mach-smdk2416.c 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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/serial_s3c.h>
  21. #include <linux/platform_device.h>
  22. #include <linux/io.h>
  23. #include <linux/mtd/partitions.h>
  24. #include <linux/gpio.h>
  25. #include <linux/fb.h>
  26. #include <linux/delay.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach/map.h>
  29. #include <asm/mach/irq.h>
  30. #include <video/samsung_fimd.h>
  31. #include <mach/hardware.h>
  32. #include <asm/irq.h>
  33. #include <asm/mach-types.h>
  34. #include <mach/regs-gpio.h>
  35. #include <mach/regs-lcd.h>
  36. #include <mach/regs-s3c2443-clock.h>
  37. #include <mach/gpio-samsung.h>
  38. #include <linux/platform_data/leds-s3c24xx.h>
  39. #include <linux/platform_data/i2c-s3c2410.h>
  40. #include <plat/gpio-cfg.h>
  41. #include <plat/devs.h>
  42. #include <plat/cpu.h>
  43. #include <linux/platform_data/mtd-nand-s3c2410.h>
  44. #include <plat/sdhci.h>
  45. #include <linux/platform_data/usb-s3c2410_udc.h>
  46. #include <linux/platform_data/s3c-hsudc.h>
  47. #include <plat/samsung-time.h>
  48. #include <plat/fb.h>
  49. #include "common.h"
  50. #include "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. .default_bpp = 16,
  134. .max_bpp = 32,
  135. .xres = 800,
  136. .yres = 480,
  137. },
  138. };
  139. static struct fb_videomode smdk2416_lcd_timing = {
  140. .pixclock = 41094,
  141. .left_margin = 8,
  142. .right_margin = 13,
  143. .upper_margin = 7,
  144. .lower_margin = 5,
  145. .hsync_len = 3,
  146. .vsync_len = 1,
  147. .xres = 800,
  148. .yres = 480,
  149. };
  150. static void s3c2416_fb_gpio_setup_24bpp(void)
  151. {
  152. unsigned int gpio;
  153. for (gpio = S3C2410_GPC(1); gpio <= S3C2410_GPC(4); gpio++) {
  154. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  155. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  156. }
  157. for (gpio = S3C2410_GPC(8); gpio <= S3C2410_GPC(15); gpio++) {
  158. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  159. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  160. }
  161. for (gpio = S3C2410_GPD(0); gpio <= S3C2410_GPD(15); gpio++) {
  162. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
  163. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  164. }
  165. }
  166. static struct s3c_fb_platdata smdk2416_fb_platdata = {
  167. .win[0] = &smdk2416_fb_win[0],
  168. .vtiming = &smdk2416_lcd_timing,
  169. .setup_gpio = s3c2416_fb_gpio_setup_24bpp,
  170. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  171. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  172. };
  173. static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
  174. .max_width = 4,
  175. .cd_type = S3C_SDHCI_CD_GPIO,
  176. .ext_cd_gpio = S3C2410_GPF(1),
  177. .ext_cd_gpio_invert = 1,
  178. };
  179. static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
  180. .max_width = 4,
  181. .cd_type = S3C_SDHCI_CD_NONE,
  182. };
  183. static struct platform_device *smdk2416_devices[] __initdata = {
  184. &s3c_device_fb,
  185. &s3c_device_wdt,
  186. &s3c_device_ohci,
  187. &s3c_device_i2c0,
  188. &s3c_device_hsmmc0,
  189. &s3c_device_hsmmc1,
  190. &s3c_device_usb_hsudc,
  191. &s3c2443_device_dma,
  192. };
  193. static void __init smdk2416_init_time(void)
  194. {
  195. s3c2416_init_clocks(12000000);
  196. samsung_timer_init();
  197. }
  198. static void __init smdk2416_map_io(void)
  199. {
  200. s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
  201. s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
  202. samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
  203. }
  204. static void __init smdk2416_machine_init(void)
  205. {
  206. s3c_i2c0_set_platdata(NULL);
  207. s3c_fb_set_platdata(&smdk2416_fb_platdata);
  208. s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
  209. s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
  210. s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
  211. gpio_request(S3C2410_GPB(4), "USBHost Power");
  212. gpio_direction_output(S3C2410_GPB(4), 1);
  213. gpio_request(S3C2410_GPB(3), "Display Power");
  214. gpio_direction_output(S3C2410_GPB(3), 1);
  215. gpio_request(S3C2410_GPB(1), "Display Reset");
  216. gpio_direction_output(S3C2410_GPB(1), 1);
  217. platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
  218. smdk_machine_init();
  219. }
  220. MACHINE_START(SMDK2416, "SMDK2416")
  221. /* Maintainer: Yauhen Kharuzhy <jekhor@gmail.com> */
  222. .atag_offset = 0x100,
  223. .init_irq = s3c2416_init_irq,
  224. .map_io = smdk2416_map_io,
  225. .init_machine = smdk2416_machine_init,
  226. .init_time = smdk2416_init_time,
  227. MACHINE_END