mach-smdkv210.c 8.4 KB

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