mach-goni.c 20 KB

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