mach-origen.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817
  1. /* linux/arch/arm/mach-exynos4/mach-origen.c
  2. *
  3. * Copyright (c) 2011 Insignal Co., Ltd.
  4. * http://www.insignal.co.kr/
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #include <linux/serial_core.h>
  11. #include <linux/leds.h>
  12. #include <linux/gpio.h>
  13. #include <linux/mmc/host.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/io.h>
  16. #include <linux/input.h>
  17. #include <linux/pwm_backlight.h>
  18. #include <linux/gpio_keys.h>
  19. #include <linux/i2c.h>
  20. #include <linux/regulator/machine.h>
  21. #include <linux/mfd/max8997.h>
  22. #include <linux/lcd.h>
  23. #include <linux/rfkill-gpio.h>
  24. #include <linux/platform_data/s3c-hsotg.h>
  25. #include <asm/mach/arch.h>
  26. #include <asm/hardware/gic.h>
  27. #include <asm/mach-types.h>
  28. #include <video/platform_lcd.h>
  29. #include <plat/regs-serial.h>
  30. #include <plat/regs-fb-v4.h>
  31. #include <plat/cpu.h>
  32. #include <plat/devs.h>
  33. #include <plat/sdhci.h>
  34. #include <plat/iic.h>
  35. #include <plat/ehci.h>
  36. #include <plat/clock.h>
  37. #include <plat/gpio-cfg.h>
  38. #include <plat/backlight.h>
  39. #include <plat/fb.h>
  40. #include <plat/mfc.h>
  41. #include <plat/hdmi.h>
  42. #include <mach/ohci.h>
  43. #include <mach/map.h>
  44. #include <drm/exynos_drm.h>
  45. #include "common.h"
  46. /* Following are default values for UCON, ULCON and UFCON UART registers */
  47. #define ORIGEN_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  48. S3C2410_UCON_RXILEVEL | \
  49. S3C2410_UCON_TXIRQMODE | \
  50. S3C2410_UCON_RXIRQMODE | \
  51. S3C2410_UCON_RXFIFO_TOI | \
  52. S3C2443_UCON_RXERR_IRQEN)
  53. #define ORIGEN_ULCON_DEFAULT S3C2410_LCON_CS8
  54. #define ORIGEN_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  55. S5PV210_UFCON_TXTRIG4 | \
  56. S5PV210_UFCON_RXTRIG4)
  57. static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = {
  58. [0] = {
  59. .hwport = 0,
  60. .flags = 0,
  61. .ucon = ORIGEN_UCON_DEFAULT,
  62. .ulcon = ORIGEN_ULCON_DEFAULT,
  63. .ufcon = ORIGEN_UFCON_DEFAULT,
  64. },
  65. [1] = {
  66. .hwport = 1,
  67. .flags = 0,
  68. .ucon = ORIGEN_UCON_DEFAULT,
  69. .ulcon = ORIGEN_ULCON_DEFAULT,
  70. .ufcon = ORIGEN_UFCON_DEFAULT,
  71. },
  72. [2] = {
  73. .hwport = 2,
  74. .flags = 0,
  75. .ucon = ORIGEN_UCON_DEFAULT,
  76. .ulcon = ORIGEN_ULCON_DEFAULT,
  77. .ufcon = ORIGEN_UFCON_DEFAULT,
  78. },
  79. [3] = {
  80. .hwport = 3,
  81. .flags = 0,
  82. .ucon = ORIGEN_UCON_DEFAULT,
  83. .ulcon = ORIGEN_ULCON_DEFAULT,
  84. .ufcon = ORIGEN_UFCON_DEFAULT,
  85. },
  86. };
  87. static struct regulator_consumer_supply __initdata ldo3_consumer[] = {
  88. REGULATOR_SUPPLY("vdd11", "s5p-mipi-csis.0"), /* MIPI */
  89. REGULATOR_SUPPLY("vdd", "exynos4-hdmi"), /* HDMI */
  90. REGULATOR_SUPPLY("vdd_pll", "exynos4-hdmi"), /* HDMI */
  91. };
  92. static struct regulator_consumer_supply __initdata ldo6_consumer[] = {
  93. REGULATOR_SUPPLY("vdd18", "s5p-mipi-csis.0"), /* MIPI */
  94. };
  95. static struct regulator_consumer_supply __initdata ldo7_consumer[] = {
  96. REGULATOR_SUPPLY("avdd", "alc5625"), /* Realtek ALC5625 */
  97. };
  98. static struct regulator_consumer_supply __initdata ldo8_consumer[] = {
  99. REGULATOR_SUPPLY("vdd", "s5p-adc"), /* ADC */
  100. REGULATOR_SUPPLY("vdd_osc", "exynos4-hdmi"), /* HDMI */
  101. };
  102. static struct regulator_consumer_supply __initdata ldo9_consumer[] = {
  103. REGULATOR_SUPPLY("dvdd", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
  104. };
  105. static struct regulator_consumer_supply __initdata ldo11_consumer[] = {
  106. REGULATOR_SUPPLY("dvdd", "alc5625"), /* Realtek ALC5625 */
  107. };
  108. static struct regulator_consumer_supply __initdata ldo14_consumer[] = {
  109. REGULATOR_SUPPLY("avdd18", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
  110. };
  111. static struct regulator_consumer_supply __initdata ldo17_consumer[] = {
  112. REGULATOR_SUPPLY("vdd33", "swb-a31"), /* AR6003 WLAN & CSR 8810 BT */
  113. };
  114. static struct regulator_consumer_supply __initdata buck1_consumer[] = {
  115. REGULATOR_SUPPLY("vdd_arm", NULL), /* CPUFREQ */
  116. };
  117. static struct regulator_consumer_supply __initdata buck2_consumer[] = {
  118. REGULATOR_SUPPLY("vdd_int", NULL), /* CPUFREQ */
  119. };
  120. static struct regulator_consumer_supply __initdata buck3_consumer[] = {
  121. REGULATOR_SUPPLY("vdd_g3d", "mali_drm"), /* G3D */
  122. };
  123. static struct regulator_consumer_supply __initdata buck7_consumer[] = {
  124. REGULATOR_SUPPLY("vcc", "platform-lcd"), /* LCD */
  125. };
  126. static struct regulator_init_data __initdata max8997_ldo1_data = {
  127. .constraints = {
  128. .name = "VDD_ABB_3.3V",
  129. .min_uV = 3300000,
  130. .max_uV = 3300000,
  131. .apply_uV = 1,
  132. .state_mem = {
  133. .disabled = 1,
  134. },
  135. },
  136. };
  137. static struct regulator_init_data __initdata max8997_ldo2_data = {
  138. .constraints = {
  139. .name = "VDD_ALIVE_1.1V",
  140. .min_uV = 1100000,
  141. .max_uV = 1100000,
  142. .apply_uV = 1,
  143. .always_on = 1,
  144. .state_mem = {
  145. .enabled = 1,
  146. },
  147. },
  148. };
  149. static struct regulator_init_data __initdata max8997_ldo3_data = {
  150. .constraints = {
  151. .name = "VMIPI_1.1V",
  152. .min_uV = 1100000,
  153. .max_uV = 1100000,
  154. .apply_uV = 1,
  155. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  156. .state_mem = {
  157. .disabled = 1,
  158. },
  159. },
  160. .num_consumer_supplies = ARRAY_SIZE(ldo3_consumer),
  161. .consumer_supplies = ldo3_consumer,
  162. };
  163. static struct regulator_init_data __initdata max8997_ldo4_data = {
  164. .constraints = {
  165. .name = "VDD_RTC_1.8V",
  166. .min_uV = 1800000,
  167. .max_uV = 1800000,
  168. .apply_uV = 1,
  169. .always_on = 1,
  170. .state_mem = {
  171. .disabled = 1,
  172. },
  173. },
  174. };
  175. static struct regulator_init_data __initdata max8997_ldo6_data = {
  176. .constraints = {
  177. .name = "VMIPI_1.8V",
  178. .min_uV = 1800000,
  179. .max_uV = 1800000,
  180. .apply_uV = 1,
  181. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  182. .state_mem = {
  183. .disabled = 1,
  184. },
  185. },
  186. .num_consumer_supplies = ARRAY_SIZE(ldo6_consumer),
  187. .consumer_supplies = ldo6_consumer,
  188. };
  189. static struct regulator_init_data __initdata max8997_ldo7_data = {
  190. .constraints = {
  191. .name = "VDD_AUD_1.8V",
  192. .min_uV = 1800000,
  193. .max_uV = 1800000,
  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(ldo7_consumer),
  201. .consumer_supplies = ldo7_consumer,
  202. };
  203. static struct regulator_init_data __initdata max8997_ldo8_data = {
  204. .constraints = {
  205. .name = "VADC_3.3V",
  206. .min_uV = 3300000,
  207. .max_uV = 3300000,
  208. .apply_uV = 1,
  209. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  210. .state_mem = {
  211. .disabled = 1,
  212. },
  213. },
  214. .num_consumer_supplies = ARRAY_SIZE(ldo8_consumer),
  215. .consumer_supplies = ldo8_consumer,
  216. };
  217. static struct regulator_init_data __initdata max8997_ldo9_data = {
  218. .constraints = {
  219. .name = "DVDD_SWB_2.8V",
  220. .min_uV = 2800000,
  221. .max_uV = 2800000,
  222. .apply_uV = 1,
  223. .always_on = 1,
  224. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  225. .state_mem = {
  226. .disabled = 1,
  227. },
  228. },
  229. .num_consumer_supplies = ARRAY_SIZE(ldo9_consumer),
  230. .consumer_supplies = ldo9_consumer,
  231. };
  232. static struct regulator_init_data __initdata max8997_ldo10_data = {
  233. .constraints = {
  234. .name = "VDD_PLL_1.1V",
  235. .min_uV = 1100000,
  236. .max_uV = 1100000,
  237. .apply_uV = 1,
  238. .always_on = 1,
  239. .state_mem = {
  240. .disabled = 1,
  241. },
  242. },
  243. };
  244. static struct regulator_init_data __initdata max8997_ldo11_data = {
  245. .constraints = {
  246. .name = "VDD_AUD_3V",
  247. .min_uV = 3000000,
  248. .max_uV = 3000000,
  249. .apply_uV = 1,
  250. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  251. .state_mem = {
  252. .disabled = 1,
  253. },
  254. },
  255. .num_consumer_supplies = ARRAY_SIZE(ldo11_consumer),
  256. .consumer_supplies = ldo11_consumer,
  257. };
  258. static struct regulator_init_data __initdata max8997_ldo14_data = {
  259. .constraints = {
  260. .name = "AVDD18_SWB_1.8V",
  261. .min_uV = 1800000,
  262. .max_uV = 1800000,
  263. .apply_uV = 1,
  264. .always_on = 1,
  265. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  266. .state_mem = {
  267. .disabled = 1,
  268. },
  269. },
  270. .num_consumer_supplies = ARRAY_SIZE(ldo14_consumer),
  271. .consumer_supplies = ldo14_consumer,
  272. };
  273. static struct regulator_init_data __initdata max8997_ldo17_data = {
  274. .constraints = {
  275. .name = "VDD_SWB_3.3V",
  276. .min_uV = 3300000,
  277. .max_uV = 3300000,
  278. .apply_uV = 1,
  279. .always_on = 1,
  280. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  281. .state_mem = {
  282. .disabled = 1,
  283. },
  284. },
  285. .num_consumer_supplies = ARRAY_SIZE(ldo17_consumer),
  286. .consumer_supplies = ldo17_consumer,
  287. };
  288. static struct regulator_init_data __initdata max8997_ldo21_data = {
  289. .constraints = {
  290. .name = "VDD_MIF_1.2V",
  291. .min_uV = 1200000,
  292. .max_uV = 1200000,
  293. .apply_uV = 1,
  294. .always_on = 1,
  295. .state_mem = {
  296. .disabled = 1,
  297. },
  298. },
  299. };
  300. static struct regulator_init_data __initdata max8997_buck1_data = {
  301. .constraints = {
  302. .name = "VDD_ARM_1.2V",
  303. .min_uV = 950000,
  304. .max_uV = 1350000,
  305. .always_on = 1,
  306. .boot_on = 1,
  307. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  308. .state_mem = {
  309. .disabled = 1,
  310. },
  311. },
  312. .num_consumer_supplies = ARRAY_SIZE(buck1_consumer),
  313. .consumer_supplies = buck1_consumer,
  314. };
  315. static struct regulator_init_data __initdata max8997_buck2_data = {
  316. .constraints = {
  317. .name = "VDD_INT_1.1V",
  318. .min_uV = 900000,
  319. .max_uV = 1100000,
  320. .always_on = 1,
  321. .boot_on = 1,
  322. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE,
  323. .state_mem = {
  324. .disabled = 1,
  325. },
  326. },
  327. .num_consumer_supplies = ARRAY_SIZE(buck2_consumer),
  328. .consumer_supplies = buck2_consumer,
  329. };
  330. static struct regulator_init_data __initdata max8997_buck3_data = {
  331. .constraints = {
  332. .name = "VDD_G3D_1.1V",
  333. .min_uV = 900000,
  334. .max_uV = 1100000,
  335. .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
  336. REGULATOR_CHANGE_STATUS,
  337. .state_mem = {
  338. .disabled = 1,
  339. },
  340. },
  341. .num_consumer_supplies = ARRAY_SIZE(buck3_consumer),
  342. .consumer_supplies = buck3_consumer,
  343. };
  344. static struct regulator_init_data __initdata max8997_buck5_data = {
  345. .constraints = {
  346. .name = "VDDQ_M1M2_1.2V",
  347. .min_uV = 1200000,
  348. .max_uV = 1200000,
  349. .apply_uV = 1,
  350. .always_on = 1,
  351. .state_mem = {
  352. .disabled = 1,
  353. },
  354. },
  355. };
  356. static struct regulator_init_data __initdata max8997_buck7_data = {
  357. .constraints = {
  358. .name = "VDD_LCD_3.3V",
  359. .min_uV = 3300000,
  360. .max_uV = 3300000,
  361. .boot_on = 1,
  362. .apply_uV = 1,
  363. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  364. .state_mem = {
  365. .disabled = 1
  366. },
  367. },
  368. .num_consumer_supplies = ARRAY_SIZE(buck7_consumer),
  369. .consumer_supplies = buck7_consumer,
  370. };
  371. static struct max8997_regulator_data __initdata origen_max8997_regulators[] = {
  372. { MAX8997_LDO1, &max8997_ldo1_data },
  373. { MAX8997_LDO2, &max8997_ldo2_data },
  374. { MAX8997_LDO3, &max8997_ldo3_data },
  375. { MAX8997_LDO4, &max8997_ldo4_data },
  376. { MAX8997_LDO6, &max8997_ldo6_data },
  377. { MAX8997_LDO7, &max8997_ldo7_data },
  378. { MAX8997_LDO8, &max8997_ldo8_data },
  379. { MAX8997_LDO9, &max8997_ldo9_data },
  380. { MAX8997_LDO10, &max8997_ldo10_data },
  381. { MAX8997_LDO11, &max8997_ldo11_data },
  382. { MAX8997_LDO14, &max8997_ldo14_data },
  383. { MAX8997_LDO17, &max8997_ldo17_data },
  384. { MAX8997_LDO21, &max8997_ldo21_data },
  385. { MAX8997_BUCK1, &max8997_buck1_data },
  386. { MAX8997_BUCK2, &max8997_buck2_data },
  387. { MAX8997_BUCK3, &max8997_buck3_data },
  388. { MAX8997_BUCK5, &max8997_buck5_data },
  389. { MAX8997_BUCK7, &max8997_buck7_data },
  390. };
  391. static struct max8997_platform_data __initdata origen_max8997_pdata = {
  392. .num_regulators = ARRAY_SIZE(origen_max8997_regulators),
  393. .regulators = origen_max8997_regulators,
  394. .wakeup = true,
  395. .buck1_gpiodvs = false,
  396. .buck2_gpiodvs = false,
  397. .buck5_gpiodvs = false,
  398. .ignore_gpiodvs_side_effect = true,
  399. .buck125_default_idx = 0x0,
  400. .buck125_gpios[0] = EXYNOS4_GPX0(0),
  401. .buck125_gpios[1] = EXYNOS4_GPX0(1),
  402. .buck125_gpios[2] = EXYNOS4_GPX0(2),
  403. .buck1_voltage[0] = 1350000,
  404. .buck1_voltage[1] = 1300000,
  405. .buck1_voltage[2] = 1250000,
  406. .buck1_voltage[3] = 1200000,
  407. .buck1_voltage[4] = 1150000,
  408. .buck1_voltage[5] = 1100000,
  409. .buck1_voltage[6] = 1000000,
  410. .buck1_voltage[7] = 950000,
  411. .buck2_voltage[0] = 1100000,
  412. .buck2_voltage[1] = 1100000,
  413. .buck2_voltage[2] = 1100000,
  414. .buck2_voltage[3] = 1100000,
  415. .buck2_voltage[4] = 1000000,
  416. .buck2_voltage[5] = 1000000,
  417. .buck2_voltage[6] = 1000000,
  418. .buck2_voltage[7] = 1000000,
  419. .buck5_voltage[0] = 1200000,
  420. .buck5_voltage[1] = 1200000,
  421. .buck5_voltage[2] = 1200000,
  422. .buck5_voltage[3] = 1200000,
  423. .buck5_voltage[4] = 1200000,
  424. .buck5_voltage[5] = 1200000,
  425. .buck5_voltage[6] = 1200000,
  426. .buck5_voltage[7] = 1200000,
  427. };
  428. /* I2C0 */
  429. static struct i2c_board_info i2c0_devs[] __initdata = {
  430. {
  431. I2C_BOARD_INFO("max8997", (0xCC >> 1)),
  432. .platform_data = &origen_max8997_pdata,
  433. .irq = IRQ_EINT(4),
  434. },
  435. };
  436. static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
  437. .cd_type = S3C_SDHCI_CD_INTERNAL,
  438. };
  439. static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
  440. .cd_type = S3C_SDHCI_CD_INTERNAL,
  441. };
  442. /* USB EHCI */
  443. static struct s5p_ehci_platdata origen_ehci_pdata;
  444. static void __init origen_ehci_init(void)
  445. {
  446. struct s5p_ehci_platdata *pdata = &origen_ehci_pdata;
  447. s5p_ehci_set_platdata(pdata);
  448. }
  449. /* USB OHCI */
  450. static struct exynos4_ohci_platdata origen_ohci_pdata;
  451. static void __init origen_ohci_init(void)
  452. {
  453. struct exynos4_ohci_platdata *pdata = &origen_ohci_pdata;
  454. exynos4_ohci_set_platdata(pdata);
  455. }
  456. /* USB OTG */
  457. static struct s3c_hsotg_plat origen_hsotg_pdata;
  458. static struct gpio_led origen_gpio_leds[] = {
  459. {
  460. .name = "origen::status1",
  461. .default_trigger = "heartbeat",
  462. .gpio = EXYNOS4_GPX1(3),
  463. .active_low = 1,
  464. },
  465. {
  466. .name = "origen::status2",
  467. .default_trigger = "mmc0",
  468. .gpio = EXYNOS4_GPX1(4),
  469. .active_low = 1,
  470. },
  471. };
  472. static struct gpio_led_platform_data origen_gpio_led_info = {
  473. .leds = origen_gpio_leds,
  474. .num_leds = ARRAY_SIZE(origen_gpio_leds),
  475. };
  476. static struct platform_device origen_leds_gpio = {
  477. .name = "leds-gpio",
  478. .id = -1,
  479. .dev = {
  480. .platform_data = &origen_gpio_led_info,
  481. },
  482. };
  483. static struct gpio_keys_button origen_gpio_keys_table[] = {
  484. {
  485. .code = KEY_MENU,
  486. .gpio = EXYNOS4_GPX1(5),
  487. .desc = "gpio-keys: KEY_MENU",
  488. .type = EV_KEY,
  489. .active_low = 1,
  490. .wakeup = 1,
  491. .debounce_interval = 1,
  492. }, {
  493. .code = KEY_HOME,
  494. .gpio = EXYNOS4_GPX1(6),
  495. .desc = "gpio-keys: KEY_HOME",
  496. .type = EV_KEY,
  497. .active_low = 1,
  498. .wakeup = 1,
  499. .debounce_interval = 1,
  500. }, {
  501. .code = KEY_BACK,
  502. .gpio = EXYNOS4_GPX1(7),
  503. .desc = "gpio-keys: KEY_BACK",
  504. .type = EV_KEY,
  505. .active_low = 1,
  506. .wakeup = 1,
  507. .debounce_interval = 1,
  508. }, {
  509. .code = KEY_UP,
  510. .gpio = EXYNOS4_GPX2(0),
  511. .desc = "gpio-keys: KEY_UP",
  512. .type = EV_KEY,
  513. .active_low = 1,
  514. .wakeup = 1,
  515. .debounce_interval = 1,
  516. }, {
  517. .code = KEY_DOWN,
  518. .gpio = EXYNOS4_GPX2(1),
  519. .desc = "gpio-keys: KEY_DOWN",
  520. .type = EV_KEY,
  521. .active_low = 1,
  522. .wakeup = 1,
  523. .debounce_interval = 1,
  524. },
  525. };
  526. static struct gpio_keys_platform_data origen_gpio_keys_data = {
  527. .buttons = origen_gpio_keys_table,
  528. .nbuttons = ARRAY_SIZE(origen_gpio_keys_table),
  529. };
  530. static struct platform_device origen_device_gpiokeys = {
  531. .name = "gpio-keys",
  532. .dev = {
  533. .platform_data = &origen_gpio_keys_data,
  534. },
  535. };
  536. static void lcd_hv070wsa_set_power(struct plat_lcd_data *pd, unsigned int power)
  537. {
  538. int ret;
  539. if (power)
  540. ret = gpio_request_one(EXYNOS4_GPE3(4),
  541. GPIOF_OUT_INIT_HIGH, "GPE3_4");
  542. else
  543. ret = gpio_request_one(EXYNOS4_GPE3(4),
  544. GPIOF_OUT_INIT_LOW, "GPE3_4");
  545. gpio_free(EXYNOS4_GPE3(4));
  546. if (ret)
  547. pr_err("failed to request gpio for LCD power: %d\n", ret);
  548. }
  549. static struct plat_lcd_data origen_lcd_hv070wsa_data = {
  550. .set_power = lcd_hv070wsa_set_power,
  551. };
  552. static struct platform_device origen_lcd_hv070wsa = {
  553. .name = "platform-lcd",
  554. .dev.parent = &s5p_device_fimd0.dev,
  555. .dev.platform_data = &origen_lcd_hv070wsa_data,
  556. };
  557. #ifdef CONFIG_DRM_EXYNOS
  558. static struct exynos_drm_fimd_pdata drm_fimd_pdata = {
  559. .panel = {
  560. .timing = {
  561. .left_margin = 64,
  562. .right_margin = 16,
  563. .upper_margin = 64,
  564. .lower_margin = 16,
  565. .hsync_len = 48,
  566. .vsync_len = 3,
  567. .xres = 1024,
  568. .yres = 600,
  569. },
  570. },
  571. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  572. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  573. VIDCON1_INV_VCLK,
  574. .default_win = 0,
  575. .bpp = 32,
  576. };
  577. #else
  578. static struct s3c_fb_pd_win origen_fb_win0 = {
  579. .xres = 1024,
  580. .yres = 600,
  581. .max_bpp = 32,
  582. .default_bpp = 24,
  583. .virtual_x = 1024,
  584. .virtual_y = 2 * 600,
  585. };
  586. static struct fb_videomode origen_lcd_timing = {
  587. .left_margin = 64,
  588. .right_margin = 16,
  589. .upper_margin = 64,
  590. .lower_margin = 16,
  591. .hsync_len = 48,
  592. .vsync_len = 3,
  593. .xres = 1024,
  594. .yres = 600,
  595. };
  596. static struct s3c_fb_platdata origen_lcd_pdata __initdata = {
  597. .win[0] = &origen_fb_win0,
  598. .vtiming = &origen_lcd_timing,
  599. .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
  600. .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC |
  601. VIDCON1_INV_VCLK,
  602. .setup_gpio = exynos4_fimd0_gpio_setup_24bpp,
  603. };
  604. #endif
  605. /* Bluetooth rfkill gpio platform data */
  606. static struct rfkill_gpio_platform_data origen_bt_pdata = {
  607. .reset_gpio = EXYNOS4_GPX2(2),
  608. .shutdown_gpio = -1,
  609. .type = RFKILL_TYPE_BLUETOOTH,
  610. .name = "origen-bt",
  611. };
  612. /* Bluetooth Platform device */
  613. static struct platform_device origen_device_bluetooth = {
  614. .name = "rfkill_gpio",
  615. .id = -1,
  616. .dev = {
  617. .platform_data = &origen_bt_pdata,
  618. },
  619. };
  620. static struct platform_device *origen_devices[] __initdata = {
  621. &s3c_device_hsmmc2,
  622. &s3c_device_hsmmc0,
  623. &s3c_device_i2c0,
  624. &s3c_device_rtc,
  625. &s3c_device_usb_hsotg,
  626. &s3c_device_wdt,
  627. &s5p_device_ehci,
  628. &s5p_device_fimc0,
  629. &s5p_device_fimc1,
  630. &s5p_device_fimc2,
  631. &s5p_device_fimc3,
  632. &s5p_device_fimc_md,
  633. &s5p_device_fimd0,
  634. &s5p_device_g2d,
  635. &s5p_device_hdmi,
  636. &s5p_device_i2c_hdmiphy,
  637. &s5p_device_jpeg,
  638. &s5p_device_mfc,
  639. &s5p_device_mfc_l,
  640. &s5p_device_mfc_r,
  641. &s5p_device_mixer,
  642. #ifdef CONFIG_DRM_EXYNOS
  643. &exynos_device_drm,
  644. #endif
  645. &exynos4_device_ohci,
  646. &origen_device_gpiokeys,
  647. &origen_lcd_hv070wsa,
  648. &origen_leds_gpio,
  649. &origen_device_bluetooth,
  650. };
  651. /* LCD Backlight data */
  652. static struct samsung_bl_gpio_info origen_bl_gpio_info = {
  653. .no = EXYNOS4_GPD0(0),
  654. .func = S3C_GPIO_SFN(2),
  655. };
  656. static struct platform_pwm_backlight_data origen_bl_data = {
  657. .pwm_id = 0,
  658. .pwm_period_ns = 1000,
  659. };
  660. static void __init origen_bt_setup(void)
  661. {
  662. gpio_request(EXYNOS4_GPA0(0), "GPIO BT_UART");
  663. /* 4 UART Pins configuration */
  664. s3c_gpio_cfgrange_nopull(EXYNOS4_GPA0(0), 4, S3C_GPIO_SFN(2));
  665. /* Setup BT Reset, this gpio will be requesed by rfkill-gpio */
  666. s3c_gpio_cfgpin(EXYNOS4_GPX2(2), S3C_GPIO_OUTPUT);
  667. s3c_gpio_setpull(EXYNOS4_GPX2(2), S3C_GPIO_PULL_NONE);
  668. }
  669. /* I2C module and id for HDMIPHY */
  670. static struct i2c_board_info hdmiphy_info = {
  671. I2C_BOARD_INFO("hdmiphy-exynos4210", 0x38),
  672. };
  673. static void s5p_tv_setup(void)
  674. {
  675. /* Direct HPD to HDMI chip */
  676. gpio_request_one(EXYNOS4_GPX3(7), GPIOF_IN, "hpd-plug");
  677. s3c_gpio_cfgpin(EXYNOS4_GPX3(7), S3C_GPIO_SFN(0x3));
  678. s3c_gpio_setpull(EXYNOS4_GPX3(7), S3C_GPIO_PULL_NONE);
  679. }
  680. static void __init origen_map_io(void)
  681. {
  682. exynos_init_io(NULL, 0);
  683. s3c24xx_init_clocks(clk_xusbxti.rate);
  684. s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs));
  685. }
  686. static void __init origen_power_init(void)
  687. {
  688. gpio_request(EXYNOS4_GPX0(4), "PMIC_IRQ");
  689. s3c_gpio_cfgpin(EXYNOS4_GPX0(4), S3C_GPIO_SFN(0xf));
  690. s3c_gpio_setpull(EXYNOS4_GPX0(4), S3C_GPIO_PULL_NONE);
  691. }
  692. static void __init origen_reserve(void)
  693. {
  694. s5p_mfc_reserve_mem(0x43000000, 8 << 20, 0x51000000, 8 << 20);
  695. }
  696. static void __init origen_machine_init(void)
  697. {
  698. origen_power_init();
  699. s3c_i2c0_set_platdata(NULL);
  700. i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
  701. /*
  702. * Since sdhci instance 2 can contain a bootable media,
  703. * sdhci instance 0 is registered after instance 2.
  704. */
  705. s3c_sdhci2_set_platdata(&origen_hsmmc2_pdata);
  706. s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
  707. origen_ehci_init();
  708. origen_ohci_init();
  709. s3c_hsotg_set_platdata(&origen_hsotg_pdata);
  710. s5p_tv_setup();
  711. s5p_i2c_hdmiphy_set_platdata(NULL);
  712. s5p_hdmi_set_platdata(&hdmiphy_info, NULL, 0);
  713. #ifdef CONFIG_DRM_EXYNOS
  714. s5p_device_fimd0.dev.platform_data = &drm_fimd_pdata;
  715. exynos4_fimd0_gpio_setup_24bpp();
  716. #else
  717. s5p_fimd0_set_platdata(&origen_lcd_pdata);
  718. #endif
  719. platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
  720. samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data);
  721. origen_bt_setup();
  722. }
  723. MACHINE_START(ORIGEN, "ORIGEN")
  724. /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
  725. .atag_offset = 0x100,
  726. .init_irq = exynos4_init_irq,
  727. .map_io = origen_map_io,
  728. .handle_irq = gic_handle_irq,
  729. .init_machine = origen_machine_init,
  730. .init_late = exynos_init_late,
  731. .timer = &exynos4_timer,
  732. .reserve = &origen_reserve,
  733. .restart = exynos4_restart,
  734. MACHINE_END