mach-aquila.c 12 KB

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