mach-aquila.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. /* linux/arch/arm/mach-s5pv210/mach-aquila.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/init.h>
  13. #include <linux/serial_core.h>
  14. #include <linux/fb.h>
  15. #include <linux/i2c.h>
  16. #include <linux/i2c-gpio.h>
  17. #include <linux/mfd/max8998.h>
  18. #include <linux/gpio_keys.h>
  19. #include <linux/input.h>
  20. #include <linux/gpio.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 <mach/map.h>
  26. #include <mach/regs-clock.h>
  27. #include <mach/regs-fb.h>
  28. #include <plat/gpio-cfg.h>
  29. #include <plat/regs-serial.h>
  30. #include <plat/s5pv210.h>
  31. #include <plat/devs.h>
  32. #include <plat/cpu.h>
  33. #include <plat/fb.h>
  34. /* Following are default values for UCON, ULCON and UFCON UART registers */
  35. #define S5PV210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  36. S3C2410_UCON_RXILEVEL | \
  37. S3C2410_UCON_TXIRQMODE | \
  38. S3C2410_UCON_RXIRQMODE | \
  39. S3C2410_UCON_RXFIFO_TOI | \
  40. S3C2443_UCON_RXERR_IRQEN)
  41. #define S5PV210_ULCON_DEFAULT S3C2410_LCON_CS8
  42. #define S5PV210_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
  43. static struct s3c2410_uartcfg aquila_uartcfgs[] __initdata = {
  44. [0] = {
  45. .hwport = 0,
  46. .flags = 0,
  47. .ucon = S5PV210_UCON_DEFAULT,
  48. .ulcon = S5PV210_ULCON_DEFAULT,
  49. /*
  50. * Actually UART0 can support 256 bytes fifo, but aquila board
  51. * supports 128 bytes fifo because of initial chip bug
  52. */
  53. .ufcon = S5PV210_UFCON_DEFAULT |
  54. S5PV210_UFCON_TXTRIG128 | S5PV210_UFCON_RXTRIG128,
  55. },
  56. [1] = {
  57. .hwport = 1,
  58. .flags = 0,
  59. .ucon = S5PV210_UCON_DEFAULT,
  60. .ulcon = S5PV210_ULCON_DEFAULT,
  61. .ufcon = S5PV210_UFCON_DEFAULT |
  62. S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
  63. },
  64. [2] = {
  65. .hwport = 2,
  66. .flags = 0,
  67. .ucon = S5PV210_UCON_DEFAULT,
  68. .ulcon = S5PV210_ULCON_DEFAULT,
  69. .ufcon = S5PV210_UFCON_DEFAULT |
  70. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  71. },
  72. [3] = {
  73. .hwport = 3,
  74. .flags = 0,
  75. .ucon = S5PV210_UCON_DEFAULT,
  76. .ulcon = S5PV210_ULCON_DEFAULT,
  77. .ufcon = S5PV210_UFCON_DEFAULT |
  78. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  79. },
  80. };
  81. /* Frame Buffer */
  82. static struct s3c_fb_pd_win aquila_fb_win0 = {
  83. .win_mode = {
  84. .pixclock = 1000000000000ULL / ((16+16+2+480)*(28+3+2+800)*60),
  85. .left_margin = 16,
  86. .right_margin = 16,
  87. .upper_margin = 3,
  88. .lower_margin = 28,
  89. .hsync_len = 2,
  90. .vsync_len = 2,
  91. .xres = 480,
  92. .yres = 800,
  93. },
  94. .max_bpp = 32,
  95. .default_bpp = 16,
  96. };
  97. static struct s3c_fb_pd_win aquila_fb_win1 = {
  98. .win_mode = {
  99. .pixclock = 1000000000000ULL / ((16+16+2+480)*(28+3+2+800)*60),
  100. .left_margin = 16,
  101. .right_margin = 16,
  102. .upper_margin = 3,
  103. .lower_margin = 28,
  104. .hsync_len = 2,
  105. .vsync_len = 2,
  106. .xres = 480,
  107. .yres = 800,
  108. },
  109. .max_bpp = 32,
  110. .default_bpp = 16,
  111. };
  112. static struct s3c_fb_platdata aquila_lcd_pdata __initdata = {
  113. .win[0] = &aquila_fb_win0,
  114. .win[1] = &aquila_fb_win1,
  115. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  116. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  117. VIDCON1_INV_VCLK | VIDCON1_INV_VDEN,
  118. .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
  119. };
  120. /* MAX8998 regulators */
  121. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  122. static struct regulator_init_data aquila_ldo2_data = {
  123. .constraints = {
  124. .name = "VALIVE_1.1V",
  125. .min_uV = 1100000,
  126. .max_uV = 1100000,
  127. .apply_uV = 1,
  128. .always_on = 1,
  129. .state_mem = {
  130. .enabled = 1,
  131. },
  132. },
  133. };
  134. static struct regulator_init_data aquila_ldo3_data = {
  135. .constraints = {
  136. .name = "VUSB/MIPI_1.1V",
  137. .min_uV = 1100000,
  138. .max_uV = 1100000,
  139. .apply_uV = 1,
  140. .always_on = 1,
  141. },
  142. };
  143. static struct regulator_init_data aquila_ldo4_data = {
  144. .constraints = {
  145. .name = "VDAC_3.3V",
  146. .min_uV = 3300000,
  147. .max_uV = 3300000,
  148. .apply_uV = 1,
  149. },
  150. };
  151. static struct regulator_init_data aquila_ldo5_data = {
  152. .constraints = {
  153. .name = "VTF_2.8V",
  154. .min_uV = 2800000,
  155. .max_uV = 2800000,
  156. .apply_uV = 1,
  157. },
  158. };
  159. static struct regulator_init_data aquila_ldo6_data = {
  160. .constraints = {
  161. .name = "VCC_3.3V",
  162. .min_uV = 3300000,
  163. .max_uV = 3300000,
  164. .apply_uV = 1,
  165. },
  166. };
  167. static struct regulator_init_data aquila_ldo7_data = {
  168. .constraints = {
  169. .name = "VCC_3.0V",
  170. .min_uV = 3000000,
  171. .max_uV = 3000000,
  172. .apply_uV = 1,
  173. .boot_on = 1,
  174. .always_on = 1,
  175. },
  176. };
  177. static struct regulator_init_data aquila_ldo8_data = {
  178. .constraints = {
  179. .name = "VUSB/VADC_3.3V",
  180. .min_uV = 3300000,
  181. .max_uV = 3300000,
  182. .apply_uV = 1,
  183. .always_on = 1,
  184. },
  185. };
  186. static struct regulator_init_data aquila_ldo9_data = {
  187. .constraints = {
  188. .name = "VCC/VCAM_2.8V",
  189. .min_uV = 2800000,
  190. .max_uV = 2800000,
  191. .apply_uV = 1,
  192. .always_on = 1,
  193. },
  194. };
  195. static struct regulator_init_data aquila_ldo10_data = {
  196. .constraints = {
  197. .name = "VPLL_1.1V",
  198. .min_uV = 1100000,
  199. .max_uV = 1100000,
  200. .apply_uV = 1,
  201. .boot_on = 1,
  202. },
  203. };
  204. static struct regulator_init_data aquila_ldo11_data = {
  205. .constraints = {
  206. .name = "CAM_IO_2.8V",
  207. .min_uV = 2800000,
  208. .max_uV = 2800000,
  209. .apply_uV = 1,
  210. .always_on = 1,
  211. },
  212. };
  213. static struct regulator_init_data aquila_ldo12_data = {
  214. .constraints = {
  215. .name = "CAM_ISP_1.2V",
  216. .min_uV = 1200000,
  217. .max_uV = 1200000,
  218. .apply_uV = 1,
  219. .always_on = 1,
  220. },
  221. };
  222. static struct regulator_init_data aquila_ldo13_data = {
  223. .constraints = {
  224. .name = "CAM_A_2.8V",
  225. .min_uV = 2800000,
  226. .max_uV = 2800000,
  227. .apply_uV = 1,
  228. .always_on = 1,
  229. },
  230. };
  231. static struct regulator_init_data aquila_ldo14_data = {
  232. .constraints = {
  233. .name = "CAM_CIF_1.8V",
  234. .min_uV = 1800000,
  235. .max_uV = 1800000,
  236. .apply_uV = 1,
  237. .always_on = 1,
  238. },
  239. };
  240. static struct regulator_init_data aquila_ldo15_data = {
  241. .constraints = {
  242. .name = "CAM_AF_3.3V",
  243. .min_uV = 3300000,
  244. .max_uV = 3300000,
  245. .apply_uV = 1,
  246. .always_on = 1,
  247. },
  248. };
  249. static struct regulator_init_data aquila_ldo16_data = {
  250. .constraints = {
  251. .name = "VMIPI_1.8V",
  252. .min_uV = 1800000,
  253. .max_uV = 1800000,
  254. .apply_uV = 1,
  255. .always_on = 1,
  256. },
  257. };
  258. static struct regulator_init_data aquila_ldo17_data = {
  259. .constraints = {
  260. .name = "CAM_8M_1.8V",
  261. .min_uV = 1800000,
  262. .max_uV = 1800000,
  263. .apply_uV = 1,
  264. .always_on = 1,
  265. },
  266. };
  267. /* BUCK */
  268. static struct regulator_consumer_supply buck1_consumer[] = {
  269. { .supply = "vddarm", },
  270. };
  271. static struct regulator_consumer_supply buck2_consumer[] = {
  272. { .supply = "vddint", },
  273. };
  274. static struct regulator_init_data aquila_buck1_data = {
  275. .constraints = {
  276. .name = "VARM_1.2V",
  277. .min_uV = 1200000,
  278. .max_uV = 1200000,
  279. .apply_uV = 1,
  280. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  281. REGULATOR_CHANGE_STATUS,
  282. },
  283. .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
  284. .consumer_supplies = buck1_consumer,
  285. };
  286. static struct regulator_init_data aquila_buck2_data = {
  287. .constraints = {
  288. .name = "VINT_1.2V",
  289. .min_uV = 1200000,
  290. .max_uV = 1200000,
  291. .apply_uV = 1,
  292. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  293. REGULATOR_CHANGE_STATUS,
  294. },
  295. .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
  296. .consumer_supplies = buck2_consumer,
  297. };
  298. static struct regulator_init_data aquila_buck3_data = {
  299. .constraints = {
  300. .name = "VCC_1.8V",
  301. .min_uV = 1800000,
  302. .max_uV = 1800000,
  303. .apply_uV = 1,
  304. .state_mem = {
  305. .enabled = 1,
  306. },
  307. },
  308. };
  309. static struct regulator_init_data aquila_buck4_data = {
  310. .constraints = {
  311. .name = "CAM_CORE_1.2V",
  312. .min_uV = 1200000,
  313. .max_uV = 1200000,
  314. .apply_uV = 1,
  315. .always_on = 1,
  316. },
  317. };
  318. static struct max8998_regulator_data aquila_regulators[] = {
  319. { MAX8998_LDO2, &aquila_ldo2_data },
  320. { MAX8998_LDO3, &aquila_ldo3_data },
  321. { MAX8998_LDO4, &aquila_ldo4_data },
  322. { MAX8998_LDO5, &aquila_ldo5_data },
  323. { MAX8998_LDO6, &aquila_ldo6_data },
  324. { MAX8998_LDO7, &aquila_ldo7_data },
  325. { MAX8998_LDO8, &aquila_ldo8_data },
  326. { MAX8998_LDO9, &aquila_ldo9_data },
  327. { MAX8998_LDO10, &aquila_ldo10_data },
  328. { MAX8998_LDO11, &aquila_ldo11_data },
  329. { MAX8998_LDO12, &aquila_ldo12_data },
  330. { MAX8998_LDO13, &aquila_ldo13_data },
  331. { MAX8998_LDO14, &aquila_ldo14_data },
  332. { MAX8998_LDO15, &aquila_ldo15_data },
  333. { MAX8998_LDO16, &aquila_ldo16_data },
  334. { MAX8998_LDO17, &aquila_ldo17_data },
  335. { MAX8998_BUCK1, &aquila_buck1_data },
  336. { MAX8998_BUCK2, &aquila_buck2_data },
  337. { MAX8998_BUCK3, &aquila_buck3_data },
  338. { MAX8998_BUCK4, &aquila_buck4_data },
  339. };
  340. static struct max8998_platform_data aquila_max8998_pdata = {
  341. .num_regulators = ARRAY_SIZE(aquila_regulators),
  342. .regulators = aquila_regulators,
  343. };
  344. #endif
  345. /* GPIO I2C PMIC */
  346. #define AP_I2C_GPIO_PMIC_BUS_4 4
  347. static struct i2c_gpio_platform_data aquila_i2c_gpio_pmic_data = {
  348. .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
  349. .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
  350. };
  351. static struct platform_device aquila_i2c_gpio_pmic = {
  352. .name = "i2c-gpio",
  353. .id = AP_I2C_GPIO_PMIC_BUS_4,
  354. .dev = {
  355. .platform_data = &aquila_i2c_gpio_pmic_data,
  356. },
  357. };
  358. static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
  359. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  360. {
  361. /* 0xCC when SRAD = 0 */
  362. I2C_BOARD_INFO("max8998", 0xCC >> 1),
  363. .platform_data = &aquila_max8998_pdata,
  364. },
  365. #endif
  366. };
  367. /* PMIC Power button */
  368. static struct gpio_keys_button aquila_gpio_keys_table[] = {
  369. {
  370. .code = KEY_POWER,
  371. .gpio = S5PV210_GPH2(6),
  372. .desc = "gpio-keys: KEY_POWER",
  373. .type = EV_KEY,
  374. .active_low = 1,
  375. .wakeup = 1,
  376. .debounce_interval = 1,
  377. },
  378. };
  379. static struct gpio_keys_platform_data aquila_gpio_keys_data = {
  380. .buttons = aquila_gpio_keys_table,
  381. .nbuttons = ARRAY_SIZE(aquila_gpio_keys_table),
  382. };
  383. static struct platform_device aquila_device_gpiokeys = {
  384. .name = "gpio-keys",
  385. .dev = {
  386. .platform_data = &aquila_gpio_keys_data,
  387. },
  388. };
  389. static void __init aquila_pmic_init(void)
  390. {
  391. /* AP_PMIC_IRQ: EINT7 */
  392. s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
  393. s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
  394. /* nPower: EINT22 */
  395. s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
  396. s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
  397. }
  398. static struct platform_device *aquila_devices[] __initdata = {
  399. &aquila_i2c_gpio_pmic,
  400. &aquila_device_gpiokeys,
  401. &s3c_device_fb,
  402. &s5pc110_device_onenand,
  403. };
  404. static void __init aquila_map_io(void)
  405. {
  406. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  407. s3c24xx_init_clocks(24000000);
  408. s3c24xx_init_uarts(aquila_uartcfgs, ARRAY_SIZE(aquila_uartcfgs));
  409. }
  410. static void __init aquila_machine_init(void)
  411. {
  412. /* PMIC */
  413. aquila_pmic_init();
  414. i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
  415. ARRAY_SIZE(i2c_gpio_pmic_devs));
  416. /* FB */
  417. s3c_fb_set_platdata(&aquila_lcd_pdata);
  418. platform_add_devices(aquila_devices, ARRAY_SIZE(aquila_devices));
  419. }
  420. MACHINE_START(AQUILA, "Aquila")
  421. /* Maintainers:
  422. Marek Szyprowski <m.szyprowski@samsung.com>
  423. Kyungmin Park <kyungmin.park@samsung.com> */
  424. .phys_io = S3C_PA_UART & 0xfff00000,
  425. .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
  426. .boot_params = S5P_PA_SDRAM + 0x100,
  427. .init_irq = s5pv210_init_irq,
  428. .map_io = aquila_map_io,
  429. .init_machine = aquila_machine_init,
  430. .timer = &s3c24xx_timer,
  431. MACHINE_END