From patchwork Wed May 6 18:31:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 6352001 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 381D59F32E for ; Wed, 6 May 2015 18:31:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 448FB20328 for ; Wed, 6 May 2015 18:31:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 857FA2034E for ; Wed, 6 May 2015 18:31:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751590AbbEFSb3 (ORCPT ); Wed, 6 May 2015 14:31:29 -0400 Received: from smtp-out-205.synserver.de ([212.40.185.205]:1052 "EHLO smtp-out-205.synserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751454AbbEFSb1 (ORCPT ); Wed, 6 May 2015 14:31:27 -0400 Received: (qmail 20536 invoked by uid 0); 6 May 2015 18:31:26 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 20432 Received: from p4fc461a9.dip0.t-ipconnect.de (HELO lars-adi-laptop.analog.com) [79.196.97.169] by 217.119.54.73 with SMTP; 6 May 2015 18:31:25 -0000 From: Lars-Peter Clausen To: Ulf Hansson Cc: Seungwon Jeon , Jaehoon Chung , Michal Simek , =?UTF-8?q?S=C3=B6ren=20Brinkmann?= , Thomas Abraham , Mike Looijmans , linux-mmc@vger.kernel.org, devicetree@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala Subject: [PATCH v2 2/4] mmc: dt: Allow to specify that no write protect signal is present Date: Wed, 6 May 2015 20:31:20 +0200 Message-Id: <1430937082-27149-2-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1430937082-27149-1-git-send-email-lars@metafoo.de> References: <1430937082-27149-1-git-send-email-lars@metafoo.de> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Allow to specify in the device-tree that no physical write-protect signal is connected to a particular instance of a MMC controller. Setting the property will cause the core will assume that the SD card is always read-write. The name for the new property is 'disable-wp' and was chosen based on the property with the same function from the Synopsys designware mobile storage host controller DT bindings specification. Signed-off-by: Lars-Peter Clausen Cc: Rob Herring Cc: Pawel Moll Cc: Mark Rutland Cc: Ian Campbell Cc: Kumar Gala --- Documentation/devicetree/bindings/mmc/mmc.txt | 5 +++++ drivers/mmc/core/host.c | 3 +++ 2 files changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/mmc/mmc.txt b/Documentation/devicetree/bindings/mmc/mmc.txt index 438899e..0384fc3 100644 --- a/Documentation/devicetree/bindings/mmc/mmc.txt +++ b/Documentation/devicetree/bindings/mmc/mmc.txt @@ -21,6 +21,11 @@ Optional properties: below for the case, when a GPIO is used for the CD line - wp-inverted: when present, polarity on the WP line is inverted. See the note below for the case, when a GPIO is used for the WP line +- disable-wp: When set no physical WP line is present. This property should + only be specified when the controller has a dedicated write-protect + detection logic. If a GPIO is always used for the write-protect detection + logic it is sufficient to not specify wp-gpios property in the absence of a WP + line. - max-frequency: maximum operating clock frequency - no-1-8-v: when present, denotes that 1.8v card voltage is not supported on this system, even if the controller claims it is. diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index 8be0df7..1eabdd0 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -400,6 +400,9 @@ int mmc_of_parse(struct mmc_host *host) else if (ret != -ENOENT) return ret; + if (of_property_read_bool(np, "disable-wp")) + host->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; + /* See the comment on CD inversion above */ if (ro_cap_invert ^ ro_gpio_invert) host->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;