Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp5094251imu; Tue, 15 Jan 2019 11:05:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN79JcRlfWQtvFkLfaW/zj7i1VhcwfEyuZZoNXhWUJXpblaxuUesMpPGbKPDKbcU3pNKbUG+ X-Received: by 2002:a17:902:ba89:: with SMTP id k9mr5640912pls.189.1547579112133; Tue, 15 Jan 2019 11:05:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547579112; cv=none; d=google.com; s=arc-20160816; b=NifP8HTiC5NEaggErs3xpKryUpKKfJmFS+mnkiUdC1qgzOJJ5jwncV16DzxjqYQ4aT 9efOOyt8bdGF17AmlgsYBDCSPEftGhU38o9YsSUP8hbIr3WMyCdY0P2EGmQZyhy1MqHA 70V81EjAslj8u5xr168GGiQ/szOb2M28bkpWlwfBfQBJ9D2+qKKxi3ALERQyJOxfZK4m PsfeOGQAyGTFrY5a/g+c//a6w1HZTt7L/ivFIuKHnzqPT80wfCoCEbQx1N4J4N4V/vRK sqb2xp+8xh8IC6FyPyU7i9WW473xf5UjfYwtXDAHjrSey1I2uuaiMommAFhD+3fAxYjT lF8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=NhNSpuNZoxJ7+YzV6a198kMqBtvDVPqYGr5mrwsK+uE=; b=h++Uv5jqOmxaPNuLxmTDnZbhVMuxfr8H0YtIlHZbgTYNxh2zsmyd7hH+saC4AgNaaw MIMgVq4iepjZg35lMGQRP4ZfBwcyqpS4IG74hmLYSA7ZAxmJ91ByGV1UJmJts5p1Hw9z viAZX+ehHq00ocEThC04KxNPwUwbG4kuWAr0BuRbehzEbOOeS8TO5WJLEaHpmqNb1Cuh jaRz9TI1KrRi41T5tEjtLTpZyiRerSMzS2m68+8h7AJe7zA1omkCHqPzO4jP6DZBBwRk ro04g4bBdT9XSvAmJdCmOqigQd/Lz4IrEI6WpyArI7MK6Q0dgM/IBuP3fME43rVIrK0p IkDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s73si3807937pfs.54.2019.01.15.11.04.52; Tue, 15 Jan 2019 11:05:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731512AbfAOQ3C (ORCPT + 99 others); Tue, 15 Jan 2019 11:29:02 -0500 Received: from mail.bootlin.com ([62.4.15.54]:57913 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731482AbfAOQ3C (ORCPT ); Tue, 15 Jan 2019 11:29:02 -0500 Received: by mail.bootlin.com (Postfix, from userid 110) id 9787C209EF; Tue, 15 Jan 2019 17:28:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.2 Received: from localhost (aaubervilliers-681-1-37-87.w90-88.abo.wanadoo.fr [90.88.156.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 69DBF20A7A; Tue, 15 Jan 2019 17:28:49 +0100 (CET) From: Thomas Petazzoni To: Adrian Hunter , Kishon Vijay Abraham I , Ulf Hansson , Thierry Reding , Jonathan Hunter Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Gregory Clement , Thomas Petazzoni Subject: [PATCH 0/3] Introduce support for WP GPIO in the core SDHCI Date: Tue, 15 Jan 2019 17:28:34 +0100 Message-Id: <20190115162837.5399-1-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, While doing the bring up of a Zynq 7000 platform where the WP signal of a SD slot is connected to a regular GPIO rather than through the SDHCI WP pin, I realized that the GPIO described by wp-gpios was properly requested, but it was in fact not used at all. Indeed, the SDHCI core implements sdhci_check_ro() by: - Calling a controller-specific ->get_ro() callback if it exists. A few controller-specific drivers implement this, but not sdhci-of-arasan, which is used on Zynq 7000. - Using the SDHCI_PRESENT_STATE register, which reports the state of the SDHCI interface WP pin, and obvisouly not the state of a separate WP GPIO. This patch series therefore changes sdhci_check_ro() to behave like sdhci_get_cd(): use a GPIO first if available, and if not, fallback to using the SDHCI_PRESENT_STATE register. Indeed, if there's a wp-gpios described in the DT, it quite certainly indicates that the SDHCI WP signal is not used, and the WP GPIO should be used instead. As part of this series, two SDHCI drivers are modified to no longer implement their custom ->get_ro() hook, since the core SDHCI now does the right thing with the WP GPIO. Best regards, Thomas Thomas Petazzoni (3): mmc: sdhci: use WP GPIO in sdhci_check_ro() mmc: sdhci-omap: drop ->get_ro() implementation mmc: sdhci-tegra: drop ->get_ro() implementation drivers/mmc/host/sdhci-omap.c | 1 - drivers/mmc/host/sdhci-tegra.c | 9 --------- drivers/mmc/host/sdhci.c | 9 ++++++--- 3 files changed, 6 insertions(+), 13 deletions(-) -- 2.20.1