mach-goni.c 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  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/i2c/atmel_mxt_ts.h>
  18. #include <linux/mfd/max8998.h>
  19. #include <linux/mfd/wm8994/pdata.h>
  20. #include <linux/regulator/fixed.h>
  21. #include <linux/spi/spi.h>
  22. #include <linux/spi/spi_gpio.h>
  23. #include <linux/lcd.h>
  24. #include <linux/gpio_keys.h>
  25. #include <linux/input.h>
  26. #include <linux/gpio.h>
  27. #include <linux/interrupt.h>
  28. #include <asm/mach/arch.h>
  29. #include <asm/mach/map.h>
  30. #include <asm/setup.h>
  31. #include <asm/mach-types.h>
  32. #include <mach/map.h>
  33. #include <mach/regs-clock.h>
  34. #include <mach/regs-fb.h>
  35. #include <plat/gpio-cfg.h>
  36. #include <plat/regs-serial.h>
  37. #include <plat/s5pv210.h>
  38. #include <plat/devs.h>
  39. #include <plat/cpu.h>
  40. #include <plat/fb.h>
  41. #include <plat/iic.h>
  42. #include <plat/keypad.h>
  43. #include <plat/sdhci.h>
  44. #include <plat/clock.h>
  45. #include <plat/s5p-time.h>
  46. /* Following are default values for UCON, ULCON and UFCON UART registers */
  47. #define GONI_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 GONI_ULCON_DEFAULT S3C2410_LCON_CS8
  54. #define GONI_UFCON_DEFAULT S3C2410_UFCON_FIFOMODE
  55. static struct s3c2410_uartcfg goni_uartcfgs[] __initdata = {
  56. [0] = {
  57. .hwport = 0,
  58. .flags = 0,
  59. .ucon = GONI_UCON_DEFAULT,
  60. .ulcon = GONI_ULCON_DEFAULT,
  61. .ufcon = GONI_UFCON_DEFAULT |
  62. S5PV210_UFCON_TXTRIG256 | S5PV210_UFCON_RXTRIG256,
  63. },
  64. [1] = {
  65. .hwport = 1,
  66. .flags = 0,
  67. .ucon = GONI_UCON_DEFAULT,
  68. .ulcon = GONI_ULCON_DEFAULT,
  69. .ufcon = GONI_UFCON_DEFAULT |
  70. S5PV210_UFCON_TXTRIG64 | S5PV210_UFCON_RXTRIG64,
  71. },
  72. [2] = {
  73. .hwport = 2,
  74. .flags = 0,
  75. .ucon = GONI_UCON_DEFAULT,
  76. .ulcon = GONI_ULCON_DEFAULT,
  77. .ufcon = GONI_UFCON_DEFAULT |
  78. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  79. },
  80. [3] = {
  81. .hwport = 3,
  82. .flags = 0,
  83. .ucon = GONI_UCON_DEFAULT,
  84. .ulcon = GONI_ULCON_DEFAULT,
  85. .ufcon = GONI_UFCON_DEFAULT |
  86. S5PV210_UFCON_TXTRIG16 | S5PV210_UFCON_RXTRIG16,
  87. },
  88. };
  89. /* Frame Buffer */
  90. static struct s3c_fb_pd_win goni_fb_win0 = {
  91. .win_mode = {
  92. .left_margin = 16,
  93. .right_margin = 16,
  94. .upper_margin = 2,
  95. .lower_margin = 28,
  96. .hsync_len = 2,
  97. .vsync_len = 1,
  98. .xres = 480,
  99. .yres = 800,
  100. .refresh = 55,
  101. },
  102. .max_bpp = 32,
  103. .default_bpp = 16,
  104. .virtual_x = 480,
  105. .virtual_y = 2 * 800,
  106. };
  107. static struct s3c_fb_platdata goni_lcd_pdata __initdata = {
  108. .win[0] = &goni_fb_win0,
  109. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  110. VIDCON0_CLKSEL_LCD,
  111. .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
  112. | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  113. .setup_gpio = s5pv210_fb_gpio_setup_24bpp,
  114. };
  115. static int lcd_power_on(struct lcd_device *ld, int enable)
  116. {
  117. return 1;
  118. }
  119. static int reset_lcd(struct lcd_device *ld)
  120. {
  121. static unsigned int first = 1;
  122. int reset_gpio = -1;
  123. reset_gpio = S5PV210_MP05(5);
  124. if (first) {
  125. gpio_request(reset_gpio, "MLCD_RST");
  126. first = 0;
  127. }
  128. gpio_direction_output(reset_gpio, 1);
  129. return 1;
  130. }
  131. static struct lcd_platform_data goni_lcd_platform_data = {
  132. .reset = reset_lcd,
  133. .power_on = lcd_power_on,
  134. .lcd_enabled = 0,
  135. .reset_delay = 120, /* 120ms */
  136. .power_on_delay = 25, /* 25ms */
  137. .power_off_delay = 200, /* 200ms */
  138. };
  139. #define LCD_BUS_NUM 3
  140. static struct spi_board_info spi_board_info[] __initdata = {
  141. {
  142. .modalias = "s6e63m0",
  143. .platform_data = &goni_lcd_platform_data,
  144. .max_speed_hz = 1200000,
  145. .bus_num = LCD_BUS_NUM,
  146. .chip_select = 0,
  147. .mode = SPI_MODE_3,
  148. .controller_data = (void *)S5PV210_MP01(1), /* DISPLAY_CS */
  149. },
  150. };
  151. static struct spi_gpio_platform_data lcd_spi_gpio_data = {
  152. .sck = S5PV210_MP04(1), /* DISPLAY_CLK */
  153. .mosi = S5PV210_MP04(3), /* DISPLAY_SI */
  154. .miso = SPI_GPIO_NO_MISO,
  155. .num_chipselect = 1,
  156. };
  157. static struct platform_device goni_spi_gpio = {
  158. .name = "spi_gpio",
  159. .id = LCD_BUS_NUM,
  160. .dev = {
  161. .parent = &s3c_device_fb.dev,
  162. .platform_data = &lcd_spi_gpio_data,
  163. },
  164. };
  165. /* KEYPAD */
  166. static uint32_t keymap[] __initdata = {
  167. /* KEY(row, col, keycode) */
  168. KEY(0, 1, KEY_MENU), /* Send */
  169. KEY(0, 2, KEY_BACK), /* End */
  170. KEY(1, 1, KEY_CONFIG), /* Half shot */
  171. KEY(1, 2, KEY_VOLUMEUP),
  172. KEY(2, 1, KEY_CAMERA), /* Full shot */
  173. KEY(2, 2, KEY_VOLUMEDOWN),
  174. };
  175. static struct matrix_keymap_data keymap_data __initdata = {
  176. .keymap = keymap,
  177. .keymap_size = ARRAY_SIZE(keymap),
  178. };
  179. static struct samsung_keypad_platdata keypad_data __initdata = {
  180. .keymap_data = &keymap_data,
  181. .rows = 3,
  182. .cols = 3,
  183. };
  184. /* Radio */
  185. static struct i2c_board_info i2c1_devs[] __initdata = {
  186. {
  187. I2C_BOARD_INFO("si470x", 0x10),
  188. },
  189. };
  190. static void __init goni_radio_init(void)
  191. {
  192. int gpio;
  193. gpio = S5PV210_GPJ2(4); /* XMSMDATA_4 */
  194. gpio_request(gpio, "FM_INT");
  195. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  196. i2c1_devs[0].irq = gpio_to_irq(gpio);
  197. gpio = S5PV210_GPJ2(5); /* XMSMDATA_5 */
  198. gpio_request(gpio, "FM_RST");
  199. gpio_direction_output(gpio, 1);
  200. }
  201. /* TSP */
  202. static struct mxt_platform_data qt602240_platform_data = {
  203. .x_line = 17,
  204. .y_line = 11,
  205. .x_size = 800,
  206. .y_size = 480,
  207. .blen = 0x21,
  208. .threshold = 0x28,
  209. .voltage = 2800000, /* 2.8V */
  210. .orient = MXT_DIAGONAL,
  211. .irqflags = IRQF_TRIGGER_FALLING,
  212. };
  213. static struct s3c2410_platform_i2c i2c2_data __initdata = {
  214. .flags = 0,
  215. .bus_num = 2,
  216. .slave_addr = 0x10,
  217. .frequency = 400 * 1000,
  218. .sda_delay = 100,
  219. };
  220. static struct i2c_board_info i2c2_devs[] __initdata = {
  221. {
  222. I2C_BOARD_INFO("qt602240_ts", 0x4a),
  223. .platform_data = &qt602240_platform_data,
  224. },
  225. };
  226. static void __init goni_tsp_init(void)
  227. {
  228. int gpio;
  229. gpio = S5PV210_GPJ1(3); /* XMSMADDR_11 */
  230. gpio_request(gpio, "TSP_LDO_ON");
  231. gpio_direction_output(gpio, 1);
  232. gpio_export(gpio, 0);
  233. gpio = S5PV210_GPJ0(5); /* XMSMADDR_5 */
  234. gpio_request(gpio, "TSP_INT");
  235. s5p_register_gpio_interrupt(gpio);
  236. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  237. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
  238. i2c2_devs[0].irq = gpio_to_irq(gpio);
  239. }
  240. /* MAX8998 regulators */
  241. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  242. static struct regulator_consumer_supply goni_ldo3_consumers[] = {
  243. REGULATOR_SUPPLY("vusb_a", "s3c-hsotg"),
  244. };
  245. static struct regulator_consumer_supply goni_ldo5_consumers[] = {
  246. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  247. };
  248. static struct regulator_consumer_supply goni_ldo8_consumers[] = {
  249. REGULATOR_SUPPLY("vusb_d", "s3c-hsotg"),
  250. };
  251. static struct regulator_consumer_supply goni_ldo11_consumers[] = {
  252. REGULATOR_SUPPLY("vddio", "0-0030"), /* "CAM_IO_2.8V" */
  253. };
  254. static struct regulator_consumer_supply goni_ldo13_consumers[] = {
  255. REGULATOR_SUPPLY("vdda", "0-0030"), /* "CAM_A_2.8V" */
  256. };
  257. static struct regulator_consumer_supply goni_ldo14_consumers[] = {
  258. REGULATOR_SUPPLY("vdd_core", "0-0030"), /* "CAM_CIF_1.8V" */
  259. };
  260. static struct regulator_init_data goni_ldo2_data = {
  261. .constraints = {
  262. .name = "VALIVE_1.1V",
  263. .min_uV = 1100000,
  264. .max_uV = 1100000,
  265. .apply_uV = 1,
  266. .always_on = 1,
  267. .state_mem = {
  268. .enabled = 1,
  269. },
  270. },
  271. };
  272. static struct regulator_init_data goni_ldo3_data = {
  273. .constraints = {
  274. .name = "VUSB+MIPI_1.1V",
  275. .min_uV = 1100000,
  276. .max_uV = 1100000,
  277. .apply_uV = 1,
  278. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  279. },
  280. .num_consumer_supplies = ARRAY_SIZE(goni_ldo3_consumers),
  281. .consumer_supplies = goni_ldo3_consumers,
  282. };
  283. static struct regulator_init_data goni_ldo4_data = {
  284. .constraints = {
  285. .name = "VDAC_3.3V",
  286. .min_uV = 3300000,
  287. .max_uV = 3300000,
  288. .apply_uV = 1,
  289. },
  290. };
  291. static struct regulator_init_data goni_ldo5_data = {
  292. .constraints = {
  293. .name = "VTF_2.8V",
  294. .min_uV = 2800000,
  295. .max_uV = 2800000,
  296. .apply_uV = 1,
  297. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  298. },
  299. .num_consumer_supplies = ARRAY_SIZE(goni_ldo5_consumers),
  300. .consumer_supplies = goni_ldo5_consumers,
  301. };
  302. static struct regulator_init_data goni_ldo6_data = {
  303. .constraints = {
  304. .name = "VCC_3.3V",
  305. .min_uV = 3300000,
  306. .max_uV = 3300000,
  307. .apply_uV = 1,
  308. },
  309. };
  310. static struct regulator_init_data goni_ldo7_data = {
  311. .constraints = {
  312. .name = "VLCD_1.8V",
  313. .min_uV = 1800000,
  314. .max_uV = 1800000,
  315. .apply_uV = 1,
  316. .always_on = 1,
  317. },
  318. };
  319. static struct regulator_init_data goni_ldo8_data = {
  320. .constraints = {
  321. .name = "VUSB+VADC_3.3V",
  322. .min_uV = 3300000,
  323. .max_uV = 3300000,
  324. .apply_uV = 1,
  325. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  326. },
  327. .num_consumer_supplies = ARRAY_SIZE(goni_ldo8_consumers),
  328. .consumer_supplies = goni_ldo8_consumers,
  329. };
  330. static struct regulator_init_data goni_ldo9_data = {
  331. .constraints = {
  332. .name = "VCC+VCAM_2.8V",
  333. .min_uV = 2800000,
  334. .max_uV = 2800000,
  335. .apply_uV = 1,
  336. },
  337. };
  338. static struct regulator_init_data goni_ldo10_data = {
  339. .constraints = {
  340. .name = "VPLL_1.1V",
  341. .min_uV = 1100000,
  342. .max_uV = 1100000,
  343. .apply_uV = 1,
  344. .boot_on = 1,
  345. },
  346. };
  347. static struct regulator_init_data goni_ldo11_data = {
  348. .constraints = {
  349. .name = "CAM_IO_2.8V",
  350. .min_uV = 2800000,
  351. .max_uV = 2800000,
  352. .apply_uV = 1,
  353. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  354. },
  355. .num_consumer_supplies = ARRAY_SIZE(goni_ldo11_consumers),
  356. .consumer_supplies = goni_ldo11_consumers,
  357. };
  358. static struct regulator_init_data goni_ldo12_data = {
  359. .constraints = {
  360. .name = "CAM_ISP_1.2V",
  361. .min_uV = 1200000,
  362. .max_uV = 1200000,
  363. .apply_uV = 1,
  364. },
  365. };
  366. static struct regulator_init_data goni_ldo13_data = {
  367. .constraints = {
  368. .name = "CAM_A_2.8V",
  369. .min_uV = 2800000,
  370. .max_uV = 2800000,
  371. .apply_uV = 1,
  372. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  373. },
  374. .num_consumer_supplies = ARRAY_SIZE(goni_ldo13_consumers),
  375. .consumer_supplies = goni_ldo13_consumers,
  376. };
  377. static struct regulator_init_data goni_ldo14_data = {
  378. .constraints = {
  379. .name = "CAM_CIF_1.8V",
  380. .min_uV = 1800000,
  381. .max_uV = 1800000,
  382. .apply_uV = 1,
  383. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  384. },
  385. .num_consumer_supplies = ARRAY_SIZE(goni_ldo14_consumers),
  386. .consumer_supplies = goni_ldo14_consumers,
  387. };
  388. static struct regulator_init_data goni_ldo15_data = {
  389. .constraints = {
  390. .name = "CAM_AF_3.3V",
  391. .min_uV = 3300000,
  392. .max_uV = 3300000,
  393. .apply_uV = 1,
  394. },
  395. };
  396. static struct regulator_init_data goni_ldo16_data = {
  397. .constraints = {
  398. .name = "VMIPI_1.8V",
  399. .min_uV = 1800000,
  400. .max_uV = 1800000,
  401. .apply_uV = 1,
  402. },
  403. };
  404. static struct regulator_init_data goni_ldo17_data = {
  405. .constraints = {
  406. .name = "VCC_3.0V_LCD",
  407. .min_uV = 3000000,
  408. .max_uV = 3000000,
  409. .apply_uV = 1,
  410. .always_on = 1,
  411. },
  412. };
  413. /* BUCK */
  414. static struct regulator_consumer_supply buck1_consumer =
  415. REGULATOR_SUPPLY("vddarm", NULL);
  416. static struct regulator_consumer_supply buck2_consumer =
  417. REGULATOR_SUPPLY("vddint", NULL);
  418. static struct regulator_init_data goni_buck1_data = {
  419. .constraints = {
  420. .name = "VARM_1.2V",
  421. .min_uV = 1200000,
  422. .max_uV = 1200000,
  423. .apply_uV = 1,
  424. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  425. REGULATOR_CHANGE_STATUS,
  426. },
  427. .num_consumer_supplies = 1,
  428. .consumer_supplies = &buck1_consumer,
  429. };
  430. static struct regulator_init_data goni_buck2_data = {
  431. .constraints = {
  432. .name = "VINT_1.2V",
  433. .min_uV = 1200000,
  434. .max_uV = 1200000,
  435. .apply_uV = 1,
  436. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  437. REGULATOR_CHANGE_STATUS,
  438. },
  439. .num_consumer_supplies = 1,
  440. .consumer_supplies = &buck2_consumer,
  441. };
  442. static struct regulator_init_data goni_buck3_data = {
  443. .constraints = {
  444. .name = "VCC_1.8V",
  445. .min_uV = 1800000,
  446. .max_uV = 1800000,
  447. .apply_uV = 1,
  448. .state_mem = {
  449. .enabled = 1,
  450. },
  451. },
  452. };
  453. static struct regulator_init_data goni_buck4_data = {
  454. .constraints = {
  455. .name = "CAM_CORE_1.2V",
  456. .min_uV = 1200000,
  457. .max_uV = 1200000,
  458. .apply_uV = 1,
  459. .always_on = 1,
  460. },
  461. };
  462. static struct max8998_regulator_data goni_regulators[] = {
  463. { MAX8998_LDO2, &goni_ldo2_data },
  464. { MAX8998_LDO3, &goni_ldo3_data },
  465. { MAX8998_LDO4, &goni_ldo4_data },
  466. { MAX8998_LDO5, &goni_ldo5_data },
  467. { MAX8998_LDO6, &goni_ldo6_data },
  468. { MAX8998_LDO7, &goni_ldo7_data },
  469. { MAX8998_LDO8, &goni_ldo8_data },
  470. { MAX8998_LDO9, &goni_ldo9_data },
  471. { MAX8998_LDO10, &goni_ldo10_data },
  472. { MAX8998_LDO11, &goni_ldo11_data },
  473. { MAX8998_LDO12, &goni_ldo12_data },
  474. { MAX8998_LDO13, &goni_ldo13_data },
  475. { MAX8998_LDO14, &goni_ldo14_data },
  476. { MAX8998_LDO15, &goni_ldo15_data },
  477. { MAX8998_LDO16, &goni_ldo16_data },
  478. { MAX8998_LDO17, &goni_ldo17_data },
  479. { MAX8998_BUCK1, &goni_buck1_data },
  480. { MAX8998_BUCK2, &goni_buck2_data },
  481. { MAX8998_BUCK3, &goni_buck3_data },
  482. { MAX8998_BUCK4, &goni_buck4_data },
  483. };
  484. static struct max8998_platform_data goni_max8998_pdata = {
  485. .num_regulators = ARRAY_SIZE(goni_regulators),
  486. .regulators = goni_regulators,
  487. .buck1_set1 = S5PV210_GPH0(3),
  488. .buck1_set2 = S5PV210_GPH0(4),
  489. .buck2_set3 = S5PV210_GPH0(5),
  490. .buck1_voltage1 = 1200000,
  491. .buck1_voltage2 = 1200000,
  492. .buck1_voltage3 = 1200000,
  493. .buck1_voltage4 = 1200000,
  494. .buck2_voltage1 = 1200000,
  495. .buck2_voltage2 = 1200000,
  496. };
  497. #endif
  498. static struct regulator_consumer_supply wm8994_fixed_voltage0_supplies[] = {
  499. REGULATOR_SUPPLY("DBVDD", "5-001a"),
  500. REGULATOR_SUPPLY("AVDD2", "5-001a"),
  501. REGULATOR_SUPPLY("CPVDD", "5-001a"),
  502. };
  503. static struct regulator_consumer_supply wm8994_fixed_voltage1_supplies[] = {
  504. REGULATOR_SUPPLY("SPKVDD1", "5-001a"),
  505. REGULATOR_SUPPLY("SPKVDD2", "5-001a"),
  506. };
  507. static struct regulator_init_data wm8994_fixed_voltage0_init_data = {
  508. .constraints = {
  509. .always_on = 1,
  510. },
  511. .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage0_supplies),
  512. .consumer_supplies = wm8994_fixed_voltage0_supplies,
  513. };
  514. static struct regulator_init_data wm8994_fixed_voltage1_init_data = {
  515. .constraints = {
  516. .always_on = 1,
  517. },
  518. .num_consumer_supplies = ARRAY_SIZE(wm8994_fixed_voltage1_supplies),
  519. .consumer_supplies = wm8994_fixed_voltage1_supplies,
  520. };
  521. static struct fixed_voltage_config wm8994_fixed_voltage0_config = {
  522. .supply_name = "VCC_1.8V_PDA",
  523. .microvolts = 1800000,
  524. .gpio = -EINVAL,
  525. .init_data = &wm8994_fixed_voltage0_init_data,
  526. };
  527. static struct fixed_voltage_config wm8994_fixed_voltage1_config = {
  528. .supply_name = "V_BAT",
  529. .microvolts = 3700000,
  530. .gpio = -EINVAL,
  531. .init_data = &wm8994_fixed_voltage1_init_data,
  532. };
  533. static struct platform_device wm8994_fixed_voltage0 = {
  534. .name = "reg-fixed-voltage",
  535. .id = 0,
  536. .dev = {
  537. .platform_data = &wm8994_fixed_voltage0_config,
  538. },
  539. };
  540. static struct platform_device wm8994_fixed_voltage1 = {
  541. .name = "reg-fixed-voltage",
  542. .id = 1,
  543. .dev = {
  544. .platform_data = &wm8994_fixed_voltage1_config,
  545. },
  546. };
  547. static struct regulator_consumer_supply wm8994_avdd1_supply =
  548. REGULATOR_SUPPLY("AVDD1", "5-001a");
  549. static struct regulator_consumer_supply wm8994_dcvdd_supply =
  550. REGULATOR_SUPPLY("DCVDD", "5-001a");
  551. static struct regulator_init_data wm8994_ldo1_data = {
  552. .constraints = {
  553. .name = "AVDD1_3.0V",
  554. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  555. },
  556. .num_consumer_supplies = 1,
  557. .consumer_supplies = &wm8994_avdd1_supply,
  558. };
  559. static struct regulator_init_data wm8994_ldo2_data = {
  560. .constraints = {
  561. .name = "DCVDD_1.0V",
  562. },
  563. .num_consumer_supplies = 1,
  564. .consumer_supplies = &wm8994_dcvdd_supply,
  565. };
  566. static struct wm8994_pdata wm8994_platform_data = {
  567. /* configure gpio1 function: 0x0001(Logic level input/output) */
  568. .gpio_defaults[0] = 0x0001,
  569. /* configure gpio3/4/5/7 function for AIF2 voice */
  570. .gpio_defaults[2] = 0x8100,
  571. .gpio_defaults[3] = 0x8100,
  572. .gpio_defaults[4] = 0x8100,
  573. .gpio_defaults[6] = 0x0100,
  574. /* configure gpio8/9/10/11 function for AIF3 BT */
  575. .gpio_defaults[7] = 0x8100,
  576. .gpio_defaults[8] = 0x0100,
  577. .gpio_defaults[9] = 0x0100,
  578. .gpio_defaults[10] = 0x0100,
  579. .ldo[0] = { S5PV210_MP03(6), NULL, &wm8994_ldo1_data }, /* XM0FRNB_2 */
  580. .ldo[1] = { 0, NULL, &wm8994_ldo2_data },
  581. };
  582. /* GPIO I2C PMIC */
  583. #define AP_I2C_GPIO_PMIC_BUS_4 4
  584. static struct i2c_gpio_platform_data goni_i2c_gpio_pmic_data = {
  585. .sda_pin = S5PV210_GPJ4(0), /* XMSMCSN */
  586. .scl_pin = S5PV210_GPJ4(3), /* XMSMIRQN */
  587. };
  588. static struct platform_device goni_i2c_gpio_pmic = {
  589. .name = "i2c-gpio",
  590. .id = AP_I2C_GPIO_PMIC_BUS_4,
  591. .dev = {
  592. .platform_data = &goni_i2c_gpio_pmic_data,
  593. },
  594. };
  595. static struct i2c_board_info i2c_gpio_pmic_devs[] __initdata = {
  596. #if defined(CONFIG_REGULATOR_MAX8998) || defined(CONFIG_REGULATOR_MAX8998_MODULE)
  597. {
  598. /* 0xCC when SRAD = 0 */
  599. I2C_BOARD_INFO("max8998", 0xCC >> 1),
  600. .platform_data = &goni_max8998_pdata,
  601. },
  602. #endif
  603. };
  604. /* GPIO I2C AP 1.8V */
  605. #define AP_I2C_GPIO_BUS_5 5
  606. static struct i2c_gpio_platform_data goni_i2c_gpio5_data = {
  607. .sda_pin = S5PV210_MP05(3), /* XM0ADDR_11 */
  608. .scl_pin = S5PV210_MP05(2), /* XM0ADDR_10 */
  609. };
  610. static struct platform_device goni_i2c_gpio5 = {
  611. .name = "i2c-gpio",
  612. .id = AP_I2C_GPIO_BUS_5,
  613. .dev = {
  614. .platform_data = &goni_i2c_gpio5_data,
  615. },
  616. };
  617. static struct i2c_board_info i2c_gpio5_devs[] __initdata = {
  618. {
  619. /* CS/ADDR = low 0x34 (FYI: high = 0x36) */
  620. I2C_BOARD_INFO("wm8994", 0x1a),
  621. .platform_data = &wm8994_platform_data,
  622. },
  623. };
  624. /* PMIC Power button */
  625. static struct gpio_keys_button goni_gpio_keys_table[] = {
  626. {
  627. .code = KEY_POWER,
  628. .gpio = S5PV210_GPH2(6),
  629. .desc = "gpio-keys: KEY_POWER",
  630. .type = EV_KEY,
  631. .active_low = 1,
  632. .wakeup = 1,
  633. .debounce_interval = 1,
  634. },
  635. };
  636. static struct gpio_keys_platform_data goni_gpio_keys_data = {
  637. .buttons = goni_gpio_keys_table,
  638. .nbuttons = ARRAY_SIZE(goni_gpio_keys_table),
  639. };
  640. static struct platform_device goni_device_gpiokeys = {
  641. .name = "gpio-keys",
  642. .dev = {
  643. .platform_data = &goni_gpio_keys_data,
  644. },
  645. };
  646. static void __init goni_pmic_init(void)
  647. {
  648. /* AP_PMIC_IRQ: EINT7 */
  649. s3c_gpio_cfgpin(S5PV210_GPH0(7), S3C_GPIO_SFN(0xf));
  650. s3c_gpio_setpull(S5PV210_GPH0(7), S3C_GPIO_PULL_UP);
  651. /* nPower: EINT22 */
  652. s3c_gpio_cfgpin(S5PV210_GPH2(6), S3C_GPIO_SFN(0xf));
  653. s3c_gpio_setpull(S5PV210_GPH2(6), S3C_GPIO_PULL_UP);
  654. }
  655. /* MoviNAND */
  656. static struct s3c_sdhci_platdata goni_hsmmc0_data __initdata = {
  657. .max_width = 4,
  658. .cd_type = S3C_SDHCI_CD_PERMANENT,
  659. };
  660. /* Wireless LAN */
  661. static struct s3c_sdhci_platdata goni_hsmmc1_data __initdata = {
  662. .max_width = 4,
  663. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  664. /* ext_cd_{init,cleanup} callbacks will be added later */
  665. };
  666. /* External Flash */
  667. #define GONI_EXT_FLASH_EN S5PV210_MP05(4)
  668. #define GONI_EXT_FLASH_CD S5PV210_GPH3(4)
  669. static struct s3c_sdhci_platdata goni_hsmmc2_data __initdata = {
  670. .max_width = 4,
  671. .cd_type = S3C_SDHCI_CD_GPIO,
  672. .ext_cd_gpio = GONI_EXT_FLASH_CD,
  673. .ext_cd_gpio_invert = 1,
  674. };
  675. static struct regulator_consumer_supply mmc2_supplies[] = {
  676. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"),
  677. };
  678. static struct regulator_init_data mmc2_fixed_voltage_init_data = {
  679. .constraints = {
  680. .name = "V_TF_2.8V",
  681. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  682. },
  683. .num_consumer_supplies = ARRAY_SIZE(mmc2_supplies),
  684. .consumer_supplies = mmc2_supplies,
  685. };
  686. static struct fixed_voltage_config mmc2_fixed_voltage_config = {
  687. .supply_name = "EXT_FLASH_EN",
  688. .microvolts = 2800000,
  689. .gpio = GONI_EXT_FLASH_EN,
  690. .enable_high = true,
  691. .init_data = &mmc2_fixed_voltage_init_data,
  692. };
  693. static struct platform_device mmc2_fixed_voltage = {
  694. .name = "reg-fixed-voltage",
  695. .id = 2,
  696. .dev = {
  697. .platform_data = &mmc2_fixed_voltage_config,
  698. },
  699. };
  700. static void goni_setup_sdhci(void)
  701. {
  702. s3c_sdhci0_set_platdata(&goni_hsmmc0_data);
  703. s3c_sdhci1_set_platdata(&goni_hsmmc1_data);
  704. s3c_sdhci2_set_platdata(&goni_hsmmc2_data);
  705. };
  706. static struct platform_device *goni_devices[] __initdata = {
  707. &s3c_device_fb,
  708. &s5p_device_onenand,
  709. &goni_spi_gpio,
  710. &goni_i2c_gpio_pmic,
  711. &goni_i2c_gpio5,
  712. &mmc2_fixed_voltage,
  713. &goni_device_gpiokeys,
  714. &s3c_device_i2c0,
  715. &s5p_device_fimc0,
  716. &s5p_device_fimc1,
  717. &s5p_device_fimc2,
  718. &s3c_device_hsmmc0,
  719. &s3c_device_hsmmc1,
  720. &s3c_device_hsmmc2,
  721. &s5pv210_device_iis0,
  722. &s3c_device_usb_hsotg,
  723. &samsung_device_keypad,
  724. &s3c_device_i2c1,
  725. &s3c_device_i2c2,
  726. &wm8994_fixed_voltage0,
  727. &wm8994_fixed_voltage1,
  728. };
  729. static void __init goni_sound_init(void)
  730. {
  731. /* Ths main clock of WM8994 codec uses the output of CLKOUT pin.
  732. * The CLKOUT[9:8] set to 0x3(XUSBXTI) of 0xE010E000(OTHERS)
  733. * because it needs 24MHz clock to operate WM8994 codec.
  734. */
  735. __raw_writel(__raw_readl(S5P_OTHERS) | (0x3 << 8), S5P_OTHERS);
  736. }
  737. static void __init goni_map_io(void)
  738. {
  739. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  740. s3c24xx_init_clocks(24000000);
  741. s3c24xx_init_uarts(goni_uartcfgs, ARRAY_SIZE(goni_uartcfgs));
  742. s5p_set_timer_source(S5P_PWM3, S5P_PWM4);
  743. }
  744. static void __init goni_machine_init(void)
  745. {
  746. /* Radio: call before I2C 1 registeration */
  747. goni_radio_init();
  748. /* I2C0 */
  749. s3c_i2c0_set_platdata(NULL);
  750. /* I2C1 */
  751. s3c_i2c1_set_platdata(NULL);
  752. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  753. /* TSP: call before I2C 2 registeration */
  754. goni_tsp_init();
  755. /* I2C2 */
  756. s3c_i2c2_set_platdata(&i2c2_data);
  757. i2c_register_board_info(2, i2c2_devs, ARRAY_SIZE(i2c2_devs));
  758. /* PMIC */
  759. goni_pmic_init();
  760. i2c_register_board_info(AP_I2C_GPIO_PMIC_BUS_4, i2c_gpio_pmic_devs,
  761. ARRAY_SIZE(i2c_gpio_pmic_devs));
  762. /* SDHCI */
  763. goni_setup_sdhci();
  764. /* SOUND */
  765. goni_sound_init();
  766. i2c_register_board_info(AP_I2C_GPIO_BUS_5, i2c_gpio5_devs,
  767. ARRAY_SIZE(i2c_gpio5_devs));
  768. /* FB */
  769. s3c_fb_set_platdata(&goni_lcd_pdata);
  770. /* SPI */
  771. spi_register_board_info(spi_board_info, ARRAY_SIZE(spi_board_info));
  772. /* KEYPAD */
  773. samsung_keypad_set_platdata(&keypad_data);
  774. clk_xusbxti.rate = 24000000;
  775. platform_add_devices(goni_devices, ARRAY_SIZE(goni_devices));
  776. }
  777. MACHINE_START(GONI, "GONI")
  778. /* Maintainers: Kyungmin Park <kyungmin.park@samsung.com> */
  779. .boot_params = S5P_PA_SDRAM + 0x100,
  780. .init_irq = s5pv210_init_irq,
  781. .map_io = goni_map_io,
  782. .init_machine = goni_machine_init,
  783. .timer = &s5p_timer,
  784. MACHINE_END