mach-origen.c 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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/gpio.h>
  12. #include <linux/mmc/host.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/io.h>
  15. #include <linux/input.h>
  16. #include <linux/pwm_backlight.h>
  17. #include <linux/gpio_keys.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach-types.h>
  20. #include <plat/regs-serial.h>
  21. #include <plat/exynos4.h>
  22. #include <plat/cpu.h>
  23. #include <plat/devs.h>
  24. #include <plat/sdhci.h>
  25. #include <plat/iic.h>
  26. #include <plat/ehci.h>
  27. #include <plat/clock.h>
  28. #include <plat/gpio-cfg.h>
  29. #include <plat/backlight.h>
  30. #include <mach/map.h>
  31. /* Following are default values for UCON, ULCON and UFCON UART registers */
  32. #define ORIGEN_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  33. S3C2410_UCON_RXILEVEL | \
  34. S3C2410_UCON_TXIRQMODE | \
  35. S3C2410_UCON_RXIRQMODE | \
  36. S3C2410_UCON_RXFIFO_TOI | \
  37. S3C2443_UCON_RXERR_IRQEN)
  38. #define ORIGEN_ULCON_DEFAULT S3C2410_LCON_CS8
  39. #define ORIGEN_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  40. S5PV210_UFCON_TXTRIG4 | \
  41. S5PV210_UFCON_RXTRIG4)
  42. static struct s3c2410_uartcfg origen_uartcfgs[] __initdata = {
  43. [0] = {
  44. .hwport = 0,
  45. .flags = 0,
  46. .ucon = ORIGEN_UCON_DEFAULT,
  47. .ulcon = ORIGEN_ULCON_DEFAULT,
  48. .ufcon = ORIGEN_UFCON_DEFAULT,
  49. },
  50. [1] = {
  51. .hwport = 1,
  52. .flags = 0,
  53. .ucon = ORIGEN_UCON_DEFAULT,
  54. .ulcon = ORIGEN_ULCON_DEFAULT,
  55. .ufcon = ORIGEN_UFCON_DEFAULT,
  56. },
  57. [2] = {
  58. .hwport = 2,
  59. .flags = 0,
  60. .ucon = ORIGEN_UCON_DEFAULT,
  61. .ulcon = ORIGEN_ULCON_DEFAULT,
  62. .ufcon = ORIGEN_UFCON_DEFAULT,
  63. },
  64. [3] = {
  65. .hwport = 3,
  66. .flags = 0,
  67. .ucon = ORIGEN_UCON_DEFAULT,
  68. .ulcon = ORIGEN_ULCON_DEFAULT,
  69. .ufcon = ORIGEN_UFCON_DEFAULT,
  70. },
  71. };
  72. static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
  73. .cd_type = S3C_SDHCI_CD_INTERNAL,
  74. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  75. };
  76. static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
  77. .cd_type = S3C_SDHCI_CD_INTERNAL,
  78. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  79. };
  80. /* USB EHCI */
  81. static struct s5p_ehci_platdata origen_ehci_pdata;
  82. static void __init origen_ehci_init(void)
  83. {
  84. struct s5p_ehci_platdata *pdata = &origen_ehci_pdata;
  85. s5p_ehci_set_platdata(pdata);
  86. }
  87. static struct gpio_keys_button origen_gpio_keys_table[] = {
  88. {
  89. .code = KEY_MENU,
  90. .gpio = EXYNOS4_GPX1(5),
  91. .desc = "gpio-keys: KEY_MENU",
  92. .type = EV_KEY,
  93. .active_low = 1,
  94. .wakeup = 1,
  95. .debounce_interval = 1,
  96. }, {
  97. .code = KEY_HOME,
  98. .gpio = EXYNOS4_GPX1(6),
  99. .desc = "gpio-keys: KEY_HOME",
  100. .type = EV_KEY,
  101. .active_low = 1,
  102. .wakeup = 1,
  103. .debounce_interval = 1,
  104. }, {
  105. .code = KEY_BACK,
  106. .gpio = EXYNOS4_GPX1(7),
  107. .desc = "gpio-keys: KEY_BACK",
  108. .type = EV_KEY,
  109. .active_low = 1,
  110. .wakeup = 1,
  111. .debounce_interval = 1,
  112. }, {
  113. .code = KEY_UP,
  114. .gpio = EXYNOS4_GPX2(0),
  115. .desc = "gpio-keys: KEY_UP",
  116. .type = EV_KEY,
  117. .active_low = 1,
  118. .wakeup = 1,
  119. .debounce_interval = 1,
  120. }, {
  121. .code = KEY_DOWN,
  122. .gpio = EXYNOS4_GPX2(1),
  123. .desc = "gpio-keys: KEY_DOWN",
  124. .type = EV_KEY,
  125. .active_low = 1,
  126. .wakeup = 1,
  127. .debounce_interval = 1,
  128. },
  129. };
  130. static struct gpio_keys_platform_data origen_gpio_keys_data = {
  131. .buttons = origen_gpio_keys_table,
  132. .nbuttons = ARRAY_SIZE(origen_gpio_keys_table),
  133. };
  134. static struct platform_device origen_device_gpiokeys = {
  135. .name = "gpio-keys",
  136. .dev = {
  137. .platform_data = &origen_gpio_keys_data,
  138. },
  139. };
  140. static struct platform_device *origen_devices[] __initdata = {
  141. &s3c_device_hsmmc2,
  142. &s3c_device_hsmmc0,
  143. &s3c_device_rtc,
  144. &s3c_device_wdt,
  145. &s5p_device_ehci,
  146. &s5p_device_fimc0,
  147. &s5p_device_fimc1,
  148. &s5p_device_fimc2,
  149. &s5p_device_fimc3,
  150. &origen_device_gpiokeys,
  151. };
  152. /* LCD Backlight data */
  153. static struct samsung_bl_gpio_info origen_bl_gpio_info = {
  154. .no = EXYNOS4_GPD0(0),
  155. .func = S3C_GPIO_SFN(2),
  156. };
  157. static struct platform_pwm_backlight_data origen_bl_data = {
  158. .pwm_id = 0,
  159. .pwm_period_ns = 1000,
  160. };
  161. static void __init origen_map_io(void)
  162. {
  163. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  164. s3c24xx_init_clocks(24000000);
  165. s3c24xx_init_uarts(origen_uartcfgs, ARRAY_SIZE(origen_uartcfgs));
  166. }
  167. static void __init origen_machine_init(void)
  168. {
  169. /*
  170. * Since sdhci instance 2 can contain a bootable media,
  171. * sdhci instance 0 is registered after instance 2.
  172. */
  173. s3c_sdhci2_set_platdata(&origen_hsmmc2_pdata);
  174. s3c_sdhci0_set_platdata(&origen_hsmmc0_pdata);
  175. origen_ehci_init();
  176. clk_xusbxti.rate = 24000000;
  177. platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
  178. samsung_bl_set(&origen_bl_gpio_info, &origen_bl_data);
  179. }
  180. MACHINE_START(ORIGEN, "ORIGEN")
  181. /* Maintainer: JeongHyeon Kim <jhkim@insignal.co.kr> */
  182. .boot_params = S5P_PA_SDRAM + 0x100,
  183. .init_irq = exynos4_init_irq,
  184. .map_io = origen_map_io,
  185. .init_machine = origen_machine_init,
  186. .timer = &exynos4_timer,
  187. MACHINE_END