diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2006-06-19 14:58:51 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2006-06-19 14:58:51 -0400 |
commit | 88660351cb6daa85baf9700f12dff3af564dc14a (patch) | |
tree | 8824d4dac6576324e9922d0acc72a42f39325af5 /arch/arm | |
parent | 74617fb6b825ea370ae72565f7543306bc08ef6e (diff) |
[ARM] 3561/1: Poodle: Correct the MMC/SD power control
Patch from Richard Purdie
Correct the Poodle power control for the MMC/SD port. Also
add write protection switch support.
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-pxa/poodle.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c index 1d516d317e89..234877a09dfb 100644 --- a/arch/arm/mach-pxa/poodle.c +++ b/arch/arm/mach-pxa/poodle.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/platform_device.h> | 19 | #include <linux/platform_device.h> |
20 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
21 | #include <linux/pm.h> | 21 | #include <linux/pm.h> |
22 | #include <linux/delay.h> | ||
22 | 23 | ||
23 | #include <asm/hardware.h> | 24 | #include <asm/hardware.h> |
24 | #include <asm/mach-types.h> | 25 | #include <asm/mach-types.h> |
@@ -143,7 +144,9 @@ static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)( | |||
143 | pxa_gpio_mode(GPIO6_MMCCLK_MD); | 144 | pxa_gpio_mode(GPIO6_MMCCLK_MD); |
144 | pxa_gpio_mode(GPIO8_MMCCS0_MD); | 145 | pxa_gpio_mode(GPIO8_MMCCS0_MD); |
145 | pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN); | 146 | pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN); |
147 | pxa_gpio_mode(POODLE_GPIO_nSD_WP | GPIO_IN); | ||
146 | pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT); | 148 | pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT); |
149 | pxa_gpio_mode(POODLE_GPIO_SD_PWR1 | GPIO_OUT); | ||
147 | 150 | ||
148 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); | 151 | poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); |
149 | 152 | ||
@@ -162,12 +165,22 @@ static void poodle_mci_setpower(struct device *dev, unsigned int vdd) | |||
162 | { | 165 | { |
163 | struct pxamci_platform_data* p_d = dev->platform_data; | 166 | struct pxamci_platform_data* p_d = dev->platform_data; |
164 | 167 | ||
165 | if (( 1 << vdd) & p_d->ocr_mask) | 168 | if (( 1 << vdd) & p_d->ocr_mask) { |
166 | GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | 169 | GPSR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR); |
167 | else | 170 | mdelay(2); |
168 | GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR); | 171 | GPSR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1); |
172 | } else { | ||
173 | GPCR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1); | ||
174 | GPCR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR); | ||
175 | } | ||
176 | } | ||
177 | |||
178 | static int poodle_mci_get_ro(struct device *dev) | ||
179 | { | ||
180 | return GPLR(POODLE_GPIO_nSD_WP) & GPIO_bit(POODLE_GPIO_nSD_WP); | ||
169 | } | 181 | } |
170 | 182 | ||
183 | |||
171 | static void poodle_mci_exit(struct device *dev, void *data) | 184 | static void poodle_mci_exit(struct device *dev, void *data) |
172 | { | 185 | { |
173 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); | 186 | free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data); |
@@ -176,6 +189,7 @@ static void poodle_mci_exit(struct device *dev, void *data) | |||
176 | static struct pxamci_platform_data poodle_mci_platform_data = { | 189 | static struct pxamci_platform_data poodle_mci_platform_data = { |
177 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, | 190 | .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, |
178 | .init = poodle_mci_init, | 191 | .init = poodle_mci_init, |
192 | .get_ro = poodle_mci_get_ro, | ||
179 | .setpower = poodle_mci_setpower, | 193 | .setpower = poodle_mci_setpower, |
180 | .exit = poodle_mci_exit, | 194 | .exit = poodle_mci_exit, |
181 | }; | 195 | }; |