mach-smdkc210.c 6.3 KB

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