mach-nuri.c 35 KB

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