mach-universal_c210.c 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /* linux/arch/arm/mach-s5pv310/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/regulator/machine.h>
  16. #include <linux/regulator/fixed.h>
  17. #include <linux/mmc/host.h>
  18. #include <asm/mach/arch.h>
  19. #include <asm/mach-types.h>
  20. #include <plat/regs-serial.h>
  21. #include <plat/s5pv310.h>
  22. #include <plat/cpu.h>
  23. #include <plat/devs.h>
  24. #include <plat/sdhci.h>
  25. #include <mach/map.h>
  26. /* Following are default values for UCON, ULCON and UFCON UART registers */
  27. #define UNIVERSAL_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  28. S3C2410_UCON_RXILEVEL | \
  29. S3C2410_UCON_TXIRQMODE | \
  30. S3C2410_UCON_RXIRQMODE | \
  31. S3C2410_UCON_RXFIFO_TOI | \
  32. S3C2443_UCON_RXERR_IRQEN)
  33. #define UNIVERSAL_ULCON_DEFAULT S3C2410_LCON_CS8
  34. #define UNIVERSAL_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  35. S5PV210_UFCON_TXTRIG256 | \
  36. S5PV210_UFCON_RXTRIG256)
  37. static struct s3c2410_uartcfg universal_uartcfgs[] __initdata = {
  38. [0] = {
  39. .hwport = 0,
  40. .ucon = UNIVERSAL_UCON_DEFAULT,
  41. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  42. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  43. },
  44. [1] = {
  45. .hwport = 1,
  46. .ucon = UNIVERSAL_UCON_DEFAULT,
  47. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  48. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  49. },
  50. [2] = {
  51. .hwport = 2,
  52. .ucon = UNIVERSAL_UCON_DEFAULT,
  53. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  54. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  55. },
  56. [3] = {
  57. .hwport = 3,
  58. .ucon = UNIVERSAL_UCON_DEFAULT,
  59. .ulcon = UNIVERSAL_ULCON_DEFAULT,
  60. .ufcon = UNIVERSAL_UFCON_DEFAULT,
  61. },
  62. };
  63. static struct gpio_keys_button universal_gpio_keys_tables[] = {
  64. {
  65. .code = KEY_VOLUMEUP,
  66. .gpio = S5PV310_GPX2(0), /* XEINT16 */
  67. .desc = "gpio-keys: KEY_VOLUMEUP",
  68. .type = EV_KEY,
  69. .active_low = 1,
  70. .debounce_interval = 1,
  71. }, {
  72. .code = KEY_VOLUMEDOWN,
  73. .gpio = S5PV310_GPX2(1), /* XEINT17 */
  74. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  75. .type = EV_KEY,
  76. .active_low = 1,
  77. .debounce_interval = 1,
  78. }, {
  79. .code = KEY_CONFIG,
  80. .gpio = S5PV310_GPX2(2), /* XEINT18 */
  81. .desc = "gpio-keys: KEY_CONFIG",
  82. .type = EV_KEY,
  83. .active_low = 1,
  84. .debounce_interval = 1,
  85. }, {
  86. .code = KEY_CAMERA,
  87. .gpio = S5PV310_GPX2(3), /* XEINT19 */
  88. .desc = "gpio-keys: KEY_CAMERA",
  89. .type = EV_KEY,
  90. .active_low = 1,
  91. .debounce_interval = 1,
  92. }, {
  93. .code = KEY_OK,
  94. .gpio = S5PV310_GPX3(5), /* XEINT29 */
  95. .desc = "gpio-keys: KEY_OK",
  96. .type = EV_KEY,
  97. .active_low = 1,
  98. .debounce_interval = 1,
  99. },
  100. };
  101. static struct gpio_keys_platform_data universal_gpio_keys_data = {
  102. .buttons = universal_gpio_keys_tables,
  103. .nbuttons = ARRAY_SIZE(universal_gpio_keys_tables),
  104. };
  105. static struct platform_device universal_gpio_keys = {
  106. .name = "gpio-keys",
  107. .dev = {
  108. .platform_data = &universal_gpio_keys_data,
  109. },
  110. };
  111. /* eMMC */
  112. static struct s3c_sdhci_platdata universal_hsmmc0_data __initdata = {
  113. .max_width = 8,
  114. .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
  115. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  116. MMC_CAP_DISABLE),
  117. .cd_type = S3C_SDHCI_CD_PERMANENT,
  118. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  119. };
  120. static struct regulator_consumer_supply mmc0_supplies[] = {
  121. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  122. };
  123. static struct regulator_init_data mmc0_fixed_voltage_init_data = {
  124. .constraints = {
  125. .name = "VMEM_VDD_2.8V",
  126. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  127. },
  128. .num_consumer_supplies = ARRAY_SIZE(mmc0_supplies),
  129. .consumer_supplies = mmc0_supplies,
  130. };
  131. static struct fixed_voltage_config mmc0_fixed_voltage_config = {
  132. .supply_name = "MASSMEMORY_EN",
  133. .microvolts = 2800000,
  134. .gpio = S5PV310_GPE1(3),
  135. .enable_high = true,
  136. .init_data = &mmc0_fixed_voltage_init_data,
  137. };
  138. static struct platform_device mmc0_fixed_voltage = {
  139. .name = "reg-fixed-voltage",
  140. .id = 0,
  141. .dev = {
  142. .platform_data = &mmc0_fixed_voltage_config,
  143. },
  144. };
  145. /* SD */
  146. static struct s3c_sdhci_platdata universal_hsmmc2_data __initdata = {
  147. .max_width = 4,
  148. .host_caps = MMC_CAP_4_BIT_DATA |
  149. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  150. MMC_CAP_DISABLE,
  151. .ext_cd_gpio = S5PV310_GPX3(4), /* XEINT_28 */
  152. .ext_cd_gpio_invert = 1,
  153. .cd_type = S3C_SDHCI_CD_GPIO,
  154. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  155. };
  156. /* WiFi */
  157. static struct s3c_sdhci_platdata universal_hsmmc3_data __initdata = {
  158. .max_width = 4,
  159. .host_caps = MMC_CAP_4_BIT_DATA |
  160. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  161. MMC_CAP_DISABLE,
  162. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  163. };
  164. static void __init universal_sdhci_init(void)
  165. {
  166. s3c_sdhci0_set_platdata(&universal_hsmmc0_data);
  167. s3c_sdhci2_set_platdata(&universal_hsmmc2_data);
  168. s3c_sdhci3_set_platdata(&universal_hsmmc3_data);
  169. }
  170. /* I2C0 */
  171. static struct i2c_board_info i2c0_devs[] __initdata = {
  172. /* Camera, To be updated */
  173. };
  174. /* I2C1 */
  175. static struct i2c_board_info i2c1_devs[] __initdata = {
  176. /* Gyro, To be updated */
  177. };
  178. static struct platform_device *universal_devices[] __initdata = {
  179. /* Samsung Platform Devices */
  180. &mmc0_fixed_voltage,
  181. &s3c_device_hsmmc0,
  182. &s3c_device_hsmmc2,
  183. &s3c_device_hsmmc3,
  184. /* Universal Devices */
  185. &universal_gpio_keys,
  186. &s5p_device_onenand,
  187. };
  188. static void __init universal_map_io(void)
  189. {
  190. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  191. s3c24xx_init_clocks(24000000);
  192. s3c24xx_init_uarts(universal_uartcfgs, ARRAY_SIZE(universal_uartcfgs));
  193. }
  194. static void __init universal_machine_init(void)
  195. {
  196. universal_sdhci_init();
  197. i2c_register_board_info(0, i2c0_devs, ARRAY_SIZE(i2c0_devs));
  198. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  199. /* Last */
  200. platform_add_devices(universal_devices, ARRAY_SIZE(universal_devices));
  201. }
  202. MACHINE_START(UNIVERSAL_C210, "UNIVERSAL_C210")
  203. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  204. .boot_params = S5P_PA_SDRAM + 0x100,
  205. .init_irq = s5pv310_init_irq,
  206. .map_io = universal_map_io,
  207. .init_machine = universal_machine_init,
  208. .timer = &s5pv310_timer,
  209. MACHINE_END