mach-armlex4210.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. /* linux/arch/arm/mach-exynos4/mach-armlex4210.c
  2. *
  3. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  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/gpio.h>
  11. #include <linux/io.h>
  12. #include <linux/mmc/host.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/serial_core.h>
  15. #include <linux/smsc911x.h>
  16. #include <asm/mach/arch.h>
  17. #include <asm/mach-types.h>
  18. #include <plat/cpu.h>
  19. #include <plat/devs.h>
  20. #include <plat/gpio-cfg.h>
  21. #include <plat/regs-serial.h>
  22. #include <plat/regs-srom.h>
  23. #include <plat/sdhci.h>
  24. #include <mach/map.h>
  25. #include "common.h"
  26. /* Following are default values for UCON, ULCON and UFCON UART registers */
  27. #define ARMLEX4210_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 ARMLEX4210_ULCON_DEFAULT S3C2410_LCON_CS8
  34. #define ARMLEX4210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  35. S5PV210_UFCON_TXTRIG4 | \
  36. S5PV210_UFCON_RXTRIG4)
  37. static struct s3c2410_uartcfg armlex4210_uartcfgs[] __initdata = {
  38. [0] = {
  39. .hwport = 0,
  40. .flags = 0,
  41. .ucon = ARMLEX4210_UCON_DEFAULT,
  42. .ulcon = ARMLEX4210_ULCON_DEFAULT,
  43. .ufcon = ARMLEX4210_UFCON_DEFAULT,
  44. },
  45. [1] = {
  46. .hwport = 1,
  47. .flags = 0,
  48. .ucon = ARMLEX4210_UCON_DEFAULT,
  49. .ulcon = ARMLEX4210_ULCON_DEFAULT,
  50. .ufcon = ARMLEX4210_UFCON_DEFAULT,
  51. },
  52. [2] = {
  53. .hwport = 2,
  54. .flags = 0,
  55. .ucon = ARMLEX4210_UCON_DEFAULT,
  56. .ulcon = ARMLEX4210_ULCON_DEFAULT,
  57. .ufcon = ARMLEX4210_UFCON_DEFAULT,
  58. },
  59. [3] = {
  60. .hwport = 3,
  61. .flags = 0,
  62. .ucon = ARMLEX4210_UCON_DEFAULT,
  63. .ulcon = ARMLEX4210_ULCON_DEFAULT,
  64. .ufcon = ARMLEX4210_UFCON_DEFAULT,
  65. },
  66. };
  67. static struct s3c_sdhci_platdata armlex4210_hsmmc0_pdata __initdata = {
  68. .cd_type = S3C_SDHCI_CD_PERMANENT,
  69. #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
  70. .max_width = 8,
  71. .host_caps = MMC_CAP_8_BIT_DATA,
  72. #endif
  73. };
  74. static struct s3c_sdhci_platdata armlex4210_hsmmc2_pdata __initdata = {
  75. .cd_type = S3C_SDHCI_CD_GPIO,
  76. .ext_cd_gpio = EXYNOS4_GPX2(5),
  77. .ext_cd_gpio_invert = 1,
  78. .max_width = 4,
  79. };
  80. static struct s3c_sdhci_platdata armlex4210_hsmmc3_pdata __initdata = {
  81. .cd_type = S3C_SDHCI_CD_PERMANENT,
  82. .max_width = 4,
  83. };
  84. static void __init armlex4210_sdhci_init(void)
  85. {
  86. s3c_sdhci0_set_platdata(&armlex4210_hsmmc0_pdata);
  87. s3c_sdhci2_set_platdata(&armlex4210_hsmmc2_pdata);
  88. s3c_sdhci3_set_platdata(&armlex4210_hsmmc3_pdata);
  89. }
  90. static void __init armlex4210_wlan_init(void)
  91. {
  92. /* enable */
  93. s3c_gpio_cfgpin(EXYNOS4_GPX2(0), S3C_GPIO_SFN(0xf));
  94. s3c_gpio_setpull(EXYNOS4_GPX2(0), S3C_GPIO_PULL_UP);
  95. /* reset */
  96. s3c_gpio_cfgpin(EXYNOS4_GPX1(6), S3C_GPIO_SFN(0xf));
  97. s3c_gpio_setpull(EXYNOS4_GPX1(6), S3C_GPIO_PULL_UP);
  98. /* wakeup */
  99. s3c_gpio_cfgpin(EXYNOS4_GPX1(5), S3C_GPIO_SFN(0xf));
  100. s3c_gpio_setpull(EXYNOS4_GPX1(5), S3C_GPIO_PULL_UP);
  101. }
  102. static struct resource armlex4210_smsc911x_resources[] = {
  103. [0] = DEFINE_RES_MEM(EXYNOS4_PA_SROM_BANK(3), SZ_64K),
  104. [1] = DEFINE_RES_NAMED(IRQ_EINT(27), 1, NULL, IORESOURCE_IRQ \
  105. | IRQF_TRIGGER_HIGH),
  106. };
  107. static struct smsc911x_platform_config smsc9215_config = {
  108. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  109. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  110. .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
  111. .phy_interface = PHY_INTERFACE_MODE_MII,
  112. .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
  113. };
  114. static struct platform_device armlex4210_smsc911x = {
  115. .name = "smsc911x",
  116. .id = -1,
  117. .num_resources = ARRAY_SIZE(armlex4210_smsc911x_resources),
  118. .resource = armlex4210_smsc911x_resources,
  119. .dev = {
  120. .platform_data = &smsc9215_config,
  121. },
  122. };
  123. static struct platform_device *armlex4210_devices[] __initdata = {
  124. &s3c_device_hsmmc0,
  125. &s3c_device_hsmmc2,
  126. &s3c_device_hsmmc3,
  127. &s3c_device_rtc,
  128. &s3c_device_wdt,
  129. &armlex4210_smsc911x,
  130. &exynos4_device_ahci,
  131. };
  132. static void __init armlex4210_smsc911x_init(void)
  133. {
  134. u32 cs1;
  135. /* configure nCS1 width to 16 bits */
  136. cs1 = __raw_readl(S5P_SROM_BW) &
  137. ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
  138. cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
  139. (0 << S5P_SROM_BW__WAITENABLE__SHIFT) |
  140. (1 << S5P_SROM_BW__ADDRMODE__SHIFT) |
  141. (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
  142. S5P_SROM_BW__NCS1__SHIFT;
  143. __raw_writel(cs1, S5P_SROM_BW);
  144. /* set timing for nCS1 suitable for ethernet chip */
  145. __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
  146. (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
  147. (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
  148. (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
  149. (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
  150. (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
  151. (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
  152. }
  153. static void __init armlex4210_map_io(void)
  154. {
  155. exynos_init_io(NULL, 0);
  156. s3c24xx_init_clocks(24000000);
  157. s3c24xx_init_uarts(armlex4210_uartcfgs,
  158. ARRAY_SIZE(armlex4210_uartcfgs));
  159. }
  160. static void __init armlex4210_machine_init(void)
  161. {
  162. armlex4210_smsc911x_init();
  163. armlex4210_sdhci_init();
  164. armlex4210_wlan_init();
  165. platform_add_devices(armlex4210_devices,
  166. ARRAY_SIZE(armlex4210_devices));
  167. }
  168. MACHINE_START(ARMLEX4210, "ARMLEX4210")
  169. /* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */
  170. .atag_offset = 0x100,
  171. .smp = smp_ops(exynos_smp_ops),
  172. .init_irq = exynos4_init_irq,
  173. .map_io = armlex4210_map_io,
  174. .init_machine = armlex4210_machine_init,
  175. .init_late = exynos_init_late,
  176. .init_time = exynos4_timer_init,
  177. .restart = exynos4_restart,
  178. MACHINE_END