From patchwork Sun Aug 26 11:52:03 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: 10955 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 9B17523EFE for ; Sun, 26 Aug 2012 11:34: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 28E54A18263 for ; Sun, 26 Aug 2012 11:34:01 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id j25so3776090iaf.11 for ; Sun, 26 Aug 2012 04:34: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=N5klEE46F//oCqjzDswb/Nb+Hz+sq1yLGQsA1Zwni9Y=; b=njUN7Cmo/kQ9kMJ+BHhrQ30HH0zzsJ6bVIe/bkvgFCJ2taRf+Z87ZH6RwqR9ZtrdC6 XPbA744wGAKCDsg2zhaNwBfo08b4lnWVc9zVeH2eR5DM0Gj3s1MHPBYnUfdGNB5127rR CegX3o1H1najoY01kV1TJXUPXVw/LHFoSNk5shgiFqTWbeCzgBsOXi7DAWX77ARFo8xd CBzmi4+Yox+LQ4givykyRcc6cCkjuVUwQRzyj6RdARnQWBUP+TjKxNHgZ20bsqHjKUXu ApL6sRa+RVKpQylFLdA+b+BOm8K27wGcxrvL+OdntldnVARLhhfIJZLDqDGDaOc8UxFT mgxQ== Received: by 10.50.10.201 with SMTP id k9mr7229923igb.28.1345980863861; Sun, 26 Aug 2012 04:34: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 ex8csp396430igc; Sun, 26 Aug 2012 04:34:23 -0700 (PDT) Received: by 10.68.241.99 with SMTP id wh3mr26769289pbc.16.1345980863320; Sun, 26 Aug 2012 04:34:23 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id pb4si27244723pbc.60.2012.08.26.04.34.22; Sun, 26 Aug 2012 04:34:23 -0700 (PDT) Received-SPF: neutral (google.com: 203.254.224.24 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=203.254.224.24; Authentication-Results: mx.google.com; spf=neutral (google.com: 203.254.224.24 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 mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M9D006XB1GZK000@mailout1.samsung.com>; Sun, 26 Aug 2012 20:34:22 +0900 (KST) X-AuditID: cbfee61a-b7fc66d0000043b7-49-503a09bef4b0 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 49.4A.17335.EB90A305; Sun, 26 Aug 2012 20:34:22 +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 <0M9D00AQQ1GN7UA0@mmp1.samsung.com>; Sun, 26 Aug 2012 20:34:22 +0900 (KST) From: Thomas Abraham To: linux-mmc@vger.kernel.org, devicetree-discuss@lists.ozlabs.org Cc: 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 v4 5/9] mmc: dw_mmc: add quirk to indicate missing write protect line Date: Sun, 26 Aug 2012 17:22:03 +0530 Message-id: <1345981927-26359-6-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.6.6.rc2 In-reply-to: <1345981927-26359-1-git-send-email-thomas.abraham@linaro.org> References: <1345981927-26359-1-git-send-email-thomas.abraham@linaro.org> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGJMWRmVeSWpSXmKPExsVy+t9jAd19nFYBBtN/clt8+XqCzWLK4S8s Dkwed67tYQtgjOKySUnNySxLLdK3S+DK6D73k7Wgk69ix6K6BsZr3F2MHBwSAiYSX/8zdjFy ApliEhfurWcDsYUEFjFKLJpv3cXIBWS3MUk8eNTKBJJgEzCQeLTwHTuILSLgJLFk7gRmkCJm gZeMEjN3zQTrFhYIl9i8oYcZxGYRUJXoaJsLZvMKeEq8+7qMBWKbksSG3qNgQzkFvCRuLGpl h9jsKXF8xnfGCYy8CxgZVjGKphYkFxQnpeca6hUn5haX5qXrJefnbmIE+/6Z1A7GlQ0WhxgF OBiVeHgFSi0DhFgTy4orcw8xSnAwK4nwft8PFOJNSaysSi3Kjy8qzUktPsQozcGiJM7L32cY ICSQnliSmp2aWpBaBJNl4uCUamDkYWet5YnzfjHrxfQyx0cna+fwNPB+KIn9PTP6i/cRpYPT E38477xYo2/Z17d90xk+k6d7+8QF1VbqdgtuYGV/zbR55pftvKsuG5XJX5zq/PDFmX3ftVym HZv0tdLN+PfJI6dOe688YHZ/623O9iD3I30MBbWmrrf9XxheN881DO5Yony2apuhEktxRqKh FnNRcSIAQW0gefkBAAA= X-Gm-Message-State: ALoCoQlYCrnvOtcHrKZ2n3N6WgoKi6amzW7bNxQrD9TmFNa8Gr50D2bMmub6C7VlTn4THqEM1LbX 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;