mach-smdk2416.c 5.4 KB

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