mach-nuri.c 34 KB

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