mach-nuri.c 35 KB

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