mach-universal_c210.c 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116
  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/cpu.h>
  30. #include <plat/devs.h>
  31. #include <plat/iic.h>
  32. #include <plat/gpio-cfg.h>
  33. #include <plat/fb.h>
  34. #include <plat/mfc.h>
  35. #include <plat/sdhci.h>
  36. #include <plat/pd.h>
  37. #include <plat/regs-fb-v4.h>
  38. #include <plat/fimc-core.h>
  39. #include <plat/camport.h>
  40. #include <plat/mipi_csis.h>
  41. #include <mach/map.h>
  42. #include <media/v4l2-mediabus.h>
  43. #include <media/s5p_fimc.h>
  44. #include <media/m5mols.h>
  45. #include <media/s5k6aa.h>
  46. #include "common.h"
  47. /* Following are default values for UCON, ULCON and UFCON UART registers */
  48. #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  49. S3C2410_UCON_RXILEVEL | \
  50. S3C2410_UCON_TXIRQMODE | \
  51. S3C2410_UCON_RXIRQMODE | \
  52. S3C2410_UCON_RXFIFO_TOI | \
  53. S3C2443_UCON_RXERR_IRQEN)
  54. #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
  55. #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  56. S5PV210_UFCON_TXTRIG256 | \
  57. S5PV210_UFCON_RXTRIG256)
  58. static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
  59. [0] = {
  60. .hwport = 0,
  61. .ucon = UNIVERSAL_UCON_DEFAULT,
  62. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  63. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  64. },
  65. [1] = {
  66. .hwport = 1,
  67. .ucon = UNIVERSAL_UCON_DEFAULT,
  68. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  69. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  70. },
  71. [2] = {
  72. .hwport = 2,
  73. .ucon = UNIVERSAL_UCON_DEFAULT,
  74. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  75. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  76. },
  77. [3] = {
  78. .hwport = 3,
  79. .ucon = UNIVERSAL_UCON_DEFAULT,
  80. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  81. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  82. },
  83. };
  84. static struct regulator_consumer_supply max8952_consumer =
  85. REGULATOR_SUPPLY("vdd_arm", NULL);
  86. static struct max8952_platform_data universal_max8952_pdata __initdata = {
  87. .gpio_vid0 = EXYNOS4_GPX0(3),
  88. .gpio_vid1 = EXYNOS4_GPX0(4),
  89. .gpio_en = -1, /* Not controllable, set "Always High" */
  90. .default_mode = 0, /* vid0 = 0, vid1 = 0 */
  91. .dvs_mode = { 48, 32, 28, 18 }, /* 1.25, 1.20, 1.05, 0.95V */
  92. .sync_freq = 0, /* default: fastest */
  93. .ramp_speed = 0, /* default: fastest */
  94. .reg_data = {
  95. .constraints = {
  96. .name = "VARM_1.2V",
  97. .min_uV = 770000,
  98. .max_uV = 1400000,
  99. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  100. .always_on = 1,
  101. .boot_on = 1,
  102. },
  103. .num_consumer_supplies = 1,
  104. .consumer_supplies = &max8952_consumer,
  105. },
  106. };
  107. static struct regulator_consumer_supply lp3974_buck1_consumer =
  108. REGULATOR_SUPPLY("vdd_int", NULL);
  109. static struct regulator_consumer_supply lp3974_buck2_consumer =
  110. REGULATOR_SUPPLY("vddg3d", NULL);
  111. static struct regulator_consumer_supply lp3974_buck3_consumer[] = {
  112. REGULATOR_SUPPLY("vdet", "s5p-sdo"),
  113. REGULATOR_SUPPLY("vdd_reg", "0-003c"),
  114. };
  115. static struct regulator_init_data lp3974_buck1_data = {
  116. .constraints = {
  117. .name = "VINT_1.1V",
  118. .min_uV = 750000,
  119. .max_uV = 1500000,
  120. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  121. REGULATOR_CHANGE_STATUS,
  122. .boot_on = 1,
  123. .state_mem = {
  124. .disabled = 1,
  125. },
  126. },
  127. .num_consumer_supplies = 1,
  128. .consumer_supplies = &lp3974_buck1_consumer,
  129. };
  130. static struct regulator_init_data lp3974_buck2_data = {
  131. .constraints = {
  132. .name = "VG3D_1.1V",
  133. .min_uV = 750000,
  134. .max_uV = 1500000,
  135. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  136. REGULATOR_CHANGE_STATUS,
  137. .boot_on = 1,
  138. .state_mem = {
  139. .disabled = 1,
  140. },
  141. },
  142. .num_consumer_supplies = 1,
  143. .consumer_supplies = &lp3974_buck2_consumer,
  144. };
  145. static struct regulator_init_data lp3974_buck3_data = {
  146. .constraints = {
  147. .name = "VCC_1.8V",
  148. .min_uV = 1800000,
  149. .max_uV = 1800000,
  150. .apply_uV = 1,
  151. .always_on = 1,
  152. .state_mem = {
  153. .enabled = 1,
  154. },
  155. },
  156. .num_consumer_supplies = ARRAY_SIZE(lp3974_buck3_consumer),
  157. .consumer_supplies = lp3974_buck3_consumer,
  158. };
  159. static struct regulator_init_data lp3974_buck4_data = {
  160. .constraints = {
  161. .name = "VMEM_1.2V",
  162. .min_uV = 1200000,
  163. .max_uV = 1200000,
  164. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  165. .apply_uV = 1,
  166. .state_mem = {
  167. .disabled = 1,
  168. },
  169. },
  170. };
  171. static struct regulator_init_data lp3974_ldo2_data = {
  172. .constraints = {
  173. .name = "VALIVE_1.2V",
  174. .min_uV = 1200000,
  175. .max_uV = 1200000,
  176. .apply_uV = 1,
  177. .always_on = 1,
  178. .state_mem = {
  179. .enabled = 1,
  180. },
  181. },
  182. };
  183. static struct regulator_consumer_supply lp3974_ldo3_consumer[] = {
  184. REGULATOR_SUPPLY("vdd", "exynos4-hdmi"),
  185. REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"),
  186. REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"),
  187. };
  188. static struct regulator_init_data lp3974_ldo3_data = {
  189. .constraints = {
  190. .name = "VUSB+MIPI_1.1V",
  191. .min_uV = 1100000,
  192. .max_uV = 1100000,
  193. .apply_uV = 1,
  194. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  195. .state_mem = {
  196. .disabled = 1,
  197. },
  198. },
  199. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo3_consumer),
  200. .consumer_supplies = lp3974_ldo3_consumer,
  201. };
  202. static struct regulator_consumer_supply lp3974_ldo4_consumer[] = {
  203. REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"),
  204. };
  205. static struct regulator_init_data lp3974_ldo4_data = {
  206. .constraints = {
  207. .name = "VADC_3.3V",
  208. .min_uV = 3300000,
  209. .max_uV = 3300000,
  210. .apply_uV = 1,
  211. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  212. .state_mem = {
  213. .disabled = 1,
  214. },
  215. },
  216. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo4_consumer),
  217. .consumer_supplies = lp3974_ldo4_consumer,
  218. };
  219. static struct regulator_init_data lp3974_ldo5_data = {
  220. .constraints = {
  221. .name = "VTF_2.8V",
  222. .min_uV = 2800000,
  223. .max_uV = 2800000,
  224. .apply_uV = 1,
  225. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  226. .state_mem = {
  227. .disabled = 1,
  228. },
  229. },
  230. };
  231. static struct regulator_init_data lp3974_ldo6_data = {
  232. .constraints = {
  233. .name = "LDO6",
  234. .min_uV = 2000000,
  235. .max_uV = 2000000,
  236. .apply_uV = 1,
  237. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  238. .state_mem = {
  239. .disabled = 1,
  240. },
  241. },
  242. };
  243. static struct regulator_consumer_supply lp3974_ldo7_consumer[] = {
  244. REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"),
  245. };
  246. static struct regulator_init_data lp3974_ldo7_data = {
  247. .constraints = {
  248. .name = "VLCD+VMIPI_1.8V",
  249. .min_uV = 1800000,
  250. .max_uV = 1800000,
  251. .apply_uV = 1,
  252. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  253. .state_mem = {
  254. .disabled = 1,
  255. },
  256. },
  257. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo7_consumer),
  258. .consumer_supplies = lp3974_ldo7_consumer,
  259. };
  260. static struct regulator_consumer_supply lp3974_ldo8_consumer[] = {
  261. REGULATOR_SUPPLY("vdd33a_dac", "s5p-sdo"),
  262. };
  263. static struct regulator_init_data lp3974_ldo8_data = {
  264. .constraints = {
  265. .name = "VUSB+VDAC_3.3V",
  266. .min_uV = 3300000,
  267. .max_uV = 3300000,
  268. .apply_uV = 1,
  269. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  270. .state_mem = {
  271. .disabled = 1,
  272. },
  273. },
  274. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo8_consumer),
  275. .consumer_supplies = lp3974_ldo8_consumer,
  276. };
  277. static struct regulator_consumer_supply lp3974_ldo9_consumer =
  278. REGULATOR_SUPPLY("vddio", "0-003c");
  279. static struct regulator_init_data lp3974_ldo9_data = {
  280. .constraints = {
  281. .name = "VCC_2.8V",
  282. .min_uV = 2800000,
  283. .max_uV = 2800000,
  284. .apply_uV = 1,
  285. .always_on = 1,
  286. .state_mem = {
  287. .enabled = 1,
  288. },
  289. },
  290. .num_consumer_supplies = 1,
  291. .consumer_supplies = &lp3974_ldo9_consumer,
  292. };
  293. static struct regulator_init_data lp3974_ldo10_data = {
  294. .constraints = {
  295. .name = "VPLL_1.1V",
  296. .min_uV = 1100000,
  297. .max_uV = 1100000,
  298. .boot_on = 1,
  299. .apply_uV = 1,
  300. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  301. .state_mem = {
  302. .disabled = 1,
  303. },
  304. },
  305. };
  306. static struct regulator_consumer_supply lp3974_ldo11_consumer =
  307. REGULATOR_SUPPLY("dig_28", "0-001f");
  308. static struct regulator_init_data lp3974_ldo11_data = {
  309. .constraints = {
  310. .name = "CAM_AF_3.3V",
  311. .min_uV = 3300000,
  312. .max_uV = 3300000,
  313. .apply_uV = 1,
  314. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  315. .state_mem = {
  316. .disabled = 1,
  317. },
  318. },
  319. .num_consumer_supplies = 1,
  320. .consumer_supplies = &lp3974_ldo11_consumer,
  321. };
  322. static struct regulator_init_data lp3974_ldo12_data = {
  323. .constraints = {
  324. .name = "PS_2.8V",
  325. .min_uV = 2800000,
  326. .max_uV = 2800000,
  327. .apply_uV = 1,
  328. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  329. .state_mem = {
  330. .disabled = 1,
  331. },
  332. },
  333. };
  334. static struct regulator_init_data lp3974_ldo13_data = {
  335. .constraints = {
  336. .name = "VHIC_1.2V",
  337. .min_uV = 1200000,
  338. .max_uV = 1200000,
  339. .apply_uV = 1,
  340. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  341. .state_mem = {
  342. .disabled = 1,
  343. },
  344. },
  345. };
  346. static struct regulator_consumer_supply lp3974_ldo14_consumer =
  347. REGULATOR_SUPPLY("dig_18", "0-001f");
  348. static struct regulator_init_data lp3974_ldo14_data = {
  349. .constraints = {
  350. .name = "CAM_I_HOST_1.8V",
  351. .min_uV = 1800000,
  352. .max_uV = 1800000,
  353. .apply_uV = 1,
  354. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  355. .state_mem = {
  356. .disabled = 1,
  357. },
  358. },
  359. .num_consumer_supplies = 1,
  360. .consumer_supplies = &lp3974_ldo14_consumer,
  361. };
  362. static struct regulator_consumer_supply lp3974_ldo15_consumer =
  363. REGULATOR_SUPPLY("dig_12", "0-001f");
  364. static struct regulator_init_data lp3974_ldo15_data = {
  365. .constraints = {
  366. .name = "CAM_S_DIG+FM33_CORE_1.2V",
  367. .min_uV = 1200000,
  368. .max_uV = 1200000,
  369. .apply_uV = 1,
  370. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  371. .state_mem = {
  372. .disabled = 1,
  373. },
  374. },
  375. .num_consumer_supplies = 1,
  376. .consumer_supplies = &lp3974_ldo15_consumer,
  377. };
  378. static struct regulator_consumer_supply lp3974_ldo16_consumer[] = {
  379. REGULATOR_SUPPLY("vdda", "0-003c"),
  380. REGULATOR_SUPPLY("a_sensor", "0-001f"),
  381. };
  382. static struct regulator_init_data lp3974_ldo16_data = {
  383. .constraints = {
  384. .name = "CAM_S_ANA_2.8V",
  385. .min_uV = 2800000,
  386. .max_uV = 2800000,
  387. .apply_uV = 1,
  388. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  389. .state_mem = {
  390. .disabled = 1,
  391. },
  392. },
  393. .num_consumer_supplies = ARRAY_SIZE(lp3974_ldo16_consumer),
  394. .consumer_supplies = lp3974_ldo16_consumer,
  395. };
  396. static struct regulator_init_data lp3974_ldo17_data = {
  397. .constraints = {
  398. .name = "VCC_3.0V_LCD",
  399. .min_uV = 3000000,
  400. .max_uV = 3000000,
  401. .apply_uV = 1,
  402. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  403. .boot_on = 1,
  404. .state_mem = {
  405. .disabled = 1,
  406. },
  407. },
  408. };
  409. static struct regulator_init_data lp3974_32khz_ap_data = {
  410. .constraints = {
  411. .name = "32KHz AP",
  412. .always_on = 1,
  413. .state_mem = {
  414. .enabled = 1,
  415. },
  416. },
  417. };
  418. static struct regulator_init_data lp3974_32khz_cp_data = {
  419. .constraints = {
  420. .name = "32KHz CP",
  421. .state_mem = {
  422. .disabled = 1,
  423. },
  424. },
  425. };
  426. static struct regulator_init_data lp3974_vichg_data = {
  427. .constraints = {
  428. .name = "VICHG",
  429. .state_mem = {
  430. .disabled = 1,
  431. },
  432. },
  433. };
  434. static struct regulator_init_data lp3974_esafeout1_data = {
  435. .constraints = {
  436. .name = "SAFEOUT1",
  437. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  438. .state_mem = {
  439. .enabled = 1,
  440. },
  441. },
  442. };
  443. static struct regulator_init_data lp3974_esafeout2_data = {
  444. .constraints = {
  445. .name = "SAFEOUT2",
  446. .boot_on = 1,
  447. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  448. .state_mem = {
  449. .enabled = 1,
  450. },
  451. },
  452. };
  453. static struct max8998_regulator_data lp3974_regulators[] = {
  454. { MAX8998_LDO2, &lp3974_ldo2_data },
  455. { MAX8998_LDO3, &lp3974_ldo3_data },
  456. { MAX8998_LDO4, &lp3974_ldo4_data },
  457. { MAX8998_LDO5, &lp3974_ldo5_data },
  458. { MAX8998_LDO6, &lp3974_ldo6_data },
  459. { MAX8998_LDO7, &lp3974_ldo7_data },
  460. { MAX8998_LDO8, &lp3974_ldo8_data },
  461. { MAX8998_LDO9, &lp3974_ldo9_data },
  462. { MAX8998_LDO10, &lp3974_ldo10_data },
  463. { MAX8998_LDO11, &lp3974_ldo11_data },
  464. { MAX8998_LDO12, &lp3974_ldo12_data },
  465. { MAX8998_LDO13, &lp3974_ldo13_data },
  466. { MAX8998_LDO14, &lp3974_ldo14_data },
  467. { MAX8998_LDO15, &lp3974_ldo15_data },
  468. { MAX8998_LDO16, &lp3974_ldo16_data },
  469. { MAX8998_LDO17, &lp3974_ldo17_data },
  470. { MAX8998_BUCK1, &lp3974_buck1_data },
  471. { MAX8998_BUCK2, &lp3974_buck2_data },
  472. { MAX8998_BUCK3, &lp3974_buck3_data },
  473. { MAX8998_BUCK4, &lp3974_buck4_data },
  474. { MAX8998_EN32KHZ_AP, &lp3974_32khz_ap_data },
  475. { MAX8998_EN32KHZ_CP, &lp3974_32khz_cp_data },
  476. { MAX8998_ENVICHG, &lp3974_vichg_data },
  477. { MAX8998_ESAFEOUT1, &lp3974_esafeout1_data },
  478. { MAX8998_ESAFEOUT2, &lp3974_esafeout2_data },
  479. };
  480. static struct max8998_platform_data universal_lp3974_pdata = {
  481. .num_regulators = ARRAY_SIZE(lp3974_regulators),
  482. .regulators = lp3974_regulators,
  483. .buck1_voltage1 = 1100000, /* INT */
  484. .buck1_voltage2 = 1000000,
  485. .buck1_voltage3 = 1100000,
  486. .buck1_voltage4 = 1000000,
  487. .buck1_set1 = EXYNOS4_GPX0(5),
  488. .buck1_set2 = EXYNOS4_GPX0(6),
  489. .buck2_voltage1 = 1200000, /* G3D */
  490. .buck2_voltage2 = 1100000,
  491. .buck1_default_idx = 0,
  492. .buck2_set3 = EXYNOS4_GPE2(0),
  493. .buck2_default_idx = 0,
  494. .wakeup = true,
  495. };
  496. enum fixed_regulator_id {
  497. FIXED_REG_ID_MMC0,
  498. FIXED_REG_ID_HDMI_5V,
  499. FIXED_REG_ID_CAM_S_IF,
  500. FIXED_REG_ID_CAM_I_CORE,
  501. FIXED_REG_ID_CAM_VT_DIO,
  502. };
  503. static struct regulator_consumer_supply hdmi_fixed_consumer =
  504. REGULATOR_SUPPLY("hdmi-en", "exynos4-hdmi");
  505. static struct regulator_init_data hdmi_fixed_voltage_init_data = {
  506. .constraints = {
  507. .name = "HDMI_5V",
  508. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  509. },
  510. .num_consumer_supplies = 1,
  511. .consumer_supplies = &hdmi_fixed_consumer,
  512. };
  513. static struct fixed_voltage_config hdmi_fixed_voltage_config = {
  514. .supply_name = "HDMI_EN1",
  515. .microvolts = 5000000,
  516. .gpio = EXYNOS4_GPE0(1),
  517. .enable_high = true,
  518. .init_data = &hdmi_fixed_voltage_init_data,
  519. };
  520. static struct platform_device hdmi_fixed_voltage = {
  521. .name = "reg-fixed-voltage",
  522. .id = FIXED_REG_ID_HDMI_5V,
  523. .dev = {
  524. .platform_data = &hdmi_fixed_voltage_config,
  525. },
  526. };
  527. /* GPIO I2C 5 (PMIC) */
  528. static struct i2c_board_info i2c5_devs[] __initdata = {
  529. {
  530. I2C_BOARD_INFO("max8952", 0xC0 >> 1),
  531. .platform_data = &universal_max8952_pdata,
  532. }, {
  533. I2C_BOARD_INFO("lp3974", 0xCC >> 1),
  534. .platform_data = &universal_lp3974_pdata,
  535. },
  536. };
  537. /* I2C3 (TSP) */
  538. static struct mxt_platform_data qt602240_platform_data = {
  539. .x_line = 19,
  540. .y_line = 11,
  541. .x_size = 800,
  542. .y_size = 480,
  543. .blen = 0x11,
  544. .threshold = 0x28,
  545. .voltage = 2800000, /* 2.8V */
  546. .orient = MXT_DIAGONAL,
  547. .irqflags = IRQF_TRIGGER_FALLING,
  548. };
  549. static struct i2c_board_info i2c3_devs[] __initdata = {
  550. {
  551. I2C_BOARD_INFO("qt602240_ts", 0x4a),
  552. .platform_data = &qt602240_platform_data,
  553. },
  554. };
  555. static void __init universal_tsp_init(void)
  556. {
  557. int gpio;
  558. /* TSP_LDO_ON: XMDMADDR_11 */
  559. gpio = EXYNOS4_GPE2(3);
  560. gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "TSP_LDO_ON");
  561. gpio_export(gpio, 0);
  562. /* TSP_INT: XMDMADDR_7 */
  563. gpio = EXYNOS4_GPE1(7);
  564. gpio_request(gpio, "TSP_INT");
  565. s5p_register_gpio_interrupt(gpio);
  566. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  567. s3c_gpio_setpull(gpio, S3C_GPIO_PULL_UP);
  568. i2c3_devs[0].irq = gpio_to_irq(gpio);
  569. }
  570. /* GPIO I2C 12 (3 Touchkey) */
  571. static uint32_t touchkey_keymap[] = {
  572. /* MCS_KEY_MAP(value, keycode) */
  573. MCS_KEY_MAP(0, KEY_MENU), /* KEY_SEND */
  574. MCS_KEY_MAP(1, KEY_BACK), /* KEY_END */
  575. };
  576. static struct mcs_platform_data touchkey_data = {
  577. .keymap = touchkey_keymap,
  578. .keymap_size = ARRAY_SIZE(touchkey_keymap),
  579. .key_maxval = 2,
  580. };
  581. /* GPIO I2C 3_TOUCH 2.8V */
  582. #define I2C_GPIO_BUS_12 12
  583. static struct i2c_gpio_platform_data i2c_gpio12_data = {
  584. .sda_pin = EXYNOS4_GPE4(0), /* XMDMDATA_8 */
  585. .scl_pin = EXYNOS4_GPE4(1), /* XMDMDATA_9 */
  586. };
  587. static struct platform_device i2c_gpio12 = {
  588. .name = "i2c-gpio",
  589. .id = I2C_GPIO_BUS_12,
  590. .dev = {
  591. .platform_data = &i2c_gpio12_data,
  592. },
  593. };
  594. static struct i2c_board_info i2c_gpio12_devs[] __initdata = {
  595. {
  596. I2C_BOARD_INFO("mcs5080_touchkey", 0x20),
  597. .platform_data = &touchkey_data,
  598. },
  599. };
  600. static void __init universal_touchkey_init(void)
  601. {
  602. int gpio;
  603. gpio = EXYNOS4_GPE3(7); /* XMDMDATA_7 */
  604. gpio_request(gpio, "3_TOUCH_INT");
  605. s5p_register_gpio_interrupt(gpio);
  606. s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(0xf));
  607. i2c_gpio12_devs[0].irq = gpio_to_irq(gpio);
  608. gpio = EXYNOS4_GPE3(3); /* XMDMDATA_3 */
  609. gpio_request_one(gpio, GPIOF_OUT_INIT_HIGH, "3_TOUCH_EN");
  610. }
  611. static struct s3c2410_platform_i2c universal_i2c0_platdata __initdata = {
  612. .frequency = 300 * 1000,
  613. .sda_delay = 200,
  614. };
  615. /* GPIO KEYS */
  616. static struct gpio_keys_button universal_gpio_keys_tables[] = {
  617. {
  618. .code = KEY_VOLUMEUP,
  619. .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
  620. .desc = "gpio-keys: KEY_VOLUMEUP",
  621. .type = EV_KEY,
  622. .active_low = 1,
  623. .debounce_interval = 1,
  624. }, {
  625. .code = KEY_VOLUMEDOWN,
  626. .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
  627. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  628. .type = EV_KEY,
  629. .active_low = 1,
  630. .debounce_interval = 1,
  631. }, {
  632. .code = KEY_CONFIG,
  633. .gpio = EXYNOS4_GPX2(2), /* XEINT18 */
  634. .desc = "gpio-keys: KEY_CONFIG",
  635. .type = EV_KEY,
  636. .active_low = 1,
  637. .debounce_interval = 1,
  638. }, {
  639. .code = KEY_CAMERA,
  640. .gpio = EXYNOS4_GPX2(3), /* XEINT19 */
  641. .desc = "gpio-keys: KEY_CAMERA",
  642. .type = EV_KEY,
  643. .active_low = 1,
  644. .debounce_interval = 1,
  645. }, {
  646. .code = KEY_OK,
  647. .gpio = EXYNOS4_GPX3(5), /* XEINT29 */
  648. .desc = "gpio-keys: KEY_OK",
  649. .type = EV_KEY,
  650. .active_low = 1,
  651. .debounce_interval = 1,
  652. },
  653. };
  654. static struct gpio_keys_platform_data universal_gpio_keys_data = {
  655. .buttons = universal_gpio_keys_tables,
  656. .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
  657. };
  658. static struct platform_device universal_gpio_keys = {
  659. .name = "gpio-keys",
  660. .dev = {
  661. .platform_data = &universal_gpio_keys_data,
  662. },
  663. };
  664. /* eMMC */
  665. static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
  666. .max_width = 8,
  667. .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
  668. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED),
  669. .cd_type = S3C_SDHCI_CD_PERMANENT,
  670. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  671. };
  672. static struct regulator_consumer_supply mmc0_supplies[] = {
  673. REGULATOR_SUPPLY("vmmc", "exynos4-sdhci.0"),
  674. };
  675. static struct regulator_init_data mmc0_fixed_voltage_init_data = {
  676. .constraints = {
  677. .name = "VMEM_VDD_2.8V",
  678. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  679. },
  680. .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies),
  681. .consumer_supplies = mmc0_supplies,
  682. };
  683. static struct fixed_voltage_config mmc0_fixed_voltage_config = {
  684. .supply_name = "MASSMEMORY_EN",
  685. .microvolts = 2800000,
  686. .gpio = EXYNOS4_GPE1(3),
  687. .enable_high = true,
  688. .init_data = &mmc0_fixed_voltage_init_data,
  689. };
  690. static struct platform_device mmc0_fixed_voltage = {
  691. .name = "reg-fixed-voltage",
  692. .id = FIXED_REG_ID_MMC0,
  693. .dev = {
  694. .platform_data = &mmc0_fixed_voltage_config,
  695. },
  696. };
  697. /* SD */
  698. static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
  699. .max_width = 4,
  700. .host_caps = MMC_CAP_4_BIT_DATA |
  701. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  702. .ext_cd_gpio = EXYNOS4_GPX3(4), /* XEINT_28 */
  703. .ext_cd_gpio_invert = 1,
  704. .cd_type = S3C_SDHCI_CD_GPIO,
  705. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  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. exynos_init_io(NULL, 0);
  940. s3c24xx_init_clocks(24000000);
  941. s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
  942. }
  943. static void s5p_tv_setup(void)
  944. {
  945. /* direct HPD to HDMI chip */
  946. gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
  947. s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
  948. s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
  949. }
  950. static void __init universal_reserve(void)
  951. {
  952. s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
  953. }
  954. static void __init universal_machine_init(void)
  955. {
  956. universal_sdhci_init();
  957. s5p_tv_setup();
  958. s3c_i2c0_set_platdata(&universal_i2c0_platdata);
  959. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  960. universal_tsp_init();
  961. s3c_i2c3_set_platdata(NULL);
  962. i2c_register_board_info(3, i2c3_devs, ARRAY_SIZE(i2c3_devs));
  963. s3c_i2c5_set_platdata(NULL);
  964. s5p_i2c_hdmiphy_set_platdata(NULL);
  965. i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
  966. s5p_fimd0_set_platdata(&universal_lcd_pdata);
  967. universal_touchkey_init();
  968. i2c_register_board_info(I2C_GPIO_BUS_12, i2c_gpio12_devs,
  969. ARRAY_SIZE(i2c_gpio12_devs));
  970. universal_camera_init();
  971. /* Last */
  972. platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
  973. }
  974. MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
  975. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  976. .atag_offset = 0x100,
  977. .init_irq = exynos4_init_irq,
  978. .map_io = universal_map_io,
  979. .handle_irq = gic_handle_irq,
  980. .init_machine = universal_machine_init,
  981. .timer = &exynos4_timer,
  982. .reserve = &universal_reserve,
  983. .restart = exynos4_restart,
  984. MACHINE_END