mach-nuri.c 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356
  1. /*
  2. * linux/arch/arm/mach-exynos4/mach-nuri.c
  3. *
  4. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  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/platform_device.h>
  11. #include <linux/serial_core.h>
  12. #include <linux/input.h>
  13. #include <linux/i2c.h>
  14. #include <linux/i2c/atmel_mxt_ts.h>
  15. #include <linux/i2c-gpio.h>
  16. #include <linux/gpio_keys.h>
  17. #include <linux/gpio.h>
  18. #include <linux/power/max8903_charger.h>
  19. #include <linux/power/max17042_battery.h>
  20. #include <linux/regulator/machine.h>
  21. #include <linux/regulator/fixed.h>
  22. #include <linux/mfd/max8997.h>
  23. #include <linux/mfd/max8997-private.h>
  24. #include <linux/mmc/host.h>
  25. #include <linux/fb.h>
  26. #include <linux/pwm_backlight.h>
  27. #include <video/platform_lcd.h>
  28. #include <media/m5mols.h>
  29. #include <media/s5k6aa.h>
  30. #include <media/s5p_fimc.h>
  31. #include <media/v4l2-mediabus.h>
  32. #include <asm/mach/arch.h>
  33. #include <asm/hardware/gic.h>
  34. #include <asm/mach-types.h>
  35. #include <plat/adc.h>
  36. #include <plat/regs-fb-v4.h>
  37. #include <plat/regs-serial.h>
  38. #include <plat/cpu.h>
  39. #include <plat/devs.h>
  40. #include <plat/fb.h>
  41. #include <plat/sdhci.h>
  42. #include <plat/ehci.h>
  43. #include <plat/clock.h>
  44. #include <plat/gpio-cfg.h>
  45. #include <plat/iic.h>
  46. #include <plat/mfc.h>
  47. #include <plat/pd.h>
  48. #include <plat/fimc-core.h>
  49. #include <plat/camport.h>
  50. #include <plat/mipi_csis.h>
  51. #include <mach/map.h>
  52. #include "common.h"
  53. /* Following are default values for UCON, ULCON and UFCON UART registers */
  54. #define NURI_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 NURI_ULCON_DEFAULT S3C2410_LCON_CS8
  61. #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  62. S5PV210_UFCON_TXTRIG256 | \
  63. S5PV210_UFCON_RXTRIG256)
  64. enum fixed_regulator_id {
  65. FIXED_REG_ID_MMC = 0,
  66. FIXED_REG_ID_MAX8903,
  67. FIXED_REG_ID_CAM_A28V,
  68. FIXED_REG_ID_CAM_12V,
  69. FIXED_REG_ID_CAM_VT_15V,
  70. };
  71. static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
  72. {
  73. .hwport = 0,
  74. .ucon = NURI_UCON_DEFAULT,
  75. .ulcon = NURI_ULCON_DEFAULT,
  76. .ufcon = NURI_UFCON_DEFAULT,
  77. },
  78. {
  79. .hwport = 1,
  80. .ucon = NURI_UCON_DEFAULT,
  81. .ulcon = NURI_ULCON_DEFAULT,
  82. .ufcon = NURI_UFCON_DEFAULT,
  83. },
  84. {
  85. .hwport = 2,
  86. .ucon = NURI_UCON_DEFAULT,
  87. .ulcon = NURI_ULCON_DEFAULT,
  88. .ufcon = NURI_UFCON_DEFAULT,
  89. },
  90. {
  91. .hwport = 3,
  92. .ucon = NURI_UCON_DEFAULT,
  93. .ulcon = NURI_ULCON_DEFAULT,
  94. .ufcon = NURI_UFCON_DEFAULT,
  95. },
  96. };
  97. /* eMMC */
  98. static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
  99. .max_width = 8,
  100. .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
  101. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  102. MMC_CAP_ERASE),
  103. .cd_type = S3C_SDHCI_CD_PERMANENT,
  104. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  105. };
  106. static struct regulator_consumer_supply emmc_supplies[] = {
  107. REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
  108. REGULATOR_SUPPLY("vmmc", "dw_mmc"),
  109. };
  110. static struct regulator_init_data emmc_fixed_voltage_init_data = {
  111. .constraints = {
  112. .name = "VMEM_VDD_2.8V",
  113. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  114. },
  115. .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
  116. .consumer_supplies = emmc_supplies,
  117. };
  118. static struct fixed_voltage_config emmc_fixed_voltage_config = {
  119. .supply_name = "MASSMEMORY_EN (inverted)",
  120. .microvolts = 2800000,
  121. .gpio = EXYNOS4_GPL1(1),
  122. .enable_high = false,
  123. .init_data = &emmc_fixed_voltage_init_data,
  124. };
  125. static struct platform_device emmc_fixed_voltage = {
  126. .name = "reg-fixed-voltage",
  127. .id = FIXED_REG_ID_MMC,
  128. .dev = {
  129. .platform_data = &emmc_fixed_voltage_config,
  130. },
  131. };
  132. /* SD */
  133. static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
  134. .max_width = 4,
  135. .host_caps = MMC_CAP_4_BIT_DATA |
  136. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  137. .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
  138. .ext_cd_gpio_invert = 1,
  139. .cd_type = S3C_SDHCI_CD_GPIO,
  140. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  141. };
  142. /* WLAN */
  143. static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
  144. .max_width = 4,
  145. .host_caps = MMC_CAP_4_BIT_DATA |
  146. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  147. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  148. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  149. };
  150. static void __init nuri_sdhci_init(void)
  151. {
  152. s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
  153. s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
  154. s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
  155. }
  156. /* GPIO KEYS */
  157. static struct gpio_keys_button nuri_gpio_keys_tables[] = {
  158. {
  159. .code = KEY_VOLUMEUP,
  160. .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
  161. .desc = "gpio-keys: KEY_VOLUMEUP",
  162. .type = EV_KEY,
  163. .active_low = 1,
  164. .debounce_interval = 1,
  165. }, {
  166. .code = KEY_VOLUMEDOWN,
  167. .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
  168. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  169. .type = EV_KEY,
  170. .active_low = 1,
  171. .debounce_interval = 1,
  172. }, {
  173. .code = KEY_POWER,
  174. .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
  175. .desc = "gpio-keys: KEY_POWER",
  176. .type = EV_KEY,
  177. .active_low = 1,
  178. .wakeup = 1,
  179. .debounce_interval = 1,
  180. },
  181. };
  182. static struct gpio_keys_platform_data nuri_gpio_keys_data = {
  183. .buttons = nuri_gpio_keys_tables,
  184. .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
  185. };
  186. static struct platform_device nuri_gpio_keys = {
  187. .name = "gpio-keys",
  188. .dev = {
  189. .platform_data = &nuri_gpio_keys_data,
  190. },
  191. };
  192. /* Frame Buffer */
  193. static struct s3c_fb_pd_win nuri_fb_win0 = {
  194. .win_mode = {
  195. .left_margin = 64,
  196. .right_margin = 16,
  197. .upper_margin = 64,
  198. .lower_margin = 1,
  199. .hsync_len = 48,
  200. .vsync_len = 3,
  201. .xres = 1024,
  202. .yres = 600,
  203. .refresh = 60,
  204. },
  205. .max_bpp = 24,
  206. .default_bpp = 16,
  207. .virtual_x = 1024,
  208. .virtual_y = 2 * 600,
  209. };
  210. static struct s3c_fb_platdata nuri_fb_pdata __initdata = {
  211. .win[0] = &nuri_fb_win0,
  212. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  213. VIDCON0_CLKSEL_LCD,
  214. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  215. .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
  216. };
  217. static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
  218. {
  219. int gpio = EXYNOS4_GPE1(5);
  220. gpio_request(gpio, "LVDS_nSHDN");
  221. gpio_direction_output(gpio, power);
  222. gpio_free(gpio);
  223. }
  224. static int nuri_bl_init(struct device *dev)
  225. {
  226. return gpio_request_one(EXYNOS4_GPE2(3), GPIOF_OUT_INIT_LOW,
  227. "LCD_LD0_EN");
  228. }
  229. static int nuri_bl_notify(struct device *dev, int brightness)
  230. {
  231. if (brightness < 1)
  232. brightness = 0;
  233. gpio_set_value(EXYNOS4_GPE2(3), 1);
  234. return brightness;
  235. }
  236. static void nuri_bl_exit(struct device *dev)
  237. {
  238. gpio_free(EXYNOS4_GPE2(3));
  239. }
  240. /* nuri pwm backlight */
  241. static struct platform_pwm_backlight_data nuri_backlight_data = {
  242. .pwm_id = 0,
  243. .pwm_period_ns = 30000,
  244. .max_brightness = 100,
  245. .dft_brightness = 50,
  246. .init = nuri_bl_init,
  247. .notify = nuri_bl_notify,
  248. .exit = nuri_bl_exit,
  249. };
  250. static struct platform_device nuri_backlight_device = {
  251. .name = "pwm-backlight",
  252. .id = -1,
  253. .dev = {
  254. .parent = &s3c_device_timer[0].dev,
  255. .platform_data = &nuri_backlight_data,
  256. },
  257. };
  258. static struct plat_lcd_data nuri_lcd_platform_data = {
  259. .set_power = nuri_lcd_power_on,
  260. };
  261. static struct platform_device nuri_lcd_device = {
  262. .name = "platform-lcd",
  263. .id = -1,
  264. .dev = {
  265. .platform_data = &nuri_lcd_platform_data,
  266. },
  267. };
  268. /* I2C1 */
  269. static struct i2c_board_info i2c1_devs[] __initdata = {
  270. /* Gyro, To be updated */
  271. };
  272. /* TSP */
  273. static struct mxt_platform_data mxt_platform_data = {
  274. .x_line = 18,
  275. .y_line = 11,
  276. .x_size = 1024,
  277. .y_size = 600,
  278. .blen = 0x1,
  279. .threshold = 0x28,
  280. .voltage = 2800000, /* 2.8V */
  281. .orient = MXT_DIAGONAL_COUNTER,
  282. .irqflags = IRQF_TRIGGER_FALLING,
  283. };
  284. static struct s3c2410_platform_i2c i2c3_data __initdata = {
  285. .flags = 0,
  286. .bus_num = 3,
  287. .slave_addr = 0x10,
  288. .frequency = 400 * 1000,
  289. .sda_delay = 100,
  290. };
  291. static struct i2c_board_info i2c3_devs[] __initdata = {
  292. {
  293. I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
  294. .platform_data = &mxt_platform_data,
  295. .irq = IRQ_EINT(4),
  296. },
  297. };
  298. static void __init nuri_tsp_init(void)
  299. {
  300. int gpio;
  301. /* TOUCH_INT: XEINT_4 */
  302. gpio = EXYNOS4_GPX0(4);
  303. gpio_request(gpio, "TOUCH_INT");
  304. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  305. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
  306. }
  307. static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
  308. REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
  309. };
  310. static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
  311. REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
  312. };
  313. static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
  314. REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
  315. };
  316. static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
  317. REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
  318. };
  319. static struct regulator_consumer_supply nuri_max8997_ldo6_consumer[] = {
  320. REGULATOR_SUPPLY("vdd_reg", "6-003c"), /* S5K6AA camera */
  321. };
  322. static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
  323. REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
  324. };
  325. static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
  326. REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
  327. REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
  328. };
  329. static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
  330. REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
  331. };
  332. static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
  333. REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
  334. };
  335. static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
  336. REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.2"), /* TFLASH */
  337. };
  338. static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
  339. REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
  340. };
  341. static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
  342. REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
  343. };
  344. static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
  345. REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
  346. };
  347. static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
  348. REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
  349. };
  350. static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
  351. REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
  352. };
  353. static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
  354. REGULATOR_SUPPLY("vdd_int", "exynos4210-busfreq.0"), /* CPUFREQ */
  355. };
  356. static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
  357. REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
  358. };
  359. static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
  360. REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
  361. };
  362. static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
  363. REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
  364. };
  365. static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
  366. REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
  367. };
  368. static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
  369. REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
  370. };
  371. static struct regulator_consumer_supply __initdata max8997_charger_[] = {
  372. REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
  373. };
  374. static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
  375. REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
  376. };
  377. static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
  378. REGULATOR_SUPPLY("gps_clk", "bcm4751"),
  379. REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
  380. REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
  381. };
  382. static struct regulator_init_data __initdata max8997_ldo1_data = {
  383. .constraints = {
  384. .name = "VADC_3.3V_C210",
  385. .min_uV = 3300000,
  386. .max_uV = 3300000,
  387. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  388. .apply_uV = 1,
  389. .state_mem = {
  390. .disabled = 1,
  391. },
  392. },
  393. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
  394. .consumer_supplies = max8997_ldo1_,
  395. };
  396. static struct regulator_init_data __initdata max8997_ldo2_data = {
  397. .constraints = {
  398. .name = "VALIVE_1.1V_C210",
  399. .min_uV = 1100000,
  400. .max_uV = 1100000,
  401. .apply_uV = 1,
  402. .always_on = 1,
  403. .state_mem = {
  404. .enabled = 1,
  405. },
  406. },
  407. };
  408. static struct regulator_init_data __initdata max8997_ldo3_data = {
  409. .constraints = {
  410. .name = "VUSB_1.1V_C210",
  411. .min_uV = 1100000,
  412. .max_uV = 1100000,
  413. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  414. .apply_uV = 1,
  415. .state_mem = {
  416. .disabled = 1,
  417. },
  418. },
  419. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
  420. .consumer_supplies = max8997_ldo3_,
  421. };
  422. static struct regulator_init_data __initdata max8997_ldo4_data = {
  423. .constraints = {
  424. .name = "VMIPI_1.8V",
  425. .min_uV = 1800000,
  426. .max_uV = 1800000,
  427. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  428. .apply_uV = 1,
  429. .state_mem = {
  430. .disabled = 1,
  431. },
  432. },
  433. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
  434. .consumer_supplies = max8997_ldo4_,
  435. };
  436. static struct regulator_init_data __initdata max8997_ldo5_data = {
  437. .constraints = {
  438. .name = "VHSIC_1.2V_C210",
  439. .min_uV = 1200000,
  440. .max_uV = 1200000,
  441. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  442. .apply_uV = 1,
  443. .state_mem = {
  444. .disabled = 1,
  445. },
  446. },
  447. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
  448. .consumer_supplies = max8997_ldo5_,
  449. };
  450. static struct regulator_init_data __initdata max8997_ldo6_data = {
  451. .constraints = {
  452. .name = "VCC_1.8V_PDA",
  453. .min_uV = 1800000,
  454. .max_uV = 1800000,
  455. .apply_uV = 1,
  456. .always_on = 1,
  457. .state_mem = {
  458. .enabled = 1,
  459. },
  460. },
  461. .num_consumer_supplies = ARRAY_SIZE(nuri_max8997_ldo6_consumer),
  462. .consumer_supplies = nuri_max8997_ldo6_consumer,
  463. };
  464. static struct regulator_init_data __initdata max8997_ldo7_data = {
  465. .constraints = {
  466. .name = "CAM_ISP_1.8V",
  467. .min_uV = 1800000,
  468. .max_uV = 1800000,
  469. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  470. .apply_uV = 1,
  471. .state_mem = {
  472. .disabled = 1,
  473. },
  474. },
  475. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
  476. .consumer_supplies = max8997_ldo7_,
  477. };
  478. static struct regulator_init_data __initdata max8997_ldo8_data = {
  479. .constraints = {
  480. .name = "VUSB+VDAC_3.3V_C210",
  481. .min_uV = 3300000,
  482. .max_uV = 3300000,
  483. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  484. .apply_uV = 1,
  485. .state_mem = {
  486. .disabled = 1,
  487. },
  488. },
  489. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
  490. .consumer_supplies = max8997_ldo8_,
  491. };
  492. static struct regulator_init_data __initdata max8997_ldo9_data = {
  493. .constraints = {
  494. .name = "VCC_2.8V_PDA",
  495. .min_uV = 2800000,
  496. .max_uV = 2800000,
  497. .apply_uV = 1,
  498. .always_on = 1,
  499. .state_mem = {
  500. .enabled = 1,
  501. },
  502. },
  503. };
  504. static struct regulator_init_data __initdata max8997_ldo10_data = {
  505. .constraints = {
  506. .name = "VPLL_1.1V_C210",
  507. .min_uV = 1100000,
  508. .max_uV = 1100000,
  509. .apply_uV = 1,
  510. .always_on = 1,
  511. .state_mem = {
  512. .disabled = 1,
  513. },
  514. },
  515. };
  516. static struct regulator_init_data __initdata max8997_ldo11_data = {
  517. .constraints = {
  518. .name = "LVDS_VDD3.3V",
  519. .min_uV = 3300000,
  520. .max_uV = 3300000,
  521. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  522. .apply_uV = 1,
  523. .boot_on = 1,
  524. .state_mem = {
  525. .disabled = 1,
  526. },
  527. },
  528. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
  529. .consumer_supplies = max8997_ldo11_,
  530. };
  531. static struct regulator_init_data __initdata max8997_ldo12_data = {
  532. .constraints = {
  533. .name = "VT_CAM_1.8V",
  534. .min_uV = 1800000,
  535. .max_uV = 1800000,
  536. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  537. .apply_uV = 1,
  538. .state_mem = {
  539. .disabled = 1,
  540. },
  541. },
  542. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
  543. .consumer_supplies = max8997_ldo12_,
  544. };
  545. static struct regulator_init_data __initdata max8997_ldo13_data = {
  546. .constraints = {
  547. .name = "VTF_2.8V",
  548. .min_uV = 2800000,
  549. .max_uV = 2800000,
  550. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  551. .apply_uV = 1,
  552. .state_mem = {
  553. .disabled = 1,
  554. },
  555. },
  556. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
  557. .consumer_supplies = max8997_ldo13_,
  558. };
  559. static struct regulator_init_data __initdata max8997_ldo14_data = {
  560. .constraints = {
  561. .name = "VCC_3.0V_MOTOR",
  562. .min_uV = 3000000,
  563. .max_uV = 3000000,
  564. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  565. .apply_uV = 1,
  566. .state_mem = {
  567. .disabled = 1,
  568. },
  569. },
  570. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
  571. .consumer_supplies = max8997_ldo14_,
  572. };
  573. static struct regulator_init_data __initdata max8997_ldo15_data = {
  574. .constraints = {
  575. .name = "VTOUCH_ADVV2.8V",
  576. .min_uV = 2800000,
  577. .max_uV = 2800000,
  578. .apply_uV = 1,
  579. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  580. .state_mem = {
  581. .disabled = 1,
  582. },
  583. },
  584. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
  585. .consumer_supplies = max8997_ldo15_,
  586. };
  587. static struct regulator_init_data __initdata max8997_ldo16_data = {
  588. .constraints = {
  589. .name = "CAM_SENSOR_IO_1.8V",
  590. .min_uV = 1800000,
  591. .max_uV = 1800000,
  592. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  593. .apply_uV = 1,
  594. .state_mem = {
  595. .disabled = 1,
  596. },
  597. },
  598. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
  599. .consumer_supplies = max8997_ldo16_,
  600. };
  601. static struct regulator_init_data __initdata max8997_ldo18_data = {
  602. .constraints = {
  603. .name = "VTOUCH_VDD2.8V",
  604. .min_uV = 2800000,
  605. .max_uV = 2800000,
  606. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  607. .apply_uV = 1,
  608. .state_mem = {
  609. .disabled = 1,
  610. },
  611. },
  612. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
  613. .consumer_supplies = max8997_ldo18_,
  614. };
  615. static struct regulator_init_data __initdata max8997_ldo21_data = {
  616. .constraints = {
  617. .name = "VDDQ_M1M2_1.2V",
  618. .min_uV = 1200000,
  619. .max_uV = 1200000,
  620. .apply_uV = 1,
  621. .always_on = 1,
  622. .state_mem = {
  623. .disabled = 1,
  624. },
  625. },
  626. };
  627. static struct regulator_init_data __initdata max8997_buck1_data = {
  628. .constraints = {
  629. .name = "VARM_1.2V_C210",
  630. .min_uV = 900000,
  631. .max_uV = 1350000,
  632. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  633. .always_on = 1,
  634. .state_mem = {
  635. .disabled = 1,
  636. },
  637. },
  638. .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
  639. .consumer_supplies = max8997_buck1_,
  640. };
  641. static struct regulator_init_data __initdata max8997_buck2_data = {
  642. .constraints = {
  643. .name = "VINT_1.1V_C210",
  644. .min_uV = 900000,
  645. .max_uV = 1200000,
  646. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  647. .always_on = 1,
  648. .state_mem = {
  649. .disabled = 1,
  650. },
  651. },
  652. .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
  653. .consumer_supplies = max8997_buck2_,
  654. };
  655. static struct regulator_init_data __initdata max8997_buck3_data = {
  656. .constraints = {
  657. .name = "VG3D_1.1V_C210",
  658. .min_uV = 900000,
  659. .max_uV = 1100000,
  660. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  661. REGULATOR_CHANGE_STATUS,
  662. .state_mem = {
  663. .disabled = 1,
  664. },
  665. },
  666. .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
  667. .consumer_supplies = max8997_buck3_,
  668. };
  669. static struct regulator_init_data __initdata max8997_buck4_data = {
  670. .constraints = {
  671. .name = "CAM_ISP_CORE_1.2V",
  672. .min_uV = 1200000,
  673. .max_uV = 1200000,
  674. .apply_uV = 1,
  675. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  676. .state_mem = {
  677. .disabled = 1,
  678. },
  679. },
  680. .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
  681. .consumer_supplies = max8997_buck4_,
  682. };
  683. static struct regulator_init_data __initdata max8997_buck5_data = {
  684. .constraints = {
  685. .name = "VMEM_1.2V_C210",
  686. .min_uV = 1200000,
  687. .max_uV = 1200000,
  688. .apply_uV = 1,
  689. .always_on = 1,
  690. .state_mem = {
  691. .enabled = 1,
  692. },
  693. },
  694. };
  695. static struct regulator_init_data __initdata max8997_buck6_data = {
  696. .constraints = {
  697. .name = "CAM_AF_2.8V",
  698. .min_uV = 2800000,
  699. .max_uV = 2800000,
  700. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  701. .state_mem = {
  702. .disabled = 1,
  703. },
  704. },
  705. .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
  706. .consumer_supplies = max8997_buck6_,
  707. };
  708. static struct regulator_init_data __initdata max8997_buck7_data = {
  709. .constraints = {
  710. .name = "VCC_SUB_2.0V",
  711. .min_uV = 2000000,
  712. .max_uV = 2000000,
  713. .apply_uV = 1,
  714. .always_on = 1,
  715. .state_mem = {
  716. .enabled = 1,
  717. },
  718. },
  719. };
  720. static struct regulator_init_data __initdata max8997_32khz_ap_data = {
  721. .constraints = {
  722. .name = "32KHz AP",
  723. .always_on = 1,
  724. .state_mem = {
  725. .enabled = 1,
  726. },
  727. },
  728. .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
  729. .consumer_supplies = max8997_32khz_ap_,
  730. };
  731. static struct regulator_init_data __initdata max8997_32khz_cp_data = {
  732. .constraints = {
  733. .name = "32KHz CP",
  734. .state_mem = {
  735. .disabled = 1,
  736. },
  737. },
  738. };
  739. static struct regulator_init_data __initdata max8997_vichg_data = {
  740. .constraints = {
  741. .name = "VICHG",
  742. .state_mem = {
  743. .disabled = 1,
  744. },
  745. },
  746. };
  747. static struct regulator_init_data __initdata max8997_esafeout1_data = {
  748. .constraints = {
  749. .name = "SAFEOUT1",
  750. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  751. .state_mem = {
  752. .disabled = 1,
  753. },
  754. },
  755. .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
  756. .consumer_supplies = max8997_esafeout1_,
  757. };
  758. static struct regulator_init_data __initdata max8997_esafeout2_data = {
  759. .constraints = {
  760. .name = "SAFEOUT2",
  761. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  762. .state_mem = {
  763. .disabled = 1,
  764. },
  765. },
  766. .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
  767. .consumer_supplies = max8997_esafeout2_,
  768. };
  769. static struct regulator_init_data __initdata max8997_charger_cv_data = {
  770. .constraints = {
  771. .name = "CHARGER_CV",
  772. .min_uV = 4200000,
  773. .max_uV = 4200000,
  774. .apply_uV = 1,
  775. },
  776. };
  777. static struct regulator_init_data __initdata max8997_charger_data = {
  778. .constraints = {
  779. .name = "CHARGER",
  780. .min_uA = 200000,
  781. .max_uA = 950000,
  782. .boot_on = 1,
  783. .valid_ops_mask = REGULATOR_CHANGE_STATUS |
  784. REGULATOR_CHANGE_CURRENT,
  785. },
  786. .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
  787. .consumer_supplies = max8997_charger_,
  788. };
  789. static struct regulator_init_data __initdata max8997_charger_topoff_data = {
  790. .constraints = {
  791. .name = "CHARGER TOPOFF",
  792. .min_uA = 50000,
  793. .max_uA = 200000,
  794. .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
  795. },
  796. .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
  797. .consumer_supplies = max8997_chg_toff_,
  798. };
  799. static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
  800. { MAX8997_LDO1, &max8997_ldo1_data },
  801. { MAX8997_LDO2, &max8997_ldo2_data },
  802. { MAX8997_LDO3, &max8997_ldo3_data },
  803. { MAX8997_LDO4, &max8997_ldo4_data },
  804. { MAX8997_LDO5, &max8997_ldo5_data },
  805. { MAX8997_LDO6, &max8997_ldo6_data },
  806. { MAX8997_LDO7, &max8997_ldo7_data },
  807. { MAX8997_LDO8, &max8997_ldo8_data },
  808. { MAX8997_LDO9, &max8997_ldo9_data },
  809. { MAX8997_LDO10, &max8997_ldo10_data },
  810. { MAX8997_LDO11, &max8997_ldo11_data },
  811. { MAX8997_LDO12, &max8997_ldo12_data },
  812. { MAX8997_LDO13, &max8997_ldo13_data },
  813. { MAX8997_LDO14, &max8997_ldo14_data },
  814. { MAX8997_LDO15, &max8997_ldo15_data },
  815. { MAX8997_LDO16, &max8997_ldo16_data },
  816. { MAX8997_LDO18, &max8997_ldo18_data },
  817. { MAX8997_LDO21, &max8997_ldo21_data },
  818. { MAX8997_BUCK1, &max8997_buck1_data },
  819. { MAX8997_BUCK2, &max8997_buck2_data },
  820. { MAX8997_BUCK3, &max8997_buck3_data },
  821. { MAX8997_BUCK4, &max8997_buck4_data },
  822. { MAX8997_BUCK5, &max8997_buck5_data },
  823. { MAX8997_BUCK6, &max8997_buck6_data },
  824. { MAX8997_BUCK7, &max8997_buck7_data },
  825. { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
  826. { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
  827. { MAX8997_ENVICHG, &max8997_vichg_data },
  828. { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
  829. { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
  830. { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
  831. { MAX8997_CHARGER, &max8997_charger_data },
  832. { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
  833. };
  834. static struct max8997_platform_data __initdata nuri_max8997_pdata = {
  835. .wakeup = 1,
  836. .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
  837. .regulators = nuri_max8997_regulators,
  838. .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
  839. .buck1_voltage[0] = 1350000, /* 1.35V */
  840. .buck1_voltage[1] = 1300000, /* 1.3V */
  841. .buck1_voltage[2] = 1250000, /* 1.25V */
  842. .buck1_voltage[3] = 1200000, /* 1.2V */
  843. .buck1_voltage[4] = 1150000, /* 1.15V */
  844. .buck1_voltage[5] = 1100000, /* 1.1V */
  845. .buck1_voltage[6] = 1000000, /* 1.0V */
  846. .buck1_voltage[7] = 950000, /* 0.95V */
  847. .buck2_voltage[0] = 1100000, /* 1.1V */
  848. .buck2_voltage[1] = 1000000, /* 1.0V */
  849. .buck2_voltage[2] = 950000, /* 0.95V */
  850. .buck2_voltage[3] = 900000, /* 0.9V */
  851. .buck2_voltage[4] = 1100000, /* 1.1V */
  852. .buck2_voltage[5] = 1000000, /* 1.0V */
  853. .buck2_voltage[6] = 950000, /* 0.95V */
  854. .buck2_voltage[7] = 900000, /* 0.9V */
  855. .buck5_voltage[0] = 1200000, /* 1.2V */
  856. .buck5_voltage[1] = 1200000, /* 1.2V */
  857. .buck5_voltage[2] = 1200000, /* 1.2V */
  858. .buck5_voltage[3] = 1200000, /* 1.2V */
  859. .buck5_voltage[4] = 1200000, /* 1.2V */
  860. .buck5_voltage[5] = 1200000, /* 1.2V */
  861. .buck5_voltage[6] = 1200000, /* 1.2V */
  862. .buck5_voltage[7] = 1200000, /* 1.2V */
  863. };
  864. /* GPIO I2C 5 (PMIC) */
  865. enum { I2C5_MAX8997 };
  866. static struct i2c_board_info i2c5_devs[] __initdata = {
  867. [I2C5_MAX8997] = {
  868. I2C_BOARD_INFO("max8997", 0xCC >> 1),
  869. .platform_data = &nuri_max8997_pdata,
  870. },
  871. };
  872. static struct max17042_platform_data nuri_battery_platform_data = {
  873. };
  874. /* GPIO I2C 9 (Fuel Gauge) */
  875. static struct i2c_gpio_platform_data i2c9_gpio_data = {
  876. .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
  877. .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
  878. };
  879. static struct platform_device i2c9_gpio = {
  880. .name = "i2c-gpio",
  881. .id = 9,
  882. .dev = {
  883. .platform_data = &i2c9_gpio_data,
  884. },
  885. };
  886. enum { I2C9_MAX17042};
  887. static struct i2c_board_info i2c9_devs[] __initdata = {
  888. [I2C9_MAX17042] = {
  889. I2C_BOARD_INFO("max17042", 0x36),
  890. .platform_data = &nuri_battery_platform_data,
  891. },
  892. };
  893. /* MAX8903 Secondary Charger */
  894. static struct regulator_consumer_supply supplies_max8903[] = {
  895. REGULATOR_SUPPLY("vinchg2", "charger-manager.0"),
  896. };
  897. static struct regulator_init_data max8903_charger_en_data = {
  898. .constraints = {
  899. .name = "VOUT_CHARGER",
  900. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  901. .boot_on = 1,
  902. },
  903. .num_consumer_supplies = ARRAY_SIZE(supplies_max8903),
  904. .consumer_supplies = supplies_max8903,
  905. };
  906. static struct fixed_voltage_config max8903_charger_en = {
  907. .supply_name = "VOUT_CHARGER",
  908. .microvolts = 5000000, /* Assume 5VDC */
  909. .gpio = EXYNOS4_GPY4(5), /* TA_EN negaged */
  910. .enable_high = 0, /* Enable = Low */
  911. .enabled_at_boot = 1,
  912. .init_data = &max8903_charger_en_data,
  913. };
  914. static struct platform_device max8903_fixed_reg_dev = {
  915. .name = "reg-fixed-voltage",
  916. .id = FIXED_REG_ID_MAX8903,
  917. .dev = { .platform_data = &max8903_charger_en },
  918. };
  919. static struct max8903_pdata nuri_max8903 = {
  920. /*
  921. * cen: don't control with the driver, let it be
  922. * controlled by regulator above
  923. */
  924. .dok = EXYNOS4_GPX1(4), /* TA_nCONNECTED */
  925. /* uok, usus: not connected */
  926. .chg = EXYNOS4_GPE2(0), /* TA_nCHG */
  927. /* flt: vcc_1.8V_pda */
  928. .dcm = EXYNOS4_GPL0(1), /* CURR_ADJ */
  929. .dc_valid = true,
  930. .usb_valid = false, /* USB is not wired to MAX8903 */
  931. };
  932. static struct platform_device nuri_max8903_device = {
  933. .name = "max8903-charger",
  934. .dev = {
  935. .platform_data = &nuri_max8903,
  936. },
  937. };
  938. static void __init nuri_power_init(void)
  939. {
  940. int gpio;
  941. int irq_base = IRQ_GPIO_END + 1;
  942. int ta_en = 0;
  943. nuri_max8997_pdata.irq_base = irq_base;
  944. irq_base += MAX8997_IRQ_NR;
  945. gpio = EXYNOS4_GPX0(7);
  946. gpio_request(gpio, "AP_PMIC_IRQ");
  947. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  948. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  949. gpio = EXYNOS4_GPX2(3);
  950. gpio_request(gpio, "FUEL_ALERT");
  951. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  952. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  953. gpio = nuri_max8903.dok;
  954. gpio_request(gpio, "TA_nCONNECTED");
  955. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  956. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  957. ta_en = gpio_get_value(gpio) ? 0 : 1;
  958. gpio = nuri_max8903.chg;
  959. gpio_request(gpio, "TA_nCHG");
  960. gpio_direction_input(gpio);
  961. gpio = nuri_max8903.dcm;
  962. gpio_request(gpio, "CURR_ADJ");
  963. gpio_direction_output(gpio, ta_en);
  964. }
  965. /* USB EHCI */
  966. static struct s5p_ehci_platdata nuri_ehci_pdata;
  967. static void __init nuri_ehci_init(void)
  968. {
  969. struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
  970. s5p_ehci_set_platdata(pdata);
  971. }
  972. /* CAMERA */
  973. static struct regulator_consumer_supply cam_vt_cam15_supply =
  974. REGULATOR_SUPPLY("vdd_core", "6-003c");
  975. static struct regulator_init_data cam_vt_cam15_reg_init_data = {
  976. .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
  977. .num_consumer_supplies = 1,
  978. .consumer_supplies = &cam_vt_cam15_supply,
  979. };
  980. static struct fixed_voltage_config cam_vt_cam15_fixed_voltage_cfg = {
  981. .supply_name = "VT_CAM_1.5V",
  982. .microvolts = 1500000,
  983. .gpio = EXYNOS4_GPE2(2), /* VT_CAM_1.5V_EN */
  984. .enable_high = 1,
  985. .init_data = &cam_vt_cam15_reg_init_data,
  986. };
  987. static struct platform_device cam_vt_cam15_fixed_rdev = {
  988. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_VT_15V,
  989. .dev = { .platform_data = &cam_vt_cam15_fixed_voltage_cfg },
  990. };
  991. static struct regulator_consumer_supply cam_vdda_supply[] = {
  992. REGULATOR_SUPPLY("vdda", "6-003c"),
  993. REGULATOR_SUPPLY("a_sensor", "0-001f"),
  994. };
  995. static struct regulator_init_data cam_vdda_reg_init_data = {
  996. .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
  997. .num_consumer_supplies = ARRAY_SIZE(cam_vdda_supply),
  998. .consumer_supplies = cam_vdda_supply,
  999. };
  1000. static struct fixed_voltage_config cam_vdda_fixed_voltage_cfg = {
  1001. .supply_name = "CAM_IO_EN",
  1002. .microvolts = 2800000,
  1003. .gpio = EXYNOS4_GPE2(1), /* CAM_IO_EN */
  1004. .enable_high = 1,
  1005. .init_data = &cam_vdda_reg_init_data,
  1006. };
  1007. static struct platform_device cam_vdda_fixed_rdev = {
  1008. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_A28V,
  1009. .dev = { .platform_data = &cam_vdda_fixed_voltage_cfg },
  1010. };
  1011. static struct regulator_consumer_supply camera_8m_12v_supply =
  1012. REGULATOR_SUPPLY("dig_12", "0-001f");
  1013. static struct regulator_init_data cam_8m_12v_reg_init_data = {
  1014. .num_consumer_supplies = 1,
  1015. .consumer_supplies = &camera_8m_12v_supply,
  1016. .constraints = {
  1017. .valid_ops_mask = REGULATOR_CHANGE_STATUS
  1018. },
  1019. };
  1020. static struct fixed_voltage_config cam_8m_12v_fixed_voltage_cfg = {
  1021. .supply_name = "8M_1.2V",
  1022. .microvolts = 1200000,
  1023. .gpio = EXYNOS4_GPE2(5), /* 8M_1.2V_EN */
  1024. .enable_high = 1,
  1025. .init_data = &cam_8m_12v_reg_init_data,
  1026. };
  1027. static struct platform_device cam_8m_12v_fixed_rdev = {
  1028. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_12V,
  1029. .dev = { .platform_data = &cam_8m_12v_fixed_voltage_cfg },
  1030. };
  1031. static struct s5p_platform_mipi_csis mipi_csis_platdata = {
  1032. .clk_rate = 166000000UL,
  1033. .lanes = 2,
  1034. .alignment = 32,
  1035. .hs_settle = 12,
  1036. .phy_enable = s5p_csis_phy_enable,
  1037. };
  1038. #define GPIO_CAM_MEGA_RST EXYNOS4_GPY3(7) /* ISP_RESET */
  1039. #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPL2(5)
  1040. #define GPIO_CAM_VT_NSTBY EXYNOS4_GPL2(0)
  1041. #define GPIO_CAM_VT_NRST EXYNOS4_GPL2(1)
  1042. static struct s5k6aa_platform_data s5k6aa_pldata = {
  1043. .mclk_frequency = 24000000UL,
  1044. .gpio_reset = { GPIO_CAM_VT_NRST, 0 },
  1045. .gpio_stby = { GPIO_CAM_VT_NSTBY, 0 },
  1046. .bus_type = V4L2_MBUS_PARALLEL,
  1047. .horiz_flip = 1,
  1048. };
  1049. static struct i2c_board_info s5k6aa_board_info = {
  1050. I2C_BOARD_INFO("S5K6AA", 0x3c),
  1051. .platform_data = &s5k6aa_pldata,
  1052. };
  1053. static struct m5mols_platform_data m5mols_platdata = {
  1054. .gpio_reset = GPIO_CAM_MEGA_RST,
  1055. };
  1056. static struct i2c_board_info m5mols_board_info = {
  1057. I2C_BOARD_INFO("M5MOLS", 0x1F),
  1058. .platform_data = &m5mols_platdata,
  1059. };
  1060. static struct s5p_fimc_isp_info nuri_camera_sensors[] = {
  1061. {
  1062. .flags = V4L2_MBUS_PCLK_SAMPLE_RISING |
  1063. V4L2_MBUS_VSYNC_ACTIVE_LOW,
  1064. .bus_type = FIMC_ITU_601,
  1065. .board_info = &s5k6aa_board_info,
  1066. .clk_frequency = 24000000UL,
  1067. .i2c_bus_num = 6,
  1068. }, {
  1069. .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
  1070. V4L2_MBUS_VSYNC_ACTIVE_LOW,
  1071. .bus_type = FIMC_MIPI_CSI2,
  1072. .board_info = &m5mols_board_info,
  1073. .clk_frequency = 24000000UL,
  1074. .csi_data_align = 32,
  1075. },
  1076. };
  1077. static struct s5p_platform_fimc fimc_md_platdata = {
  1078. .isp_info = nuri_camera_sensors,
  1079. .num_clients = ARRAY_SIZE(nuri_camera_sensors),
  1080. };
  1081. static struct gpio nuri_camera_gpios[] = {
  1082. { GPIO_CAM_VT_NSTBY, GPIOF_OUT_INIT_LOW, "CAM_VGA_NSTBY" },
  1083. { GPIO_CAM_VT_NRST, GPIOF_OUT_INIT_LOW, "CAM_VGA_NRST" },
  1084. { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
  1085. { GPIO_CAM_MEGA_RST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
  1086. };
  1087. static void __init nuri_camera_init(void)
  1088. {
  1089. s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
  1090. &s5p_device_mipi_csis0);
  1091. s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
  1092. &s5p_device_fimc_md);
  1093. if (gpio_request_array(nuri_camera_gpios,
  1094. ARRAY_SIZE(nuri_camera_gpios))) {
  1095. pr_err("%s: GPIO request failed\n", __func__);
  1096. return;
  1097. }
  1098. m5mols_board_info.irq = s5p_register_gpio_interrupt(GPIO_CAM_8M_ISP_INT);
  1099. if (!IS_ERR_VALUE(m5mols_board_info.irq))
  1100. s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xF));
  1101. else
  1102. pr_err("%s: Failed to configure 8M_ISP_INT GPIO\n", __func__);
  1103. /* Free GPIOs controlled directly by the sensor drivers. */
  1104. gpio_free(GPIO_CAM_VT_NRST);
  1105. gpio_free(GPIO_CAM_VT_NSTBY);
  1106. gpio_free(GPIO_CAM_MEGA_RST);
  1107. if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A)) {
  1108. pr_err("%s: Camera port A setup failed\n", __func__);
  1109. return;
  1110. }
  1111. /* Increase drive strength of the sensor clock output */
  1112. s5p_gpio_set_drvstr(EXYNOS4_GPJ1(3), S5P_GPIO_DRVSTR_LV4);
  1113. }
  1114. static struct s3c2410_platform_i2c nuri_i2c6_platdata __initdata = {
  1115. .frequency = 400000U,
  1116. .sda_delay = 200,
  1117. .bus_num = 6,
  1118. };
  1119. static struct s3c2410_platform_i2c nuri_i2c0_platdata __initdata = {
  1120. .frequency = 400000U,
  1121. .sda_delay = 200,
  1122. };
  1123. /* DEVFREQ controlling memory/bus */
  1124. static struct platform_device exynos4_bus_devfreq = {
  1125. .name = "exynos4210-busfreq",
  1126. };
  1127. static struct platform_device *nuri_devices[] __initdata = {
  1128. /* Samsung Platform Devices */
  1129. &s3c_device_i2c5, /* PMIC should initialize first */
  1130. &s3c_device_i2c0,
  1131. &s3c_device_i2c6,
  1132. &emmc_fixed_voltage,
  1133. &s5p_device_mipi_csis0,
  1134. &s5p_device_fimc0,
  1135. &s5p_device_fimc1,
  1136. &s5p_device_fimc2,
  1137. &s5p_device_fimc3,
  1138. &s5p_device_fimd0,
  1139. &s3c_device_hsmmc0,
  1140. &s3c_device_hsmmc2,
  1141. &s3c_device_hsmmc3,
  1142. &s3c_device_wdt,
  1143. &s3c_device_timer[0],
  1144. &s5p_device_ehci,
  1145. &s3c_device_i2c3,
  1146. &i2c9_gpio,
  1147. &s3c_device_adc,
  1148. &s5p_device_g2d,
  1149. &s5p_device_jpeg,
  1150. &s3c_device_rtc,
  1151. &s5p_device_mfc,
  1152. &s5p_device_mfc_l,
  1153. &s5p_device_mfc_r,
  1154. &s5p_device_fimc_md,
  1155. /* NURI Devices */
  1156. &nuri_gpio_keys,
  1157. &nuri_lcd_device,
  1158. &nuri_backlight_device,
  1159. &max8903_fixed_reg_dev,
  1160. &nuri_max8903_device,
  1161. &cam_vt_cam15_fixed_rdev,
  1162. &cam_vdda_fixed_rdev,
  1163. &cam_8m_12v_fixed_rdev,
  1164. &exynos4_bus_devfreq,
  1165. };
  1166. static void __init nuri_map_io(void)
  1167. {
  1168. clk_xusbxti.rate = 24000000;
  1169. exynos_init_io(NULL, 0);
  1170. s3c24xx_init_clocks(24000000);
  1171. s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
  1172. }
  1173. static void __init nuri_reserve(void)
  1174. {
  1175. s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
  1176. }
  1177. static void __init nuri_machine_init(void)
  1178. {
  1179. nuri_sdhci_init();
  1180. nuri_tsp_init();
  1181. nuri_power_init();
  1182. s3c_i2c0_set_platdata(&nuri_i2c0_platdata);
  1183. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  1184. s3c_i2c3_set_platdata(&i2c3_data);
  1185. i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
  1186. s3c_i2c5_set_platdata(NULL);
  1187. i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
  1188. i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
  1189. i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
  1190. i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
  1191. s3c_i2c6_set_platdata(&nuri_i2c6_platdata);
  1192. s5p_fimd0_set_platdata(&nuri_fb_pdata);
  1193. nuri_camera_init();
  1194. nuri_ehci_init();
  1195. /* Last */
  1196. platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
  1197. }
  1198. MACHINE_START(NURI, "NURI")
  1199. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  1200. .atag_offset = 0x100,
  1201. .init_irq = exynos4_init_irq,
  1202. .map_io = nuri_map_io,
  1203. .handle_irq = gic_handle_irq,
  1204. .init_machine = nuri_machine_init,
  1205. .timer = &exynos4_timer,
  1206. .reserve = &nuri_reserve,
  1207. .restart = exynos4_restart,
  1208. MACHINE_END