mach-nuri.c 27 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069
  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/max17042_battery.h>
  19. #include <linux/regulator/machine.h>
  20. #include <linux/regulator/fixed.h>
  21. #include <linux/mfd/max8997.h>
  22. #include <linux/mfd/max8997-private.h>
  23. #include <linux/mmc/host.h>
  24. #include <linux/fb.h>
  25. #include <linux/pwm_backlight.h>
  26. #include <video/platform_lcd.h>
  27. #include <asm/mach/arch.h>
  28. #include <asm/mach-types.h>
  29. #include <plat/adc.h>
  30. #include <plat/regs-serial.h>
  31. #include <plat/exynos4.h>
  32. #include <plat/cpu.h>
  33. #include <plat/devs.h>
  34. #include <plat/sdhci.h>
  35. #include <plat/ehci.h>
  36. #include <plat/clock.h>
  37. #include <plat/gpio-cfg.h>
  38. #include <plat/iic.h>
  39. #include <mach/map.h>
  40. /* Following are default values for UCON, ULCON and UFCON UART registers */
  41. #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  42. S3C2410_UCON_RXILEVEL | \
  43. S3C2410_UCON_TXIRQMODE | \
  44. S3C2410_UCON_RXIRQMODE | \
  45. S3C2410_UCON_RXFIFO_TOI | \
  46. S3C2443_UCON_RXERR_IRQEN)
  47. #define NURI_ULCON_DEFAULT S3C2410_LCON_CS8
  48. #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  49. S5PV210_UFCON_TXTRIG256 | \
  50. S5PV210_UFCON_RXTRIG256)
  51. enum fixed_regulator_id {
  52. FIXED_REG_ID_MMC = 0,
  53. };
  54. static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
  55. {
  56. .hwport = 0,
  57. .ucon = NURI_UCON_DEFAULT,
  58. .ulcon = NURI_ULCON_DEFAULT,
  59. .ufcon = NURI_UFCON_DEFAULT,
  60. },
  61. {
  62. .hwport = 1,
  63. .ucon = NURI_UCON_DEFAULT,
  64. .ulcon = NURI_ULCON_DEFAULT,
  65. .ufcon = NURI_UFCON_DEFAULT,
  66. },
  67. {
  68. .hwport = 2,
  69. .ucon = NURI_UCON_DEFAULT,
  70. .ulcon = NURI_ULCON_DEFAULT,
  71. .ufcon = NURI_UFCON_DEFAULT,
  72. },
  73. {
  74. .hwport = 3,
  75. .ucon = NURI_UCON_DEFAULT,
  76. .ulcon = NURI_ULCON_DEFAULT,
  77. .ufcon = NURI_UFCON_DEFAULT,
  78. },
  79. };
  80. /* eMMC */
  81. static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
  82. .max_width = 8,
  83. .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
  84. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  85. MMC_CAP_DISABLE | MMC_CAP_ERASE),
  86. .cd_type = S3C_SDHCI_CD_PERMANENT,
  87. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  88. };
  89. static struct regulator_consumer_supply emmc_supplies[] = {
  90. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  91. REGULATOR_SUPPLY("vmmc", "dw_mmc"),
  92. };
  93. static struct regulator_init_data emmc_fixed_voltage_init_data = {
  94. .constraints = {
  95. .name = "VMEM_VDD_2.8V",
  96. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  97. },
  98. .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
  99. .consumer_supplies = emmc_supplies,
  100. };
  101. static struct fixed_voltage_config emmc_fixed_voltage_config = {
  102. .supply_name = "MASSMEMORY_EN (inverted)",
  103. .microvolts = 2800000,
  104. .gpio = EXYNOS4_GPL1(1),
  105. .enable_high = false,
  106. .init_data = &emmc_fixed_voltage_init_data,
  107. };
  108. static struct platform_device emmc_fixed_voltage = {
  109. .name = "reg-fixed-voltage",
  110. .id = FIXED_REG_ID_MMC,
  111. .dev = {
  112. .platform_data = &emmc_fixed_voltage_config,
  113. },
  114. };
  115. /* SD */
  116. static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
  117. .max_width = 4,
  118. .host_caps = MMC_CAP_4_BIT_DATA |
  119. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  120. MMC_CAP_DISABLE,
  121. .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
  122. .ext_cd_gpio_invert = 1,
  123. .cd_type = S3C_SDHCI_CD_GPIO,
  124. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  125. };
  126. /* WLAN */
  127. static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
  128. .max_width = 4,
  129. .host_caps = MMC_CAP_4_BIT_DATA |
  130. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  131. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  132. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  133. };
  134. static void __init nuri_sdhci_init(void)
  135. {
  136. s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
  137. s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
  138. s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
  139. }
  140. /* GPIO KEYS */
  141. static struct gpio_keys_button nuri_gpio_keys_tables[] = {
  142. {
  143. .code = KEY_VOLUMEUP,
  144. .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
  145. .desc = "gpio-keys: KEY_VOLUMEUP",
  146. .type = EV_KEY,
  147. .active_low = 1,
  148. .debounce_interval = 1,
  149. }, {
  150. .code = KEY_VOLUMEDOWN,
  151. .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
  152. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  153. .type = EV_KEY,
  154. .active_low = 1,
  155. .debounce_interval = 1,
  156. }, {
  157. .code = KEY_POWER,
  158. .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
  159. .desc = "gpio-keys: KEY_POWER",
  160. .type = EV_KEY,
  161. .active_low = 1,
  162. .wakeup = 1,
  163. .debounce_interval = 1,
  164. },
  165. };
  166. static struct gpio_keys_platform_data nuri_gpio_keys_data = {
  167. .buttons = nuri_gpio_keys_tables,
  168. .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
  169. };
  170. static struct platform_device nuri_gpio_keys = {
  171. .name = "gpio-keys",
  172. .dev = {
  173. .platform_data = &nuri_gpio_keys_data,
  174. },
  175. };
  176. static void nuri_lcd_power_on(struct plat_lcd_data *pd, unsigned int power)
  177. {
  178. int gpio = EXYNOS4_GPE1(5);
  179. gpio_request(gpio, "LVDS_nSHDN");
  180. gpio_direction_output(gpio, power);
  181. gpio_free(gpio);
  182. }
  183. static int nuri_bl_init(struct device *dev)
  184. {
  185. int ret, gpio = EXYNOS4_GPE2(3);
  186. ret = gpio_request(gpio, "LCD_LDO_EN");
  187. if (!ret)
  188. gpio_direction_output(gpio, 0);
  189. return ret;
  190. }
  191. static int nuri_bl_notify(struct device *dev, int brightness)
  192. {
  193. if (brightness < 1)
  194. brightness = 0;
  195. gpio_set_value(EXYNOS4_GPE2(3), 1);
  196. return brightness;
  197. }
  198. static void nuri_bl_exit(struct device *dev)
  199. {
  200. gpio_free(EXYNOS4_GPE2(3));
  201. }
  202. /* nuri pwm backlight */
  203. static struct platform_pwm_backlight_data nuri_backlight_data = {
  204. .pwm_id = 0,
  205. .pwm_period_ns = 30000,
  206. .max_brightness = 100,
  207. .dft_brightness = 50,
  208. .init = nuri_bl_init,
  209. .notify = nuri_bl_notify,
  210. .exit = nuri_bl_exit,
  211. };
  212. static struct platform_device nuri_backlight_device = {
  213. .name = "pwm-backlight",
  214. .id = -1,
  215. .dev = {
  216. .parent = &s3c_device_timer[0].dev,
  217. .platform_data = &nuri_backlight_data,
  218. },
  219. };
  220. static struct plat_lcd_data nuri_lcd_platform_data = {
  221. .set_power = nuri_lcd_power_on,
  222. };
  223. static struct platform_device nuri_lcd_device = {
  224. .name = "platform-lcd",
  225. .id = -1,
  226. .dev = {
  227. .platform_data = &nuri_lcd_platform_data,
  228. },
  229. };
  230. /* I2C1 */
  231. static struct i2c_board_info i2c1_devs[] __initdata = {
  232. /* Gyro, To be updated */
  233. };
  234. /* TSP */
  235. static u8 mxt_init_vals[] = {
  236. /* MXT_GEN_COMMAND(6) */
  237. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  238. /* MXT_GEN_POWER(7) */
  239. 0x20, 0xff, 0x32,
  240. /* MXT_GEN_ACQUIRE(8) */
  241. 0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x09, 0x23,
  242. /* MXT_TOUCH_MULTI(9) */
  243. 0x00, 0x00, 0x00, 0x13, 0x0b, 0x00, 0x00, 0x00, 0x02, 0x00,
  244. 0x00, 0x01, 0x01, 0x0e, 0x0a, 0x0a, 0x0a, 0x0a, 0x00, 0x00,
  245. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  246. 0x00,
  247. /* MXT_TOUCH_KEYARRAY(15) */
  248. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
  249. 0x00,
  250. /* MXT_SPT_GPIOPWM(19) */
  251. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  252. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  253. /* MXT_PROCI_GRIPFACE(20) */
  254. 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x28, 0x04,
  255. 0x0f, 0x0a,
  256. /* MXT_PROCG_NOISE(22) */
  257. 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x23, 0x00,
  258. 0x00, 0x05, 0x0f, 0x19, 0x23, 0x2d, 0x03,
  259. /* MXT_TOUCH_PROXIMITY(23) */
  260. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  261. 0x00, 0x00, 0x00, 0x00, 0x00,
  262. /* MXT_PROCI_ONETOUCH(24) */
  263. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  264. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  265. /* MXT_SPT_SELFTEST(25) */
  266. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  267. 0x00, 0x00, 0x00, 0x00,
  268. /* MXT_PROCI_TWOTOUCH(27) */
  269. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  270. /* MXT_SPT_CTECONFIG(28) */
  271. 0x00, 0x00, 0x02, 0x08, 0x10, 0x00,
  272. };
  273. static struct mxt_platform_data mxt_platform_data = {
  274. .config = mxt_init_vals,
  275. .config_length = ARRAY_SIZE(mxt_init_vals),
  276. .x_line = 18,
  277. .y_line = 11,
  278. .x_size = 1024,
  279. .y_size = 600,
  280. .blen = 0x1,
  281. .threshold = 0x28,
  282. .voltage = 2800000, /* 2.8V */
  283. .orient = MXT_DIAGONAL_COUNTER,
  284. .irqflags = IRQF_TRIGGER_FALLING,
  285. };
  286. static struct s3c2410_platform_i2c i2c3_data __initdata = {
  287. .flags = 0,
  288. .bus_num = 3,
  289. .slave_addr = 0x10,
  290. .frequency = 400 * 1000,
  291. .sda_delay = 100,
  292. };
  293. static struct i2c_board_info i2c3_devs[] __initdata = {
  294. {
  295. I2C_BOARD_INFO("atmel_mxt_ts", 0x4a),
  296. .platform_data = &mxt_platform_data,
  297. .irq = IRQ_EINT(4),
  298. },
  299. };
  300. static void __init nuri_tsp_init(void)
  301. {
  302. int gpio;
  303. /* TOUCH_INT: XEINT_4 */
  304. gpio = EXYNOS4_GPX0(4);
  305. gpio_request(gpio, "TOUCH_INT");
  306. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  307. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
  308. }
  309. static struct regulator_consumer_supply __initdata max8997_ldo1_[] = {
  310. REGULATOR_SUPPLY("vdd", "s5p-adc"), /* Used by CPU's ADC drv */
  311. };
  312. static struct regulator_consumer_supply __initdata max8997_ldo3_[] = {
  313. REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
  314. };
  315. static struct regulator_consumer_supply __initdata max8997_ldo4_[] = {
  316. REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
  317. };
  318. static struct regulator_consumer_supply __initdata max8997_ldo5_[] = {
  319. REGULATOR_SUPPLY("vhsic", "modemctl"), /* MODEM */
  320. };
  321. static struct regulator_consumer_supply __initdata max8997_ldo7_[] = {
  322. REGULATOR_SUPPLY("dig_18", "0-001f"), /* HCD803 */
  323. };
  324. static struct regulator_consumer_supply __initdata max8997_ldo8_[] = {
  325. REGULATOR_SUPPLY("vusb_d", NULL), /* Used by CPU */
  326. REGULATOR_SUPPLY("vdac", NULL), /* Used by CPU */
  327. };
  328. static struct regulator_consumer_supply __initdata max8997_ldo11_[] = {
  329. REGULATOR_SUPPLY("vcc", "platform-lcd"), /* U804 LVDS */
  330. };
  331. static struct regulator_consumer_supply __initdata max8997_ldo12_[] = {
  332. REGULATOR_SUPPLY("vddio", "6-003c"), /* HDC802 */
  333. };
  334. static struct regulator_consumer_supply __initdata max8997_ldo13_[] = {
  335. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.2"), /* TFLASH */
  336. };
  337. static struct regulator_consumer_supply __initdata max8997_ldo14_[] = {
  338. REGULATOR_SUPPLY("inmotor", "max8997-haptic"),
  339. };
  340. static struct regulator_consumer_supply __initdata max8997_ldo15_[] = {
  341. REGULATOR_SUPPLY("avdd", "3-004a"), /* Touch Screen */
  342. };
  343. static struct regulator_consumer_supply __initdata max8997_ldo16_[] = {
  344. REGULATOR_SUPPLY("d_sensor", "0-001f"), /* HDC803 */
  345. };
  346. static struct regulator_consumer_supply __initdata max8997_ldo18_[] = {
  347. REGULATOR_SUPPLY("vdd", "3-004a"), /* Touch Screen */
  348. };
  349. static struct regulator_consumer_supply __initdata max8997_buck1_[] = {
  350. REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
  351. };
  352. static struct regulator_consumer_supply __initdata max8997_buck2_[] = {
  353. REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
  354. };
  355. static struct regulator_consumer_supply __initdata max8997_buck3_[] = {
  356. REGULATOR_SUPPLY("vdd", "mali_dev.0"), /* G3D of Exynos 4 */
  357. };
  358. static struct regulator_consumer_supply __initdata max8997_buck4_[] = {
  359. REGULATOR_SUPPLY("core", "0-001f"), /* HDC803 */
  360. };
  361. static struct regulator_consumer_supply __initdata max8997_buck6_[] = {
  362. REGULATOR_SUPPLY("dig_28", "0-001f"), /* pin "7" of HDC803 */
  363. };
  364. static struct regulator_consumer_supply __initdata max8997_esafeout1_[] = {
  365. REGULATOR_SUPPLY("usb_vbus", NULL), /* CPU's USB OTG */
  366. };
  367. static struct regulator_consumer_supply __initdata max8997_esafeout2_[] = {
  368. REGULATOR_SUPPLY("usb_vbus", "modemctl"), /* VBUS of Modem */
  369. };
  370. static struct regulator_consumer_supply __initdata max8997_charger_[] = {
  371. REGULATOR_SUPPLY("vinchg1", "charger-manager.0"),
  372. };
  373. static struct regulator_consumer_supply __initdata max8997_chg_toff_[] = {
  374. REGULATOR_SUPPLY("vinchg_stop", NULL), /* for jack interrupt handlers */
  375. };
  376. static struct regulator_consumer_supply __initdata max8997_32khz_ap_[] = {
  377. REGULATOR_SUPPLY("gps_clk", "bcm4751"),
  378. REGULATOR_SUPPLY("bt_clk", "bcm4330-b1"),
  379. REGULATOR_SUPPLY("wifi_clk", "bcm433-b1"),
  380. };
  381. static struct regulator_init_data __initdata max8997_ldo1_data = {
  382. .constraints = {
  383. .name = "VADC_3.3V_C210",
  384. .min_uV = 3300000,
  385. .max_uV = 3300000,
  386. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  387. .apply_uV = 1,
  388. .state_mem = {
  389. .disabled = 1,
  390. },
  391. },
  392. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo1_),
  393. .consumer_supplies = max8997_ldo1_,
  394. };
  395. static struct regulator_init_data __initdata max8997_ldo2_data = {
  396. .constraints = {
  397. .name = "VALIVE_1.1V_C210",
  398. .min_uV = 1100000,
  399. .max_uV = 1100000,
  400. .apply_uV = 1,
  401. .always_on = 1,
  402. .state_mem = {
  403. .enabled = 1,
  404. },
  405. },
  406. };
  407. static struct regulator_init_data __initdata max8997_ldo3_data = {
  408. .constraints = {
  409. .name = "VUSB_1.1V_C210",
  410. .min_uV = 1100000,
  411. .max_uV = 1100000,
  412. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  413. .apply_uV = 1,
  414. .state_mem = {
  415. .disabled = 1,
  416. },
  417. },
  418. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo3_),
  419. .consumer_supplies = max8997_ldo3_,
  420. };
  421. static struct regulator_init_data __initdata max8997_ldo4_data = {
  422. .constraints = {
  423. .name = "VMIPI_1.8V",
  424. .min_uV = 1800000,
  425. .max_uV = 1800000,
  426. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  427. .apply_uV = 1,
  428. .state_mem = {
  429. .disabled = 1,
  430. },
  431. },
  432. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo4_),
  433. .consumer_supplies = max8997_ldo4_,
  434. };
  435. static struct regulator_init_data __initdata max8997_ldo5_data = {
  436. .constraints = {
  437. .name = "VHSIC_1.2V_C210",
  438. .min_uV = 1200000,
  439. .max_uV = 1200000,
  440. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  441. .apply_uV = 1,
  442. .state_mem = {
  443. .disabled = 1,
  444. },
  445. },
  446. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo5_),
  447. .consumer_supplies = max8997_ldo5_,
  448. };
  449. static struct regulator_init_data __initdata max8997_ldo6_data = {
  450. .constraints = {
  451. .name = "VCC_1.8V_PDA",
  452. .min_uV = 1800000,
  453. .max_uV = 1800000,
  454. .apply_uV = 1,
  455. .always_on = 1,
  456. .state_mem = {
  457. .enabled = 1,
  458. },
  459. },
  460. };
  461. static struct regulator_init_data __initdata max8997_ldo7_data = {
  462. .constraints = {
  463. .name = "CAM_ISP_1.8V",
  464. .min_uV = 1800000,
  465. .max_uV = 1800000,
  466. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  467. .apply_uV = 1,
  468. .state_mem = {
  469. .disabled = 1,
  470. },
  471. },
  472. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo7_),
  473. .consumer_supplies = max8997_ldo7_,
  474. };
  475. static struct regulator_init_data __initdata max8997_ldo8_data = {
  476. .constraints = {
  477. .name = "VUSB/VDAC_3.3V_C210",
  478. .min_uV = 3300000,
  479. .max_uV = 3300000,
  480. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  481. .apply_uV = 1,
  482. .state_mem = {
  483. .disabled = 1,
  484. },
  485. },
  486. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo8_),
  487. .consumer_supplies = max8997_ldo8_,
  488. };
  489. static struct regulator_init_data __initdata max8997_ldo9_data = {
  490. .constraints = {
  491. .name = "VCC_2.8V_PDA",
  492. .min_uV = 2800000,
  493. .max_uV = 2800000,
  494. .apply_uV = 1,
  495. .always_on = 1,
  496. .state_mem = {
  497. .enabled = 1,
  498. },
  499. },
  500. };
  501. static struct regulator_init_data __initdata max8997_ldo10_data = {
  502. .constraints = {
  503. .name = "VPLL_1.1V_C210",
  504. .min_uV = 1100000,
  505. .max_uV = 1100000,
  506. .apply_uV = 1,
  507. .always_on = 1,
  508. .state_mem = {
  509. .disabled = 1,
  510. },
  511. },
  512. };
  513. static struct regulator_init_data __initdata max8997_ldo11_data = {
  514. .constraints = {
  515. .name = "LVDS_VDD3.3V",
  516. .min_uV = 3300000,
  517. .max_uV = 3300000,
  518. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  519. .apply_uV = 1,
  520. .boot_on = 1,
  521. .state_mem = {
  522. .disabled = 1,
  523. },
  524. },
  525. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo11_),
  526. .consumer_supplies = max8997_ldo11_,
  527. };
  528. static struct regulator_init_data __initdata max8997_ldo12_data = {
  529. .constraints = {
  530. .name = "VT_CAM_1.8V",
  531. .min_uV = 1800000,
  532. .max_uV = 1800000,
  533. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  534. .apply_uV = 1,
  535. .state_mem = {
  536. .disabled = 1,
  537. },
  538. },
  539. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo12_),
  540. .consumer_supplies = max8997_ldo12_,
  541. };
  542. static struct regulator_init_data __initdata max8997_ldo13_data = {
  543. .constraints = {
  544. .name = "VTF_2.8V",
  545. .min_uV = 2800000,
  546. .max_uV = 2800000,
  547. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  548. .apply_uV = 1,
  549. .state_mem = {
  550. .disabled = 1,
  551. },
  552. },
  553. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo13_),
  554. .consumer_supplies = max8997_ldo13_,
  555. };
  556. static struct regulator_init_data __initdata max8997_ldo14_data = {
  557. .constraints = {
  558. .name = "VCC_3.0V_MOTOR",
  559. .min_uV = 3000000,
  560. .max_uV = 3000000,
  561. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  562. .apply_uV = 1,
  563. .state_mem = {
  564. .disabled = 1,
  565. },
  566. },
  567. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo14_),
  568. .consumer_supplies = max8997_ldo14_,
  569. };
  570. static struct regulator_init_data __initdata max8997_ldo15_data = {
  571. .constraints = {
  572. .name = "VTOUCH_ADVV2.8V",
  573. .min_uV = 2800000,
  574. .max_uV = 2800000,
  575. .apply_uV = 1,
  576. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  577. .state_mem = {
  578. .disabled = 1,
  579. },
  580. },
  581. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo15_),
  582. .consumer_supplies = max8997_ldo15_,
  583. };
  584. static struct regulator_init_data __initdata max8997_ldo16_data = {
  585. .constraints = {
  586. .name = "CAM_SENSOR_IO_1.8V",
  587. .min_uV = 1800000,
  588. .max_uV = 1800000,
  589. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  590. .apply_uV = 1,
  591. .state_mem = {
  592. .disabled = 1,
  593. },
  594. },
  595. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo16_),
  596. .consumer_supplies = max8997_ldo16_,
  597. };
  598. static struct regulator_init_data __initdata max8997_ldo18_data = {
  599. .constraints = {
  600. .name = "VTOUCH_VDD2.8V",
  601. .min_uV = 2800000,
  602. .max_uV = 2800000,
  603. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  604. .apply_uV = 1,
  605. .state_mem = {
  606. .disabled = 1,
  607. },
  608. },
  609. .num_consumer_supplies = ARRAY_SIZE(max8997_ldo18_),
  610. .consumer_supplies = max8997_ldo18_,
  611. };
  612. static struct regulator_init_data __initdata max8997_ldo21_data = {
  613. .constraints = {
  614. .name = "VDDQ_M1M2_1.2V",
  615. .min_uV = 1200000,
  616. .max_uV = 1200000,
  617. .apply_uV = 1,
  618. .always_on = 1,
  619. .state_mem = {
  620. .disabled = 1,
  621. },
  622. },
  623. };
  624. static struct regulator_init_data __initdata max8997_buck1_data = {
  625. .constraints = {
  626. .name = "VARM_1.2V_C210",
  627. .min_uV = 900000,
  628. .max_uV = 1350000,
  629. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  630. .always_on = 1,
  631. .state_mem = {
  632. .disabled = 1,
  633. },
  634. },
  635. .num_consumer_supplies = ARRAY_SIZE(max8997_buck1_),
  636. .consumer_supplies = max8997_buck1_,
  637. };
  638. static struct regulator_init_data __initdata max8997_buck2_data = {
  639. .constraints = {
  640. .name = "VINT_1.1V_C210",
  641. .min_uV = 900000,
  642. .max_uV = 1100000,
  643. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  644. .always_on = 1,
  645. .state_mem = {
  646. .disabled = 1,
  647. },
  648. },
  649. .num_consumer_supplies = ARRAY_SIZE(max8997_buck2_),
  650. .consumer_supplies = max8997_buck2_,
  651. };
  652. static struct regulator_init_data __initdata max8997_buck3_data = {
  653. .constraints = {
  654. .name = "VG3D_1.1V_C210",
  655. .min_uV = 900000,
  656. .max_uV = 1100000,
  657. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  658. REGULATOR_CHANGE_STATUS,
  659. .state_mem = {
  660. .disabled = 1,
  661. },
  662. },
  663. .num_consumer_supplies = ARRAY_SIZE(max8997_buck3_),
  664. .consumer_supplies = max8997_buck3_,
  665. };
  666. static struct regulator_init_data __initdata max8997_buck4_data = {
  667. .constraints = {
  668. .name = "CAM_ISP_CORE_1.2V",
  669. .min_uV = 1200000,
  670. .max_uV = 1200000,
  671. .apply_uV = 1,
  672. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  673. .state_mem = {
  674. .disabled = 1,
  675. },
  676. },
  677. .num_consumer_supplies = ARRAY_SIZE(max8997_buck4_),
  678. .consumer_supplies = max8997_buck4_,
  679. };
  680. static struct regulator_init_data __initdata max8997_buck5_data = {
  681. .constraints = {
  682. .name = "VMEM_1.2V_C210",
  683. .min_uV = 1200000,
  684. .max_uV = 1200000,
  685. .apply_uV = 1,
  686. .always_on = 1,
  687. .state_mem = {
  688. .enabled = 1,
  689. },
  690. },
  691. };
  692. static struct regulator_init_data __initdata max8997_buck6_data = {
  693. .constraints = {
  694. .name = "CAM_AF_2.8V",
  695. .min_uV = 2800000,
  696. .max_uV = 2800000,
  697. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  698. .state_mem = {
  699. .disabled = 1,
  700. },
  701. },
  702. .num_consumer_supplies = ARRAY_SIZE(max8997_buck6_),
  703. .consumer_supplies = max8997_buck6_,
  704. };
  705. static struct regulator_init_data __initdata max8997_buck7_data = {
  706. .constraints = {
  707. .name = "VCC_SUB_2.0V",
  708. .min_uV = 2000000,
  709. .max_uV = 2000000,
  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_32khz_ap_data = {
  718. .constraints = {
  719. .name = "32KHz AP",
  720. .always_on = 1,
  721. .state_mem = {
  722. .enabled = 1,
  723. },
  724. },
  725. .num_consumer_supplies = ARRAY_SIZE(max8997_32khz_ap_),
  726. .consumer_supplies = max8997_32khz_ap_,
  727. };
  728. static struct regulator_init_data __initdata max8997_32khz_cp_data = {
  729. .constraints = {
  730. .name = "32KHz CP",
  731. .state_mem = {
  732. .disabled = 1,
  733. },
  734. },
  735. };
  736. static struct regulator_init_data __initdata max8997_vichg_data = {
  737. .constraints = {
  738. .name = "VICHG",
  739. .state_mem = {
  740. .disabled = 1,
  741. },
  742. },
  743. };
  744. static struct regulator_init_data __initdata max8997_esafeout1_data = {
  745. .constraints = {
  746. .name = "SAFEOUT1",
  747. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  748. .state_mem = {
  749. .disabled = 1,
  750. },
  751. },
  752. .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout1_),
  753. .consumer_supplies = max8997_esafeout1_,
  754. };
  755. static struct regulator_init_data __initdata max8997_esafeout2_data = {
  756. .constraints = {
  757. .name = "SAFEOUT2",
  758. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  759. .state_mem = {
  760. .disabled = 1,
  761. },
  762. },
  763. .num_consumer_supplies = ARRAY_SIZE(max8997_esafeout2_),
  764. .consumer_supplies = max8997_esafeout2_,
  765. };
  766. static struct regulator_init_data __initdata max8997_charger_cv_data = {
  767. .constraints = {
  768. .name = "CHARGER_CV",
  769. .min_uV = 4200000,
  770. .max_uV = 4200000,
  771. .apply_uV = 1,
  772. },
  773. };
  774. static struct regulator_init_data __initdata max8997_charger_data = {
  775. .constraints = {
  776. .name = "CHARGER",
  777. .min_uA = 200000,
  778. .max_uA = 950000,
  779. .boot_on = 1,
  780. .valid_ops_mask = REGULATOR_CHANGE_STATUS |
  781. REGULATOR_CHANGE_CURRENT,
  782. },
  783. .num_consumer_supplies = ARRAY_SIZE(max8997_charger_),
  784. .consumer_supplies = max8997_charger_,
  785. };
  786. static struct regulator_init_data __initdata max8997_charger_topoff_data = {
  787. .constraints = {
  788. .name = "CHARGER TOPOFF",
  789. .min_uA = 50000,
  790. .max_uA = 200000,
  791. .valid_ops_mask = REGULATOR_CHANGE_CURRENT,
  792. },
  793. .num_consumer_supplies = ARRAY_SIZE(max8997_chg_toff_),
  794. .consumer_supplies = max8997_chg_toff_,
  795. };
  796. static struct max8997_regulator_data __initdata nuri_max8997_regulators[] = {
  797. { MAX8997_LDO1, &max8997_ldo1_data },
  798. { MAX8997_LDO2, &max8997_ldo2_data },
  799. { MAX8997_LDO3, &max8997_ldo3_data },
  800. { MAX8997_LDO4, &max8997_ldo4_data },
  801. { MAX8997_LDO5, &max8997_ldo5_data },
  802. { MAX8997_LDO6, &max8997_ldo6_data },
  803. { MAX8997_LDO7, &max8997_ldo7_data },
  804. { MAX8997_LDO8, &max8997_ldo8_data },
  805. { MAX8997_LDO9, &max8997_ldo9_data },
  806. { MAX8997_LDO10, &max8997_ldo10_data },
  807. { MAX8997_LDO11, &max8997_ldo11_data },
  808. { MAX8997_LDO12, &max8997_ldo12_data },
  809. { MAX8997_LDO13, &max8997_ldo13_data },
  810. { MAX8997_LDO14, &max8997_ldo14_data },
  811. { MAX8997_LDO15, &max8997_ldo15_data },
  812. { MAX8997_LDO16, &max8997_ldo16_data },
  813. { MAX8997_LDO18, &max8997_ldo18_data },
  814. { MAX8997_LDO21, &max8997_ldo21_data },
  815. { MAX8997_BUCK1, &max8997_buck1_data },
  816. { MAX8997_BUCK2, &max8997_buck2_data },
  817. { MAX8997_BUCK3, &max8997_buck3_data },
  818. { MAX8997_BUCK4, &max8997_buck4_data },
  819. { MAX8997_BUCK5, &max8997_buck5_data },
  820. { MAX8997_BUCK6, &max8997_buck6_data },
  821. { MAX8997_BUCK7, &max8997_buck7_data },
  822. { MAX8997_EN32KHZ_AP, &max8997_32khz_ap_data },
  823. { MAX8997_EN32KHZ_CP, &max8997_32khz_cp_data },
  824. { MAX8997_ENVICHG, &max8997_vichg_data },
  825. { MAX8997_ESAFEOUT1, &max8997_esafeout1_data },
  826. { MAX8997_ESAFEOUT2, &max8997_esafeout2_data },
  827. { MAX8997_CHARGER_CV, &max8997_charger_cv_data },
  828. { MAX8997_CHARGER, &max8997_charger_data },
  829. { MAX8997_CHARGER_TOPOFF, &max8997_charger_topoff_data },
  830. };
  831. static struct max8997_platform_data __initdata nuri_max8997_pdata = {
  832. .wakeup = 1,
  833. .num_regulators = ARRAY_SIZE(nuri_max8997_regulators),
  834. .regulators = nuri_max8997_regulators,
  835. .buck125_gpios = { EXYNOS4_GPX0(5), EXYNOS4_GPX0(6), EXYNOS4_GPL0(0) },
  836. .buck2_gpiodvs = true,
  837. .buck1_voltage[0] = 1350000, /* 1.35V */
  838. .buck1_voltage[1] = 1300000, /* 1.3V */
  839. .buck1_voltage[2] = 1250000, /* 1.25V */
  840. .buck1_voltage[3] = 1200000, /* 1.2V */
  841. .buck1_voltage[4] = 1150000, /* 1.15V */
  842. .buck1_voltage[5] = 1100000, /* 1.1V */
  843. .buck1_voltage[6] = 1000000, /* 1.0V */
  844. .buck1_voltage[7] = 950000, /* 0.95V */
  845. .buck2_voltage[0] = 1100000, /* 1.1V */
  846. .buck2_voltage[1] = 1000000, /* 1.0V */
  847. .buck2_voltage[2] = 950000, /* 0.95V */
  848. .buck2_voltage[3] = 900000, /* 0.9V */
  849. .buck2_voltage[4] = 1100000, /* 1.1V */
  850. .buck2_voltage[5] = 1000000, /* 1.0V */
  851. .buck2_voltage[6] = 950000, /* 0.95V */
  852. .buck2_voltage[7] = 900000, /* 0.9V */
  853. .buck5_voltage[0] = 1200000, /* 1.2V */
  854. .buck5_voltage[1] = 1200000, /* 1.2V */
  855. .buck5_voltage[2] = 1200000, /* 1.2V */
  856. .buck5_voltage[3] = 1200000, /* 1.2V */
  857. .buck5_voltage[4] = 1200000, /* 1.2V */
  858. .buck5_voltage[5] = 1200000, /* 1.2V */
  859. .buck5_voltage[6] = 1200000, /* 1.2V */
  860. .buck5_voltage[7] = 1200000, /* 1.2V */
  861. };
  862. /* GPIO I2C 5 (PMIC) */
  863. enum { I2C5_MAX8997 };
  864. static struct i2c_board_info i2c5_devs[] __initdata = {
  865. [I2C5_MAX8997] = {
  866. I2C_BOARD_INFO("max8997", 0xCC >> 1),
  867. .platform_data = &nuri_max8997_pdata,
  868. },
  869. };
  870. static struct max17042_platform_data nuri_battery_platform_data = {
  871. };
  872. /* GPIO I2C 9 (Fuel Gauge) */
  873. static struct i2c_gpio_platform_data i2c9_gpio_data = {
  874. .sda_pin = EXYNOS4_GPY4(0), /* XM0ADDR_8 */
  875. .scl_pin = EXYNOS4_GPY4(1), /* XM0ADDR_9 */
  876. };
  877. static struct platform_device i2c9_gpio = {
  878. .name = "i2c-gpio",
  879. .id = 9,
  880. .dev = {
  881. .platform_data = &i2c9_gpio_data,
  882. },
  883. };
  884. enum { I2C9_MAX17042};
  885. static struct i2c_board_info i2c9_devs[] __initdata = {
  886. [I2C9_MAX17042] = {
  887. I2C_BOARD_INFO("max17042", 0x36),
  888. .platform_data = &nuri_battery_platform_data,
  889. },
  890. };
  891. static void __init nuri_power_init(void)
  892. {
  893. int gpio;
  894. int irq_base = IRQ_GPIO_END + 1;
  895. nuri_max8997_pdata.irq_base = irq_base;
  896. irq_base += MAX8997_IRQ_NR;
  897. gpio = EXYNOS4_GPX0(7);
  898. gpio_request(gpio, "AP_PMIC_IRQ");
  899. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  900. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  901. gpio = EXYNOS4_GPX2(3);
  902. gpio_request(gpio, "FUEL_ALERT");
  903. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  904. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
  905. }
  906. /* USB EHCI */
  907. static struct s5p_ehci_platdata nuri_ehci_pdata;
  908. static void __init nuri_ehci_init(void)
  909. {
  910. struct s5p_ehci_platdata *pdata = &nuri_ehci_pdata;
  911. s5p_ehci_set_platdata(pdata);
  912. }
  913. static struct platform_device *nuri_devices[] __initdata = {
  914. /* Samsung Platform Devices */
  915. &s3c_device_i2c5, /* PMIC should initialize first */
  916. &emmc_fixed_voltage,
  917. &s3c_device_hsmmc0,
  918. &s3c_device_hsmmc2,
  919. &s3c_device_hsmmc3,
  920. &s3c_device_wdt,
  921. &s3c_device_timer[0],
  922. &s5p_device_ehci,
  923. &s3c_device_i2c3,
  924. &i2c9_gpio,
  925. &s3c_device_adc,
  926. /* NURI Devices */
  927. &nuri_gpio_keys,
  928. &nuri_lcd_device,
  929. &nuri_backlight_device,
  930. };
  931. static void __init nuri_map_io(void)
  932. {
  933. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  934. s3c24xx_init_clocks(24000000);
  935. s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
  936. }
  937. static void __init nuri_machine_init(void)
  938. {
  939. nuri_sdhci_init();
  940. nuri_tsp_init();
  941. nuri_power_init();
  942. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  943. s3c_i2c3_set_platdata(&i2c3_data);
  944. i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
  945. s3c_i2c5_set_platdata(NULL);
  946. i2c5_devs[I2C5_MAX8997].irq = gpio_to_irq(EXYNOS4_GPX0(7));
  947. i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
  948. i2c9_devs[I2C9_MAX17042].irq = gpio_to_irq(EXYNOS4_GPX2(3));
  949. i2c_register_board_info(9, i2c9_devs, ARRAY_SIZE(i2c9_devs));
  950. nuri_ehci_init();
  951. clk_xusbxti.rate = 24000000;
  952. /* Last */
  953. platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
  954. }
  955. MACHINE_START(NURI, "NURI")
  956. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  957. .boot_params = S5P_PA_SDRAM + 0x100,
  958. .init_irq = exynos4_init_irq,
  959. .map_io = nuri_map_io,
  960. .init_machine = nuri_machine_init,
  961. .timer = &exynos4_timer,
  962. MACHINE_END