mach-universal_c210.c 26 KB

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