From patchwork Sun Sep 23 06:33:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 147328 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp1475127ljw; Sat, 22 Sep 2018 23:35:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV63ZdaqAiCJ6E3mmZbk+yuK0fPcPPH4G4Nq4VUBYd+bBEp8LW4nQIIASfovLmD7moAldSgZY X-Received: by 2002:a17:902:8e81:: with SMTP id bg1-v6mr5287893plb.129.1537684530560; Sat, 22 Sep 2018 23:35:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537684530; cv=none; d=google.com; s=arc-20160816; b=J2Fb0bAz3xK0P1eg/0Lz+lXUiF2gNOdUmHSK2AjT8CzUxFqMk3aPg/MA0i3+oy8HVw enPUBl1SxALQdKwA1mMXixZk9+A10xs3FHdeBpFTUExN0l57EWmXC1XWwXnTI0BevV6u rG7E6fHbAgvKTallYJxZtfx+kdAnNcdyQZrrZlPlNh/u0wZd6//g9Qmi/Yc4SzpHcyTl IFA/xwn1nE9cylpEkPX1BFe54A2uDfK4c39TlWUeK4+NSk/Pa1iJRL+EGhylvGzVKFSu hi4/qdcvV7aEEUhv2pF/kEByIHbu/6grIFiL3ZPrcQzASKBSowopsBlxqa4OlwuWiAr+ chmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=/lFZIVpURkCfgERThWWtw8fJuILZlYRbNb1PrJnUT4w=; b=UMMbOLAbBisAb2k8Kv9n++a+/77CKKnRbi66Aao3eSY43C0L5ltzTB3lCzdiYGebfb GwPbYT9/wxD3JvoT0gvSiDfqQbU88x7YPuP2/dGCSuHbTSXpq0gqs7j7Tb8Vsqejs56/ cLD16B/qTsZnWLTTYYHLU9SBEFQxfeH+mSekQLSQySWOVFvdojvJARUafOBK2W8vBNwg j1lCUuS2fEMfpaI/XMJB2nV2mYDdza8xTWybA2w2yipHBo1iE0R6HqQ0OJsHeItt01gL zDM/41eWH54GwziPmkP7AnGIwP4mAz+r5usfHXw19QtkGINW/d0eDQqY4dSXWj7FgRSg M3Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aOKH2mI3; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10-v6si32315185plk.406.2018.09.22.23.35.30; Sat, 22 Sep 2018 23:35:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aOKH2mI3; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726011AbeIWMbt (ORCPT + 5 others); Sun, 23 Sep 2018 08:31:49 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:36236 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725988AbeIWMbt (ORCPT ); Sun, 23 Sep 2018 08:31:49 -0400 Received: by mail-lf1-f67.google.com with SMTP id v17-v6so10263195lfe.3 for ; Sat, 22 Sep 2018 23:35:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=/lFZIVpURkCfgERThWWtw8fJuILZlYRbNb1PrJnUT4w=; b=aOKH2mI3knpiU8NlIEqQg5WhjnYE0Xj7i9WjPc06cKmvlTjB0PnbeJWg9wEVIsFTpx hmC5sJxETCup/mxc89U150YU6I+PU7yjl5Y7k7+/mGFEoxNFRXbtxOMZOX2Yi67sItTn /cg7qcABpV90c8Twfm4beHtKxyJSIOYP3eNtk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=/lFZIVpURkCfgERThWWtw8fJuILZlYRbNb1PrJnUT4w=; b=C0WP1n5afjbeeNBxz/tj+CxlobW2L/JJHoCWrd3S7msmNobWUeDMnlYAiQ7wymZAmE s64DzP0IvLwsjQrSRKCmlkOvCuH5HP9qS4YeTHtIHI9ZhB3QzW2zcrki/iR4kRxJJJir Q4FtlEblDqAwsTwWyEDlZpFwzRyGMmS1PrATLO3jYSdTL0wo0siBq+Eb0ET3hrTgk2tr viWwyJ0iQF+NT0KXlAfOBsMaIKqXLcL0y+tEvlkxDRmVlmUzSdZWNveI3d4zUwo4xZXf W1kSIXNgt/fkFaIgBLXV92Fl5bN+aKZX2zBErs3hj19rHqNYnGfHzvYq2e+UFetG3qZ1 UuUw== X-Gm-Message-State: APzg51AxY5qOvMYP6TGFIAiXs3tYbPIMoeQiuqi2BazK/U0l5M4whXfG 4gL2CJJvRFgduUrFOOqtq4qKQyRVXXK5Lw== X-Received: by 2002:a19:1447:: with SMTP id k68-v6mr3072650lfi.4.1537684526392; Sat, 22 Sep 2018 23:35:26 -0700 (PDT) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id d190-v6sm3083012lfg.19.2018.09.22.23.35.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 22 Sep 2018 23:35:25 -0700 (PDT) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Linus Walleij , Viresh Kumar Subject: [PATCH] mmc: sdhci: spear: Use the slot GPIO descriptor Date: Sun, 23 Sep 2018 08:33:20 +0200 Message-Id: <20180923063320.8844-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org This driver is complicating things for no reason: the "cd" GPIO can easily be retrieved from the device tree if present using just mmc_gpiod_request_cd(), which will fetch the descriptor from the device tree using the standard binding just fine. Cc: Viresh Kumar Signed-off-by: Linus Walleij --- drivers/mmc/host/sdhci-spear.c | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) -- 2.17.1 diff --git a/drivers/mmc/host/sdhci-spear.c b/drivers/mmc/host/sdhci-spear.c index 9247d51f2eed..916b5b09c3d1 100644 --- a/drivers/mmc/host/sdhci-spear.c +++ b/drivers/mmc/host/sdhci-spear.c @@ -15,13 +15,11 @@ #include #include -#include #include #include #include #include #include -#include #include #include #include @@ -32,7 +30,6 @@ struct spear_sdhci { struct clk *clk; - int card_int_gpio; }; /* sdhci ops */ @@ -43,18 +40,6 @@ static const struct sdhci_ops sdhci_pltfm_ops = { .set_uhs_signaling = sdhci_set_uhs_signaling, }; -static void sdhci_probe_config_dt(struct device_node *np, - struct spear_sdhci *host) -{ - int cd_gpio; - - cd_gpio = of_get_named_gpio(np, "cd-gpios", 0); - if (!gpio_is_valid(cd_gpio)) - cd_gpio = -1; - - host->card_int_gpio = cd_gpio; -} - static int sdhci_probe(struct platform_device *pdev) { struct sdhci_host *host; @@ -109,21 +94,13 @@ static int sdhci_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "Error setting desired clk, clk=%lu\n", clk_get_rate(sdhci->clk)); - sdhci_probe_config_dt(pdev->dev.of_node, sdhci); /* - * It is optional to use GPIOs for sdhci card detection. If - * sdhci->card_int_gpio < 0, then use original sdhci lines otherwise - * GPIO lines. We use the built-in GPIO support for this. + * It is optional to use GPIOs for sdhci card detection. If we + * find a descriptor using slot GPIO, we use it. */ - if (sdhci->card_int_gpio >= 0) { - ret = mmc_gpio_request_cd(host->mmc, sdhci->card_int_gpio, 0); - if (ret < 0) { - dev_dbg(&pdev->dev, - "failed to request card-detect gpio%d\n", - sdhci->card_int_gpio); - goto disable_clk; - } - } + ret = mmc_gpiod_request_cd(host->mmc, "cd", 0, false, 0, NULL); + if (ret == -EPROBE_DEFER) + goto disable_clk; ret = sdhci_add_host(host); if (ret)