mach-smdk2416.c 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. /* linux/arch/arm/mach-s3c2416/mach-hanlin_v3c.c
  2. *
  3. * Copyright (c) 2009 Yauhen Kharuzhy <jekhor@gmail.com>,
  4. * as part of OpenInkpot project
  5. * Copyright (c) 2009 Promwad Innovation Company
  6. * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. *
  12. */
  13. #include <linux/kernel.h>
  14. #include <linux/types.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/list.h>
  17. #include <linux/timer.h>
  18. #include <linux/init.h>
  19. #include <linux/serial_core.h>
  20. #include <linux/platform_device.h>
  21. #include <linux/io.h>
  22. #include <linux/mtd/partitions.h>
  23. #include <linux/gpio.h>
  24. #include <linux/fb.h>
  25. #include <linux/delay.h>
  26. #include <asm/mach/arch.h>
  27. #include <asm/mach/map.h>
  28. #include <asm/mach/irq.h>
  29. #include <mach/hardware.h>
  30. #include <asm/irq.h>
  31. #include <asm/mach-types.h>
  32. #include <plat/regs-serial.h>
  33. #include <mach/regs-gpio.h>
  34. #include <mach/regs-lcd.h>
  35. #include <mach/regs-s3c2443-clock.h>
  36. #include <mach/idle.h>
  37. #include <mach/leds-gpio.h>
  38. #include <plat/iic.h>
  39. #include <plat/s3c2416.h>
  40. #include <plat/gpio-cfg.h>
  41. #include <plat/clock.h>
  42. #include <plat/devs.h>
  43. #include <plat/cpu.h>
  44. #include <plat/nand.h>
  45. #include <plat/sdhci.h>
  46. #include <plat/udc.h>
  47. #include <linux/platform_data/s3c-hsudc.h>
  48. #include <plat/regs-fb-v4.h>
  49. #include <plat/fb.h>
  50. #include <plat/common-smdk.h>
  51. static struct map_desc smdk2416_iodesc[] __initdata = {
  52. /* ISA IO Space map (memory space selected by A24) */
  53. {
  54. .virtual = (u32)S3C24XX_VA_ISA_WORD,
  55. .pfn = __phys_to_pfn(S3C2410_CS2),
  56. .length = 0x10000,
  57. .type = MT_DEVICE,
  58. }, {
  59. .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
  60. .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
  61. .length = SZ_4M,
  62. .type = MT_DEVICE,
  63. }, {
  64. .virtual = (u32)S3C24XX_VA_ISA_BYTE,
  65. .pfn = __phys_to_pfn(S3C2410_CS2),
  66. .length = 0x10000,
  67. .type = MT_DEVICE,
  68. }, {
  69. .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
  70. .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
  71. .length = SZ_4M,
  72. .type = MT_DEVICE,
  73. }
  74. };
  75. #define UCON (S3C2410_UCON_DEFAULT | \
  76. S3C2440_UCON_PCLK | \
  77. S3C2443_UCON_RXERR_IRQEN)
  78. #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
  79. #define UFCON (S3C2410_UFCON_RXTRIG8 | \
  80. S3C2410_UFCON_FIFOMODE | \
  81. S3C2440_UFCON_TXTRIG16)
  82. static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
  83. [0] = {
  84. .hwport = 0,
  85. .flags = 0,
  86. .ucon = UCON,
  87. .ulcon = ULCON,
  88. .ufcon = UFCON,
  89. },
  90. [1] = {
  91. .hwport = 1,
  92. .flags = 0,
  93. .ucon = UCON,
  94. .ulcon = ULCON,
  95. .ufcon = UFCON,
  96. },
  97. /* IR port */
  98. [2] = {
  99. .hwport = 2,
  100. .flags = 0,
  101. .ucon = UCON,
  102. .ulcon = ULCON | 0x50,
  103. .ufcon = UFCON,
  104. },
  105. [3] = {
  106. .hwport = 3,
  107. .flags = 0,
  108. .ucon = UCON,
  109. .ulcon = ULCON,
  110. .ufcon = UFCON,
  111. }
  112. };
  113. static void smdk2416_hsudc_gpio_init(void)
  114. {
  115. s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
  116. s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
  117. s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
  118. s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
  119. }
  120. static void smdk2416_hsudc_gpio_uninit(void)
  121. {
  122. s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
  123. s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
  124. s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
  125. }
  126. static struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
  127. .epnum = 9,
  128. .gpio_init = smdk2416_hsudc_gpio_init,
  129. .gpio_uninit = smdk2416_hsudc_gpio_uninit,
  130. };
  131. static struct s3c_fb_pd_win smdk2416_fb_win[] = {
  132. [0] = {
  133. /* think this is the same as the smdk6410 */
  134. .win_mode = {
  135. .pixclock = 41094,
  136. .left_margin = 8,
  137. .right_margin = 13,
  138. .upper_margin = 7,
  139. .lower_margin = 5,
  140. .hsync_len = 3,
  141. .vsync_len = 1,
  142. .xres = 800,
  143. .yres = 480,
  144. },
  145. .default_bpp = 16,
  146. .max_bpp = 32,
  147. },
  148. };
  149. static void s3c2416_fb_gpio_setup_24bpp(void)
  150. {
  151. unsigned int gpio;
  152. for (gpio = S3C2410_GPC(1); gpio <= S3C2410_GPC(4); gpio++) {
  153. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  154. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  155. }
  156. for (gpio = S3C2410_GPC(8); gpio <= S3C2410_GPC(15); gpio++) {
  157. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  158. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  159. }
  160. for (gpio = S3C2410_GPD(0); gpio <= S3C2410_GPD(15); gpio++) {
  161. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  162. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  163. }
  164. }
  165. static struct s3c_fb_platdata smdk2416_fb_platdata = {
  166. .win[0] = &smdk2416_fb_win[0],
  167. .setup_gpio = s3c2416_fb_gpio_setup_24bpp,
  168. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  169. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  170. };
  171. static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
  172. .max_width = 4,
  173. .cd_type = S3C_SDHCI_CD_GPIO,
  174. .ext_cd_gpio = S3C2410_GPF(1),
  175. .ext_cd_gpio_invert = 1,
  176. };
  177. static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
  178. .max_width = 4,
  179. .cd_type = S3C_SDHCI_CD_NONE,
  180. };
  181. static struct platform_device *smdk2416_devices[] __initdata = {
  182. &s3c_device_fb,
  183. &s3c_device_wdt,
  184. &s3c_device_ohci,
  185. &s3c_device_i2c0,
  186. &s3c_device_hsmmc0,
  187. &s3c_device_hsmmc1,
  188. &s3c_device_usb_hsudc,
  189. };
  190. static void __init smdk2416_map_io(void)
  191. {
  192. s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
  193. s3c24xx_init_clocks(12000000);
  194. s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
  195. }
  196. static void __init smdk2416_machine_init(void)
  197. {
  198. s3c_i2c0_set_platdata(NULL);
  199. s3c_fb_set_platdata(&smdk2416_fb_platdata);
  200. s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
  201. s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
  202. s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
  203. gpio_request(S3C2410_GPB(4), "USBHost Power");
  204. gpio_direction_output(S3C2410_GPB(4), 1);
  205. gpio_request(S3C2410_GPB(3), "Display Power");
  206. gpio_direction_output(S3C2410_GPB(3), 1);
  207. gpio_request(S3C2410_GPB(1), "Display Reset");
  208. gpio_direction_output(S3C2410_GPB(1), 1);
  209. platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
  210. smdk_machine_init();
  211. }
  212. MACHINE_START(SMDK2416, "SMDK2416")
  213. /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */
  214. .atag_offset = 0x100,
  215. .init_irq = s3c24xx_init_irq,
  216. .map_io = smdk2416_map_io,
  217. .init_machine = smdk2416_machine_init,
  218. .timer = &s3c24xx_timer,
  219. .restart = s3c2416_restart,
  220. MACHINE_END