All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Abraham <thomas.abraham@linaro.org>
To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org
Cc: will.newton@imgtec.com, cjb@laptop.org,
	grant.likely@secretlab.ca, rob.herring@calxeda.com,
	linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com,
	girish.shivananjappa@linaro.org, jh80.chung@samsung.com,
	tgih.jun@samsung.com, patches@linaro.org
Subject: [PATCH v5 5/9] mmc: dw_mmc: add quirk to indicate missing write protect line
Date: Wed, 29 Aug 2012 16:18:11 +0530	[thread overview]
Message-ID: <1346237295-7116-6-git-send-email-thomas.abraham@linaro.org> (raw)
In-Reply-To: <1346237295-7116-1-git-send-email-thomas.abraham@linaro.org>

If the write protect pad of the controller is not connected to the write
protect pin of the slot, the driver should be notified of this condition
so that incorrect check for write protection by reading the WRTORT
register can avoided. The get_ro platform callback can be used for in
such cases, but with device tree support enabled, such platform callbacks
cannot be supported.

Add a new quirk for notifying the driver about the missing write protect
line so the driver can assume that the card write protection is disabled.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Will Newton <will.newton@imgtec.com>
---
 drivers/mmc/host/dw_mmc.c  |    4 +++-
 include/linux/mmc/dw_mmc.h |    3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 90c7c7b..1799a2d 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -830,7 +830,9 @@ static int dw_mci_get_ro(struct mmc_host *mmc)
 	struct dw_mci_board *brd = slot->host->pdata;
 
 	/* Use platform get_ro function, else try on board write protect */
-	if (brd->get_ro)
+	if (brd->quirks & DW_MCI_QUIRK_NO_WRITE_PROTECT)
+		read_only = 0;
+	else if (brd->get_ro)
 		read_only = brd->get_ro(slot->id);
 	else
 		read_only =
diff --git a/include/linux/mmc/dw_mmc.h b/include/linux/mmc/dw_mmc.h
index 787ad56..b72e4aa 100644
--- a/include/linux/mmc/dw_mmc.h
+++ b/include/linux/mmc/dw_mmc.h
@@ -205,7 +205,8 @@ struct dw_mci_dma_ops {
 #define DW_MCI_QUIRK_HIGHSPEED			BIT(2)
 /* Unreliable card detection */
 #define DW_MCI_QUIRK_BROKEN_CARD_DETECTION	BIT(3)
-
+/* Write Protect detection not available */
+#define DW_MCI_QUIRK_NO_WRITE_PROTECT		BIT(4)
 
 struct dma_pdata;
 
-- 
1.6.6.rc2

  parent reply	other threads:[~2012-08-29 10:48 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-29 10:48 [PATCH v5 0/9] mmc: dw_mmc: add support for device tree based instantiation Thomas Abraham
2012-08-29 10:48 ` [PATCH v5 1/9] mmc: dw_mmc: convert copy of struct device in struct dw_mci to a reference Thomas Abraham
2012-08-29 10:48 ` [PATCH v5 2/9] mmc: dw_mmc: Use devm_* functions in dw_mmc platform driver Thomas Abraham
2012-08-29 10:48 ` [PATCH v5 3/9] mmc: dw_mmc: allow probe to succeed even if one slot is initialized Thomas Abraham
2012-08-29 10:48 ` [PATCH v5 4/9] mmc: dw_mmc: lookup for optional biu and ciu clocks Thomas Abraham
2012-08-30  8:48   ` Jaehoon Chung
2012-08-31  5:29     ` Thomas Abraham
2012-08-31  6:02       ` Jaehoon Chung
2012-08-31  6:32         ` Thomas Abraham
2012-08-31  6:32         ` Thomas Abraham
2012-08-31  7:59           ` Jaehoon Chung
2012-08-31  8:48             ` Thomas Abraham
2012-09-04 19:46               ` Thomas Abraham
2012-09-05  8:30                 ` Jaehoon Chung
2012-09-07  6:26                   ` Thomas Abraham
2012-09-07  9:39                     ` Thomas Abraham
2012-08-29 10:48 ` Thomas Abraham [this message]
2012-08-29 10:48 ` [PATCH v5 6/9] mmc: dw_mmc: add device tree support Thomas Abraham
2012-08-29 10:48 ` [PATCH v5 7/9] mmc: dw_mmc: prepare functions in dw_mmc-pltfm for reuse Thomas Abraham
2012-08-29 10:48 ` [PATCH v5 8/9] mmc: dw_mmc: add support for implementation specific callbacks Thomas Abraham
2012-09-04 19:47   ` Thomas Abraham
2012-09-07  9:40   ` Thomas Abraham
2012-08-29 10:48 ` [PATCH v5 9/9] mmc: dw_mmc: add support for exynos specific implementation of dw-mshc Thomas Abraham
2012-09-04 19:48   ` Thomas Abraham
2012-09-05 10:43     ` Seungwon Jeon
2012-09-07  7:15       ` Thomas Abraham
2012-09-07  9:41         ` Thomas Abraham
2012-09-07 10:51         ` Seungwon Jeon
     [not found]           ` <00a601cd8ce6$ca599e50$5f0cdaf0$%jun-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-09-07 16:13             ` Thomas Abraham

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346237295-7116-6-git-send-email-thomas.abraham@linaro.org \
    --to=thomas.abraham@linaro.org \
    --cc=cjb@laptop.org \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=girish.shivananjappa@linaro.org \
    --cc=grant.likely@secretlab.ca \
    --cc=jh80.chung@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=rob.herring@calxeda.com \
    --cc=tgih.jun@samsung.com \
    --cc=will.newton@imgtec.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.