diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2009-11-17 02:41:23 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-11-30 20:33:17 -0500 |
commit | 86cd4f5f83acbfa481c513c74666ad360b49d73b (patch) | |
tree | fadf026dc26dc06b7d6fc3d8405aa96795db23e9 /arch/arm/plat-s3c | |
parent | 067f131d09d89bd56864f1f4b3144cc778024b33 (diff) |
ARM: S5PC1xx: add platform helpers for SDHCI host controllers
Samsung S5PC100 has 3 SDHCI controllers compatible with the one known from
previous SoCs series. Add required platform setup and support code that
the devices can be used with sdhci-s3c driver.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/plat-s3c')
-rw-r--r-- | arch/arm/plat-s3c/Kconfig | 5 | ||||
-rw-r--r-- | arch/arm/plat-s3c/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-s3c/dev-hsmmc2.c | 65 | ||||
-rw-r--r-- | arch/arm/plat-s3c/include/plat/sdhci.h | 55 |
4 files changed, 126 insertions, 0 deletions
diff --git a/arch/arm/plat-s3c/Kconfig b/arch/arm/plat-s3c/Kconfig index f155a849e705..e139a72c2149 100644 --- a/arch/arm/plat-s3c/Kconfig +++ b/arch/arm/plat-s3c/Kconfig | |||
@@ -184,6 +184,11 @@ config S3C_DEV_HSMMC1 | |||
184 | help | 184 | help |
185 | Compile in platform device definitions for HSMMC channel 1 | 185 | Compile in platform device definitions for HSMMC channel 1 |
186 | 186 | ||
187 | config S3C_DEV_HSMMC2 | ||
188 | bool | ||
189 | help | ||
190 | Compile in platform device definitions for HSMMC channel 2 | ||
191 | |||
187 | config S3C_DEV_I2C1 | 192 | config S3C_DEV_I2C1 |
188 | bool | 193 | bool |
189 | help | 194 | help |
diff --git a/arch/arm/plat-s3c/Makefile b/arch/arm/plat-s3c/Makefile index 3c09109e9e84..50444da98425 100644 --- a/arch/arm/plat-s3c/Makefile +++ b/arch/arm/plat-s3c/Makefile | |||
@@ -36,6 +36,7 @@ obj-$(CONFIG_HAVE_PWM) += pwm.o | |||
36 | 36 | ||
37 | obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o | 37 | obj-$(CONFIG_S3C_DEV_HSMMC) += dev-hsmmc.o |
38 | obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o | 38 | obj-$(CONFIG_S3C_DEV_HSMMC1) += dev-hsmmc1.o |
39 | obj-$(CONFIG_S3C_DEV_HSMMC2) += dev-hsmmc2.o | ||
39 | obj-y += dev-i2c0.o | 40 | obj-y += dev-i2c0.o |
40 | obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o | 41 | obj-$(CONFIG_S3C_DEV_I2C1) += dev-i2c1.o |
41 | obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o | 42 | obj-$(CONFIG_S3C_DEV_FB) += dev-fb.o |
diff --git a/arch/arm/plat-s3c/dev-hsmmc2.c b/arch/arm/plat-s3c/dev-hsmmc2.c new file mode 100644 index 000000000000..082e55a78ad7 --- /dev/null +++ b/arch/arm/plat-s3c/dev-hsmmc2.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* linux/arch/arm/plat-s3c/dev-hsmmc2.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Samsung Electronics | ||
4 | * | ||
5 | * S3C series device definition for hsmmc device 2 | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/mmc/host.h> | ||
15 | |||
16 | #include <mach/map.h> | ||
17 | #include <plat/sdhci.h> | ||
18 | #include <plat/devs.h> | ||
19 | |||
20 | #define S3C_SZ_HSMMC (0x1000) | ||
21 | |||
22 | static struct resource s3c_hsmmc2_resource[] = { | ||
23 | [0] = { | ||
24 | .start = S3C_PA_HSMMC2, | ||
25 | .end = S3C_PA_HSMMC2 + S3C_SZ_HSMMC - 1, | ||
26 | .flags = IORESOURCE_MEM, | ||
27 | }, | ||
28 | [1] = { | ||
29 | .start = IRQ_HSMMC2, | ||
30 | .end = IRQ_HSMMC2, | ||
31 | .flags = IORESOURCE_IRQ, | ||
32 | } | ||
33 | }; | ||
34 | |||
35 | static u64 s3c_device_hsmmc2_dmamask = 0xffffffffUL; | ||
36 | |||
37 | struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata = { | ||
38 | .max_width = 4, | ||
39 | .host_caps = (MMC_CAP_4_BIT_DATA | | ||
40 | MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED), | ||
41 | }; | ||
42 | |||
43 | struct platform_device s3c_device_hsmmc2 = { | ||
44 | .name = "s3c-sdhci", | ||
45 | .id = 2, | ||
46 | .num_resources = ARRAY_SIZE(s3c_hsmmc2_resource), | ||
47 | .resource = s3c_hsmmc2_resource, | ||
48 | .dev = { | ||
49 | .dma_mask = &s3c_device_hsmmc2_dmamask, | ||
50 | .coherent_dma_mask = 0xffffffffUL, | ||
51 | .platform_data = &s3c_hsmmc2_def_platdata, | ||
52 | }, | ||
53 | }; | ||
54 | |||
55 | void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd) | ||
56 | { | ||
57 | struct s3c_sdhci_platdata *set = &s3c_hsmmc2_def_platdata; | ||
58 | |||
59 | set->max_width = pd->max_width; | ||
60 | |||
61 | if (pd->cfg_gpio) | ||
62 | set->cfg_gpio = pd->cfg_gpio; | ||
63 | if (pd->cfg_card) | ||
64 | set->cfg_card = pd->cfg_card; | ||
65 | } | ||
diff --git a/arch/arm/plat-s3c/include/plat/sdhci.h b/arch/arm/plat-s3c/include/plat/sdhci.h index f615308ccdfb..c71d07861840 100644 --- a/arch/arm/plat-s3c/include/plat/sdhci.h +++ b/arch/arm/plat-s3c/include/plat/sdhci.h | |||
@@ -57,6 +57,7 @@ struct s3c_sdhci_platdata { | |||
57 | */ | 57 | */ |
58 | extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd); | 58 | extern void s3c_sdhci0_set_platdata(struct s3c_sdhci_platdata *pd); |
59 | extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); | 59 | extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); |
60 | extern void s3c_sdhci2_set_platdata(struct s3c_sdhci_platdata *pd); | ||
60 | 61 | ||
61 | /* Default platform data, exported so that per-cpu initialisation can | 62 | /* Default platform data, exported so that per-cpu initialisation can |
62 | * set the correct one when there are more than one cpu type selected. | 63 | * set the correct one when there are more than one cpu type selected. |
@@ -64,11 +65,15 @@ extern void s3c_sdhci1_set_platdata(struct s3c_sdhci_platdata *pd); | |||
64 | 65 | ||
65 | extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; | 66 | extern struct s3c_sdhci_platdata s3c_hsmmc0_def_platdata; |
66 | extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata; | 67 | extern struct s3c_sdhci_platdata s3c_hsmmc1_def_platdata; |
68 | extern struct s3c_sdhci_platdata s3c_hsmmc2_def_platdata; | ||
67 | 69 | ||
68 | /* Helper function availablity */ | 70 | /* Helper function availablity */ |
69 | 71 | ||
70 | extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); | 72 | extern void s3c64xx_setup_sdhci0_cfg_gpio(struct platform_device *, int w); |
71 | extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); | 73 | extern void s3c64xx_setup_sdhci1_cfg_gpio(struct platform_device *, int w); |
74 | extern void s5pc100_setup_sdhci0_cfg_gpio(struct platform_device *, int w); | ||
75 | extern void s5pc100_setup_sdhci1_cfg_gpio(struct platform_device *, int w); | ||
76 | extern void s5pc100_setup_sdhci2_cfg_gpio(struct platform_device *, int w); | ||
72 | 77 | ||
73 | /* S3C6400 SDHCI setup */ | 78 | /* S3C6400 SDHCI setup */ |
74 | 79 | ||
@@ -145,4 +150,54 @@ static inline void s3c6410_default_sdhci0(void) { } | |||
145 | static inline void s3c6410_default_sdhci1(void) { } | 150 | static inline void s3c6410_default_sdhci1(void) { } |
146 | #endif /* CONFIG_S3C6410_SETUP_SDHCI */ | 151 | #endif /* CONFIG_S3C6410_SETUP_SDHCI */ |
147 | 152 | ||
153 | /* S5PC100 SDHCI setup */ | ||
154 | |||
155 | #ifdef CONFIG_S5PC100_SETUP_SDHCI | ||
156 | extern char *s5pc100_hsmmc_clksrcs[4]; | ||
157 | |||
158 | extern void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev, | ||
159 | void __iomem *r, | ||
160 | struct mmc_ios *ios, | ||
161 | struct mmc_card *card); | ||
162 | |||
163 | #ifdef CONFIG_S3C_DEV_HSMMC | ||
164 | static inline void s5pc100_default_sdhci0(void) | ||
165 | { | ||
166 | s3c_hsmmc0_def_platdata.clocks = s5pc100_hsmmc_clksrcs; | ||
167 | s3c_hsmmc0_def_platdata.cfg_gpio = s5pc100_setup_sdhci0_cfg_gpio; | ||
168 | s3c_hsmmc0_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; | ||
169 | } | ||
170 | #else | ||
171 | static inline void s5pc100_default_sdhci0(void) { } | ||
172 | #endif /* CONFIG_S3C_DEV_HSMMC */ | ||
173 | |||
174 | #ifdef CONFIG_S3C_DEV_HSMMC1 | ||
175 | static inline void s5pc100_default_sdhci1(void) | ||
176 | { | ||
177 | s3c_hsmmc1_def_platdata.clocks = s5pc100_hsmmc_clksrcs; | ||
178 | s3c_hsmmc1_def_platdata.cfg_gpio = s5pc100_setup_sdhci1_cfg_gpio; | ||
179 | s3c_hsmmc1_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; | ||
180 | } | ||
181 | #else | ||
182 | static inline void s5pc100_default_sdhci1(void) { } | ||
183 | #endif /* CONFIG_S3C_DEV_HSMMC1 */ | ||
184 | |||
185 | #ifdef CONFIG_S3C_DEV_HSMMC2 | ||
186 | static inline void s5pc100_default_sdhci2(void) | ||
187 | { | ||
188 | s3c_hsmmc2_def_platdata.clocks = s5pc100_hsmmc_clksrcs; | ||
189 | s3c_hsmmc2_def_platdata.cfg_gpio = s5pc100_setup_sdhci2_cfg_gpio; | ||
190 | s3c_hsmmc2_def_platdata.cfg_card = s5pc100_setup_sdhci0_cfg_card; | ||
191 | } | ||
192 | #else | ||
193 | static inline void s5pc100_default_sdhci2(void) { } | ||
194 | #endif /* CONFIG_S3C_DEV_HSMMC1 */ | ||
195 | |||
196 | |||
197 | #else | ||
198 | static inline void s5pc100_default_sdhci0(void) { } | ||
199 | static inline void s5pc100_default_sdhci1(void) { } | ||
200 | static inline void s5pc100_default_sdhci2(void) { } | ||
201 | #endif /* CONFIG_S5PC100_SETUP_SDHCI */ | ||
202 | |||
148 | #endif /* __PLAT_S3C_SDHCI_H */ | 203 | #endif /* __PLAT_S3C_SDHCI_H */ |