mach-nuri.c 35 KB

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