mach-armlex4210.c 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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/exynos4.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. /* 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. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  70. #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
  71. .max_width = 8,
  72. .host_caps = MMC_CAP_8_BIT_DATA,
  73. #endif
  74. };
  75. static struct s3c_sdhci_platdata armlex4210_hsmmc2_pdata __initdata = {
  76. .cd_type = S3C_SDHCI_CD_GPIO,
  77. .ext_cd_gpio = EXYNOS4_GPX2(5),
  78. .ext_cd_gpio_invert = 1,
  79. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  80. .max_width = 4,
  81. };
  82. static struct s3c_sdhci_platdata armlex4210_hsmmc3_pdata __initdata = {
  83. .cd_type = S3C_SDHCI_CD_PERMANENT,
  84. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  85. .max_width = 4,
  86. };
  87. static void __init armlex4210_sdhci_init(void)
  88. {
  89. s3c_sdhci0_set_platdata(&armlex4210_hsmmc0_pdata);
  90. s3c_sdhci2_set_platdata(&armlex4210_hsmmc2_pdata);
  91. s3c_sdhci3_set_platdata(&armlex4210_hsmmc3_pdata);
  92. }
  93. static void __init armlex4210_wlan_init(void)
  94. {
  95. /* enable */
  96. s3c_gpio_cfgpin(EXYNOS4_GPX2(0), S3C_GPIO_SFN(0xf));
  97. s3c_gpio_setpull(EXYNOS4_GPX2(0), S3C_GPIO_PULL_UP);
  98. /* reset */
  99. s3c_gpio_cfgpin(EXYNOS4_GPX1(6), S3C_GPIO_SFN(0xf));
  100. s3c_gpio_setpull(EXYNOS4_GPX1(6), S3C_GPIO_PULL_UP);
  101. /* wakeup */
  102. s3c_gpio_cfgpin(EXYNOS4_GPX1(5), S3C_GPIO_SFN(0xf));
  103. s3c_gpio_setpull(EXYNOS4_GPX1(5), S3C_GPIO_PULL_UP);
  104. }
  105. static struct resource armlex4210_smsc911x_resources[] = {
  106. [0] = {
  107. .start = EXYNOS4_PA_SROM_BANK(3),
  108. .end = EXYNOS4_PA_SROM_BANK(3) + SZ_64K - 1,
  109. .flags = IORESOURCE_MEM,
  110. },
  111. [1] = {
  112. .start = IRQ_EINT(27),
  113. .end = IRQ_EINT(27),
  114. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_HIGH,
  115. },
  116. };
  117. static struct smsc911x_platform_config smsc9215_config = {
  118. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  119. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  120. .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
  121. .phy_interface = PHY_INTERFACE_MODE_MII,
  122. .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
  123. };
  124. static struct platform_device armlex4210_smsc911x = {
  125. .name = "smsc911x",
  126. .id = -1,
  127. .num_resources = ARRAY_SIZE(armlex4210_smsc911x_resources),
  128. .resource = armlex4210_smsc911x_resources,
  129. .dev = {
  130. .platform_data = &smsc9215_config,
  131. },
  132. };
  133. static struct platform_device *armlex4210_devices[] __initdata = {
  134. &s3c_device_hsmmc0,
  135. &s3c_device_hsmmc2,
  136. &s3c_device_hsmmc3,
  137. &s3c_device_rtc,
  138. &s3c_device_wdt,
  139. &exynos4_device_sysmmu,
  140. &samsung_asoc_dma,
  141. &armlex4210_smsc911x,
  142. &exynos4_device_ahci,
  143. };
  144. static void __init armlex4210_smsc911x_init(void)
  145. {
  146. u32 cs1;
  147. /* configure nCS1 width to 16 bits */
  148. cs1 = __raw_readl(S5P_SROM_BW) &
  149. ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
  150. cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
  151. (0 << S5P_SROM_BW__WAITENABLE__SHIFT) |
  152. (1 << S5P_SROM_BW__ADDRMODE__SHIFT) |
  153. (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
  154. S5P_SROM_BW__NCS1__SHIFT;
  155. __raw_writel(cs1, S5P_SROM_BW);
  156. /* set timing for nCS1 suitable for ethernet chip */
  157. __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
  158. (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
  159. (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
  160. (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
  161. (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
  162. (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
  163. (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
  164. }
  165. static void __init armlex4210_map_io(void)
  166. {
  167. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  168. s3c24xx_init_clocks(24000000);
  169. s3c24xx_init_uarts(armlex4210_uartcfgs,
  170. ARRAY_SIZE(armlex4210_uartcfgs));
  171. }
  172. static void __init armlex4210_machine_init(void)
  173. {
  174. armlex4210_smsc911x_init();
  175. armlex4210_sdhci_init();
  176. armlex4210_wlan_init();
  177. platform_add_devices(armlex4210_devices,
  178. ARRAY_SIZE(armlex4210_devices));
  179. }
  180. MACHINE_START(ARMLEX4210, "ARMLEX4210")
  181. /* Maintainer: Alim Akhtar <alim.akhtar@samsung.com> */
  182. .boot_params = S5P_PA_SDRAM + 0x100,
  183. .init_irq = exynos4_init_irq,
  184. .map_io = armlex4210_map_io,
  185. .init_machine = armlex4210_machine_init,
  186. .timer = &exynos4_timer,
  187. MACHINE_END