mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] Revert "mci: imx-esdhc: Remove excess function"
@ 2016-07-14 12:37 Sascha Hauer
  2016-07-14 21:23 ` Alexander Shiyan
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2016-07-14 12:37 UTC (permalink / raw)
  To: Barebox List

This reverts commit 8a6896971d093b9d8d1c36eb0d7af891b6ca5369.

With this patch it's no longer possible to call detect on the
physical device which is necessary for example to make environment
on MMC work. Unlike the commit message for 8a6896971d claims
mci_detect_card() is not called from mci_register().

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mci/imx-esdhc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index 4c45e92..66786ff 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -550,6 +550,13 @@ 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;
@@ -608,6 +615,8 @@ 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.8.1


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

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

* Re: [PATCH] Revert "mci: imx-esdhc: Remove excess function"
  2016-07-14 12:37 [PATCH] Revert "mci: imx-esdhc: Remove excess function" Sascha Hauer
@ 2016-07-14 21:23 ` Alexander Shiyan
  2016-07-15  5:47   ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Shiyan @ 2016-07-14 21:23 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Barebox List

>Четверг, 14 июля 2016, 15:37 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>:
>
>This reverts commit 8a6896971d093b9d8d1c36eb0d7af891b6ca5369.
>
>With this patch it's no longer possible to call detect on the
>physical device which is necessary for example to make environment
>on MMC work. Unlike the commit message for 8a6896971d claims
>mci_detect_card() is not called from mci_register().
>
>Signed-off-by: Sascha Hauer < s.hauer@pengutronix.de >
>---
> drivers/mci/imx-esdhc.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
>diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
>index 4c45e92..66786ff 100644
>--- a/drivers/mci/imx-esdhc.c
>+++ b/drivers/mci/imx-esdhc.c
>@@ -550,6 +550,13 @@ 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;
>@@ -608,6 +615,8 @@ 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)
...

I can not understand why this is happening in your case.
The mci_register() function contains the following line:
mci->dev.detect = mci_detect;
I.e. detect() call will be always overrided by mci core.

And it defined as:
static int mci_detect(struct device_d *dev)
{
struct mci *mci = container_of(dev, struct mci, dev);
return mci_detect_card(mci->host);
}

So, result should be same. Is'nt it?

---

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

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

* Re: [PATCH] Revert "mci: imx-esdhc: Remove excess function"
  2016-07-14 21:23 ` Alexander Shiyan
@ 2016-07-15  5:47   ` Sascha Hauer
  0 siblings, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2016-07-15  5:47 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: Barebox List

On Fri, Jul 15, 2016 at 12:23:53AM +0300, Alexander Shiyan wrote:
> >Четверг, 14 июля 2016, 15:37 +03:00 от Sascha Hauer <s.hauer@pengutronix.de>:
> >
> >This reverts commit 8a6896971d093b9d8d1c36eb0d7af891b6ca5369.
> >
> >With this patch it's no longer possible to call detect on the
> >physical device which is necessary for example to make environment
> >on MMC work. Unlike the commit message for 8a6896971d claims
> >mci_detect_card() is not called from mci_register().
> >
> >Signed-off-by: Sascha Hauer < s.hauer@pengutronix.de >
> >---
> > drivers/mci/imx-esdhc.c | 9 +++++++++
> > 1 file changed, 9 insertions(+)
> >
> >diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
> >index 4c45e92..66786ff 100644
> >--- a/drivers/mci/imx-esdhc.c
> >+++ b/drivers/mci/imx-esdhc.c
> >@@ -550,6 +550,13 @@ 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;
> >@@ -608,6 +615,8 @@ 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)
> ...
> 
> I can not understand why this is happening in your case.
> The mci_register() function contains the following line:
> mci->dev.detect = mci_detect;
> I.e. detect() call will be always overrided by mci core.

No, these are two different devices. The one in the controller driver is
the device instantiated from device tree / board code, the other is
embedded in struct mci_host. You can do both 'detect mci0' and 'detect
esdhc0'. The latter is used in the environment code.

Sascha

-- 
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] 3+ messages in thread

end of thread, other threads:[~2016-07-15  5:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14 12:37 [PATCH] Revert "mci: imx-esdhc: Remove excess function" Sascha Hauer
2016-07-14 21:23 ` Alexander Shiyan
2016-07-15  5:47   ` Sascha Hauer

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