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@linaro.org X-Patchwork-Id: 9958 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 219F823E3D for ; Thu, 12 Jul 2012 12:40:52 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id E580AA186CF for ; Thu, 12 Jul 2012 12:40:51 +0000 (UTC) Received: by mail-gg0-f180.google.com with SMTP id f1so2530971ggn.11 for ; Thu, 12 Jul 2012 05:40:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:x-auditid :from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-brightmail-tracker:x-tm-as-mml:x-gm-message-state; bh=N5klEE46F//oCqjzDswb/Nb+Hz+sq1yLGQsA1Zwni9Y=; b=bl05YQTtokhV67lU8KpgyyMR5dhHB9Ea80Uv0gNgrECVLXGRjGnHBsGP73QX8VI/rF 0WBViPgT9h+lJ6GA3kLEwM33mzZV8dK8zqHvZTpkYOaI08u9haGog002JNuN+qTz/tSz cBlVuaAQiNxQZolsb+xburH1jHzNWutAA/pc79sh5O+7u4mEHY38FUwDg1E6XxNIcPxV 8OKjqVTZK4IyJtuP+rs1VUEpcDEGC//LHVg5VK1eqFPut4r4xFRkq4PpESh+gbenRqTm Q7SwCIWUBmRJrHgGpI80EDMAYcNt2e9K3EqmLw38b0KQRelJvLHnpJ1efLh349NbfTFM l3Jg== Received: by 10.50.203.39 with SMTP id kn7mr16993433igc.53.1342096851615; Thu, 12 Jul 2012 05:40:51 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.241.2 with SMTP id lc2csp2592ibb; Thu, 12 Jul 2012 05:40:51 -0700 (PDT) Received: by 10.68.192.73 with SMTP id he9mr5465611pbc.17.1342096850912; Thu, 12 Jul 2012 05:40:50 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id pu9si8880986pbc.88.2012.07.12.05.40.50; Thu, 12 Jul 2012 05:40:50 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.34; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.34 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: from epcpsbgm1.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M71007D1SJSWY50@mailout4.samsung.com> for patches@linaro.org; Thu, 12 Jul 2012 21:40:49 +0900 (KST) X-AuditID: cbfee61a-b7f616d000004b7e-1f-4ffec5d10f28 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id BB.9B.19326.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 patches@linaro.org; Thu, 12 Jul 2012 21:40:49 +0900 (KST) From: Thomas Abraham To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, cjb@laptop.org, grant.likely@secretlab.ca, rob.herring@calxeda.com, linux-samsung-soc@vger.kernel.org, kgene.kim@samsung.com, patches@linaro.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+NgFnrIJMWRmVeSWpSXmKPExsVy+t9jAd2LR//5G5w8pmYx5fAXFgdGjzvX 9rAFMEZx2aSk5mSWpRbp2yVwZXSf+8la0MlXsWNRXQPjNe4uRk4OCQETiV1bW5kgbDGJC/fW s3UxcnEICSxilFg/p4kFwpnLJLFwxTI2kCo2AQOJRwvfsYPYIgJOEkvmTmAGKWIWuMMo8WjW SUaQhLBAuMSLVafBxrIIqEo0/9gN1MzBwSvgKXHlgBrENiWJDb1HwUo4Bbwkrq9sYQUpEQIq efXHYQIj7wJGhlWMoqkFyQXFSem5hnrFibnFpXnpesn5uZsYwR5/JrWDcWWDxSFGAQ5GJR7e Dwf++QuxJpYVV+YeYpTgYFYS4e3PBQrxpiRWVqUW5ccXleakFh9ilOZgURLnNfb+6i8kkJ5Y kpqdmlqQWgSTZeLglGpgLOTM8uJ5s+zBwnv6BTeCrX5kTWhwLBC6a/T0t9a/8JnXOvhWXnHr NHpTNPvZVb8OG58FE4xV9dZ6i5079Wq2/km/b13FbtrmQnfPMpgfvbhdcbv+/mVz87MOLttx xHYW4+nOX7WyiT5VT3Z5/LAOz2RVVjdvfnZ+yh+ek39rFA15lHrMm91eKLEUZyQaajEXFScC AMQnT7T0AQAA X-TM-AS-MML: No X-Gm-Message-State: ALoCoQkp1TMnXwP1PyVmbPeZ8MpAPBWoEc0u7h9Lw2/ueDp732xvUEG3I0ivkPOCj5mcGdMSh78p 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;