diff options
author | Bridge Wu <bridge.wu@marvell.com> | 2007-12-21 06:00:13 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:07:53 -0500 |
commit | fafc9d3fa35530c1a14e6743c477d7398b431e74 (patch) | |
tree | 21691538fe2d55b5868a23117d2b61421b6f0b1f /arch | |
parent | 8f58de7c3932f659fff3b4e5fc14ca8ccf8ec873 (diff) |
[ARM] pxa: mmc: add 1st host controller support for pxa3xx
This patchis to add the first mmc controller support for pxa3xx.
It's valid for pxa3[0|1|2]0.
On zylonite, the first controller supports two slots, this patch
only support the first one right now.
Signed-off-by: Bridge Wu <bridge.wu@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-pxa/devices.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/pxa3xx.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zylonite.c | 86 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zylonite_pxa300.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-pxa/zylonite_pxa320.c | 13 |
5 files changed, 115 insertions, 1 deletions
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index 75949eb3b7bd..202d048f1cdd 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c | |||
@@ -51,7 +51,7 @@ static u64 pxamci_dmamask = 0xffffffffUL; | |||
51 | 51 | ||
52 | struct platform_device pxa_device_mci = { | 52 | struct platform_device pxa_device_mci = { |
53 | .name = "pxa2xx-mci", | 53 | .name = "pxa2xx-mci", |
54 | .id = -1, | 54 | .id = 0, |
55 | .dev = { | 55 | .dev = { |
56 | .dma_mask = &pxamci_dmamask, | 56 | .dma_mask = &pxamci_dmamask, |
57 | .coherent_dma_mask = 0xffffffff, | 57 | .coherent_dma_mask = 0xffffffff, |
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index c0483c3261d0..6271af303cb9 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c | |||
@@ -194,6 +194,8 @@ static struct clk pxa3xx_clks[] = { | |||
194 | PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), | 194 | PXA3xx_CKEN("SSPCLK", SSP2, 13000000, 0, &pxa27x_device_ssp2.dev), |
195 | PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), | 195 | PXA3xx_CKEN("SSPCLK", SSP3, 13000000, 0, &pxa27x_device_ssp3.dev), |
196 | PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev), | 196 | PXA3xx_CKEN("SSPCLK", SSP4, 13000000, 0, &pxa3xx_device_ssp4.dev), |
197 | |||
198 | PXA3xx_CKEN("MMCCLK", MMC1, 19500000, 0, &pxa_device_mci.dev), | ||
197 | }; | 199 | }; |
198 | 200 | ||
199 | void __init pxa3xx_init_irq(void) | 201 | void __init pxa3xx_init_irq(void) |
diff --git a/arch/arm/mach-pxa/zylonite.c b/arch/arm/mach-pxa/zylonite.c index 743a87b2faa1..f72f37f6ff0c 100644 --- a/arch/arm/mach-pxa/zylonite.c +++ b/arch/arm/mach-pxa/zylonite.c | |||
@@ -25,9 +25,13 @@ | |||
25 | #include <asm/arch/gpio.h> | 25 | #include <asm/arch/gpio.h> |
26 | #include <asm/arch/pxafb.h> | 26 | #include <asm/arch/pxafb.h> |
27 | #include <asm/arch/zylonite.h> | 27 | #include <asm/arch/zylonite.h> |
28 | #include <asm/arch/mmc.h> | ||
28 | 29 | ||
29 | #include "generic.h" | 30 | #include "generic.h" |
30 | 31 | ||
32 | #define MAX_SLOTS 2 | ||
33 | struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS]; | ||
34 | |||
31 | int gpio_backlight; | 35 | int gpio_backlight; |
32 | int gpio_eth_irq; | 36 | int gpio_eth_irq; |
33 | 37 | ||
@@ -156,6 +160,87 @@ static void __init zylonite_init_lcd(void) | |||
156 | static inline void zylonite_init_lcd(void) {} | 160 | static inline void zylonite_init_lcd(void) {} |
157 | #endif | 161 | #endif |
158 | 162 | ||
163 | #if defined(CONFIG_MMC) | ||
164 | static int zylonite_mci_ro(struct device *dev) | ||
165 | { | ||
166 | struct platform_device *pdev = to_platform_device(dev); | ||
167 | |||
168 | return gpio_get_value(zylonite_mmc_slot[pdev->id].gpio_wp); | ||
169 | } | ||
170 | |||
171 | static int zylonite_mci_init(struct device *dev, | ||
172 | irq_handler_t zylonite_detect_int, | ||
173 | void *data) | ||
174 | { | ||
175 | struct platform_device *pdev = to_platform_device(dev); | ||
176 | int err, cd_irq, gpio_cd, gpio_wp; | ||
177 | |||
178 | cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd); | ||
179 | gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd; | ||
180 | gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp; | ||
181 | |||
182 | /* | ||
183 | * setup GPIO for Zylonite MMC controller | ||
184 | */ | ||
185 | err = gpio_request(gpio_cd, "mmc card detect"); | ||
186 | if (err) | ||
187 | goto err_request_cd; | ||
188 | gpio_direction_input(gpio_cd); | ||
189 | |||
190 | err = gpio_request(gpio_wp, "mmc write protect"); | ||
191 | if (err) | ||
192 | goto err_request_wp; | ||
193 | gpio_direction_input(gpio_wp); | ||
194 | |||
195 | err = request_irq(cd_irq, zylonite_detect_int, | ||
196 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
197 | "MMC card detect", data); | ||
198 | if (err) { | ||
199 | printk(KERN_ERR "%s: MMC/SD/SDIO: " | ||
200 | "can't request card detect IRQ\n", __func__); | ||
201 | goto err_request_irq; | ||
202 | } | ||
203 | |||
204 | return 0; | ||
205 | |||
206 | err_request_irq: | ||
207 | gpio_free(gpio_wp); | ||
208 | err_request_wp: | ||
209 | gpio_free(gpio_cd); | ||
210 | err_request_cd: | ||
211 | return err; | ||
212 | } | ||
213 | |||
214 | static void zylonite_mci_exit(struct device *dev, void *data) | ||
215 | { | ||
216 | struct platform_device *pdev = to_platform_device(dev); | ||
217 | int cd_irq, gpio_cd, gpio_wp; | ||
218 | |||
219 | cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd); | ||
220 | gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd; | ||
221 | gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp; | ||
222 | |||
223 | free_irq(cd_irq, data); | ||
224 | gpio_free(gpio_cd); | ||
225 | gpio_free(gpio_wp); | ||
226 | } | ||
227 | |||
228 | static struct pxamci_platform_data zylonite_mci_platform_data = { | ||
229 | .detect_delay = 20, | ||
230 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | ||
231 | .init = zylonite_mci_init, | ||
232 | .exit = zylonite_mci_exit, | ||
233 | .get_ro = zylonite_mci_ro, | ||
234 | }; | ||
235 | |||
236 | static void __init zylonite_init_mmc(void) | ||
237 | { | ||
238 | pxa_set_mci_info(&zylonite_mci_platform_data); | ||
239 | } | ||
240 | #else | ||
241 | static inline void zylonite_init_mmc(void) {} | ||
242 | #endif | ||
243 | |||
159 | static void __init zylonite_init(void) | 244 | static void __init zylonite_init(void) |
160 | { | 245 | { |
161 | /* board-processor specific initialization */ | 246 | /* board-processor specific initialization */ |
@@ -171,6 +256,7 @@ static void __init zylonite_init(void) | |||
171 | platform_device_register(&smc91x_device); | 256 | platform_device_register(&smc91x_device); |
172 | 257 | ||
173 | zylonite_init_lcd(); | 258 | zylonite_init_lcd(); |
259 | zylonite_init_mmc(); | ||
174 | } | 260 | } |
175 | 261 | ||
176 | MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") | 262 | MACHINE_START(ZYLONITE, "PXA3xx Platform Development Kit (aka Zylonite)") |
diff --git a/arch/arm/mach-pxa/zylonite_pxa300.c b/arch/arm/mach-pxa/zylonite_pxa300.c index 1832bc316501..cad92d480f2a 100644 --- a/arch/arm/mach-pxa/zylonite_pxa300.c +++ b/arch/arm/mach-pxa/zylonite_pxa300.c | |||
@@ -88,6 +88,15 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = { | |||
88 | GPIO4_2_KP_MKOUT_5, | 88 | GPIO4_2_KP_MKOUT_5, |
89 | GPIO5_2_KP_MKOUT_6, | 89 | GPIO5_2_KP_MKOUT_6, |
90 | GPIO6_2_KP_MKOUT_7, | 90 | GPIO6_2_KP_MKOUT_7, |
91 | |||
92 | /* MMC1 */ | ||
93 | GPIO3_MMC1_DAT0, | ||
94 | GPIO4_MMC1_DAT1, | ||
95 | GPIO5_MMC1_DAT2, | ||
96 | GPIO6_MMC1_DAT3, | ||
97 | GPIO7_MMC1_CLK, | ||
98 | GPIO8_MMC1_CMD, /* CMD0 for slot 0 */ | ||
99 | GPIO15_GPIO, /* CMD1 default as GPIO for slot 0 */ | ||
91 | }; | 100 | }; |
92 | 101 | ||
93 | static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { | 102 | static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { |
@@ -174,6 +183,10 @@ void __init zylonite_pxa300_init(void) | |||
174 | 183 | ||
175 | /* GPIO pin assignment */ | 184 | /* GPIO pin assignment */ |
176 | gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20); | 185 | gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO20); |
186 | |||
187 | /* MMC card detect & write protect for controller 0 */ | ||
188 | zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0); | ||
189 | zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2); | ||
177 | } | 190 | } |
178 | 191 | ||
179 | if (cpu_is_pxa300()) { | 192 | if (cpu_is_pxa300()) { |
diff --git a/arch/arm/mach-pxa/zylonite_pxa320.c b/arch/arm/mach-pxa/zylonite_pxa320.c index 94c715808b59..593f7bffb3b4 100644 --- a/arch/arm/mach-pxa/zylonite_pxa320.c +++ b/arch/arm/mach-pxa/zylonite_pxa320.c | |||
@@ -95,6 +95,15 @@ static mfp_cfg_t mfp_cfg[] __initdata = { | |||
95 | /* Ethernet */ | 95 | /* Ethernet */ |
96 | GPIO4_nCS3, | 96 | GPIO4_nCS3, |
97 | GPIO90_GPIO, | 97 | GPIO90_GPIO, |
98 | |||
99 | /* MMC1 */ | ||
100 | GPIO18_MMC1_DAT0, | ||
101 | GPIO19_MMC1_DAT1, | ||
102 | GPIO20_MMC1_DAT2, | ||
103 | GPIO21_MMC1_DAT3, | ||
104 | GPIO22_MMC1_CLK, | ||
105 | GPIO23_MMC1_CMD,/* CMD0 for slot 0 */ | ||
106 | GPIO31_GPIO, /* CMD1 default as GPIO for slot 0 */ | ||
98 | }; | 107 | }; |
99 | 108 | ||
100 | #define NUM_LCD_DETECT_PINS 7 | 109 | #define NUM_LCD_DETECT_PINS 7 |
@@ -169,5 +178,9 @@ void __init zylonite_pxa320_init(void) | |||
169 | /* GPIO pin assignment */ | 178 | /* GPIO pin assignment */ |
170 | gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14); | 179 | gpio_backlight = mfp_to_gpio(MFP_PIN_GPIO14); |
171 | gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9); | 180 | gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO9); |
181 | |||
182 | /* MMC card detect & write protect for controller 0 */ | ||
183 | zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1); | ||
184 | zylonite_mmc_slot[0].gpio_wp = mfp_to_gpio(MFP_PIN_GPIO5); | ||
172 | } | 185 | } |
173 | } | 186 | } |