Skip to contentSkip to conversation

s3cmci: Initialize default platform data no_wprotect and no_detect with 1

PATCH RESEND New Lars-Peter Clausen 1 participant 2 messages Feb 26, 2010 MMC, SD and SDIO

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 s3cmci: Initialize default platform data no_wprotect and no_detect with 1

If no platform_data was givin to the device it's going to use it's default platform data struct which has all fields initialized to zero.
As a result the driver is going to try to request gpio0 both as write protect and card detect pin. Which of course will fail and makes the driver unusable

Previously to the introduction of no_wprotect and no_detect the behavior was to assume that if no platform data was given there is no write protect or card detect pin.
This patch restores that behavior.

---
 drivers/mmc/host/s3cmci.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/mmc/host/s3cmci.c +2 -0
index d96e1ab..b9c96cc 100644
@@ -1360,6 +1360,8 @@ static struct mmc_host_ops s3cmci_ops = {
 static struct s3c24xx_mci_pdata s3cmci_def_pdata = {
 	/* This is currently here to avoid a number of if (host->pdata)
 	 * checks. Any zero fields to ensure reasonable defaults are picked. */
+	 .no_wprotect = 1,
+	 .no_detect = 1,
 };
 
 #ifdef CONFIG_CPU_FREQ
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH RESEND 1/1 s3cmci: s3cmci_card_present: Use no_detect to decide whether there is a card detect pin

---
 drivers/mmc/host/s3cmci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mmc/host/s3cmci.c +1 -1
index b9c96cc..2fdf768 100644
@@ -1179,7 +1179,7 @@ static int s3cmci_card_present(struct mmc_host *mmc)
 	struct s3c24xx_mci_pdata *pdata = host->pdata;
 	int ret;
 
-	if (pdata->gpio_detect == 0)
+	if (pdata->no_detect)
 		return -ENOSYS;
 
 	ret = gpio_get_value(pdata->gpio_detect) ? 0 : 1;
Signature · 1 line
1.5.6.5