mach-origen.c 20 KB

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