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: 10611605 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 332386CB for ; Sun, 23 Sep 2018 06:35:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18B18290C0 for ; Sun, 23 Sep 2018 06:35:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BF272A399; Sun, 23 Sep 2018 06:35:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, URIBL_DBL_ABUSE_MALW autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 49FB02A33F for ; Sun, 23 Sep 2018 06:35:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726011AbeIWMbt (ORCPT ); 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-Google-Smtp-Source: ANB0Vdbsu4MrDgOdSjdkRJ5bzmklOvqVa2uPIMNQZzbiepO+rGLpIokc4KoPUeHka9tgoautMOmp2g== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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)