From patchwork Mon Sep 17 18:16:39 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: 11467 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 5CC3D23F9E for ; Mon, 17 Sep 2012 17:56:52 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id B6A1AA18E3A for ; Mon, 17 Sep 2012 17:56:51 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id k11so9550081iea.11 for ; Mon, 17 Sep 2012 10:56: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-gm-message-state; bh=0MaBZaFkgjVYqP6sSYRFmuQXgMLIVdfl8tR/f+V+EJ4=; b=mmSPDvjaq2vG/cbw1L6dGkB0lbmj4qqZdv7oq6UrXCJu6azgez6dD32FiYoO3srlLC LCAP+aQNhrfIgh7HcDB7xiz/YnAlAFEeKBE9X0DxQXHfBm1p3R0IbGACyOHH96Jei0P4 xEgBixi75F/EPPddis+/7a73QeoLvRKpY4yqRcoDGnae1yVvg+PttNp56UVXzTWvt3kd Ozx3l4QNkBWW6oDfcincI1XEQr93tkPgLpKnIrAehYh2CG4NyHVVnPw3grT/U/CasHNw rvGzPA5Ga86H+vfha/ZDPHVvXc2FWMpFHz/FODpRTVlJ0UfrOkhqldSYSAvdLa506vxl KDhw== Received: by 10.42.60.139 with SMTP id q11mr9560827ich.53.1347904611389; Mon, 17 Sep 2012 10:56: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.50.184.232 with SMTP id ex8csp329893igc; Mon, 17 Sep 2012 10:56:51 -0700 (PDT) Received: by 10.66.84.229 with SMTP id c5mr21324598paz.12.1347904610727; Mon, 17 Sep 2012 10:56:50 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id ts2si16516098pbc.56.2012.09.17.10.56.50; Mon, 17 Sep 2012 10:56:50 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.25 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.25; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.25 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 (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MAI00EXM9U9AKY0@mailout2.samsung.com>; Tue, 18 Sep 2012 02:56:49 +0900 (KST) X-AuditID: cbfee61a-b7f726d000000ec7-2a-50576461b6dd Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id D0.18.03783.16467505; Tue, 18 Sep 2012 02:56: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 <0MAI00MTJ9U8PO50@mmp1.samsung.com>; Tue, 18 Sep 2012 02:56:49 +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 v6 5/9] mmc: dw_mmc: add quirk to indicate missing write protect line Date: Mon, 17 Sep 2012 23:46:39 +0530 Message-id: <1347905803-22742-6-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1347905803-22742-1-git-send-email-thomas.abraham@linaro.org> References: <1347905803-22742-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJJMWRmVeSWpSXmKPExsVy+t9jAd3ElPAAg10XFCy+fD3BZjHl8BcW ByaPO9f2sAUwRnHZpKTmZJalFunbJXBlTFm+k6mgk6/iZmcjcwPjNe4uRk4OCQETiV/7VjFB 2GISF+6tZ+ti5OIQEljEKLHx3QpGCKeNSWLP1SfMIFVsAgYSjxa+YwexRQScJJbMncAMUsQs 0MgksXHhTjaQhLBAuMSHcx/BGlgEVCXetT5gBLF5BTwlrh1qYoRYpySxofco2GpOAS+J6dsP gQ0VAqrZu2I2ywRG3gWMDKsYRVMLkguKk9JzDfWKE3OLS/PS9ZLzczcxggPgmdQOxpUNFocY BTgYlXh4A13CA4RYE8uKK3MPMUpwMCuJ8N4WAArxpiRWVqUW5ccXleakFh9ilOZgURLnFf4U GCAkkJ5YkpqdmlqQWgSTZeLglGpgtBeMYDqWdTLDXChWKN7txJxNNzk2CjvVTvV6rPLhhGzx nM3zzkzeE3P8f9tzh73KBn8Ttr+u7ex6qPLv0T8rjpprd/2/b2AVKIzWdZpVL98VkV/0odhe hitet/LFU40ffzPzZvlbm5bOXrZu7bSPrFXyDDwL/YI2HDKXbObpybL6dFO6iyVPiaU4I9FQ i7moOBEARXyYoPwBAAA= X-Gm-Message-State: ALoCoQnadVsTq1YitNBVLRnEIz6uFk0x1c0JjxDil+GUFs7YBpH+kBs6cxGbSrbzWYwE17CNHfWh 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 de45ad2..455a155 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;