From patchwork Thu May 17 15:10:09 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: 8760 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 8856E23E61 for ; Thu, 17 May 2012 15:00:18 +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 51A47A186EE for ; Thu, 17 May 2012 15:00:18 +0000 (UTC) Received: by ggnf1 with SMTP id f1so2284031ggn.11 for ; Thu, 17 May 2012 08:00:17 -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=lBi1O3yFT7sJUKLHahFqDhdyeawNaFP7CYvYupLnMt4=; b=pKcJAoRIiNVCX2orfVxfMrRH5Fu18o4QBBooP7utw1mmlPUBDt5ogveVuZp3FMds/6 J4OSYMshB+nSeXBF0a8REsv5WUzd8K8epabeh9NmHm0/Ado0Xte/od1sdHHn/yR09Asf 4f9EcimMRP7lw6XaM5hfO8wq4MsOCCBzzcIfqxFLuzc8ZFEWwKlxbs/sIBsdDpZHgF/q x8sb4OEigZ4jESf18CP40PX7Tc+IzgMK6ua7b0drXwLKpYkoF1pWywl/Cjk5c0woIq1t hdZnl8EyQC23dSSa7TgWwAM9BJW2CuNdB0wfohkjEL7mFHbaUYl9bWHyXroYEemCk6/w nUrw== Received: by 10.50.154.169 with SMTP id vp9mr13633930igb.53.1337266817583; Thu, 17 May 2012 08:00:17 -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.35.72 with SMTP id o8csp34212ibd; Thu, 17 May 2012 08:00:15 -0700 (PDT) Received: by 10.68.239.164 with SMTP id vt4mr27025503pbc.166.1337266814189; Thu, 17 May 2012 08:00:14 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id rb7si3178502pbc.169.2012.05.17.08.00.13; Thu, 17 May 2012 08:00:14 -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 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 <0M46001HO9OBCD30@mailout2.samsung.com> for patches@linaro.org; Fri, 18 May 2012 00:00:12 +0900 (KST) X-AuditID: cbfee61b-b7bb6ae0000006fb-0c-4fb5127bccb8 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (MMPCPMTA) with SMTP id E5.19.01787.B7215BF4; Fri, 18 May 2012 00:00:11 +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 <0M460077M9HVVD80@mmp1.samsung.com> for patches@linaro.org; Fri, 18 May 2012 00:00:11 +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 v2 4/6] mmc: dw_mmc: add quirk to indicate missing write protect line Date: Thu, 17 May 2012 20:40:09 +0530 Message-id: <1337267411-28226-5-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1337267411-28226-1-git-send-email-thomas.abraham@linaro.org> References: <1337267411-28226-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: AAAAAA== X-TM-AS-MML: No X-Gm-Message-State: ALoCoQn8NbcLARymS+rRORmfrOETBbtrvGk+Fc91YN+VJElfhKtF3lxhmRtOR+VhrZV0E9CjDLBr 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 eb5fa59..c862b7f 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -812,7 +812,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;