mach-goni.c 10 KB

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