mach-armlex4210.c 5.7 KB

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