mach-goni.c 22 KB

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