Commit f91e4906 authored by Haojian Zhuang's avatar Haojian Zhuang Committed by Eric Miao

[ARM] pxa/zylonite: simplify reduntant gpio settings on mmc slot

PXA mmc host driver supports card detect, read only and power gpio pin
setting already. Zylonite platform driver needn't implement this any more.
Signed-off-by: default avatarHaojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: default avatarEric Miao <eric.y.miao@gmail.com>
parent c57b9343
...@@ -8,13 +8,6 @@ ...@@ -8,13 +8,6 @@
/* the following variables are processor specific and initialized /* the following variables are processor specific and initialized
* by the corresponding zylonite_pxa3xx_init() * by the corresponding zylonite_pxa3xx_init()
*/ */
struct platform_mmc_slot {
int gpio_cd;
int gpio_wp;
};
extern struct platform_mmc_slot zylonite_mmc_slot[];
extern int gpio_eth_irq; extern int gpio_eth_irq;
extern int gpio_debug_led1; extern int gpio_debug_led1;
extern int gpio_debug_led2; extern int gpio_debug_led2;
......
...@@ -36,9 +36,6 @@ ...@@ -36,9 +36,6 @@
#include "devices.h" #include "devices.h"
#include "generic.h" #include "generic.h"
#define MAX_SLOTS 3
struct platform_mmc_slot zylonite_mmc_slot[MAX_SLOTS];
int gpio_eth_irq; int gpio_eth_irq;
int gpio_debug_led1; int gpio_debug_led1;
int gpio_debug_led2; int gpio_debug_led2;
...@@ -220,84 +217,28 @@ static inline void zylonite_init_lcd(void) {} ...@@ -220,84 +217,28 @@ static inline void zylonite_init_lcd(void) {}
#endif #endif
#if defined(CONFIG_MMC) #if defined(CONFIG_MMC)
static int zylonite_mci_ro(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
return gpio_get_value(zylonite_mmc_slot[pdev->id].gpio_wp);
}
static int zylonite_mci_init(struct device *dev,
irq_handler_t zylonite_detect_int,
void *data)
{
struct platform_device *pdev = to_platform_device(dev);
int err, cd_irq, gpio_cd, gpio_wp;
cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd);
gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd;
gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp;
/*
* setup GPIO for Zylonite MMC controller
*/
err = gpio_request(gpio_cd, "mmc card detect");
if (err)
goto err_request_cd;
gpio_direction_input(gpio_cd);
err = gpio_request(gpio_wp, "mmc write protect");
if (err)
goto err_request_wp;
gpio_direction_input(gpio_wp);
err = request_irq(cd_irq, zylonite_detect_int,
IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
"MMC card detect", data);
if (err) {
printk(KERN_ERR "%s: MMC/SD/SDIO: "
"can't request card detect IRQ\n", __func__);
goto err_request_irq;
}
return 0;
err_request_irq:
gpio_free(gpio_wp);
err_request_wp:
gpio_free(gpio_cd);
err_request_cd:
return err;
}
static void zylonite_mci_exit(struct device *dev, void *data)
{
struct platform_device *pdev = to_platform_device(dev);
int cd_irq, gpio_cd, gpio_wp;
cd_irq = gpio_to_irq(zylonite_mmc_slot[pdev->id].gpio_cd);
gpio_cd = zylonite_mmc_slot[pdev->id].gpio_cd;
gpio_wp = zylonite_mmc_slot[pdev->id].gpio_wp;
free_irq(cd_irq, data);
gpio_free(gpio_cd);
gpio_free(gpio_wp);
}
static struct pxamci_platform_data zylonite_mci_platform_data = { static struct pxamci_platform_data zylonite_mci_platform_data = {
.detect_delay = 20, .detect_delay = 20,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.init = zylonite_mci_init, .gpio_card_detect = EXT_GPIO(0),
.exit = zylonite_mci_exit, .gpio_card_ro = EXT_GPIO(2),
.get_ro = zylonite_mci_ro,
.gpio_card_detect = -1,
.gpio_card_ro = -1,
.gpio_power = -1, .gpio_power = -1,
}; };
static struct pxamci_platform_data zylonite_mci2_platform_data = { static struct pxamci_platform_data zylonite_mci2_platform_data = {
.detect_delay = 20, .detect_delay = 20,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_card_detect = EXT_GPIO(1),
.gpio_card_ro = EXT_GPIO(3),
.gpio_power = -1,
};
static struct pxamci_platform_data zylonite_mci3_platform_data = {
.detect_delay = 20,
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.gpio_card_detect = EXT_GPIO(30),
.gpio_card_ro = EXT_GPIO(31),
.gpio_power = -1,
}; };
static void __init zylonite_init_mmc(void) static void __init zylonite_init_mmc(void)
...@@ -305,7 +246,7 @@ static void __init zylonite_init_mmc(void) ...@@ -305,7 +246,7 @@ static void __init zylonite_init_mmc(void)
pxa_set_mci_info(&zylonite_mci_platform_data); pxa_set_mci_info(&zylonite_mci_platform_data);
pxa3xx_set_mci2_info(&zylonite_mci2_platform_data); pxa3xx_set_mci2_info(&zylonite_mci2_platform_data);
if (cpu_is_pxa310()) if (cpu_is_pxa310())
pxa3xx_set_mci3_info(&zylonite_mci_platform_data); pxa3xx_set_mci3_info(&zylonite_mci3_platform_data);
} }
#else #else
static inline void zylonite_init_mmc(void) {} static inline void zylonite_init_mmc(void) {}
......
...@@ -129,8 +129,8 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = { ...@@ -129,8 +129,8 @@ static mfp_cfg_t common_mfp_cfg[] __initdata = {
GPIO22_I2C_SDA, GPIO22_I2C_SDA,
/* GPIO */ /* GPIO */
GPIO18_GPIO, /* GPIO Expander #0 INT_N */ GPIO18_GPIO | MFP_PULL_HIGH, /* GPIO Expander #0 INT_N */
GPIO19_GPIO, /* GPIO Expander #1 INT_N */ GPIO19_GPIO | MFP_PULL_HIGH, /* GPIO Expander #1 INT_N */
}; };
static mfp_cfg_t pxa300_mfp_cfg[] __initdata = { static mfp_cfg_t pxa300_mfp_cfg[] __initdata = {
...@@ -258,10 +258,6 @@ void __init zylonite_pxa300_init(void) ...@@ -258,10 +258,6 @@ void __init zylonite_pxa300_init(void)
/* detect LCD panel */ /* detect LCD panel */
zylonite_detect_lcd_panel(); zylonite_detect_lcd_panel();
/* MMC card detect & write protect for controller 0 */
zylonite_mmc_slot[0].gpio_cd = EXT_GPIO(0);
zylonite_mmc_slot[0].gpio_wp = EXT_GPIO(2);
/* WM9713 IRQ */ /* WM9713 IRQ */
wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26); wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO26);
...@@ -276,10 +272,6 @@ void __init zylonite_pxa300_init(void) ...@@ -276,10 +272,6 @@ void __init zylonite_pxa300_init(void)
if (cpu_is_pxa310()) { if (cpu_is_pxa310()) {
pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg)); pxa3xx_mfp_config(ARRAY_AND_SIZE(pxa310_mfp_cfg));
gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102); gpio_eth_irq = mfp_to_gpio(MFP_PIN_GPIO102);
/* MMC card detect & write protect for controller 2 */
zylonite_mmc_slot[2].gpio_cd = EXT_GPIO(30);
zylonite_mmc_slot[2].gpio_wp = EXT_GPIO(31);
} }
/* GPIOs for Debug LEDs */ /* GPIOs for Debug LEDs */
......
...@@ -209,10 +209,6 @@ void __init zylonite_pxa320_init(void) ...@@ -209,10 +209,6 @@ void __init zylonite_pxa320_init(void)
gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2); gpio_debug_led1 = mfp_to_gpio(MFP_PIN_GPIO1_2);
gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2); gpio_debug_led2 = mfp_to_gpio(MFP_PIN_GPIO4_2);
/* MMC card detect & write protect for controller 0 */
zylonite_mmc_slot[0].gpio_cd = mfp_to_gpio(MFP_PIN_GPIO1);
zylonite_mmc_slot[0].gpio_wp = mfp_to_gpio(MFP_PIN_GPIO5);
/* WM9713 IRQ */ /* WM9713 IRQ */
wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15); wm9713_irq = mfp_to_gpio(MFP_PIN_GPIO15);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment