mach-nuri.c 36 KB

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