mach-nuri.c 35 KB

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