mach-universal_c210.c 26 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060
  1. /* linux/arch/arm/mach-exynos4/mach-universal_c210.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. */
  9. #include <linux/platform_device.h>
  10. #include <linux/serial_core.h>
  11. #include <linux/input.h>
  12. #include <linux/i2c.h>
  13. #include <linux/gpio_keys.h>
  14. #include <linux/gpio.h>
  15. #include <linux/fb.h>
  16. #include <linux/mfd/max8998.h>
  17. #include <linux/regulator/machine.h>
  18. #include <linux/regulator/fixed.h>
  19. #include <linux/regulator/max8952.h>
  20. #include <linux/mmc/host.h>
  21. #include <linux/i2c-gpio.h>
  22. #include <linux/i2c/mcs.h>
  23. #include <linux/i2c/atmel_mxt_ts.h>
  24. #include <asm/mach/arch.h>
  25. #include <asm/mach-types.h>
  26. #include <plat/regs-serial.h>
  27. #include <plat/exynos4.h>
  28. #include <plat/cpu.h>
  29. #include <plat/devs.h>
  30. #include <plat/iic.h>
  31. #include <plat/gpio-cfg.h>
  32. #include <plat/fb.h>
  33. #include <plat/mfc.h>
  34. #include <plat/sdhci.h>
  35. #include <plat/pd.h>
  36. #include <plat/regs-fb-v4.h>
  37. #include <plat/fimc-core.h>
  38. #include <plat/camport.h>
  39. #include <plat/mipi_csis.h>
  40. #include <mach/map.h>
  41. #include <media/v4l2-mediabus.h>
  42. #include <media/s5p_fimc.h>
  43. #include <media/m5mols.h>
  44. /* Following are default values for UCON, ULCON and UFCON UART registers */
  45. #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  46. S3C2410_UCON_RXILEVEL | \
  47. S3C2410_UCON_TXIRQMODE | \
  48. S3C2410_UCON_RXIRQMODE | \
  49. S3C2410_UCON_RXFIFO_TOI | \
  50. S3C2443_UCON_RXERR_IRQEN)
  51. #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
  52. #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  53. S5PV210_UFCON_TXTRIG256 | \
  54. S5PV210_UFCON_RXTRIG256)
  55. static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
  56. [0] = {
  57. .hwport = 0,
  58. .ucon = UNIVERSAL_UCON_DEFAULT,
  59. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  60. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  61. },
  62. [1] = {
  63. .hwport = 1,
  64. .ucon = UNIVERSAL_UCON_DEFAULT,
  65. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  66. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  67. },
  68. [2] = {
  69. .hwport = 2,
  70. .ucon = UNIVERSAL_UCON_DEFAULT,
  71. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  72. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  73. },
  74. [3] = {
  75. .hwport = 3,
  76. .ucon = UNIVERSAL_UCON_DEFAULT,
  77. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  78. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  79. },
  80. };
  81. static struct regulator_consumer_supply max8952_consumer =
  82. REGULATOR_SUPPLY("vdd_arm", NULL);
  83. static struct max8952_platform_data universal_max8952_pdata __initdata = {
  84. .gpio_vid0 = EXYNOS4_GPX0(3),
  85. .gpio_vid1 = EXYNOS4_GPX0(4),
  86. .gpio_en = -1, /* Not controllable, set "Always High" */
  87. .default_mode = 0, /* vid0 = 0, vid1 = 0 */
  88. .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
  89. .sync_freq = 0, /* default: fastest */
  90. .ramp_speed = 0, /* default: fastest */
  91. .reg_data = {
  92. .constraints = {
  93. .name = "VARM_1.2V",
  94. .min_uV = 770000,
  95. .max_uV = 1400000,
  96. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  97. .always_on = 1,
  98. .boot_on = 1,
  99. },
  100. .num_consumer_supplies = 1,
  101. .consumer_supplies = &max8952_consumer,
  102. },
  103. };
  104. static struct regulator_consumer_supply lp3974_buck1_consumer =
  105. REGULATOR_SUPPLY("vdd_int", NULL);
  106. static struct regulator_consumer_supply lp3974_buck2_consumer =
  107. REGULATOR_SUPPLY("vddg3d", NULL);
  108. static struct regulator_consumer_supply lp3974_buck3_consumer =
  109. REGULATOR_SUPPLY("vdet", "s5p-sdo");
  110. static struct regulator_init_data lp3974_buck1_data = {
  111. .constraints = {
  112. .name = "VINT_1.1V",
  113. .min_uV = 750000,
  114. .max_uV = 1500000,
  115. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  116. REGULATOR_CHANGE_STATUS,
  117. .boot_on = 1,
  118. .state_mem = {
  119. .disabled = 1,
  120. },
  121. },
  122. .num_consumer_supplies = 1,
  123. .consumer_supplies = &lp3974_buck1_consumer,
  124. };
  125. static struct regulator_init_data lp3974_buck2_data = {
  126. .constraints = {
  127. .name = "VG3D_1.1V",
  128. .min_uV = 750000,
  129. .max_uV = 1500000,
  130. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  131. REGULATOR_CHANGE_STATUS,
  132. .boot_on = 1,
  133. .state_mem = {
  134. .disabled = 1,
  135. },
  136. },
  137. .num_consumer_supplies = 1,
  138. .consumer_supplies = &lp3974_buck2_consumer,
  139. };
  140. static struct regulator_init_data lp3974_buck3_data = {
  141. .constraints = {
  142. .name = "VCC_1.8V",
  143. .min_uV = 1800000,
  144. .max_uV = 1800000,
  145. .apply_uV = 1,
  146. .always_on = 1,
  147. .state_mem = {
  148. .enabled = 1,
  149. },
  150. },
  151. .num_consumer_supplies = 1,
  152. .consumer_supplies = &lp3974_buck3_consumer,
  153. };
  154. static struct regulator_init_data lp3974_buck4_data = {
  155. .constraints = {
  156. .name = "VMEM_1.2V",
  157. .min_uV = 1200000,
  158. .max_uV = 1200000,
  159. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  160. .apply_uV = 1,
  161. .state_mem = {
  162. .disabled = 1,
  163. },
  164. },
  165. };
  166. static struct regulator_init_data lp3974_ldo2_data = {
  167. .constraints = {
  168. .name = "VALIVE_1.2V",
  169. .min_uV = 1200000,
  170. .max_uV = 1200000,
  171. .apply_uV = 1,
  172. .always_on = 1,
  173. .state_mem = {
  174. .enabled = 1,
  175. },
  176. },
  177. };
  178. static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
  179. REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
  180. REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
  181. REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"),
  182. };
  183. static struct regulator_init_data lp3974_ldo3_data = {
  184. .constraints = {
  185. .name = "VUSB+MIPI_1.1V",
  186. .min_uV = 1100000,
  187. .max_uV = 1100000,
  188. .apply_uV = 1,
  189. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  190. .state_mem = {
  191. .disabled = 1,
  192. },
  193. },
  194. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
  195. .consumer_supplies = lp3974_ldo3_consumer,
  196. };
  197. static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
  198. REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"),
  199. };
  200. static struct regulator_init_data lp3974_ldo4_data = {
  201. .constraints = {
  202. .name = "VADC_3.3V",
  203. .min_uV = 3300000,
  204. .max_uV = 3300000,
  205. .apply_uV = 1,
  206. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  207. .state_mem = {
  208. .disabled = 1,
  209. },
  210. },
  211. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
  212. .consumer_supplies = lp3974_ldo4_consumer,
  213. };
  214. static struct regulator_init_data lp3974_ldo5_data = {
  215. .constraints = {
  216. .name = "VTF_2.8V",
  217. .min_uV = 2800000,
  218. .max_uV = 2800000,
  219. .apply_uV = 1,
  220. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  221. .state_mem = {
  222. .disabled = 1,
  223. },
  224. },
  225. };
  226. static struct regulator_init_data lp3974_ldo6_data = {
  227. .constraints = {
  228. .name = "LDO6",
  229. .min_uV = 2000000,
  230. .max_uV = 2000000,
  231. .apply_uV = 1,
  232. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  233. .state_mem = {
  234. .disabled = 1,
  235. },
  236. },
  237. };
  238. static struct regulator_consumer_supply lp3974_ldo7_consumer[] = {
  239. REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"),
  240. };
  241. static struct regulator_init_data lp3974_ldo7_data = {
  242. .constraints = {
  243. .name = "VLCD+VMIPI_1.8V",
  244. .min_uV = 1800000,
  245. .max_uV = 1800000,
  246. .apply_uV = 1,
  247. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  248. .state_mem = {
  249. .disabled = 1,
  250. },
  251. },
  252. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo7_consumer),
  253. .consumer_supplies = lp3974_ldo7_consumer,
  254. };
  255. static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
  256. REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
  257. };
  258. static struct regulator_init_data lp3974_ldo8_data = {
  259. .constraints = {
  260. .name = "VUSB+VDAC_3.3V",
  261. .min_uV = 3300000,
  262. .max_uV = 3300000,
  263. .apply_uV = 1,
  264. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  265. .state_mem = {
  266. .disabled = 1,
  267. },
  268. },
  269. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
  270. .consumer_supplies = lp3974_ldo8_consumer,
  271. };
  272. static struct regulator_init_data lp3974_ldo9_data = {
  273. .constraints = {
  274. .name = "VCC_2.8V",
  275. .min_uV = 2800000,
  276. .max_uV = 2800000,
  277. .apply_uV = 1,
  278. .always_on = 1,
  279. .state_mem = {
  280. .enabled = 1,
  281. },
  282. },
  283. };
  284. static struct regulator_init_data lp3974_ldo10_data = {
  285. .constraints = {
  286. .name = "VPLL_1.1V",
  287. .min_uV = 1100000,
  288. .max_uV = 1100000,
  289. .boot_on = 1,
  290. .apply_uV = 1,
  291. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  292. .state_mem = {
  293. .disabled = 1,
  294. },
  295. },
  296. };
  297. static struct regulator_consumer_supply lp3974_ldo11_consumer =
  298. REGULATOR_SUPPLY("dig_28", "0-001f");
  299. static struct regulator_init_data lp3974_ldo11_data = {
  300. .constraints = {
  301. .name = "CAM_AF_3.3V",
  302. .min_uV = 3300000,
  303. .max_uV = 3300000,
  304. .apply_uV = 1,
  305. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  306. .state_mem = {
  307. .disabled = 1,
  308. },
  309. },
  310. .num_consumer_supplies = 1,
  311. .consumer_supplies = &lp3974_ldo11_consumer,
  312. };
  313. static struct regulator_init_data lp3974_ldo12_data = {
  314. .constraints = {
  315. .name = "PS_2.8V",
  316. .min_uV = 2800000,
  317. .max_uV = 2800000,
  318. .apply_uV = 1,
  319. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  320. .state_mem = {
  321. .disabled = 1,
  322. },
  323. },
  324. };
  325. static struct regulator_init_data lp3974_ldo13_data = {
  326. .constraints = {
  327. .name = "VHIC_1.2V",
  328. .min_uV = 1200000,
  329. .max_uV = 1200000,
  330. .apply_uV = 1,
  331. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  332. .state_mem = {
  333. .disabled = 1,
  334. },
  335. },
  336. };
  337. static struct regulator_consumer_supply lp3974_ldo14_consumer =
  338. REGULATOR_SUPPLY("dig_18", "0-001f");
  339. static struct regulator_init_data lp3974_ldo14_data = {
  340. .constraints = {
  341. .name = "CAM_I_HOST_1.8V",
  342. .min_uV = 1800000,
  343. .max_uV = 1800000,
  344. .apply_uV = 1,
  345. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  346. .state_mem = {
  347. .disabled = 1,
  348. },
  349. },
  350. .num_consumer_supplies = 1,
  351. .consumer_supplies = &lp3974_ldo14_consumer,
  352. };
  353. static struct regulator_consumer_supply lp3974_ldo15_consumer =
  354. REGULATOR_SUPPLY("dig_12", "0-001f");
  355. static struct regulator_init_data lp3974_ldo15_data = {
  356. .constraints = {
  357. .name = "CAM_S_DIG+FM33_CORE_1.2V",
  358. .min_uV = 1200000,
  359. .max_uV = 1200000,
  360. .apply_uV = 1,
  361. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  362. .state_mem = {
  363. .disabled = 1,
  364. },
  365. },
  366. .num_consumer_supplies = 1,
  367. .consumer_supplies = &lp3974_ldo15_consumer,
  368. };
  369. static struct regulator_consumer_supply lp3974_ldo16_consumer[] = {
  370. REGULATOR_SUPPLY("a_sensor", "0-001f"),
  371. };
  372. static struct regulator_init_data lp3974_ldo16_data = {
  373. .constraints = {
  374. .name = "CAM_S_ANA_2.8V",
  375. .min_uV = 2800000,
  376. .max_uV = 2800000,
  377. .apply_uV = 1,
  378. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  379. .state_mem = {
  380. .disabled = 1,
  381. },
  382. },
  383. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo16_consumer),
  384. .consumer_supplies = lp3974_ldo16_consumer,
  385. };
  386. static struct regulator_init_data lp3974_ldo17_data = {
  387. .constraints = {
  388. .name = "VCC_3.0V_LCD",
  389. .min_uV = 3000000,
  390. .max_uV = 3000000,
  391. .apply_uV = 1,
  392. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  393. .boot_on = 1,
  394. .state_mem = {
  395. .disabled = 1,
  396. },
  397. },
  398. };
  399. static struct regulator_init_data lp3974_32khz_ap_data = {
  400. .constraints = {
  401. .name = "32KHz AP",
  402. .always_on = 1,
  403. .state_mem = {
  404. .enabled = 1,
  405. },
  406. },
  407. };
  408. static struct regulator_init_data lp3974_32khz_cp_data = {
  409. .constraints = {
  410. .name = "32KHz CP",
  411. .state_mem = {
  412. .disabled = 1,
  413. },
  414. },
  415. };
  416. static struct regulator_init_data lp3974_vichg_data = {
  417. .constraints = {
  418. .name = "VICHG",
  419. .state_mem = {
  420. .disabled = 1,
  421. },
  422. },
  423. };
  424. static struct regulator_init_data lp3974_esafeout1_data = {
  425. .constraints = {
  426. .name = "SAFEOUT1",
  427. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  428. .state_mem = {
  429. .enabled = 1,
  430. },
  431. },
  432. };
  433. static struct regulator_init_data lp3974_esafeout2_data = {
  434. .constraints = {
  435. .name = "SAFEOUT2",
  436. .boot_on = 1,
  437. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  438. .state_mem = {
  439. .enabled = 1,
  440. },
  441. },
  442. };
  443. static struct max8998_regulator_data lp3974_regulators[] = {
  444. { MAX8998_LDO2, &lp3974_ldo2_data },
  445. { MAX8998_LDO3, &lp3974_ldo3_data },
  446. { MAX8998_LDO4, &lp3974_ldo4_data },
  447. { MAX8998_LDO5, &lp3974_ldo5_data },
  448. { MAX8998_LDO6, &lp3974_ldo6_data },
  449. { MAX8998_LDO7, &lp3974_ldo7_data },
  450. { MAX8998_LDO8, &lp3974_ldo8_data },
  451. { MAX8998_LDO9, &lp3974_ldo9_data },
  452. { MAX8998_LDO10, &lp3974_ldo10_data },
  453. { MAX8998_LDO11, &lp3974_ldo11_data },
  454. { MAX8998_LDO12, &lp3974_ldo12_data },
  455. { MAX8998_LDO13, &lp3974_ldo13_data },
  456. { MAX8998_LDO14, &lp3974_ldo14_data },
  457. { MAX8998_LDO15, &lp3974_ldo15_data },
  458. { MAX8998_LDO16, &lp3974_ldo16_data },
  459. { MAX8998_LDO17, &lp3974_ldo17_data },
  460. { MAX8998_BUCK1, &lp3974_buck1_data },
  461. { MAX8998_BUCK2, &lp3974_buck2_data },
  462. { MAX8998_BUCK3, &lp3974_buck3_data },
  463. { MAX8998_BUCK4, &lp3974_buck4_data },
  464. { MAX8998_EN32KHZ_AP, &lp3974_32khz_ap_data },
  465. { MAX8998_EN32KHZ_CP, &lp3974_32khz_cp_data },
  466. { MAX8998_ENVICHG, &lp3974_vichg_data },
  467. { MAX8998_ESAFEOUT1, &lp3974_esafeout1_data },
  468. { MAX8998_ESAFEOUT2, &lp3974_esafeout2_data },
  469. };
  470. static struct max8998_platform_data universal_lp3974_pdata = {
  471. .num_regulators = ARRAY_SIZE(lp3974_regulators),
  472. .regulators = lp3974_regulators,
  473. .buck1_voltage1 = 1100000, /* INT */
  474. .buck1_voltage2 = 1000000,
  475. .buck1_voltage3 = 1100000,
  476. .buck1_voltage4 = 1000000,
  477. .buck1_set1 = EXYNOS4_GPX0(5),
  478. .buck1_set2 = EXYNOS4_GPX0(6),
  479. .buck2_voltage1 = 1200000, /* G3D */
  480. .buck2_voltage2 = 1100000,
  481. .buck1_default_idx = 0,
  482. .buck2_set3 = EXYNOS4_GPE2(0),
  483. .buck2_default_idx = 0,
  484. .wakeup = true,
  485. };
  486. enum fixed_regulator_id {
  487. FIXED_REG_ID_MMC0,
  488. FIXED_REG_ID_HDMI_5V,
  489. FIXED_REG_ID_CAM_S_IF,
  490. FIXED_REG_ID_CAM_I_CORE,
  491. FIXED_REG_ID_CAM_VT_DIO,
  492. };
  493. static struct regulator_consumer_supply hdmi_fixed_consumer =
  494. REGULATOR_SUPPLY("hdmi-en", "exynos4-hdmi");
  495. static struct regulator_init_data hdmi_fixed_voltage_init_data = {
  496. .constraints = {
  497. .name = "HDMI_5V",
  498. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  499. },
  500. .num_consumer_supplies = 1,
  501. .consumer_supplies = &hdmi_fixed_consumer,
  502. };
  503. static struct fixed_voltage_config hdmi_fixed_voltage_config = {
  504. .supply_name = "HDMI_EN1",
  505. .microvolts = 5000000,
  506. .gpio = EXYNOS4_GPE0(1),
  507. .enable_high = true,
  508. .init_data = &hdmi_fixed_voltage_init_data,
  509. };
  510. static struct platform_device hdmi_fixed_voltage = {
  511. .name = "reg-fixed-voltage",
  512. .id = FIXED_REG_ID_HDMI_5V,
  513. .dev = {
  514. .platform_data = &hdmi_fixed_voltage_config,
  515. },
  516. };
  517. /* GPIO I2C 5 (PMIC) */
  518. static struct i2c_board_info i2c5_devs[] __initdata = {
  519. {
  520. I2C_BOARD_INFO("max8952", 0xC0 >> 1),
  521. .platform_data = &universal_max8952_pdata,
  522. }, {
  523. I2C_BOARD_INFO("lp3974", 0xCC >> 1),
  524. .platform_data = &universal_lp3974_pdata,
  525. },
  526. };
  527. /* I2C3 (TSP) */
  528. static struct mxt_platform_data qt602240_platform_data = {
  529. .x_line = 19,
  530. .y_line = 11,
  531. .x_size = 800,
  532. .y_size = 480,
  533. .blen = 0x11,
  534. .threshold = 0x28,
  535. .voltage = 2800000, /* 2.8V */
  536. .orient = MXT_DIAGONAL,
  537. };
  538. static struct i2c_board_info i2c3_devs[] __initdata = {
  539. {
  540. I2C_BOARD_INFO("qt602240_ts", 0x4a),
  541. .platform_data = &qt602240_platform_data,
  542. },
  543. };
  544. static void __init universal_tsp_init(void)
  545. {
  546. int gpio;
  547. /* TSP_LDO_ON: XMDMADDR_11 */
  548. gpio = EXYNOS4_GPE2(3);
  549. gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
  550. gpio_export(gpio, 0);
  551. /* TSP_INT: XMDMADDR_7 */
  552. gpio = EXYNOS4_GPE1(7);
  553. gpio_request(gpio, "TSP_INT");
  554. s5p_register_gpio_interrupt(gpio);
  555. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  556. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
  557. i2c3_devs[0].irq = gpio_to_irq(gpio);
  558. }
  559. /* GPIO I2C 12 (3 Touchkey) */
  560. static uint32_t touchkey_keymap[] = {
  561. /* MCS_KEY_MAP(value, keycode) */
  562. MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */
  563. MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */
  564. };
  565. static struct mcs_platform_data touchkey_data = {
  566. .keymap = touchkey_keymap,
  567. .keymap_size = ARRAY_SIZE(touchkey_keymap),
  568. .key_maxval = 2,
  569. };
  570. /* GPIO I2C 3_TOUCH 2.8V */
  571. #define I2C_GPIO_BUS_12 12
  572. static struct i2c_gpio_platform_data i2c_gpio12_data = {
  573. .sda_pin = EXYNOS4_GPE4(0), /* XMDMDATA_8 */
  574. .scl_pin = EXYNOS4_GPE4(1), /* XMDMDATA_9 */
  575. };
  576. static struct platform_device i2c_gpio12 = {
  577. .name = "i2c-gpio",
  578. .id = I2C_GPIO_BUS_12,
  579. .dev = {
  580. .platform_data = &i2c_gpio12_data,
  581. },
  582. };
  583. static struct i2c_board_info i2c_gpio12_devs[] __initdata = {
  584. {
  585. I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
  586. .platform_data = &touchkey_data,
  587. },
  588. };
  589. static void __init universal_touchkey_init(void)
  590. {
  591. int gpio;
  592. gpio = EXYNOS4_GPE3(7); /* XMDMDATA_7 */
  593. gpio_request(gpio, "3_TOUCH_INT");
  594. s5p_register_gpio_interrupt(gpio);
  595. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  596. i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
  597. gpio = EXYNOS4_GPE3(3); /* XMDMDATA_3 */
  598. gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "3_TOUCH_EN");
  599. }
  600. static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
  601. .frequency = 300 * 1000,
  602. .sda_delay = 200,
  603. };
  604. /* GPIO KEYS */
  605. static struct gpio_keys_button universal_gpio_keys_tables[] = {
  606. {
  607. .code = KEY_VOLUMEUP,
  608. .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
  609. .desc = "gpio-keys: KEY_VOLUMEUP",
  610. .type = EV_KEY,
  611. .active_low = 1,
  612. .debounce_interval = 1,
  613. }, {
  614. .code = KEY_VOLUMEDOWN,
  615. .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
  616. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  617. .type = EV_KEY,
  618. .active_low = 1,
  619. .debounce_interval = 1,
  620. }, {
  621. .code = KEY_CONFIG,
  622. .gpio = EXYNOS4_GPX2(2), /* XEINT18 */
  623. .desc = "gpio-keys: KEY_CONFIG",
  624. .type = EV_KEY,
  625. .active_low = 1,
  626. .debounce_interval = 1,
  627. }, {
  628. .code = KEY_CAMERA,
  629. .gpio = EXYNOS4_GPX2(3), /* XEINT19 */
  630. .desc = "gpio-keys: KEY_CAMERA",
  631. .type = EV_KEY,
  632. .active_low = 1,
  633. .debounce_interval = 1,
  634. }, {
  635. .code = KEY_OK,
  636. .gpio = EXYNOS4_GPX3(5), /* XEINT29 */
  637. .desc = "gpio-keys: KEY_OK",
  638. .type = EV_KEY,
  639. .active_low = 1,
  640. .debounce_interval = 1,
  641. },
  642. };
  643. static struct gpio_keys_platform_data universal_gpio_keys_data = {
  644. .buttons = universal_gpio_keys_tables,
  645. .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
  646. };
  647. static struct platform_device universal_gpio_keys = {
  648. .name = "gpio-keys",
  649. .dev = {
  650. .platform_data = &universal_gpio_keys_data,
  651. },
  652. };
  653. /* eMMC */
  654. static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
  655. .max_width = 8,
  656. .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
  657. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  658. MMC_CAP_DISABLE),
  659. .cd_type = S3C_SDHCI_CD_PERMANENT,
  660. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  661. };
  662. static struct regulator_consumer_supply mmc0_supplies[] = {
  663. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  664. };
  665. static struct regulator_init_data mmc0_fixed_voltage_init_data = {
  666. .constraints = {
  667. .name = "VMEM_VDD_2.8V",
  668. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  669. },
  670. .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies),
  671. .consumer_supplies = mmc0_supplies,
  672. };
  673. static struct fixed_voltage_config mmc0_fixed_voltage_config = {
  674. .supply_name = "MASSMEMORY_EN",
  675. .microvolts = 2800000,
  676. .gpio = EXYNOS4_GPE1(3),
  677. .enable_high = true,
  678. .init_data = &mmc0_fixed_voltage_init_data,
  679. };
  680. static struct platform_device mmc0_fixed_voltage = {
  681. .name = "reg-fixed-voltage",
  682. .id = FIXED_REG_ID_MMC0,
  683. .dev = {
  684. .platform_data = &mmc0_fixed_voltage_config,
  685. },
  686. };
  687. /* SD */
  688. static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
  689. .max_width = 4,
  690. .host_caps = MMC_CAP_4_BIT_DATA |
  691. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  692. MMC_CAP_DISABLE,
  693. .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */
  694. .ext_cd_gpio_invert = 1,
  695. .cd_type = S3C_SDHCI_CD_GPIO,
  696. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  697. };
  698. /* WiFi */
  699. static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
  700. .max_width = 4,
  701. .host_caps = MMC_CAP_4_BIT_DATA |
  702. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  703. MMC_CAP_DISABLE,
  704. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  705. };
  706. static void __init universal_sdhci_init(void)
  707. {
  708. s3c_sdhci0_set_platdata(&universal_hsmmc0_data);
  709. s3c_sdhci2_set_platdata(&universal_hsmmc2_data);
  710. s3c_sdhci3_set_platdata(&universal_hsmmc3_data);
  711. }
  712. /* I2C1 */
  713. static struct i2c_board_info i2c1_devs[] __initdata = {
  714. /* Gyro, To be updated */
  715. };
  716. /* Frame Buffer */
  717. static struct s3c_fb_pd_win universal_fb_win0 = {
  718. .win_mode = {
  719. .left_margin = 16,
  720. .right_margin = 16,
  721. .upper_margin = 2,
  722. .lower_margin = 28,
  723. .hsync_len = 2,
  724. .vsync_len = 1,
  725. .xres = 480,
  726. .yres = 800,
  727. .refresh = 55,
  728. },
  729. .max_bpp = 32,
  730. .default_bpp = 16,
  731. };
  732. static struct s3c_fb_platdata universal_lcd_pdata __initdata = {
  733. .win[0] = &universal_fb_win0,
  734. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB |
  735. VIDCON0_CLKSEL_LCD,
  736. .vidcon1 = VIDCON1_INV_VCLK | VIDCON1_INV_VDEN
  737. | VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
  738. .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
  739. };
  740. static struct regulator_consumer_supply cam_i_core_supply =
  741. REGULATOR_SUPPLY("core", "0-001f");
  742. static struct regulator_init_data cam_i_core_reg_init_data = {
  743. .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
  744. .num_consumer_supplies = 1,
  745. .consumer_supplies = &cam_i_core_supply,
  746. };
  747. static struct fixed_voltage_config cam_i_core_fixed_voltage_cfg = {
  748. .supply_name = "CAM_I_CORE_1.2V",
  749. .microvolts = 1200000,
  750. .gpio = EXYNOS4_GPE2(2), /* CAM_8M_CORE_EN */
  751. .enable_high = 1,
  752. .init_data = &cam_i_core_reg_init_data,
  753. };
  754. static struct platform_device cam_i_core_fixed_reg_dev = {
  755. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_I_CORE,
  756. .dev = { .platform_data = &cam_i_core_fixed_voltage_cfg },
  757. };
  758. static struct regulator_consumer_supply cam_s_if_supply =
  759. REGULATOR_SUPPLY("d_sensor", "0-001f");
  760. static struct regulator_init_data cam_s_if_reg_init_data = {
  761. .constraints = { .valid_ops_mask = REGULATOR_CHANGE_STATUS },
  762. .num_consumer_supplies = 1,
  763. .consumer_supplies = &cam_s_if_supply,
  764. };
  765. static struct fixed_voltage_config cam_s_if_fixed_voltage_cfg = {
  766. .supply_name = "CAM_S_IF_1.8V",
  767. .microvolts = 1800000,
  768. .gpio = EXYNOS4_GPE3(0), /* CAM_PWR_EN1 */
  769. .enable_high = 1,
  770. .init_data = &cam_s_if_reg_init_data,
  771. };
  772. static struct platform_device cam_s_if_fixed_reg_dev = {
  773. .name = "reg-fixed-voltage", .id = FIXED_REG_ID_CAM_S_IF,
  774. .dev = { .platform_data = &cam_s_if_fixed_voltage_cfg },
  775. };
  776. static struct s5p_platform_mipi_csis mipi_csis_platdata = {
  777. .clk_rate = 166000000UL,
  778. .lanes = 2,
  779. .alignment = 32,
  780. .hs_settle = 12,
  781. .phy_enable = s5p_csis_phy_enable,
  782. };
  783. #define GPIO_CAM_LEVEL_EN(n) EXYNOS4_GPE4(n + 3)
  784. #define GPIO_CAM_8M_ISP_INT EXYNOS4_GPX1(5) /* XEINT_13 */
  785. #define GPIO_CAM_MEGA_nRST EXYNOS4_GPE2(5)
  786. static int m5mols_set_power(struct device *dev, int on)
  787. {
  788. gpio_set_value(GPIO_CAM_LEVEL_EN(1), !on);
  789. gpio_set_value(GPIO_CAM_LEVEL_EN(2), !!on);
  790. return 0;
  791. }
  792. static struct m5mols_platform_data m5mols_platdata = {
  793. .gpio_reset = GPIO_CAM_MEGA_nRST,
  794. .reset_polarity = 0,
  795. .set_power = m5mols_set_power,
  796. };
  797. static struct i2c_board_info m5mols_board_info = {
  798. I2C_BOARD_INFO("M5MOLS", 0x1F),
  799. .platform_data = &m5mols_platdata,
  800. };
  801. static struct s5p_fimc_isp_info universal_camera_sensors[] = {
  802. {
  803. .mux_id = 0,
  804. .flags = V4L2_MBUS_PCLK_SAMPLE_FALLING |
  805. V4L2_MBUS_VSYNC_ACTIVE_LOW,
  806. .bus_type = FIMC_MIPI_CSI2,
  807. .board_info = &m5mols_board_info,
  808. .i2c_bus_num = 0,
  809. .clk_frequency = 21600000UL,
  810. .csi_data_align = 32,
  811. },
  812. };
  813. static struct s5p_platform_fimc fimc_md_platdata = {
  814. .isp_info = universal_camera_sensors,
  815. .num_clients = ARRAY_SIZE(universal_camera_sensors),
  816. };
  817. static struct gpio universal_camera_gpios[] = {
  818. { GPIO_CAM_LEVEL_EN(1), GPIOF_OUT_INIT_HIGH, "CAM_LVL_EN1" },
  819. { GPIO_CAM_LEVEL_EN(2), GPIOF_OUT_INIT_LOW, "CAM_LVL_EN2" },
  820. { GPIO_CAM_8M_ISP_INT, GPIOF_IN, "8M_ISP_INT" },
  821. { GPIO_CAM_MEGA_nRST, GPIOF_OUT_INIT_LOW, "CAM_8M_NRST" },
  822. };
  823. static void universal_camera_init(void)
  824. {
  825. s3c_set_platdata(&mipi_csis_platdata, sizeof(mipi_csis_platdata),
  826. &s5p_device_mipi_csis0);
  827. s3c_set_platdata(&fimc_md_platdata, sizeof(fimc_md_platdata),
  828. &s5p_device_fimc_md);
  829. if (gpio_request_array(universal_camera_gpios,
  830. ARRAY_SIZE(universal_camera_gpios))) {
  831. pr_err("%s: GPIO request failed\n", __func__);
  832. return;
  833. }
  834. if (!s3c_gpio_cfgpin(GPIO_CAM_8M_ISP_INT, S3C_GPIO_SFN(0xf)))
  835. m5mols_board_info.irq = gpio_to_irq(GPIO_CAM_8M_ISP_INT);
  836. else
  837. pr_err("Failed to configure 8M_ISP_INT GPIO\n");
  838. /* Free GPIOs controlled directly by the sensor drivers. */
  839. gpio_free(GPIO_CAM_MEGA_nRST);
  840. gpio_free(GPIO_CAM_8M_ISP_INT);
  841. if (exynos4_fimc_setup_gpio(S5P_CAMPORT_A))
  842. pr_err("Camera port A setup failed\n");
  843. }
  844. static struct platform_device *universal_devices[] __initdata = {
  845. /* Samsung Platform Devices */
  846. &s5p_device_mipi_csis0,
  847. &s5p_device_fimc0,
  848. &s5p_device_fimc1,
  849. &s5p_device_fimc2,
  850. &s5p_device_fimc3,
  851. &mmc0_fixed_voltage,
  852. &s3c_device_hsmmc0,
  853. &s3c_device_hsmmc2,
  854. &s3c_device_hsmmc3,
  855. &s3c_device_i2c0,
  856. &s3c_device_i2c3,
  857. &s3c_device_i2c5,
  858. &s5p_device_i2c_hdmiphy,
  859. &hdmi_fixed_voltage,
  860. &exynos4_device_pd[PD_TV],
  861. &s5p_device_hdmi,
  862. &s5p_device_sdo,
  863. &s5p_device_mixer,
  864. /* Universal Devices */
  865. &i2c_gpio12,
  866. &universal_gpio_keys,
  867. &s5p_device_onenand,
  868. &s5p_device_fimd0,
  869. &s5p_device_mfc,
  870. &s5p_device_mfc_l,
  871. &s5p_device_mfc_r,
  872. &exynos4_device_pd[PD_MFC],
  873. &exynos4_device_pd[PD_LCD0],
  874. &exynos4_device_pd[PD_CAM],
  875. &cam_i_core_fixed_reg_dev,
  876. &cam_s_if_fixed_reg_dev,
  877. &s5p_device_fimc_md,
  878. };
  879. static void __init universal_map_io(void)
  880. {
  881. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  882. s3c24xx_init_clocks(24000000);
  883. s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
  884. }
  885. void s5p_tv_setup(void)
  886. {
  887. /* direct HPD to HDMI chip */
  888. gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
  889. s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
  890. s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
  891. /* setup dependencies between TV devices */
  892. s5p_device_hdmi.dev.parent = &exynos4_device_pd[PD_TV].dev;
  893. s5p_device_mixer.dev.parent = &exynos4_device_pd[PD_TV].dev;
  894. }
  895. static void __init universal_reserve(void)
  896. {
  897. s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
  898. }
  899. static void __init universal_machine_init(void)
  900. {
  901. universal_sdhci_init();
  902. s5p_tv_setup();
  903. s3c_i2c0_set_platdata(&universal_i2c0_platdata);
  904. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  905. universal_tsp_init();
  906. s3c_i2c3_set_platdata(NULL);
  907. i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
  908. s3c_i2c5_set_platdata(NULL);
  909. s5p_i2c_hdmiphy_set_platdata(NULL);
  910. i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
  911. s5p_fimd0_set_platdata(&universal_lcd_pdata);
  912. universal_touchkey_init();
  913. i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
  914. ARRAY_SIZE(i2c_gpio12_devs));
  915. universal_camera_init();
  916. /* Last */
  917. platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
  918. s5p_device_mfc.dev.parent = &exynos4_device_pd[PD_MFC].dev;
  919. s5p_device_fimd0.dev.parent = &exynos4_device_pd[PD_LCD0].dev;
  920. s5p_device_fimc0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
  921. s5p_device_fimc1.dev.parent = &exynos4_device_pd[PD_CAM].dev;
  922. s5p_device_fimc2.dev.parent = &exynos4_device_pd[PD_CAM].dev;
  923. s5p_device_fimc3.dev.parent = &exynos4_device_pd[PD_CAM].dev;
  924. s5p_device_mipi_csis0.dev.parent = &exynos4_device_pd[PD_CAM].dev;
  925. }
  926. MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
  927. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  928. .atag_offset = 0x100,
  929. .init_irq = exynos4_init_irq,
  930. .map_io = universal_map_io,
  931. .init_machine = universal_machine_init,
  932. .timer = &exynos4_timer,
  933. .reserve = &universal_reserve,
  934. MACHINE_END