mach-nuri.c 36 KB

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