From: Richard Purdie <rpurdie@rpsys.net>

Add a write protection switch handling code to the PXA MMC driver so
that platform specific code can provide it if available.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/mmc/pxamci.c           |   11 +++++++++++
 include/asm-arm/arch-pxa/mmc.h |    1 +
 2 files changed, 12 insertions(+)

diff -puN drivers/mmc/pxamci.c~add-write-protection-switch-handling-to-the-pxa-mmc-driver drivers/mmc/pxamci.c
--- devel/drivers/mmc/pxamci.c~add-write-protection-switch-handling-to-the-pxa-mmc-driver	2005-08-05 00:53:03.000000000 -0700
+++ devel-akpm/drivers/mmc/pxamci.c	2005-08-05 00:53:03.000000000 -0700
@@ -362,6 +362,16 @@ static void pxamci_request(struct mmc_ho
 	pxamci_start_cmd(host, mrq->cmd, cmdat);
 }
 
+static int pxamci_get_ro(struct mmc_host *mmc)
+{
+	struct pxamci_host *host = mmc_priv(mmc);
+
+	if (host->pdata && host->pdata->get_ro)
+		return host->pdata->get_ro(mmc->dev);
+	/* Host doesn't support read only detection so assume writeable */
+	return 0;
+}
+
 static void pxamci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 {
 	struct pxamci_host *host = mmc_priv(mmc);
@@ -401,6 +411,7 @@ static void pxamci_set_ios(struct mmc_ho
 
 static struct mmc_host_ops pxamci_ops = {
 	.request	= pxamci_request,
+	.get_ro		= pxamci_get_ro,
 	.set_ios	= pxamci_set_ios,
 };
 
diff -puN include/asm-arm/arch-pxa/mmc.h~add-write-protection-switch-handling-to-the-pxa-mmc-driver include/asm-arm/arch-pxa/mmc.h
--- devel/include/asm-arm/arch-pxa/mmc.h~add-write-protection-switch-handling-to-the-pxa-mmc-driver	2005-08-05 00:53:03.000000000 -0700
+++ devel-akpm/include/asm-arm/arch-pxa/mmc.h	2005-08-05 00:53:03.000000000 -0700
@@ -10,6 +10,7 @@ struct mmc_host;
 struct pxamci_platform_data {
 	unsigned int ocr_mask;			/* available voltages */
 	int (*init)(struct device *, irqreturn_t (*)(int, void *, struct pt_regs *), void *);
+	int (*get_ro)(struct device *);
 	void (*setpower)(struct device *, unsigned int);
 	void (*exit)(struct device *, void *);
 };
_