mach-goni.c 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. /* linux/arch/arm/mach-s5pv210/mach-goni.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 GONI_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 GONI_ULCON_DEFAULT S3C2410_LCON_CS8
  43. #define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
  44. static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
  45. [0] = {
  46. .hwport = 0,
  47. .flags = 0,
  48. .ucon = GONI_UCON_DEFAULT,
  49. .ulcon = GONI_ULCON_DEFAULT,
  50. .ufcon = GONI_UFCON_DEFAULT |
  51. S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
  52. },
  53. [1] = {
  54. .hwport = 1,
  55. .flags = 0,
  56. .ucon = GONI_UCON_DEFAULT,
  57. .ulcon = GONI_ULCON_DEFAULT,
  58. .ufcon = GONI_UFCON_DEFAULT |
  59. S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
  60. },
  61. [2] = {
  62. .hwport = 2,
  63. .flags = 0,
  64. .ucon = GONI_UCON_DEFAULT,
  65. .ulcon = GONI_ULCON_DEFAULT,
  66. .ufcon = GONI_UFCON_DEFAULT |
  67. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  68. },
  69. [3] = {
  70. .hwport = 3,
  71. .flags = 0,
  72. .ucon = GONI_UCON_DEFAULT,
  73. .ulcon = GONI_ULCON_DEFAULT,
  74. .ufcon = GONI_UFCON_DEFAULT |
  75. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  76. },
  77. };
  78. /* Frame Buffer */
  79. static struct s3c_fb_pd_win goni_fb_win0 = {
  80. .win_mode = {
  81. .pixclock = 1000000000000ULL / ((16+16+2+480)*(28+3+2+800)*55),
  82. .left_margin = 16,
  83. .right_margin = 16,
  84. .upper_margin = 3,
  85. .lower_margin = 28,
  86. .hsync_len = 2,
  87. .vsync_len = 2,
  88. .xres = 480,
  89. .yres = 800,
  90. .refresh = 55,
  91. },
  92. .max_bpp = 32,
  93. .default_bpp = 16,
  94. };
  95. static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
  96. .win[0] = &goni_fb_win0,
  97. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  98. VIDCON0_CLKSEL_LCD,
  99. .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
  100. | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  101. .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
  102. };
  103. /* MAX8998 regulators */
  104. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  105. static struct regulator_init_data goni_ldo2_data = {
  106. .constraints = {
  107. .name = "VALIVE_1.1V",
  108. .min_uV = 1100000,
  109. .max_uV = 1100000,
  110. .apply_uV = 1,
  111. .always_on = 1,
  112. .state_mem = {
  113. .enabled = 1,
  114. },
  115. },
  116. };
  117. static struct regulator_init_data goni_ldo3_data = {
  118. .constraints = {
  119. .name = "VUSB/MIPI_1.1V",
  120. .min_uV = 1100000,
  121. .max_uV = 1100000,
  122. .apply_uV = 1,
  123. .always_on = 1,
  124. },
  125. };
  126. static struct regulator_init_data goni_ldo4_data = {
  127. .constraints = {
  128. .name = "VDAC_3.3V",
  129. .min_uV = 3300000,
  130. .max_uV = 3300000,
  131. .apply_uV = 1,
  132. },
  133. };
  134. static struct regulator_init_data goni_ldo5_data = {
  135. .constraints = {
  136. .name = "VTF_2.8V",
  137. .min_uV = 2800000,
  138. .max_uV = 2800000,
  139. .apply_uV = 1,
  140. },
  141. };
  142. static struct regulator_init_data goni_ldo6_data = {
  143. .constraints = {
  144. .name = "VCC_3.3V",
  145. .min_uV = 3300000,
  146. .max_uV = 3300000,
  147. .apply_uV = 1,
  148. },
  149. };
  150. static struct regulator_init_data goni_ldo7_data = {
  151. .constraints = {
  152. .name = "VLCD_1.8V",
  153. .min_uV = 1800000,
  154. .max_uV = 1800000,
  155. .apply_uV = 1,
  156. .always_on = 1,
  157. },
  158. };
  159. static struct regulator_init_data goni_ldo8_data = {
  160. .constraints = {
  161. .name = "VUSB/VADC_3.3V",
  162. .min_uV = 3300000,
  163. .max_uV = 3300000,
  164. .apply_uV = 1,
  165. .always_on = 1,
  166. },
  167. };
  168. static struct regulator_init_data goni_ldo9_data = {
  169. .constraints = {
  170. .name = "VCC/VCAM_2.8V",
  171. .min_uV = 2800000,
  172. .max_uV = 2800000,
  173. .apply_uV = 1,
  174. .always_on = 1,
  175. },
  176. };
  177. static struct regulator_init_data goni_ldo10_data = {
  178. .constraints = {
  179. .name = "VPLL_1.1V",
  180. .min_uV = 1100000,
  181. .max_uV = 1100000,
  182. .apply_uV = 1,
  183. .boot_on = 1,
  184. },
  185. };
  186. static struct regulator_init_data goni_ldo11_data = {
  187. .constraints = {
  188. .name = "CAM_IO_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 goni_ldo12_data = {
  196. .constraints = {
  197. .name = "CAM_ISP_1.2V",
  198. .min_uV = 1200000,
  199. .max_uV = 1200000,
  200. .apply_uV = 1,
  201. .always_on = 1,
  202. },
  203. };
  204. static struct regulator_init_data goni_ldo13_data = {
  205. .constraints = {
  206. .name = "CAM_A_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 goni_ldo14_data = {
  214. .constraints = {
  215. .name = "CAM_CIF_1.8V",
  216. .min_uV = 1800000,
  217. .max_uV = 1800000,
  218. .apply_uV = 1,
  219. .always_on = 1,
  220. },
  221. };
  222. static struct regulator_init_data goni_ldo15_data = {
  223. .constraints = {
  224. .name = "CAM_AF_3.3V",
  225. .min_uV = 3300000,
  226. .max_uV = 3300000,
  227. .apply_uV = 1,
  228. .always_on = 1,
  229. },
  230. };
  231. static struct regulator_init_data goni_ldo16_data = {
  232. .constraints = {
  233. .name = "VMIPI_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 goni_ldo17_data = {
  241. .constraints = {
  242. .name = "VCC_3.0V_LCD",
  243. .min_uV = 3000000,
  244. .max_uV = 3000000,
  245. .apply_uV = 1,
  246. .always_on = 1,
  247. },
  248. };
  249. /* BUCK */
  250. static struct regulator_consumer_supply buck1_consumer[] = {
  251. { .supply = "vddarm", },
  252. };
  253. static struct regulator_consumer_supply buck2_consumer[] = {
  254. { .supply = "vddint", },
  255. };
  256. static struct regulator_init_data goni_buck1_data = {
  257. .constraints = {
  258. .name = "VARM_1.2V",
  259. .min_uV = 1200000,
  260. .max_uV = 1200000,
  261. .apply_uV = 1,
  262. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  263. REGULATOR_CHANGE_STATUS,
  264. },
  265. .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
  266. .consumer_supplies = buck1_consumer,
  267. };
  268. static struct regulator_init_data goni_buck2_data = {
  269. .constraints = {
  270. .name = "VINT_1.2V",
  271. .min_uV = 1200000,
  272. .max_uV = 1200000,
  273. .apply_uV = 1,
  274. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  275. REGULATOR_CHANGE_STATUS,
  276. },
  277. .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
  278. .consumer_supplies = buck2_consumer,
  279. };
  280. static struct regulator_init_data goni_buck3_data = {
  281. .constraints = {
  282. .name = "VCC_1.8V",
  283. .min_uV = 1800000,
  284. .max_uV = 1800000,
  285. .apply_uV = 1,
  286. .state_mem = {
  287. .enabled = 1,
  288. },
  289. },
  290. };
  291. static struct regulator_init_data goni_buck4_data = {
  292. .constraints = {
  293. .name = "CAM_CORE_1.2V",
  294. .min_uV = 1200000,
  295. .max_uV = 1200000,
  296. .apply_uV = 1,
  297. .always_on = 1,
  298. },
  299. };
  300. static struct max8998_regulator_data goni_regulators[] = {
  301. { MAX8998_LDO2, &goni_ldo2_data },
  302. { MAX8998_LDO3, &goni_ldo3_data },
  303. { MAX8998_LDO4, &goni_ldo4_data },
  304. { MAX8998_LDO5, &goni_ldo5_data },
  305. { MAX8998_LDO6, &goni_ldo6_data },
  306. { MAX8998_LDO7, &goni_ldo7_data },
  307. { MAX8998_LDO8, &goni_ldo8_data },
  308. { MAX8998_LDO9, &goni_ldo9_data },
  309. { MAX8998_LDO10, &goni_ldo10_data },
  310. { MAX8998_LDO11, &goni_ldo11_data },
  311. { MAX8998_LDO12, &goni_ldo12_data },
  312. { MAX8998_LDO13, &goni_ldo13_data },
  313. { MAX8998_LDO14, &goni_ldo14_data },
  314. { MAX8998_LDO15, &goni_ldo15_data },
  315. { MAX8998_LDO16, &goni_ldo16_data },
  316. { MAX8998_LDO17, &goni_ldo17_data },
  317. { MAX8998_BUCK1, &goni_buck1_data },
  318. { MAX8998_BUCK2, &goni_buck2_data },
  319. { MAX8998_BUCK3, &goni_buck3_data },
  320. { MAX8998_BUCK4, &goni_buck4_data },
  321. };
  322. static struct max8998_platform_data goni_max8998_pdata = {
  323. .num_regulators = ARRAY_SIZE(goni_regulators),
  324. .regulators = goni_regulators,
  325. };
  326. #endif
  327. /* GPIO I2C PMIC */
  328. #define AP_I2C_GPIO_PMIC_BUS_4 4
  329. static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
  330. .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
  331. .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
  332. };
  333. static struct platform_device goni_i2c_gpio_pmic = {
  334. .name = "i2c-gpio",
  335. .id = AP_I2C_GPIO_PMIC_BUS_4,
  336. .dev = {
  337. .platform_data = &goni_i2c_gpio_pmic_data,
  338. },
  339. };
  340. static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
  341. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  342. {
  343. /* 0xCC when SRAD = 0 */
  344. I2C_BOARD_INFO("max8998", 0xCC >> 1),
  345. .platform_data = &goni_max8998_pdata,
  346. },
  347. #endif
  348. };
  349. /* PMIC Power button */
  350. static struct gpio_keys_button goni_gpio_keys_table[] = {
  351. {
  352. .code = KEY_POWER,
  353. .gpio = S5PV210_GPH2(6),
  354. .desc = "gpio-keys: KEY_POWER",
  355. .type = EV_KEY,
  356. .active_low = 1,
  357. .wakeup = 1,
  358. .debounce_interval = 1,
  359. },
  360. };
  361. static struct gpio_keys_platform_data goni_gpio_keys_data = {
  362. .buttons = goni_gpio_keys_table,
  363. .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
  364. };
  365. static struct platform_device goni_device_gpiokeys = {
  366. .name = "gpio-keys",
  367. .dev = {
  368. .platform_data = &goni_gpio_keys_data,
  369. },
  370. };
  371. static void __init goni_pmic_init(void)
  372. {
  373. /* AP_PMIC_IRQ: EINT7 */
  374. s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
  375. s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
  376. /* nPower: EINT22 */
  377. s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
  378. s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
  379. }
  380. /* MoviNAND */
  381. static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
  382. .max_width = 4,
  383. .cd_type = S3C_SDHCI_CD_PERMANENT,
  384. };
  385. /* Wireless LAN */
  386. static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata = {
  387. .max_width = 4,
  388. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  389. /* ext_cd_{init,cleanup} callbacks will be added later */
  390. };
  391. /* External Flash */
  392. #define GONI_EXT_FLASH_EN S5PV210_MP05(4)
  393. #define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
  394. static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = {
  395. .max_width = 4,
  396. .cd_type = S3C_SDHCI_CD_GPIO,
  397. .ext_cd_gpio = GONI_EXT_FLASH_CD,
  398. .ext_cd_gpio_invert = 1,
  399. };
  400. static void goni_setup_sdhci(void)
  401. {
  402. gpio_request(GONI_EXT_FLASH_EN, "FLASH_EN");
  403. gpio_direction_output(GONI_EXT_FLASH_EN, 1);
  404. s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
  405. s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
  406. s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
  407. };
  408. static struct platform_device *goni_devices[] __initdata = {
  409. &s3c_device_fb,
  410. &s5pc110_device_onenand,
  411. &goni_i2c_gpio_pmic,
  412. &goni_device_gpiokeys,
  413. &s5p_device_fimc0,
  414. &s5p_device_fimc1,
  415. &s5p_device_fimc2,
  416. &s3c_device_hsmmc0,
  417. &s3c_device_hsmmc1,
  418. &s3c_device_hsmmc2,
  419. };
  420. static void __init goni_map_io(void)
  421. {
  422. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  423. s3c24xx_init_clocks(24000000);
  424. s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
  425. }
  426. static void __init goni_machine_init(void)
  427. {
  428. /* PMIC */
  429. goni_pmic_init();
  430. i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
  431. ARRAY_SIZE(i2c_gpio_pmic_devs));
  432. /* SDHCI */
  433. goni_setup_sdhci();
  434. /* FB */
  435. s3c_fb_set_platdata(&goni_lcd_pdata);
  436. platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
  437. }
  438. MACHINE_START(GONI, "GONI")
  439. /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
  440. .phys_io = S3C_PA_UART & 0xfff00000,
  441. .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
  442. .boot_params = S5P_PA_SDRAM + 0x100,
  443. .init_irq = s5pv210_init_irq,
  444. .map_io = goni_map_io,
  445. .init_machine = goni_machine_init,
  446. .timer = &s3c24xx_timer,
  447. MACHINE_END