mach-smdkv210.c 8.2 KB

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