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 X-Patchwork-Id: 1469201 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 1388EDF2D8 for ; Mon, 17 Sep 2012 17:56:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757067Ab2IQR4v (ORCPT ); Mon, 17 Sep 2012 13:56:51 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:13271 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757128Ab2IQR4u (ORCPT ); Mon, 17 Sep 2012 13:56:50 -0400 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MAI005339UEK530@mailout3.samsung.com>; Tue, 18 Sep 2012 02:56:49 +0900 (KST) X-AuditID: cbfee61b-b7f2b6d000000f14-ee-50576461efdf Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 51.6A.03860.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+NgFnrBJMWRmVeSWpSXmKPExsVy+t9jAd3ElPAAg2sdyhZH/vczWsw4v4/J gcnj8ya5AMYoLpuU1JzMstQifbsErowpy3cyFXTyVdzsbGRuYLzG3cXIySEhYCKx9N47Zghb TOLCvfVsXYxcHEICixgltux4DeW0MUnsufoErIpNwEDi0cJ37CC2iICTxJK5E5hBipgFGpkk Ni7cyQaSEBYIl/hw7iNYA4uAqsS71geMIDavgKfEtUNNjBDrlCQ29B5lArE5Bbwkpm8/BDZU CKhm74rZLBMYeRcwMqxiFE0tSC4oTkrPNdIrTswtLs1L10vOz93ECPb/M+kdjKsaLA4xCnAw KvHwJgSFBwixJpYVV+YeYpTgYFYS4b0tABTiTUmsrEotyo8vKs1JLT7EKM3BoiTOK/wpMEBI ID2xJDU7NbUgtQgmy8TBKdXAuO5QJtsDw7CvuWIMU3g9JyVnysls+tb5PlR/3jfNxI+J36La TvhzLbxhy7arUEBwu1Zolt7e9nz+xWx63XxsDrc/PdWSmmb8ye2EzS7X62GydQpHxBZ/uSXf 7Bmn5a50bebNy+v0f83jTD4g7l8Y6yrLk6jyOIhdqzp67+QtXi5vZmVGnrihxFKckWioxVxU nAgAIFVjN/sBAAA= Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org 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;