mach-nuri.c 35 KB

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