From patchwork Wed Aug 29 10:48:11 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: 11019 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 8151623EFF for ; Wed, 29 Aug 2012 10:30:24 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 409D3A188FF for ; Wed, 29 Aug 2012 10:29:52 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j25so734260iaf.11 for ; Wed, 29 Aug 2012 03:30:24 -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-gm-message-state; bh=CXDUIt4W7bJUMiv73xWXHD90NM70KSg2Nr/umdmoDhQ=; b=XmbOWqwWQTIYorPmxFkR1rfhpCXT7u6BejW5L/sXVlh/ChgEJTLj0DS+pWDcu1IBqF 4IXYYnB7ESpQQzu4u11DDkRLHz0+SxGVWh60ZdMCKFQTADW6EMmXTNexgHntXqVTbFHQ ZqFmjEXPmQ1Jqb+pbKYWdtHljaEvmYexHsya1oroJB/IODBs3VmRTjqKkFqGYqzGGlqN X2z8ZadVO2r2xQCXpsW6FXbqvDRuh8v2JBo15IvX0wfAWnMZWdGlTThUQEMB5WKzdHy8 BdA9dL1ZcHqznf7JCgqtgMd9CwMiutT6Tn4CLgkIm0DSOfJAuC8Qo1egKe9Pi43+TEp9 RhGA== Received: by 10.50.45.162 with SMTP id o2mr1112750igm.0.1346236223912; Wed, 29 Aug 2012 03:30:23 -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.50.184.232 with SMTP id ex8csp77426igc; Wed, 29 Aug 2012 03:30:23 -0700 (PDT) Received: by 10.66.84.6 with SMTP id u6mr2511469pay.75.1346236223327; Wed, 29 Aug 2012 03:30:23 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id qd8si27235863pbc.217.2012.08.29.03.30.22; Wed, 29 Aug 2012 03:30:23 -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 epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9I00CPJIHKH311@mailout4.samsung.com>; Wed, 29 Aug 2012 19:30:22 +0900 (KST) X-AuditID: cbfee61b-b7faf6d00000476a-9d-503def3d2b59 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 2C.2F.18282.D3FED305; Wed, 29 Aug 2012 19:30:22 +0900 (KST) Received: from localhost.localdomain ([107.108.73.37]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0M9I004F3IHPXG70@mmp2.samsung.com>; Wed, 29 Aug 2012 19:30:21 +0900 (KST) From: Thomas Abraham 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 Message-id: <1346237295-7116-6-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1346237295-7116-1-git-send-email-thomas.abraham@linaro.org> References: <1346237295-7116-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrBJMWRmVeSWpSXmKPExsVy+t9jQV2797YBBusXM1p8+XqCzWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DKaJ16jK2gk69iYWMjawPjNe4uRk4OCQETiT1P/rJB 2GISF+6tB7K5OIQEpjNKnGntZ4Fw2pgknt74zw5SxSZgIPFo4TswW0TASWLJ3AnMIEXMAo1M EhsX7gQbJSwQLrHw1xNGEJtFQFXi/9JGoDgHB6+Ah8Ts3WUQ25QkNvQeZQKxOQU8Jd6tvALW KgRU8vveSrYJjLwLGBlWMYqmFiQXFCel5xrpFSfmFpfmpesl5+duYgT7/5n0DsZVDRaHGAU4 GJV4eC9w2wYIsSaWFVfmHmKU4GBWEuFNfQUU4k1JrKxKLcqPLyrNSS0+xCjNwaIkzsvfZxgg JJCeWJKanZpakFoEk2Xi4JRqYNzK8H8G+/LcdZnOIg8/vvh8TssmUf4c5+qEz3dy8kyaWKu1 X/2O0d95qWBX9KJDdmp/DPbFOFpON58pwPPyq+XGWw8utwr+dpx4rD7v4tymzK8ztuxv2LQ9 OeLwgvXeSyZUVkx8GJo4aXWzUnG31IPj3643hs/YXM0i9sGsM+Js+SXuPzqykR+VWIozEg21 mIuKEwGiPhiD+wEAAA== X-Gm-Message-State: ALoCoQlYGPAW5uzQOabA4yOKHJa9HtCPpBEsWaHqBbl56+gSLbB0NzqSX+Gl9DbNVZoxHoszxXay 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 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;