mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe.
@ 2016-06-18 13:28 Alexander Shiyan
  2016-06-18 13:28 ` [PATCH 2/4] mci: imx: Add devicetree options parsing by MCI core Alexander Shiyan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Alexander Shiyan @ 2016-06-18 13:28 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/imx.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c
index 2788fb9..4f29ddf 100644
--- a/drivers/mci/imx.c
+++ b/drivers/mci/imx.c
@@ -519,9 +519,7 @@ static int mxcmci_probe(struct device_d *dev)
 	host->mci.f_min = rate >> 7;
 	host->mci.f_max = rate >> 1;
 
-	mci_register(&host->mci);
-
-	return 0;
+	return mci_register(&host->mci);
 }
 
 static __maybe_unused struct of_device_id mxcmci_compatible[] = {
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 2/4] mci: imx: Add devicetree options parsing by MCI core.
  2016-06-18 13:28 [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Alexander Shiyan
@ 2016-06-18 13:28 ` Alexander Shiyan
  2016-06-18 13:28 ` [PATCH 3/4] mci: core: Do not fail if vmmc regulator fail Alexander Shiyan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2016-06-18 13:28 UTC (permalink / raw)
  To: barebox

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/imx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c
index 4f29ddf..354daba 100644
--- a/drivers/mci/imx.c
+++ b/drivers/mci/imx.c
@@ -519,6 +519,8 @@ static int mxcmci_probe(struct device_d *dev)
 	host->mci.f_min = rate >> 7;
 	host->mci.f_max = rate >> 1;
 
+	mci_of_parse(&host->mci);
+
 	return mci_register(&host->mci);
 }
 
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 3/4] mci: core: Do not fail if vmmc regulator fail
  2016-06-18 13:28 [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Alexander Shiyan
  2016-06-18 13:28 ` [PATCH 2/4] mci: imx: Add devicetree options parsing by MCI core Alexander Shiyan
@ 2016-06-18 13:28 ` Alexander Shiyan
  2016-06-18 13:28 ` [PATCH 4/4] mci: imx-esdhc: Remove excess function Alexander Shiyan
  2016-06-20  6:32 ` [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2016-06-18 13:28 UTC (permalink / raw)
  To: barebox

The vmmc regulator can be an usupported device for barebox,
the specific MFD regulator type, for example. Just lets think is all ok.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/mci-core.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index 59f6675..086b564 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1585,11 +1585,13 @@ static int mci_card_probe(struct mci *mci)
 		return -ENODEV;
 	}
 
-	ret = regulator_enable(host->supply);
-	if (ret) {
-		dev_err(&mci->dev, "failed to enable regulator: %s\n",
+	if (!IS_ERR(host->supply)) {
+		ret = regulator_enable(host->supply);
+		if (ret) {
+			dev_err(&mci->dev, "failed to enable regulator: %s\n",
 				strerror(-ret));
-		return ret;
+			return ret;
+		}
 	}
 
 	/* start with a host interface reset */
@@ -1680,7 +1682,8 @@ on_error:
 	if (rc != 0) {
 		host->clock = 0;	/* disable the MCI clock */
 		mci_set_ios(mci);
-		regulator_disable(host->supply);
+		if (!IS_ERR(host->supply))
+			regulator_disable(host->supply);
 	}
 
 	return rc;
@@ -1767,10 +1770,8 @@ int mci_register(struct mci_host *host)
 	mci->dev.detect = mci_detect;
 
 	host->supply = regulator_get(host->hw_dev, "vmmc");
-	if (IS_ERR(host->supply)) {
-		ret = PTR_ERR(host->supply);
-		goto err_free;
-	}
+	if (IS_ERR(host->supply))
+		dev_err(&mci->dev, "Failed to get 'vmmc' regulator.\n");
 
 	ret = register_device(&mci->dev);
 	if (ret)
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* [PATCH 4/4] mci: imx-esdhc: Remove excess function
  2016-06-18 13:28 [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Alexander Shiyan
  2016-06-18 13:28 ` [PATCH 2/4] mci: imx: Add devicetree options parsing by MCI core Alexander Shiyan
  2016-06-18 13:28 ` [PATCH 3/4] mci: core: Do not fail if vmmc regulator fail Alexander Shiyan
@ 2016-06-18 13:28 ` Alexander Shiyan
  2016-06-20  6:32 ` [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Alexander Shiyan @ 2016-06-18 13:28 UTC (permalink / raw)
  To: barebox

Function detect() is defined in the MCI core and mci_detect_card() is
already called form mci_register(). Remove excess fuction.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 drivers/mci/imx-esdhc.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 2e189fe..2a34bec 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -550,13 +550,6 @@ static int esdhc_reset(struct fsl_esdhc_host *host)
 	return 0;
 }
 
-static int fsl_esdhc_detect(struct device_d *dev)
-{
-	struct fsl_esdhc_host *host = dev->priv;
-
-	return mci_detect_card(&host->mci);
-}
-
 static int fsl_esdhc_probe(struct device_d *dev)
 {
 	struct resource *iores;
@@ -618,8 +611,6 @@ static int fsl_esdhc_probe(struct device_d *dev)
 	host->mci.card_present = esdhc_card_present;
 	host->mci.hw_dev = dev;
 
-	dev->detect = fsl_esdhc_detect,
-
 	rate = clk_get_rate(host->clk);
 	host->mci.f_min = rate >> 12;
 	if (host->mci.f_min < 200000)
-- 
2.4.9


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe.
  2016-06-18 13:28 [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Alexander Shiyan
                   ` (2 preceding siblings ...)
  2016-06-18 13:28 ` [PATCH 4/4] mci: imx-esdhc: Remove excess function Alexander Shiyan
@ 2016-06-20  6:32 ` Sascha Hauer
  3 siblings, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2016-06-20  6:32 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: barebox

On Sat, Jun 18, 2016 at 04:28:55PM +0300, Alexander Shiyan wrote:
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  drivers/mci/imx.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)

Applied all, thanks

Sascha

> 
> diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c
> index 2788fb9..4f29ddf 100644
> --- a/drivers/mci/imx.c
> +++ b/drivers/mci/imx.c
> @@ -519,9 +519,7 @@ static int mxcmci_probe(struct device_d *dev)
>  	host->mci.f_min = rate >> 7;
>  	host->mci.f_max = rate >> 1;
>  
> -	mci_register(&host->mci);
> -
> -	return 0;
> +	return mci_register(&host->mci);
>  }
>  
>  static __maybe_unused struct of_device_id mxcmci_compatible[] = {
> -- 
> 2.4.9
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2016-06-20  6:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-18 13:28 [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Alexander Shiyan
2016-06-18 13:28 ` [PATCH 2/4] mci: imx: Add devicetree options parsing by MCI core Alexander Shiyan
2016-06-18 13:28 ` [PATCH 3/4] mci: core: Do not fail if vmmc regulator fail Alexander Shiyan
2016-06-18 13:28 ` [PATCH 4/4] mci: imx-esdhc: Remove excess function Alexander Shiyan
2016-06-20  6:32 ` [PATCH 1/4] mci: imx: Use mci_register() return value for driver probe Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox