mach-origen.c 20 KB

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