* [PATCH 1/2] mmc: sdhci-esdhc-imx: Move mmc_of_parse() to the dt probe
@ 2015-05-08 5:56 Fabio Estevam
2015-05-08 5:56 ` [PATCH 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards Fabio Estevam
0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2015-05-08 5:56 UTC (permalink / raw)
To: ulf.hansson; +Cc: shawn.guo, kernel, linux-mmc, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
mmc_of_parse() should be placed inside sdhci_esdhc_imx_probe_dt() as it
suits only for the dt case.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index d7b0a39..a9980d7 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -896,7 +896,8 @@ sdhci_esdhc_imx_probe_dt(struct platform_device *pdev,
mmc_of_parse_voltage(np, &host->ocr_mask);
- return 0;
+ /* call to generic mmc_of_parse to support additional capabilities */
+ return mmc_of_parse(host->mmc);
}
#else
static inline int
@@ -1041,11 +1042,6 @@ 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] 5+ messages in thread
* [PATCH 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards
2015-05-08 5:56 [PATCH 1/2] mmc: sdhci-esdhc-imx: Move mmc_of_parse() to the dt probe Fabio Estevam
@ 2015-05-08 5:56 ` Fabio Estevam
2015-05-08 11:46 ` Ulf Hansson
0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2015-05-08 5:56 UTC (permalink / raw)
To: ulf.hansson; +Cc: shawn.guo, kernel, linux-mmc, Fabio Estevam
From: Fabio Estevam <fabio.estevam@freescale.com>
The only user of this driver that has not been converted to fully
device tree is the i.MX35 SoC.
There is a i.MX35-based board (mach-pcm043.c) that uses platform data
to pass wp_gpio and cd_gpio information.
Commit 8d86e4fcccf61ba ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()")
broke the platform data case by removing mmc_gpio_request_ro() and
mmc_gpio_request_cd(), so restore the functionality for the non-dt
case.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/mmc/host/sdhci-esdhc-imx.c | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
index a9980d7..812c670 100644
--- a/drivers/mmc/host/sdhci-esdhc-imx.c
+++ b/drivers/mmc/host/sdhci-esdhc-imx.c
@@ -918,6 +918,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
struct esdhc_platform_data *boarddata;
int err;
struct pltfm_imx_data *imx_data;
+ bool dt = true;
host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
if (IS_ERR(host))
@@ -1005,11 +1006,44 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
}
imx_data->boarddata = *((struct esdhc_platform_data *)
host->mmc->parent->platform_data);
+ dt = false;
+ }
+ /* write_protect */
+ if (boarddata->wp_type == ESDHC_WP_GPIO && !dt) {
+ 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 */
- if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
+ switch (boarddata->cd_type) {
+ case ESDHC_CD_GPIO:
+ if (dt)
+ break;
+ 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 */
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:
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards
2015-05-08 5:56 ` [PATCH 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards Fabio Estevam
@ 2015-05-08 11:46 ` Ulf Hansson
2015-05-08 11:55 ` Fabio Estevam
0 siblings, 1 reply; 5+ messages in thread
From: Ulf Hansson @ 2015-05-08 11:46 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Shawn Guo, Sascha Hauer, linux-mmc, Fabio Estevam
On 8 May 2015 at 07:56, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> The only user of this driver that has not been converted to fully
> device tree is the i.MX35 SoC.
>
> There is a i.MX35-based board (mach-pcm043.c) that uses platform data
> to pass wp_gpio and cd_gpio information.
>
> Commit 8d86e4fcccf61ba ("mmc: sdhci-esdhc-imx: Call mmc_of_parse()")
> broke the platform data case by removing mmc_gpio_request_ro() and
> mmc_gpio_request_cd(), so restore the functionality for the non-dt
> case.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
> drivers/mmc/host/sdhci-esdhc-imx.c | 36 +++++++++++++++++++++++++++++++++++-
> 1 file changed, 35 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c
> index a9980d7..812c670 100644
> --- a/drivers/mmc/host/sdhci-esdhc-imx.c
> +++ b/drivers/mmc/host/sdhci-esdhc-imx.c
> @@ -918,6 +918,7 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
> struct esdhc_platform_data *boarddata;
> int err;
> struct pltfm_imx_data *imx_data;
> + bool dt = true;
>
> host = sdhci_pltfm_init(pdev, &sdhci_esdhc_imx_pdata, 0);
> if (IS_ERR(host))
> @@ -1005,11 +1006,44 @@ static int sdhci_esdhc_imx_probe(struct platform_device *pdev)
> }
> imx_data->boarddata = *((struct esdhc_platform_data *)
> host->mmc->parent->platform_data);
> + dt = false;
> + }
> + /* write_protect */
> + if (boarddata->wp_type == ESDHC_WP_GPIO && !dt) {
> + 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 */
> - if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
> + switch (boarddata->cd_type) {
I don't think you want to do this "switch" for dt case, right?
> + case ESDHC_CD_GPIO:
> + if (dt)
> + break;
> + 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 */
> 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:
> --
> 1.9.1
>
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards
2015-05-08 11:46 ` Ulf Hansson
@ 2015-05-08 11:55 ` Fabio Estevam
2015-05-09 12:49 ` Ulf Hansson
0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2015-05-08 11:55 UTC (permalink / raw)
To: Ulf Hansson; +Cc: Shawn Guo, Sascha Hauer, linux-mmc, Fabio Estevam
Hi Ulf,
On Fri, May 8, 2015 at 8:46 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> /* card_detect */
>> - if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
>> + switch (boarddata->cd_type) {
>
> I don't think you want to do this "switch" for dt case, right?
dt case needs the switch in order not to break the users of the
"fsl,cd-controller" property.
Actually, I don't see any dts file really using it, but since it is
documented in Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt,
then we need to keep supporting it.
Regards,
Fabio Estevam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards
2015-05-08 11:55 ` Fabio Estevam
@ 2015-05-09 12:49 ` Ulf Hansson
0 siblings, 0 replies; 5+ messages in thread
From: Ulf Hansson @ 2015-05-09 12:49 UTC (permalink / raw)
To: Fabio Estevam; +Cc: Shawn Guo, Sascha Hauer, linux-mmc, Fabio Estevam
On 8 May 2015 at 13:55, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Ulf,
>
> On Fri, May 8, 2015 at 8:46 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
>>> /* card_detect */
>>> - if (boarddata->cd_type == ESDHC_CD_CONTROLLER)
>>> + switch (boarddata->cd_type) {
>>
>> I don't think you want to do this "switch" for dt case, right?
>
> dt case needs the switch in order not to break the users of the
> "fsl,cd-controller" property.
>
> Actually, I don't see any dts file really using it, but since it is
> documented in Documentation/devicetree/bindings/mmc/fsl-imx-esdhc.txt,
> then we need to keep supporting it.
Okay. Perhaps the commit message could inform us about that as well?
Kind regards
Uffe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-05-09 12:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-08 5:56 [PATCH 1/2] mmc: sdhci-esdhc-imx: Move mmc_of_parse() to the dt probe Fabio Estevam
2015-05-08 5:56 ` [PATCH 2/2] mmc: sdhci-esdhc-imx: Do not break platform data boards Fabio Estevam
2015-05-08 11:46 ` Ulf Hansson
2015-05-08 11:55 ` Fabio Estevam
2015-05-09 12:49 ` 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.