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 X-Patchwork-Id: 1374781 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 B8E6BDFABE for ; Sun, 26 Aug 2012 11:34:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754042Ab2HZLeZ (ORCPT ); Sun, 26 Aug 2012 07:34:25 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:33054 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753583Ab2HZLeX (ORCPT ); Sun, 26 Aug 2012 07:34:23 -0400 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-4b-503a09bee85e Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 69.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+NgFnrOJMWRmVeSWpSXmKPExsVy+t9jAd19nFYBBndn8Voc+d/PaDHj/D4m ByaPz5vkAhijuGxSUnMyy1KL9O0SuDK6z/1kLejkq9ixqK6B8Rp3FyMnh4SAicTOG93sELaY xIV769m6GLk4hAQWMUps3NjODOG0MUk8eNTKBFLFJmAg8WjhO7AOEQEniSVzJ4AVMQu8ZJSY uWsmG0hCWCBcYvOGHmYQm0VAVaKjbS6YzSvgKfHu6zIWiHVKEht6j4IN5RTwkrixqBVsqBBQ zfEZ3xknMPIuYGRYxSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iRHs/WdSOxhXNlgcYhTgYFTi 4RUotQwQYk0sK67MPcQowcGsJML7fT9QiDclsbIqtSg/vqg0J7X4EKM0B4uSOC9/n2GAkEB6 YklqdmpqQWoRTJaJg1OqgVHZ3+FaxDTNW6tKq+daHRffdlElKkqTserbtIv31NlO/Y27LeXr fmvpg6SeqCkSavPkiv1az+94YsZYZPV7fjuDbqF0h/5GeyXzT1XqDZzc5o5KTmf51ih4VEf4 Lp2Xsar2f2HyZp3QyAlKW3a4nXzi/e709PPfdx7Zzu3D5vvk5c0PVm2FrkosxRmJhlrMRcWJ ACrLisT6AQAA 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 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;