mach-goni.c 24 KB

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