mach-goni.c 23 KB

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