mirror of
https://github.com/torvalds/linux.git
synced 2024-11-02 10:11:36 +00:00
[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>
This commit is contained in:
parent
74617fb6b8
commit
88660351cb
@ -19,6 +19,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/fb.h>
|
||||
#include <linux/pm.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
#include <asm/hardware.h>
|
||||
#include <asm/mach-types.h>
|
||||
@ -143,7 +144,9 @@ static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)(
|
||||
pxa_gpio_mode(GPIO6_MMCCLK_MD);
|
||||
pxa_gpio_mode(GPIO8_MMCCS0_MD);
|
||||
pxa_gpio_mode(POODLE_GPIO_nSD_DETECT | GPIO_IN);
|
||||
pxa_gpio_mode(POODLE_GPIO_nSD_WP | GPIO_IN);
|
||||
pxa_gpio_mode(POODLE_GPIO_SD_PWR | GPIO_OUT);
|
||||
pxa_gpio_mode(POODLE_GPIO_SD_PWR1 | GPIO_OUT);
|
||||
|
||||
poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250);
|
||||
|
||||
@ -162,12 +165,22 @@ static void poodle_mci_setpower(struct device *dev, unsigned int vdd)
|
||||
{
|
||||
struct pxamci_platform_data* p_d = dev->platform_data;
|
||||
|
||||
if (( 1 << vdd) & p_d->ocr_mask)
|
||||
GPSR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
|
||||
else
|
||||
GPCR1 = GPIO_bit(POODLE_GPIO_SD_PWR);
|
||||
if (( 1 << vdd) & p_d->ocr_mask) {
|
||||
GPSR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR);
|
||||
mdelay(2);
|
||||
GPSR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1);
|
||||
} else {
|
||||
GPCR(POODLE_GPIO_SD_PWR1) = GPIO_bit(POODLE_GPIO_SD_PWR1);
|
||||
GPCR(POODLE_GPIO_SD_PWR) = GPIO_bit(POODLE_GPIO_SD_PWR);
|
||||
}
|
||||
}
|
||||
|
||||
static int poodle_mci_get_ro(struct device *dev)
|
||||
{
|
||||
return GPLR(POODLE_GPIO_nSD_WP) & GPIO_bit(POODLE_GPIO_nSD_WP);
|
||||
}
|
||||
|
||||
|
||||
static void poodle_mci_exit(struct device *dev, void *data)
|
||||
{
|
||||
free_irq(POODLE_IRQ_GPIO_nSD_DETECT, data);
|
||||
@ -176,6 +189,7 @@ static void poodle_mci_exit(struct device *dev, void *data)
|
||||
static struct pxamci_platform_data poodle_mci_platform_data = {
|
||||
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
|
||||
.init = poodle_mci_init,
|
||||
.get_ro = poodle_mci_get_ro,
|
||||
.setpower = poodle_mci_setpower,
|
||||
.exit = poodle_mci_exit,
|
||||
};
|
||||
|
@ -31,6 +31,7 @@
|
||||
#define POODLE_GPIO_CF_CD (14)
|
||||
#define POODLE_GPIO_CF_STSCHG (14)
|
||||
#define POODLE_GPIO_SD_PWR (33)
|
||||
#define POODLE_GPIO_SD_PWR1 (3)
|
||||
#define POODLE_GPIO_nSD_CLK (6)
|
||||
#define POODLE_GPIO_nSD_WP (7)
|
||||
#define POODLE_GPIO_nSD_INT (8)
|
||||
@ -42,6 +43,7 @@
|
||||
#define POODLE_GPIO_BYPASS_ON (36)
|
||||
#define POODLE_GPIO_CHRG_ON (38)
|
||||
#define POODLE_GPIO_CHRG_FULL (16)
|
||||
#define POODLE_GPIO_DISCHARGE_ON (42) /* Enable battery discharge */
|
||||
|
||||
/* PXA GPIOs */
|
||||
#define POODLE_IRQ_GPIO_ON_KEY IRQ_GPIO(0)
|
||||
|
Loading…
Reference in New Issue
Block a user