Re: [PATCH] mmc: sdhci: spear: Use the slot GPIO descriptor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23 September 2018 at 08:33, Linus Walleij <linus.walleij@xxxxxxxxxx> wrote:
> 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 <vireshk@xxxxxxxxxx>
> Signed-off-by: Linus Walleij <linus.walleij@xxxxxxxxxx>

Applied for next, thanks!

Kind regards
Uffe

> ---
>  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 <linux/clk.h>
>  #include <linux/delay.h>
> -#include <linux/gpio.h>
>  #include <linux/highmem.h>
>  #include <linux/module.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
>  #include <linux/of.h>
> -#include <linux/of_gpio.h>
>  #include <linux/platform_device.h>
>  #include <linux/pm.h>
>  #include <linux/slab.h>
> @@ -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)
> --
> 2.17.1
>



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux