From patchwork Thu Jul 12 12:54:26 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Abraham X-Patchwork-Id: 1188831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 0AD5140B20 for ; Thu, 12 Jul 2012 12:49:38 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SpIkz-0005bN-CW; Thu, 12 Jul 2012 12:44:33 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SpIhW-00051Y-Db for linux-arm-kernel@lists.infradead.org; Thu, 12 Jul 2012 12:41:04 +0000 Received: from epcpsbgm2.samsung.com (mailout2.samsung.com [203.254.224.25]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M71003DOSJUSDB0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 12 Jul 2012 21:40:49 +0900 (KST) X-AuditID: cbfee61b-b7f566d000005c8a-d3-4ffec5d14f5e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id A0.5E.23690.1D5CEFF4; Thu, 12 Jul 2012 21:40:49 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M7100BYUSJJH720@mmp1.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 12 Jul 2012 21:40:49 +0900 (KST) From: Thomas Abraham To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Subject: [PATCH v3 4/6] mmc: dw_mmc: add quirk to indicate missing write protect line Date: Thu, 12 Jul 2012 18:24:26 +0530 Message-id: <1342097668-25243-5-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1342097668-25243-1-git-send-email-thomas.abraham@linaro.org> References: <1342097668-25243-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrPJMWRmVeSWpSXmKPExsVy+t9jAd2LR//5G1y5qm6x6fE1VgdGj81L 6gMYo7hsUlJzMstSi/TtErgyus/9ZC3o5KvYsaiugfEadxcjJ4eEgInEqam9jBC2mMSFe+vZ QGwhgUWMElemRHQxcgHZ65kk2tYcACtiEzCQeLTwHTuILSLgJLFk7gRmkCJmgTuMEo9mnQQr EhYIl3ix6jQTiM0ioCrR/GM30FQODl4BT4krB9QglilJbOg9ClbCKeAlcX1lCytIiRBQyas/ DhMYeRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93ECPb2M+kdjKsaLA4xCnAwKvHwPtj0 z1+INbGsuDL3EKMEB7OSCG9/LlCINyWxsiq1KD++qDQntfgQozQHi5I4r4n3V38hgfTEktTs 1NSC1CKYLBMHp1QDY8z76Q/TfM6/j/C9sfvtPMtV0pomF6ZFPdRhztr2sf2xjYHVe0sT2QO/ HO2/6Esd/OU4Rdpw1o9rO5SSLe5eyHXa4XT2RP9Vz4q/L3Iyw21WSV3h/StbH7l6lXZekPFy WyH9n2FyRtlsZgbH2nUbNrdbFbn1Crct1j9sXXNt1ZP3AvMXa/g/V2Ipzkg01GIuKk4EALX9 VZDyAQAA X-TM-AS-MML: No X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.25 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-samsung-soc@vger.kernel.org, patches@linaro.org, linux-kernel@vger.kernel.org, rob.herring@calxeda.com, grant.likely@secretlab.ca, kgene.kim@samsung.com, cjb@laptop.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 Acked-by: Will Newton --- 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 679473c..075f89d 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -827,7 +827,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;