mach-goni.c 24 KB

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