All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] mmc: sdhci-esdhc-imx: Call mmc_of_parse()
@ 2015-04-08 13:17 ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2015-04-08 13:17 UTC (permalink / raw)
  To: ulf.hansson
  Cc: linux-mmc, linux, kernel, otavio, linux-arm-kernel, b29396,
	Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

Currently it is not possible to use 'mmc-pwrseq-simple' property with this
driver because mmc_of_parse() is never called.

mmc_of_parse() calls mmc_pwrseq_alloc() that manages MMC power sequence and
allows passing GPIOs in the devicetree to properly power/reset the Wifi
chipset.

When using mmc_of_parse() we no longer need to have custom code to request
card-detect and write-protect pins, as this can now be handled by the mmc
core.

Tested on a imx6sl-warp board where BT/Wifi is functional and also on a
imx6q-sabresd.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Change since v2:
- Use mmc_of_parse() and remove custom code to retrieve CD/WP GPIOs.

 drivers/mmc/host/sdhci-esdhc-imx.c | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 7ee8312..82f512d 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1013,40 +1013,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 					host->mmc->parent->platform_data);
 	}
 
-	/* write_protect */
-	if (boarddata->wp_type == ESDHC_WP_GPIO) {
-		err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio);
-		if (err) {
-			dev_err(mmc_dev(host->mmc),
-				"failed to request write-protect gpio!\n");
-			goto disable_clk;
-		}
-		host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
-	}
-
 	/* card_detect */
-	switch (boarddata->cd_type) {
-	case ESDHC_CD_GPIO:
-		err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0);
-		if (err) {
-			dev_err(mmc_dev(host->mmc),
-				"failed to request card-detect gpio!\n");
-			goto disable_clk;
-		}
-		/* fall through */
-
-	case ESDHC_CD_CONTROLLER:
-		/* we have a working card_detect back */
+	if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
 		host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
-		break;
-
-	case ESDHC_CD_PERMANENT:
-		host->mmc->caps |= MMC_CAP_NONREMOVABLE;
-		break;
-
-	case ESDHC_CD_NONE:
-		break;
-	}
 
 	switch (boarddata->max_bus_width) {
 	case 8:
@@ -1079,6 +1048,11 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
 	}
 
+	/* call to generic mmc_of_parse to support additional capabilities */
+	err = mmc_of_parse(host->mmc);
+	if (err)
+		goto disable_clk;
+
 	err = sdhci_add_host(host);
 	if (err)
 		goto disable_clk;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3] mmc: sdhci-esdhc-imx: Call mmc_of_parse()
@ 2015-04-08 13:17 ` Fabio Estevam
  0 siblings, 0 replies; 4+ messages in thread
From: Fabio Estevam @ 2015-04-08 13:17 UTC (permalink / raw)
  To: linux-arm-kernel

From: Fabio Estevam <fabio.estevam@freescale.com>

Currently it is not possible to use 'mmc-pwrseq-simple' property with this
driver because mmc_of_parse() is never called.

mmc_of_parse() calls mmc_pwrseq_alloc() that manages MMC power sequence and
allows passing GPIOs in the devicetree to properly power/reset the Wifi
chipset.

When using mmc_of_parse() we no longer need to have custom code to request
card-detect and write-protect pins, as this can now be handled by the mmc
core.

Tested on a imx6sl-warp board where BT/Wifi is functional and also on a
imx6q-sabresd.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Change since v2:
- Use mmc_of_parse() and remove custom code to retrieve CD/WP GPIOs.

 drivers/mmc/host/sdhci-esdhc-imx.c | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index 7ee8312..82f512d 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -1013,40 +1013,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 					host->mmc->parent->platform_data);
 	}
 
-	/* write_protect */
-	if (boarddata->wp_type == ESDHC_WP_GPIO) {
-		err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio);
-		if (err) {
-			dev_err(mmc_dev(host->mmc),
-				"failed to request write-protect gpio!\n");
-			goto disable_clk;
-		}
-		host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
-	}
-
 	/* card_detect */
-	switch (boarddata->cd_type) {
-	case ESDHC_CD_GPIO:
-		err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0);
-		if (err) {
-			dev_err(mmc_dev(host->mmc),
-				"failed to request card-detect gpio!\n");
-			goto disable_clk;
-		}
-		/* fall through */
-
-	case ESDHC_CD_CONTROLLER:
-		/* we have a working card_detect back */
+	if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
 		host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
-		break;
-
-	case ESDHC_CD_PERMANENT:
-		host->mmc->caps |= MMC_CAP_NONREMOVABLE;
-		break;
-
-	case ESDHC_CD_NONE:
-		break;
-	}
 
 	switch (boarddata->max_bus_width) {
 	case 8:
@@ -1079,6 +1048,11 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
 		host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
 	}
 
+	/* call to generic mmc_of_parse to support additional capabilities */
+	err = mmc_of_parse(host->mmc);
+	if (err)
+		goto disable_clk;
+
 	err = sdhci_add_host(host);
 	if (err)
 		goto disable_clk;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] mmc: sdhci-esdhc-imx: Call mmc_of_parse()
  2015-04-08 13:17 ` Fabio Estevam
