mach-universal_c210.c 28 KB

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