mach-smdkv210.c 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. /* linux/arch/arm/mach-s5pv210/mach-smdkv210.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com/
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/kernel.h>
  11. #include <linux/types.h>
  12. #include <linux/i2c.h>
  13. #include <linux/init.h>
  14. #include <linux/serial_core.h>
  15. #include <linux/sysdev.h>
  16. #include <linux/dm9000.h>
  17. #include <linux/fb.h>
  18. #include <linux/gpio.h>
  19. #include <linux/delay.h>
  20. #include <linux/pwm_backlight.h>
  21. #include <asm/mach/arch.h>
  22. #include <asm/mach/map.h>
  23. #include <asm/setup.h>
  24. #include <asm/mach-types.h>
  25. #include <video/platform_lcd.h>
  26. #include <mach/map.h>
  27. #include <mach/regs-clock.h>
  28. #include <plat/regs-serial.h>
  29. #include <plat/regs-srom.h>
  30. #include <plat/gpio-cfg.h>
  31. #include <plat/s5pv210.h>
  32. #include <plat/devs.h>
  33. #include <plat/cpu.h>
  34. #include <plat/adc.h>
  35. #include <plat/ts.h>
  36. #include <plat/ata.h>
  37. #include <plat/iic.h>
  38. #include <plat/keypad.h>
  39. #include <plat/pm.h>
  40. #include <plat/fb.h>
  41. #include <plat/s5p-time.h>
  42. #include <plat/backlight.h>
  43. #include <plat/regs-fb-v4.h>
  44. /* Following are default values for UCON, ULCON and UFCON UART registers */
  45. #define SMDKV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  46. S3C2410_UCON_RXILEVEL | \
  47. S3C2410_UCON_TXIRQMODE | \
  48. S3C2410_UCON_RXIRQMODE | \
  49. S3C2410_UCON_RXFIFO_TOI | \
  50. S3C2443_UCON_RXERR_IRQEN)
  51. #define SMDKV210_ULCON_DEFAULT S3C2410_LCON_CS8
  52. #define SMDKV210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  53. S5PV210_UFCON_TXTRIG4 | \
  54. S5PV210_UFCON_RXTRIG4)
  55. static struct s3c2410_uartcfg smdkv210_uartcfgs[] __initdata = {
  56. [0] = {
  57. .hwport = 0,
  58. .flags = 0,
  59. .ucon = SMDKV210_UCON_DEFAULT,
  60. .ulcon = SMDKV210_ULCON_DEFAULT,
  61. .ufcon = SMDKV210_UFCON_DEFAULT,
  62. },
  63. [1] = {
  64. .hwport = 1,
  65. .flags = 0,
  66. .ucon = SMDKV210_UCON_DEFAULT,
  67. .ulcon = SMDKV210_ULCON_DEFAULT,
  68. .ufcon = SMDKV210_UFCON_DEFAULT,
  69. },
  70. [2] = {
  71. .hwport = 2,
  72. .flags = 0,
  73. .ucon = SMDKV210_UCON_DEFAULT,
  74. .ulcon = SMDKV210_ULCON_DEFAULT,
  75. .ufcon = SMDKV210_UFCON_DEFAULT,
  76. },
  77. [3] = {
  78. .hwport = 3,
  79. .flags = 0,
  80. .ucon = SMDKV210_UCON_DEFAULT,
  81. .ulcon = SMDKV210_ULCON_DEFAULT,
  82. .ufcon = SMDKV210_UFCON_DEFAULT,
  83. },
  84. };
  85. static struct s3c_ide_platdata smdkv210_ide_pdata __initdata = {
  86. .setup_gpio = s5pv210_ide_setup_gpio,
  87. };
  88. static uint32_t smdkv210_keymap[] __initdata = {
  89. /* KEY(row, col, keycode) */
  90. KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
  91. KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
  92. KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
  93. KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
  94. };
  95. static struct matrix_keymap_data smdkv210_keymap_data __initdata = {
  96. .keymap = smdkv210_keymap,
  97. .keymap_size = ARRAY_SIZE(smdkv210_keymap),
  98. };
  99. static struct samsung_keypad_platdata smdkv210_keypad_data __initdata = {
  100. .keymap_data = &smdkv210_keymap_data,
  101. .rows = 8,
  102. .cols = 8,
  103. };
  104. static struct resource smdkv210_dm9000_resources[] = {
  105. [0] = {
  106. .start = S5PV210_PA_SROM_BANK5,
  107. .end = S5PV210_PA_SROM_BANK5,
  108. .flags = IORESOURCE_MEM,
  109. },
  110. [1] = {
  111. .start = S5PV210_PA_SROM_BANK5 + 2,
  112. .end = S5PV210_PA_SROM_BANK5 + 2,
  113. .flags = IORESOURCE_MEM,
  114. },
  115. [2] = {
  116. .start = IRQ_EINT(9),
  117. .end = IRQ_EINT(9),
  118. .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
  119. },
  120. };
  121. static struct dm9000_plat_data smdkv210_dm9000_platdata = {
  122. .flags = DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM,
  123. .dev_addr = { 0x00, 0x09, 0xc0, 0xff, 0xec, 0x48 },
  124. };
  125. struct platform_device smdkv210_dm9000 = {
  126. .name = "dm9000",
  127. .id = -1,
  128. .num_resources = ARRAY_SIZE(smdkv210_dm9000_resources),
  129. .resource = smdkv210_dm9000_resources,
  130. .dev = {
  131. .platform_data = &smdkv210_dm9000_platdata,
  132. },
  133. };
  134. static void smdkv210_lte480wv_set_power(struct plat_lcd_data *pd,
  135. unsigned int power)
  136. {
  137. if (power) {
  138. #if !defined(CONFIG_BACKLIGHT_PWM)
  139. gpio_request(S5PV210_GPD0(3), "GPD0");
  140. gpio_direction_output(S5PV210_GPD0(3), 1);
  141. gpio_free(S5PV210_GPD0(3));
  142. #endif
  143. /* fire nRESET on power up */
  144. gpio_request(S5PV210_GPH0(6), "GPH0");
  145. gpio_direction_output(S5PV210_GPH0(6), 1);
  146. gpio_set_value(S5PV210_GPH0(6), 0);
  147. mdelay(10);
  148. gpio_set_value(S5PV210_GPH0(6), 1);
  149. mdelay(10);
  150. gpio_free(S5PV210_GPH0(6));
  151. } else {
  152. #if !defined(CONFIG_BACKLIGHT_PWM)
  153. gpio_request(S5PV210_GPD0(3), "GPD0");
  154. gpio_direction_output(S5PV210_GPD0(3), 0);
  155. gpio_free(S5PV210_GPD0(3));
  156. #endif
  157. }
  158. }
  159. static struct plat_lcd_data smdkv210_lcd_lte480wv_data = {
  160. .set_power = smdkv210_lte480wv_set_power,
  161. };
  162. static struct platform_device smdkv210_lcd_lte480wv = {
  163. .name = "platform-lcd",
  164. .dev.parent = &s3c_device_fb.dev,
  165. .dev.platform_data = &smdkv210_lcd_lte480wv_data,
  166. };
  167. static struct s3c_fb_pd_win smdkv210_fb_win0 = {
  168. .win_mode = {
  169. .left_margin = 13,
  170. .right_margin = 8,
  171. .upper_margin = 7,
  172. .lower_margin = 5,
  173. .hsync_len = 3,
  174. .vsync_len = 1,
  175. .xres = 800,
  176. .yres = 480,
  177. },
  178. .max_bpp = 32,
  179. .default_bpp = 24,
  180. };
  181. static struct s3c_fb_platdata smdkv210_lcd0_pdata __initdata = {
  182. .win[0] = &smdkv210_fb_win0,
  183. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  184. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  185. .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
  186. };
  187. static struct platform_device *smdkv210_devices[] __initdata = {
  188. &s3c_device_adc,
  189. &s3c_device_cfcon,
  190. &s3c_device_fb,
  191. &s3c_device_hsmmc0,
  192. &s3c_device_hsmmc1,
  193. &s3c_device_hsmmc2,
  194. &s3c_device_hsmmc3,
  195. &s3c_device_i2c0,
  196. &s3c_device_i2c1,
  197. &s3c_device_i2c2,
  198. &s3c_device_rtc,
  199. &s3c_device_ts,
  200. &s3c_device_wdt,
  201. &s5pv210_device_ac97,
  202. &s5pv210_device_iis0,
  203. &s5pv210_device_spdif,
  204. &samsung_asoc_dma,
  205. &samsung_asoc_idma,
  206. &samsung_device_keypad,
  207. &smdkv210_dm9000,
  208. &smdkv210_lcd_lte480wv,
  209. };
  210. static void __init smdkv210_dm9000_init(void)
  211. {
  212. unsigned int tmp;
  213. gpio_request(S5PV210_MP01(5), "nCS5");
  214. s3c_gpio_cfgpin(S5PV210_MP01(5), S3C_GPIO_SFN(2));
  215. gpio_free(S5PV210_MP01(5));
  216. tmp = (5 << S5P_SROM_BCX__TACC__SHIFT);
  217. __raw_writel(tmp, S5P_SROM_BC5);
  218. tmp = __raw_readl(S5P_SROM_BW);
  219. tmp &= (S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS5__SHIFT);
  220. tmp |= (1 << S5P_SROM_BW__NCS5__SHIFT);
  221. __raw_writel(tmp, S5P_SROM_BW);
  222. }
  223. static struct i2c_board_info smdkv210_i2c_devs0[] __initdata = {
  224. { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung S524AD0XD1 */
  225. { I2C_BOARD_INFO("wm8580", 0x1b), },
  226. };
  227. static struct i2c_board_info smdkv210_i2c_devs1[] __initdata = {
  228. /* To Be Updated */
  229. };
  230. static struct i2c_board_info smdkv210_i2c_devs2[] __initdata = {
  231. /* To Be Updated */
  232. };
  233. static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
  234. .delay = 10000,
  235. .presc = 49,
  236. .oversampling_shift = 2,
  237. };
  238. /* LCD Backlight data */
  239. static struct samsung_bl_gpio_info smdkv210_bl_gpio_info = {
  240. .no = S5PV210_GPD0(3),
  241. .func = S3C_GPIO_SFN(2),
  242. };
  243. static struct platform_pwm_backlight_data smdkv210_bl_data = {
  244. .pwm_id = 3,
  245. };
  246. static void __init smdkv210_map_io(void)
  247. {
  248. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  249. s3c24xx_init_clocks(24000000);
  250. s3c24xx_init_uarts(smdkv210_uartcfgs, ARRAY_SIZE(smdkv210_uartcfgs));
  251. s5p_set_timer_source(S5P_PWM2, S5P_PWM4);
  252. }
  253. static void __init smdkv210_machine_init(void)
  254. {
  255. s3c_pm_init();
  256. smdkv210_dm9000_init();
  257. samsung_keypad_set_platdata(&smdkv210_keypad_data);
  258. s3c24xx_ts_set_platdata(&s3c_ts_platform);
  259. s3c_i2c0_set_platdata(NULL);
  260. s3c_i2c1_set_platdata(NULL);
  261. s3c_i2c2_set_platdata(NULL);
  262. i2c_register_board_info(0, smdkv210_i2c_devs0,
  263. ARRAY_SIZE(smdkv210_i2c_devs0));
  264. i2c_register_board_info(1, smdkv210_i2c_devs1,
  265. ARRAY_SIZE(smdkv210_i2c_devs1));
  266. i2c_register_board_info(2, smdkv210_i2c_devs2,
  267. ARRAY_SIZE(smdkv210_i2c_devs2));
  268. s3c_ide_set_platdata(&smdkv210_ide_pdata);
  269. s3c_fb_set_platdata(&smdkv210_lcd0_pdata);
  270. samsung_bl_set(&smdkv210_bl_gpio_info, &smdkv210_bl_data);
  271. platform_add_devices(smdkv210_devices, ARRAY_SIZE(smdkv210_devices));
  272. }
  273. MACHINE_START(SMDKV210, "SMDKV210")
  274. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  275. .boot_params = S5P_PA_SDRAM + 0x100,
  276. .init_irq = s5pv210_init_irq,
  277. .map_io = smdkv210_map_io,
  278. .init_machine = smdkv210_machine_init,
  279. .timer = &s5p_timer,
  280. MACHINE_END