mach-nuri.c 26 KB

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