mach-goni.c 21 KB

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