mach-smdkv210.c 7.6 KB

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