mach-goni.c 23 KB

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