From patchwork Wed May 2 05:07:41 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: 8345 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 B3E6F23E1D for ; Wed, 2 May 2012 05:12:19 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 837EBA18111 for ; Wed, 2 May 2012 05:12:19 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id l4so326334yen.11 for ; Tue, 01 May 2012 22:12:19 -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:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=vQxU5eb5Dv3T92NoAL8Db97ZifZln2zgnMfdrdM7+UM=; b=UhNGnvbooSsjxonscNC80e/E6xW8tjkxhGbcioVCZECaaKSWNbTkz89kGf4GMaq2hc nAu64yLhKXidzhN2bVW9H/BtSAXAhPIBaRvCm866XQgtzrCzzzlvT7qHUe/b3K2Zhb7r GoQ9dn1trtceQb/xoLSuIqjLxD7IvjNVuzuCfDwLsfNwDRJHi8j/a/WjDW+5ZE0UZXwe 210FgLlKrLgbawo7ouKlBwzoDzG5MpnPbUYSjDWlLdEdpky8X7HbUuWpBDG9tGATfbUL XiuleIbFc6MXe2b8W0rzfdtNcJAFd9HksxZ4K2LPsoIqPXQFNavwNj7UwLL5YgaBCGNR IUeQ== Received: by 10.42.142.71 with SMTP id r7mr5210359icu.7.1335935538993; Tue, 01 May 2012 22:12:18 -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.137.198 with SMTP id x6csp227443ibt; Tue, 1 May 2012 22:12:18 -0700 (PDT) Received: by 10.236.77.164 with SMTP id d24mr9092987yhe.28.1335935538051; Tue, 01 May 2012 22:12:18 -0700 (PDT) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by mx.google.com with ESMTPS id a27si403831yhj.153.2012.05.01.22.12.17 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 22:12:18 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.213.50 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) client-ip=209.85.213.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.213.50 is neither permitted nor denied by best guess record for domain of thomas.abraham@linaro.org) smtp.mail=thomas.abraham@linaro.org Received: by yhjj63 with SMTP id j63so360757yhj.37 for ; Tue, 01 May 2012 22:12:17 -0700 (PDT) Received: by 10.68.130.131 with SMTP id oe3mr28545239pbb.159.1335935537402; Tue, 01 May 2012 22:12:17 -0700 (PDT) Received: from localhost.localdomain ([216.239.45.23]) by mx.google.com with ESMTPS id gv2sm887161pbc.73.2012.05.01.22.12.16 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 May 2012 22:12:16 -0700 (PDT) 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 2/7] mmc: dw_mmc: add quirk to indicate missing write protect line Date: Tue, 1 May 2012 22:07:41 -0700 Message-Id: <1335935266-25289-3-git-send-email-thomas.abraham@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1335935266-25289-1-git-send-email-thomas.abraham@linaro.org> References: <1335935266-25289-1-git-send-email-thomas.abraham@linaro.org> X-Gm-Message-State: ALoCoQlohceJ8zBGHNfgKkSq6FFoxJkkJpSpILSEeaYcKFgttoB8eGID2HxBtHmVQIdV5UBOUduR 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 036846f..38cb7f8 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 fa9a139..fb51a5f 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;