@ 2015-04-09  7:16   ` Ulf Hansson
  -1 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2015-04-09  7:16 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: linux-mmc, Russell King - ARM Linux, Sascha Hauer,
	Otavio Salvador, linux-arm-kernel, Dong Aisheng, Fabio Estevam

On 8 April 2015 at 15:17, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Currently it is not possible to use 'mmc-pwrseq-simple' property with this
> driver because mmc_of_parse() is never called.
>
> mmc_of_parse() calls mmc_pwrseq_alloc() that manages MMC power sequence and
> allows passing GPIOs in the devicetree to properly power/reset the Wifi
> chipset.
>
> When using mmc_of_parse() we no longer need to have custom code to request
> card-detect and write-protect pins, as this can now be handled by the mmc
> core.
>
> Tested on a imx6sl-warp board where BT/Wifi is functional and also on a
> imx6q-sabresd.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Thanks! Applied.

Kind regards
Uffe

> ---
> Change since v2:
> - Use mmc_of_parse() and remove custom code to retrieve CD/WP GPIOs.
>
>  drivers/mmc/host/sdhci-esdhc-imx.c | 38 ++++++--------------------------------
>  1 file changed, 6 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 7ee8312..82f512d 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1013,40 +1013,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>                                         host->mmc->parent->platform_data);
>         }
>
> -       /* write_protect */
> -       if (boarddata->wp_type == ESDHC_WP_GPIO) {
> -               err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio);
> -               if (err) {
> -                       dev_err(mmc_dev(host->mmc),
> -                               "failed to request write-protect gpio!\n");
> -                       goto disable_clk;
> -               }
> -               host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
> -       }
> -
>         /* card_detect */
> -       switch (boarddata->cd_type) {
> -       case ESDHC_CD_GPIO:
> -               err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0);
> -               if (err) {
> -                       dev_err(mmc_dev(host->mmc),
> -                               "failed to request card-detect gpio!\n");
> -                       goto disable_clk;
> -               }
> -               /* fall through */
> -
> -       case ESDHC_CD_CONTROLLER:
> -               /* we have a working card_detect back */
> +       if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
>                 host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
> -               break;
> -
> -       case ESDHC_CD_PERMANENT:
> -               host->mmc->caps |= MMC_CAP_NONREMOVABLE;
> -               break;
> -
> -       case ESDHC_CD_NONE:
> -               break;
> -       }
>
>         switch (boarddata->max_bus_width) {
>         case 8:
> @@ -1079,6 +1048,11 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>                 host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>         }
>
> +       /* call to generic mmc_of_parse to support additional capabilities */
> +       err = mmc_of_parse(host->mmc);
> +       if (err)
> +               goto disable_clk;
> +
>         err = sdhci_add_host(host);
>         if (err)
>                 goto disable_clk;
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3] mmc: sdhci-esdhc-imx: Call mmc_of_parse()
@ 2015-04-09  7:16   ` Ulf Hansson
  0 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2015-04-09  7:16 UTC (permalink / raw)
  To: linux-arm-kernel

On 8 April 2015 at 15:17, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Currently it is not possible to use 'mmc-pwrseq-simple' property with this
> driver because mmc_of_parse() is never called.
>
> mmc_of_parse() calls mmc_pwrseq_alloc() that manages MMC power sequence and
> allows passing GPIOs in the devicetree to properly power/reset the Wifi
> chipset.
>
> When using mmc_of_parse() we no longer need to have custom code to request
> card-detect and write-protect pins, as this can now be handled by the mmc
> core.
>
> Tested on a imx6sl-warp board where BT/Wifi is functional and also on a
> imx6q-sabresd.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Thanks! Applied.

Kind regards
Uffe

> ---
> Change since v2:
> - Use mmc_of_parse() and remove custom code to retrieve CD/WP GPIOs.
>
>  drivers/mmc/host/sdhci-esdhc-imx.c | 38 ++++++--------------------------------
>  1 file changed, 6 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index 7ee8312..82f512d 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -1013,40 +1013,9 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>                                         host->mmc->parent->platform_data);
>         }
>
> -       /* write_protect */
> -       if (boarddata->wp_type == ESDHC_WP_GPIO) {
> -               err = mmc_gpio_request_ro(host->mmc, boarddata->wp_gpio);
> -               if (err) {
> -                       dev_err(mmc_dev(host->mmc),
> -                               "failed to request write-protect gpio!\n");
> -                       goto disable_clk;
> -               }
> -               host->mmc->caps2 |= MMC_CAP2_RO_ACTIVE_HIGH;
> -       }
> -
>         /* card_detect */
> -       switch (boarddata->cd_type) {
> -       case ESDHC_CD_GPIO:
> -               err = mmc_gpio_request_cd(host->mmc, boarddata->cd_gpio, 0);
> -               if (err) {
> -                       dev_err(mmc_dev(host->mmc),
> -                               "failed to request card-detect gpio!\n");
> -                       goto disable_clk;
> -               }
> -               /* fall through */
> -
> -       case ESDHC_CD_CONTROLLER:
> -               /* we have a working card_detect back */
> +       if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
>                 host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
> -               break;
> -
> -       case ESDHC_CD_PERMANENT:
> -               host->mmc->caps |= MMC_CAP_NONREMOVABLE;
> -               break;
> -
> -       case ESDHC_CD_NONE:
> -               break;
> -       }
>
>         switch (boarddata->max_bus_width) {
>         case 8:
> @@ -1079,6 +1048,11 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
>                 host->quirks2 |= SDHCI_QUIRK2_NO_1_8_V;
>         }
>
> +       /* call to generic mmc_of_parse to support additional capabilities */
> +       err = mmc_of_parse(host->mmc);
> +       if (err)
> +               goto disable_clk;
> +
>         err = sdhci_add_host(host);
>         if (err)
>                 goto disable_clk;
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-04-09  7:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-08 13:17 [PATCH v3] mmc: sdhci-esdhc-imx: Call mmc_of_parse() Fabio Estevam
2015-04-08 13:17 ` Fabio Estevam
2015-04-09  7:16 ` Ulf Hansson
2015-04-09  7:16   ` Ulf Hansson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.