mach-smdk2416.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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 <plat/regs-fb-v4.h>
  48. #include <plat/fb.h>
  49. #include <plat/common-smdk.h>
  50. static struct map_desc smdk2416_iodesc[] __initdata = {
  51. /* ISA IO Space map (memory space selected by A24) */
  52. {
  53. .virtual = (u32)S3C24XX_VA_ISA_WORD,
  54. .pfn = __phys_to_pfn(S3C2410_CS2),
  55. .length = 0x10000,
  56. .type = MT_DEVICE,
  57. }, {
  58. .virtual = (u32)S3C24XX_VA_ISA_WORD + 0x10000,
  59. .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
  60. .length = SZ_4M,
  61. .type = MT_DEVICE,
  62. }, {
  63. .virtual = (u32)S3C24XX_VA_ISA_BYTE,
  64. .pfn = __phys_to_pfn(S3C2410_CS2),
  65. .length = 0x10000,
  66. .type = MT_DEVICE,
  67. }, {
  68. .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
  69. .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
  70. .length = SZ_4M,
  71. .type = MT_DEVICE,
  72. }
  73. };
  74. #define UCON (S3C2410_UCON_DEFAULT | \
  75. S3C2440_UCON_PCLK | \
  76. S3C2443_UCON_RXERR_IRQEN)
  77. #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
  78. #define UFCON (S3C2410_UFCON_RXTRIG8 | \
  79. S3C2410_UFCON_FIFOMODE | \
  80. S3C2440_UFCON_TXTRIG16)
  81. static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
  82. [0] = {
  83. .hwport = 0,
  84. .flags = 0,
  85. .ucon = UCON,
  86. .ulcon = ULCON,
  87. .ufcon = UFCON,
  88. },
  89. [1] = {
  90. .hwport = 1,
  91. .flags = 0,
  92. .ucon = UCON,
  93. .ulcon = ULCON,
  94. .ufcon = UFCON,
  95. },
  96. /* IR port */
  97. [2] = {
  98. .hwport = 2,
  99. .flags = 0,
  100. .ucon = UCON,
  101. .ulcon = ULCON | 0x50,
  102. .ufcon = UFCON,
  103. },
  104. [3] = {
  105. .hwport = 3,
  106. .flags = 0,
  107. .ucon = UCON,
  108. .ulcon = ULCON,
  109. .ufcon = UFCON,
  110. }
  111. };
  112. void smdk2416_hsudc_gpio_init(void)
  113. {
  114. s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
  115. s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
  116. s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
  117. s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
  118. }
  119. void smdk2416_hsudc_gpio_uninit(void)
  120. {
  121. s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
  122. s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
  123. s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
  124. }
  125. struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
  126. .epnum = 9,
  127. .gpio_init = smdk2416_hsudc_gpio_init,
  128. .gpio_uninit = smdk2416_hsudc_gpio_uninit,
  129. };
  130. struct s3c_fb_pd_win smdk2416_fb_win[] = {
  131. [0] = {
  132. /* think this is the same as the smdk6410 */
  133. .win_mode = {
  134. .pixclock = 41094,
  135. .left_margin = 8,
  136. .right_margin = 13,
  137. .upper_margin = 7,
  138. .lower_margin = 5,
  139. .hsync_len = 3,
  140. .vsync_len = 1,
  141. .xres = 800,
  142. .yres = 480,
  143. },
  144. .default_bpp = 16,
  145. .max_bpp = 32,
  146. },
  147. };
  148. static void s3c2416_fb_gpio_setup_24bpp(void)
  149. {
  150. unsigned int gpio;
  151. for (gpio = S3C2410_GPC(1); gpio <= S3C2410_GPC(4); gpio++) {
  152. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  153. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  154. }
  155. for (gpio = S3C2410_GPC(8); gpio <= S3C2410_GPC(15); gpio++) {
  156. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  157. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  158. }
  159. for (gpio = S3C2410_GPD(0); gpio <= S3C2410_GPD(15); gpio++) {
  160. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  161. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  162. }
  163. }
  164. static struct s3c_fb_platdata smdk2416_fb_platdata = {
  165. .win[0] = &smdk2416_fb_win[0],
  166. .setup_gpio = s3c2416_fb_gpio_setup_24bpp,
  167. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  168. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  169. };
  170. static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
  171. .max_width = 4,
  172. .cd_type = S3C_SDHCI_CD_GPIO,
  173. .ext_cd_gpio = S3C2410_GPF(1),
  174. .ext_cd_gpio_invert = 1,
  175. };
  176. static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
  177. .max_width = 4,
  178. .cd_type = S3C_SDHCI_CD_NONE,
  179. };
  180. static struct platform_device *smdk2416_devices[] __initdata = {
  181. &s3c_device_fb,
  182. &s3c_device_wdt,
  183. &s3c_device_ohci,
  184. &s3c_device_i2c0,
  185. &s3c_device_hsmmc0,
  186. &s3c_device_hsmmc1,
  187. &s3c_device_usb_hsudc,
  188. };
  189. static void __init smdk2416_map_io(void)
  190. {
  191. s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
  192. s3c24xx_init_clocks(12000000);
  193. s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
  194. }
  195. static void __init smdk2416_machine_init(void)
  196. {
  197. s3c_i2c0_set_platdata(NULL);
  198. s3c_fb_set_platdata(&smdk2416_fb_platdata);
  199. s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
  200. s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
  201. s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
  202. gpio_request(S3C2410_GPB(4), "USBHost Power");
  203. gpio_direction_output(S3C2410_GPB(4), 1);
  204. gpio_request(S3C2410_GPB(3), "Display Power");
  205. gpio_direction_output(S3C2410_GPB(3), 1);
  206. gpio_request(S3C2410_GPB(1), "Display Reset");
  207. gpio_direction_output(S3C2410_GPB(1), 1);
  208. platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
  209. smdk_machine_init();
  210. }
  211. MACHINE_START(SMDK2416, "SMDK2416")
  212. /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */
  213. .atag_offset = 0x100,
  214. .init_irq = s3c24xx_init_irq,
  215. .map_io = smdk2416_map_io,
  216. .init_machine = smdk2416_machine_init,
  217. .timer = &s3c24xx_timer,
  218. MACHINE_END