mbox series

[0/9] pinctrl: Consolidate some pinctrl code for mmc

Message ID 20191206170821.29711-1-ulf.hansson@linaro.org
Headers show
Series pinctrl: Consolidate some pinctrl code for mmc | expand

Message

Ulf Hansson Dec. 6, 2019, 5:08 p.m. UTC
Some mmc host drivers, but perhaps also others drivers, needs to reset the
pinctrl into the default state (PINCTRL_STATE_DEFAULT). However, they can't use
the existing pinctrl_pm_select_default_state(), as that requires CONFIG_PM to
be set. This leads to open coding, as they need to look up the default state
themselves and then select it. This series attempt to address these problems.

Ulf Hansson (9):
  pinctrl: core: Add pinctrl_select_default_state() and export it
  mmc: meson-gx: Convert to pinctrl_select_default_state()
  mmc: mmci: Convert to pinctrl_select_default_state()
  mmc: usdhi6rol0: Convert to pinctrl_select_default_state()
  mmc: omap_hsmmc: Convert to pinctrl_select_default_state()
  mmc: sdhci-esdhc-imx: Convert to pinctrl_select_default_state()
  mmc: atmel-mci: Convert to pinctrl_select_default_state()
  mmc: jz4740: Convert to pinctrl_select_default_state()
  mmc: uniphier-sd: Convert to pinctrl_select_default_state()

 drivers/mmc/host/atmel-mci.c       |  2 +-
 drivers/mmc/host/jz4740_mmc.c      |  2 +-
 drivers/mmc/host/meson-gx-mmc.c    | 10 +--------
 drivers/mmc/host/mmci.c            | 12 ++---------
 drivers/mmc/host/mmci.h            |  1 -
 drivers/mmc/host/omap_hsmmc.c      | 10 ++-------
 drivers/mmc/host/sdhci-esdhc-imx.c | 11 ++--------
 drivers/mmc/host/uniphier-sd.c     | 14 +++++--------
 drivers/mmc/host/usdhi6rol0.c      | 15 +-------------
 drivers/pinctrl/core.c             | 33 +++++++++++++++++-------------
 include/linux/pinctrl/consumer.h   |  6 ++++++
 11 files changed, 40 insertions(+), 76 deletions(-)

-- 
2.17.1

Comments

Jesper Nilsson Dec. 9, 2019, 9 a.m. UTC | #1
On Fri, Dec 06, 2019 at 06:08:16PM +0100, Ulf Hansson wrote:
> Let's drop the boilerplate code for managing the default pinctrl state and

> convert into using the new pinctrl_select_default_state().


Looks good, thanks!

Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>


> Cc: Lars Persson <lars.persson@axis.com>

> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

> ---

>  drivers/mmc/host/usdhi6rol0.c | 15 +--------------

>  1 file changed, 1 insertion(+), 14 deletions(-)

> 

> diff --git a/drivers/mmc/host/usdhi6rol0.c b/drivers/mmc/host/usdhi6rol0.c

> index b11ac2314328..969a34e698f2 100644

> --- a/drivers/mmc/host/usdhi6rol0.c

> +++ b/drivers/mmc/host/usdhi6rol0.c

> @@ -199,7 +199,6 @@ struct usdhi6_host {

>  

>  	/* Pin control */

>  	struct pinctrl *pinctrl;

> -	struct pinctrl_state *pins_default;

>  	struct pinctrl_state *pins_uhs;

>  };

>  

> @@ -1162,8 +1161,7 @@ static int usdhi6_set_pinstates(struct usdhi6_host *host, int voltage)

>  					    host->pins_uhs);

>  

>  	default:

> -		return pinctrl_select_state(host->pinctrl,

> -					    host->pins_default);

> +		return pinctrl_select_default_state(mmc_dev(host->mmc));

>  	}

>  }

>  

> @@ -1770,17 +1768,6 @@ static int usdhi6_probe(struct platform_device *pdev)

>  	}

>  

>  	host->pins_uhs = pinctrl_lookup_state(host->pinctrl, "state_uhs");

> -	if (!IS_ERR(host->pins_uhs)) {

> -		host->pins_default = pinctrl_lookup_state(host->pinctrl,

> -							  PINCTRL_STATE_DEFAULT);

> -

> -		if (IS_ERR(host->pins_default)) {

> -			dev_err(dev,

> -				"UHS pinctrl requires a default pin state.\n");

> -			ret = PTR_ERR(host->pins_default);

> -			goto e_free_mmc;

> -		}

> -	}

>  

>  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

>  	host->base = devm_ioremap_resource(dev, res);

> -- 

> 2.17.1

> 


/^JN - Jesper Nilsson
-- 
               Jesper Nilsson -- jesper.nilsson@axis.com
Linus Walleij Dec. 16, 2019, 8:02 a.m. UTC | #2
On Fri, Dec 6, 2019 at 6:08 PM Ulf Hansson <ulf.hansson@linaro.org> wrote:

> Ulf Hansson (9):

>   pinctrl: core: Add pinctrl_select_default_state() and export it

>   mmc: meson-gx: Convert to pinctrl_select_default_state()

>   mmc: mmci: Convert to pinctrl_select_default_state()

>   mmc: usdhi6rol0: Convert to pinctrl_select_default_state()

>   mmc: omap_hsmmc: Convert to pinctrl_select_default_state()

>   mmc: sdhci-esdhc-imx: Convert to pinctrl_select_default_state()

>   mmc: atmel-mci: Convert to pinctrl_select_default_state()

>   mmc: jz4740: Convert to pinctrl_select_default_state()

>   mmc: uniphier-sd: Convert to pinctrl_select_default_state()


For patches 2-9:
Acked-by: Linus Walleij <linus.walleij@linaro.org>


Yours,
Linus Walleij