mach-smdkv310.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. /* linux/arch/arm/mach-s5pv310/mach-smdkv310.c
  2. *
  3. * Copyright (c) 2010 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/serial_core.h>
  11. #include <linux/gpio.h>
  12. #include <linux/mmc/host.h>
  13. #include <linux/platform_device.h>
  14. #include <linux/smsc911x.h>
  15. #include <linux/io.h>
  16. #include <asm/mach/arch.h>
  17. #include <asm/mach-types.h>
  18. #include <plat/regs-serial.h>
  19. #include <plat/s5pv310.h>
  20. #include <plat/cpu.h>
  21. #include <plat/devs.h>
  22. #include <plat/sdhci.h>
  23. #include <mach/map.h>
  24. #include <mach/regs-srom.h>
  25. /* Following are default values for UCON, ULCON and UFCON UART registers */
  26. #define SMDKV310_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  27. S3C2410_UCON_RXILEVEL | \
  28. S3C2410_UCON_TXIRQMODE | \
  29. S3C2410_UCON_RXIRQMODE | \
  30. S3C2410_UCON_RXFIFO_TOI | \
  31. S3C2443_UCON_RXERR_IRQEN)
  32. #define SMDKV310_ULCON_DEFAULT S3C2410_LCON_CS8
  33. #define SMDKV310_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  34. S5PV210_UFCON_TXTRIG4 | \
  35. S5PV210_UFCON_RXTRIG4)
  36. static struct s3c2410_uartcfg smdkv310_uartcfgs[] __initdata = {
  37. [0] = {
  38. .hwport = 0,
  39. .flags = 0,
  40. .ucon = SMDKV310_UCON_DEFAULT,
  41. .ulcon = SMDKV310_ULCON_DEFAULT,
  42. .ufcon = SMDKV310_UFCON_DEFAULT,
  43. },
  44. [1] = {
  45. .hwport = 1,
  46. .flags = 0,
  47. .ucon = SMDKV310_UCON_DEFAULT,
  48. .ulcon = SMDKV310_ULCON_DEFAULT,
  49. .ufcon = SMDKV310_UFCON_DEFAULT,
  50. },
  51. [2] = {
  52. .hwport = 2,
  53. .flags = 0,
  54. .ucon = SMDKV310_UCON_DEFAULT,
  55. .ulcon = SMDKV310_ULCON_DEFAULT,
  56. .ufcon = SMDKV310_UFCON_DEFAULT,
  57. },
  58. [3] = {
  59. .hwport = 3,
  60. .flags = 0,
  61. .ucon = SMDKV310_UCON_DEFAULT,
  62. .ulcon = SMDKV310_ULCON_DEFAULT,
  63. .ufcon = SMDKV310_UFCON_DEFAULT,
  64. },
  65. };
  66. static struct s3c_sdhci_platdata smdkv310_hsmmc0_pdata __initdata = {
  67. .cd_type = S3C_SDHCI_CD_GPIO,
  68. .ext_cd_gpio = S5PV310_GPK0(2),
  69. .ext_cd_gpio_invert = 1,
  70. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  71. #ifdef CONFIG_S5PV310_SDHCI_CH0_8BIT
  72. .max_width = 8,
  73. .host_caps = MMC_CAP_8_BIT_DATA,
  74. #endif
  75. };
  76. static struct s3c_sdhci_platdata smdkv310_hsmmc1_pdata __initdata = {
  77. .cd_type = S3C_SDHCI_CD_GPIO,
  78. .ext_cd_gpio = S5PV310_GPK0(2),
  79. .ext_cd_gpio_invert = 1,
  80. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  81. };
  82. static struct s3c_sdhci_platdata smdkv310_hsmmc2_pdata __initdata = {
  83. .cd_type = S3C_SDHCI_CD_GPIO,
  84. .ext_cd_gpio = S5PV310_GPK2(2),
  85. .ext_cd_gpio_invert = 1,
  86. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  87. #ifdef CONFIG_S5PV310_SDHCI_CH2_8BIT
  88. .max_width = 8,
  89. .host_caps = MMC_CAP_8_BIT_DATA,
  90. #endif
  91. };
  92. static struct s3c_sdhci_platdata smdkv310_hsmmc3_pdata __initdata = {
  93. .cd_type = S3C_SDHCI_CD_GPIO,
  94. .ext_cd_gpio = S5PV310_GPK2(2),
  95. .ext_cd_gpio_invert = 1,
  96. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  97. };
  98. static struct resource smdkv310_smsc911x_resources[] = {
  99. [0] = {
  100. .start = S5PV310_PA_SROM_BANK(1),
  101. .end = S5PV310_PA_SROM_BANK(1) + SZ_64K - 1,
  102. .flags = IORESOURCE_MEM,
  103. },
  104. [1] = {
  105. .start = IRQ_EINT(5),
  106. .end = IRQ_EINT(5),
  107. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  108. },
  109. };
  110. static struct smsc911x_platform_config smsc9215_config = {
  111. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_HIGH,
  112. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  113. .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
  114. .phy_interface = PHY_INTERFACE_MODE_MII,
  115. .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
  116. };
  117. static struct platform_device smdkv310_smsc911x = {
  118. .name = "smsc911x",
  119. .id = -1,
  120. .num_resources = ARRAY_SIZE(smdkv310_smsc911x_resources),
  121. .resource = smdkv310_smsc911x_resources,
  122. .dev = {
  123. .platform_data = &smsc9215_config,
  124. },
  125. };
  126. static struct platform_device *smdkv310_devices[] __initdata = {
  127. &s3c_device_hsmmc0,
  128. &s3c_device_hsmmc1,
  129. &s3c_device_hsmmc2,
  130. &s3c_device_hsmmc3,
  131. &s3c_device_rtc,
  132. &s3c_device_wdt,
  133. &smdkv310_smsc911x,
  134. };
  135. static void __init smdkv310_smsc911x_init(void)
  136. {
  137. u32 cs1;
  138. /* configure nCS1 width to 16 bits */
  139. cs1 = __raw_readl(S5PV310_SROM_BW) &
  140. ~(S5PV310_SROM_BW__CS_MASK <<
  141. S5PV310_SROM_BW__NCS1__SHIFT);
  142. cs1 |= ((1 << S5PV310_SROM_BW__DATAWIDTH__SHIFT) |
  143. (1 << S5PV310_SROM_BW__WAITENABLE__SHIFT) |
  144. (1 << S5PV310_SROM_BW__BYTEENABLE__SHIFT)) <<
  145. S5PV310_SROM_BW__NCS1__SHIFT;
  146. __raw_writel(cs1, S5PV310_SROM_BW);
  147. /* set timing for nCS1 suitable for ethernet chip */
  148. __raw_writel((0x1 << S5PV310_SROM_BCX__PMC__SHIFT) |
  149. (0x9 << S5PV310_SROM_BCX__TACP__SHIFT) |
  150. (0xc << S5PV310_SROM_BCX__TCAH__SHIFT) |
  151. (0x1 << S5PV310_SROM_BCX__TCOH__SHIFT) |
  152. (0x6 << S5PV310_SROM_BCX__TACC__SHIFT) |
  153. (0x1 << S5PV310_SROM_BCX__TCOS__SHIFT) |
  154. (0x1 << S5PV310_SROM_BCX__TACS__SHIFT), S5PV310_SROM_BC1);
  155. }
  156. static void __init smdkv310_map_io(void)
  157. {
  158. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  159. s3c24xx_init_clocks(24000000);
  160. s3c24xx_init_uarts(smdkv310_uartcfgs, ARRAY_SIZE(smdkv310_uartcfgs));
  161. }
  162. static void __init smdkv310_machine_init(void)
  163. {
  164. smdkv310_smsc911x_init();
  165. s3c_sdhci0_set_platdata(&smdkv310_hsmmc0_pdata);
  166. s3c_sdhci1_set_platdata(&smdkv310_hsmmc1_pdata);
  167. s3c_sdhci2_set_platdata(&smdkv310_hsmmc2_pdata);
  168. s3c_sdhci3_set_platdata(&smdkv310_hsmmc3_pdata);
  169. platform_add_devices(smdkv310_devices, ARRAY_SIZE(smdkv310_devices));
  170. }
  171. MACHINE_START(SMDKV310, "SMDKV310")
  172. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  173. /* Maintainer: Changhwan Youn <chaos.youn@samsung.com> */
  174. .boot_params = S5P_PA_SDRAM + 0x100,
  175. .init_irq = s5pv310_init_irq,
  176. .map_io = smdkv310_map_io,
  177. .init_machine = smdkv310_machine_init,
  178. .timer = &s5pv310_timer,
  179. MACHINE_END