mach-nuri.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. /*
  2. * linux/arch/arm/mach-exynos4/mach-nuri.c
  3. *
  4. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  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/platform_device.h>
  11. #include <linux/serial_core.h>
  12. #include <linux/input.h>
  13. #include <linux/i2c.h>
  14. #include <linux/gpio_keys.h>
  15. #include <linux/gpio.h>
  16. #include <linux/regulator/machine.h>
  17. #include <linux/regulator/fixed.h>
  18. #include <linux/mmc/host.h>
  19. #include <asm/mach/arch.h>
  20. #include <asm/mach-types.h>
  21. #include <plat/regs-serial.h>
  22. #include <plat/exynos4.h>
  23. #include <plat/cpu.h>
  24. #include <plat/devs.h>
  25. #include <plat/sdhci.h>
  26. #include <mach/map.h>
  27. /* Following are default values for UCON, ULCON and UFCON UART registers */
  28. #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  29. S3C2410_UCON_RXILEVEL | \
  30. S3C2410_UCON_TXIRQMODE | \
  31. S3C2410_UCON_RXIRQMODE | \
  32. S3C2410_UCON_RXFIFO_TOI | \
  33. S3C2443_UCON_RXERR_IRQEN)
  34. #define NURI_ULCON_DEFAULT S3C2410_LCON_CS8
  35. #define NURI_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  36. S5PV210_UFCON_TXTRIG256 | \
  37. S5PV210_UFCON_RXTRIG256)
  38. enum fixed_regulator_id {
  39. FIXED_REG_ID_MMC = 0,
  40. };
  41. static struct s3c2410_uartcfg nuri_uartcfgs[] __initdata = {
  42. {
  43. .hwport = 0,
  44. .ucon = NURI_UCON_DEFAULT,
  45. .ulcon = NURI_ULCON_DEFAULT,
  46. .ufcon = NURI_UFCON_DEFAULT,
  47. },
  48. {
  49. .hwport = 1,
  50. .ucon = NURI_UCON_DEFAULT,
  51. .ulcon = NURI_ULCON_DEFAULT,
  52. .ufcon = NURI_UFCON_DEFAULT,
  53. },
  54. {
  55. .hwport = 2,
  56. .ucon = NURI_UCON_DEFAULT,
  57. .ulcon = NURI_ULCON_DEFAULT,
  58. .ufcon = NURI_UFCON_DEFAULT,
  59. },
  60. {
  61. .hwport = 3,
  62. .ucon = NURI_UCON_DEFAULT,
  63. .ulcon = NURI_ULCON_DEFAULT,
  64. .ufcon = NURI_UFCON_DEFAULT,
  65. },
  66. };
  67. /* eMMC */
  68. static struct s3c_sdhci_platdata nuri_hsmmc0_data __initdata = {
  69. .max_width = 8,
  70. .host_caps = (MMC_CAP_8_BIT_DATA | MMC_CAP_4_BIT_DATA |
  71. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  72. MMC_CAP_DISABLE | MMC_CAP_ERASE),
  73. .cd_type = S3C_SDHCI_CD_PERMANENT,
  74. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  75. };
  76. static struct regulator_consumer_supply emmc_supplies[] = {
  77. REGULATOR_SUPPLY("vmmc", "s3c-sdhci.0"),
  78. REGULATOR_SUPPLY("vmmc", "dw_mmc"),
  79. };
  80. static struct regulator_init_data emmc_fixed_voltage_init_data = {
  81. .constraints = {
  82. .name = "VMEM_VDD_2.8V",
  83. .valid_ops_mask = REGULATOR_CHANGE_STATUS,
  84. },
  85. .num_consumer_supplies = ARRAY_SIZE(emmc_supplies),
  86. .consumer_supplies = emmc_supplies,
  87. };
  88. static struct fixed_voltage_config emmc_fixed_voltage_config = {
  89. .supply_name = "MASSMEMORY_EN (inverted)",
  90. .microvolts = 2800000,
  91. .gpio = EXYNOS4_GPL1(1),
  92. .enable_high = false,
  93. .init_data = &emmc_fixed_voltage_init_data,
  94. };
  95. static struct platform_device emmc_fixed_voltage = {
  96. .name = "reg-fixed-voltage",
  97. .id = FIXED_REG_ID_MMC,
  98. .dev = {
  99. .platform_data = &emmc_fixed_voltage_config,
  100. },
  101. };
  102. /* SD */
  103. static struct s3c_sdhci_platdata nuri_hsmmc2_data __initdata = {
  104. .max_width = 4,
  105. .host_caps = MMC_CAP_4_BIT_DATA |
  106. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED |
  107. MMC_CAP_DISABLE,
  108. .ext_cd_gpio = EXYNOS4_GPX3(3), /* XEINT_27 */
  109. .ext_cd_gpio_invert = 1,
  110. .cd_type = S3C_SDHCI_CD_GPIO,
  111. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  112. };
  113. /* WLAN */
  114. static struct s3c_sdhci_platdata nuri_hsmmc3_data __initdata = {
  115. .max_width = 4,
  116. .host_caps = MMC_CAP_4_BIT_DATA |
  117. MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED,
  118. .cd_type = S3C_SDHCI_CD_EXTERNAL,
  119. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  120. };
  121. static void __init nuri_sdhci_init(void)
  122. {
  123. s3c_sdhci0_set_platdata(&nuri_hsmmc0_data);
  124. s3c_sdhci2_set_platdata(&nuri_hsmmc2_data);
  125. s3c_sdhci3_set_platdata(&nuri_hsmmc3_data);
  126. }
  127. /* GPIO KEYS */
  128. static struct gpio_keys_button nuri_gpio_keys_tables[] = {
  129. {
  130. .code = KEY_VOLUMEUP,
  131. .gpio = EXYNOS4_GPX2(0), /* XEINT16 */
  132. .desc = "gpio-keys: KEY_VOLUMEUP",
  133. .type = EV_KEY,
  134. .active_low = 1,
  135. .debounce_interval = 1,
  136. }, {
  137. .code = KEY_VOLUMEDOWN,
  138. .gpio = EXYNOS4_GPX2(1), /* XEINT17 */
  139. .desc = "gpio-keys: KEY_VOLUMEDOWN",
  140. .type = EV_KEY,
  141. .active_low = 1,
  142. .debounce_interval = 1,
  143. }, {
  144. .code = KEY_POWER,
  145. .gpio = EXYNOS4_GPX2(7), /* XEINT23 */
  146. .desc = "gpio-keys: KEY_POWER",
  147. .type = EV_KEY,
  148. .active_low = 1,
  149. .wakeup = 1,
  150. .debounce_interval = 1,
  151. },
  152. };
  153. static struct gpio_keys_platform_data nuri_gpio_keys_data = {
  154. .buttons = nuri_gpio_keys_tables,
  155. .nbuttons = ARRAY_SIZE(nuri_gpio_keys_tables),
  156. };
  157. static struct platform_device nuri_gpio_keys = {
  158. .name = "gpio-keys",
  159. .dev = {
  160. .platform_data = &nuri_gpio_keys_data,
  161. },
  162. };
  163. /* I2C1 */
  164. static struct i2c_board_info i2c1_devs[] __initdata = {
  165. /* Gyro, To be updated */
  166. };
  167. /* GPIO I2C 5 (PMIC) */
  168. static struct i2c_board_info i2c5_devs[] __initdata = {
  169. /* max8997, To be updated */
  170. };
  171. static struct platform_device *nuri_devices[] __initdata = {
  172. /* Samsung Platform Devices */
  173. &emmc_fixed_voltage,
  174. &s3c_device_hsmmc0,
  175. &s3c_device_hsmmc2,
  176. &s3c_device_hsmmc3,
  177. &s3c_device_wdt,
  178. /* NURI Devices */
  179. &nuri_gpio_keys,
  180. };
  181. static void __init nuri_map_io(void)
  182. {
  183. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  184. s3c24xx_init_clocks(24000000);
  185. s3c24xx_init_uarts(nuri_uartcfgs, ARRAY_SIZE(nuri_uartcfgs));
  186. }
  187. static void __init nuri_machine_init(void)
  188. {
  189. nuri_sdhci_init();
  190. i2c_register_board_info(1, i2c1_devs, ARRAY_SIZE(i2c1_devs));
  191. i2c_register_board_info(5, i2c5_devs, ARRAY_SIZE(i2c5_devs));
  192. /* Last */
  193. platform_add_devices(nuri_devices, ARRAY_SIZE(nuri_devices));
  194. }
  195. MACHINE_START(NURI, "NURI")
  196. /* Maintainer: Kyungmin Park <kyungmin.park@samsung.com> */
  197. .boot_params = S5P_PA_SDRAM + 0x100,
  198. .init_irq = exynos4_init_irq,
  199. .map_io = nuri_map_io,
  200. .init_machine = nuri_machine_init,
  201. .timer = &exynos4_timer,
  202. MACHINE_END