mach-smdkc210.c 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /* linux/arch/arm/mach-exynos4/mach-smdkc210.c
  2. *
  3. * Copyright (c) 2010-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/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 <linux/i2c.h>
  17. #include <asm/mach/arch.h>
  18. #include <asm/mach-types.h>
  19. #include <plat/regs-serial.h>
  20. #include <plat/regs-srom.h>
  21. #include <plat/exynos4.h>
  22. #include <plat/cpu.h>
  23. #include <plat/devs.h>
  24. #include <plat/sdhci.h>
  25. #include <plat/iic.h>
  26. #include <plat/pd.h>
  27. #include <mach/map.h>
  28. /* Following are default values for UCON, ULCON and UFCON UART registers */
  29. #define SMDKC210_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
  30. S3C2410_UCON_RXILEVEL | \
  31. S3C2410_UCON_TXIRQMODE | \
  32. S3C2410_UCON_RXIRQMODE | \
  33. S3C2410_UCON_RXFIFO_TOI | \
  34. S3C2443_UCON_RXERR_IRQEN)
  35. #define SMDKC210_ULCON_DEFAULT S3C2410_LCON_CS8
  36. #define SMDKC210_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
  37. S5PV210_UFCON_TXTRIG4 | \
  38. S5PV210_UFCON_RXTRIG4)
  39. static struct s3c2410_uartcfg smdkc210_uartcfgs[] __initdata = {
  40. [0] = {
  41. .hwport = 0,
  42. .flags = 0,
  43. .ucon = SMDKC210_UCON_DEFAULT,
  44. .ulcon = SMDKC210_ULCON_DEFAULT,
  45. .ufcon = SMDKC210_UFCON_DEFAULT,
  46. },
  47. [1] = {
  48. .hwport = 1,
  49. .flags = 0,
  50. .ucon = SMDKC210_UCON_DEFAULT,
  51. .ulcon = SMDKC210_ULCON_DEFAULT,
  52. .ufcon = SMDKC210_UFCON_DEFAULT,
  53. },
  54. [2] = {
  55. .hwport = 2,
  56. .flags = 0,
  57. .ucon = SMDKC210_UCON_DEFAULT,
  58. .ulcon = SMDKC210_ULCON_DEFAULT,
  59. .ufcon = SMDKC210_UFCON_DEFAULT,
  60. },
  61. [3] = {
  62. .hwport = 3,
  63. .flags = 0,
  64. .ucon = SMDKC210_UCON_DEFAULT,
  65. .ulcon = SMDKC210_ULCON_DEFAULT,
  66. .ufcon = SMDKC210_UFCON_DEFAULT,
  67. },
  68. };
  69. static struct s3c_sdhci_platdata smdkc210_hsmmc0_pdata __initdata = {
  70. .cd_type = S3C_SDHCI_CD_GPIO,
  71. .ext_cd_gpio = EXYNOS4_GPK0(2),
  72. .ext_cd_gpio_invert = 1,
  73. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  74. #ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
  75. .max_width = 8,
  76. .host_caps = MMC_CAP_8_BIT_DATA,
  77. #endif
  78. };
  79. static struct s3c_sdhci_platdata smdkc210_hsmmc1_pdata __initdata = {
  80. .cd_type = S3C_SDHCI_CD_GPIO,
  81. .ext_cd_gpio = EXYNOS4_GPK0(2),
  82. .ext_cd_gpio_invert = 1,
  83. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  84. };
  85. static struct s3c_sdhci_platdata smdkc210_hsmmc2_pdata __initdata = {
  86. .cd_type = S3C_SDHCI_CD_GPIO,
  87. .ext_cd_gpio = EXYNOS4_GPK2(2),
  88. .ext_cd_gpio_invert = 1,
  89. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  90. #ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
  91. .max_width = 8,
  92. .host_caps = MMC_CAP_8_BIT_DATA,
  93. #endif
  94. };
  95. static struct s3c_sdhci_platdata smdkc210_hsmmc3_pdata __initdata = {
  96. .cd_type = S3C_SDHCI_CD_GPIO,
  97. .ext_cd_gpio = EXYNOS4_GPK2(2),
  98. .ext_cd_gpio_invert = 1,
  99. .clk_type = S3C_SDHCI_CLK_DIV_EXTERNAL,
  100. };
  101. static struct resource smdkc210_smsc911x_resources[] = {
  102. [0] = {
  103. .start = EXYNOS4_PA_SROM_BANK(1),
  104. .end = EXYNOS4_PA_SROM_BANK(1) + SZ_64K - 1,
  105. .flags = IORESOURCE_MEM,
  106. },
  107. [1] = {
  108. .start = IRQ_EINT(5),
  109. .end = IRQ_EINT(5),
  110. .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
  111. },
  112. };
  113. static struct smsc911x_platform_config smsc9215_config = {
  114. .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
  115. .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
  116. .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
  117. .phy_interface = PHY_INTERFACE_MODE_MII,
  118. .mac = {0x00, 0x80, 0x00, 0x23, 0x45, 0x67},
  119. };
  120. static struct platform_device smdkc210_smsc911x = {
  121. .name = "smsc911x",
  122. .id = -1,
  123. .num_resources = ARRAY_SIZE(smdkc210_smsc911x_resources),
  124. .resource = smdkc210_smsc911x_resources,
  125. .dev = {
  126. .platform_data = &smsc9215_config,
  127. },
  128. };
  129. static struct i2c_board_info i2c_devs1[] __initdata = {
  130. {I2C_BOARD_INFO("wm8994", 0x1a),},
  131. };
  132. static struct platform_device *smdkc210_devices[] __initdata = {
  133. &s3c_device_hsmmc0,
  134. &s3c_device_hsmmc1,
  135. &s3c_device_hsmmc2,
  136. &s3c_device_hsmmc3,
  137. &s3c_device_i2c1,
  138. &s3c_device_rtc,
  139. &s3c_device_wdt,
  140. &exynos4_device_ac97,
  141. &exynos4_device_i2s0,
  142. &exynos4_device_pd[PD_MFC],
  143. &exynos4_device_pd[PD_G3D],
  144. &exynos4_device_pd[PD_LCD0],
  145. &exynos4_device_pd[PD_LCD1],
  146. &exynos4_device_pd[PD_CAM],
  147. &exynos4_device_pd[PD_TV],
  148. &exynos4_device_pd[PD_GPS],
  149. &exynos4_device_sysmmu,
  150. &samsung_asoc_dma,
  151. &smdkc210_smsc911x,
  152. };
  153. static void __init smdkc210_smsc911x_init(void)
  154. {
  155. u32 cs1;
  156. /* configure nCS1 width to 16 bits */
  157. cs1 = __raw_readl(S5P_SROM_BW) &
  158. ~(S5P_SROM_BW__CS_MASK << S5P_SROM_BW__NCS1__SHIFT);
  159. cs1 |= ((1 << S5P_SROM_BW__DATAWIDTH__SHIFT) |
  160. (1 << S5P_SROM_BW__WAITENABLE__SHIFT) |
  161. (1 << S5P_SROM_BW__BYTEENABLE__SHIFT)) <<
  162. S5P_SROM_BW__NCS1__SHIFT;
  163. __raw_writel(cs1, S5P_SROM_BW);
  164. /* set timing for nCS1 suitable for ethernet chip */
  165. __raw_writel((0x1 << S5P_SROM_BCX__PMC__SHIFT) |
  166. (0x9 << S5P_SROM_BCX__TACP__SHIFT) |
  167. (0xc << S5P_SROM_BCX__TCAH__SHIFT) |
  168. (0x1 << S5P_SROM_BCX__TCOH__SHIFT) |
  169. (0x6 << S5P_SROM_BCX__TACC__SHIFT) |
  170. (0x1 << S5P_SROM_BCX__TCOS__SHIFT) |
  171. (0x1 << S5P_SROM_BCX__TACS__SHIFT), S5P_SROM_BC1);
  172. }
  173. static void __init smdkc210_map_io(void)
  174. {
  175. s5p_init_io(NULL, 0, S5P_VA_CHIPID);
  176. s3c24xx_init_clocks(24000000);
  177. s3c24xx_init_uarts(smdkc210_uartcfgs, ARRAY_SIZE(smdkc210_uartcfgs));
  178. }
  179. static void __init smdkc210_machine_init(void)
  180. {
  181. s3c_i2c1_set_platdata(NULL);
  182. i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
  183. smdkc210_smsc911x_init();
  184. s3c_sdhci0_set_platdata(&smdkc210_hsmmc0_pdata);
  185. s3c_sdhci1_set_platdata(&smdkc210_hsmmc1_pdata);
  186. s3c_sdhci2_set_platdata(&smdkc210_hsmmc2_pdata);
  187. s3c_sdhci3_set_platdata(&smdkc210_hsmmc3_pdata);
  188. platform_add_devices(smdkc210_devices, ARRAY_SIZE(smdkc210_devices));
  189. }
  190. MACHINE_START(SMDKC210, "SMDKC210")
  191. /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */
  192. .boot_params = S5P_PA_SDRAM + 0x100,
  193. .init_irq = exynos4_init_irq,
  194. .map_io = smdkc210_map_io,
  195. .init_machine = smdkc210_machine_init,
  196. .timer = &exynos4_timer,
  197. MACHINE_END