mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] i.MX: i2c: fix i2c-fsl for non-OF boards
@ 2017-02-11 22:31 Alexander Kurz
  2017-02-11 22:31 ` [PATCH 2/2] i.MX: esdhc: fix imx-esdhc driver " Alexander Kurz
  2017-02-14  7:50 ` [PATCH 1/2] i.MX: i2c: fix i2c-fsl " Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Alexander Kurz @ 2017-02-11 22:31 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Kurz

With commit 4ed5b778a56b ("i.MX: i2c: Add Vybrid support") i2c-fsl probe
returns -EINVAL for all non-OF boards.
Since newer planforms, especially vf610 are restricted OF-only it is safe to
assume "fsl,imx21-i2c" if CONFIG_OFDEVICE is not set.

Signed-off-by: Alexander Kurz <akurz@blala.de>
---
 drivers/i2c/busses/i2c-imx.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 5677443..4ff4f5c 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -153,6 +153,8 @@ static struct fsl_i2c_clk_pair vf610_i2c_clk_div[] = {
 	{ 3840, 0x3F }, { 4096, 0x7B }, { 5120, 0x7D }, { 6144, 0x7E },
 };
 
+static const struct fsl_i2c_hwdata imx21_i2c_hwdata;
+
 struct fsl_i2c_hwdata {
 	unsigned		regshift;
 	struct fsl_i2c_clk_pair	*clk_div;
@@ -676,10 +678,14 @@ static int __init i2c_fsl_probe(struct device_d *pdev)
 	clk_enable(i2c_fsl->clk);
 #endif
 
-	i2c_fsl->hwdata = of_device_get_match_data(pdev);
-	if (!i2c_fsl->hwdata) {
-		ret = -EINVAL;
-		goto fail;
+	if (IS_ENABLED(CONFIG_OFDEVICE)) {
+		i2c_fsl->hwdata = of_device_get_match_data(pdev);
+		if (!i2c_fsl->hwdata) {
+			ret = -EINVAL;
+			goto fail;
+		}
+	} else {
+		i2c_fsl->hwdata = &imx21_i2c_hwdata;
 	}
 
 	/* Setup i2c_fsl driver structure */
-- 
2.1.4


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

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

* [PATCH 2/2] i.MX: esdhc: fix imx-esdhc driver for non-OF boards
  2017-02-11 22:31 [PATCH 1/2] i.MX: i2c: fix i2c-fsl for non-OF boards Alexander Kurz
@ 2017-02-11 22:31 ` Alexander Kurz
  2017-02-14  7:50 ` [PATCH 1/2] i.MX: i2c: fix i2c-fsl " Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Alexander Kurz @ 2017-02-11 22:31 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Kurz

Commit 39f7a7ee8b68 ("i.MX: esdhc: Do not rely on CPU type for quirks")
made imx-esdhc dependent on OF and broke probing for all non-OF boards.
Since newer platforms like mx6 and vf610 are restricted to OF, the non-OF
probing only needs to distinguish mx5 vs earlier SoC.

Signed-off-by: Alexander Kurz <akurz@blala.de>
---
 drivers/mci/imx-esdhc.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c
index b2961cc..141d715 100644
--- a/drivers/mci/imx-esdhc.c
+++ b/drivers/mci/imx-esdhc.c
@@ -600,6 +600,9 @@ static int fsl_esdhc_detect(struct device_d *dev)
 	return mci_detect_card(&host->mci);
 }
 
+static struct esdhc_soc_data esdhc_imx25_data;
+static struct esdhc_soc_data esdhc_imx53_data;
+
 static int fsl_esdhc_probe(struct device_d *dev)
 {
 	struct resource *iores;
@@ -613,9 +616,16 @@ static int fsl_esdhc_probe(struct device_d *dev)
 	host = xzalloc(sizeof(*host));
 	mci = &host->mci;
 
-	host->socdata = of_device_get_match_data(dev);
-	if (!host->socdata)
-		return -EINVAL;
+	if (IS_ENABLED(CONFIG_OFDEVICE)) {
+		host->socdata = of_device_get_match_data(dev);
+		if (!host->socdata)
+			return -EINVAL;
+	} else {
+		if (cpu_is_mx50() || cpu_is_mx51() || cpu_is_mx53())
+			host->socdata = &esdhc_imx53_data;
+		else
+			host->socdata = &esdhc_imx25_data;
+	}
 
 	host->clk = clk_get(dev, "per");
 	if (IS_ERR(host->clk))
@@ -693,16 +703,6 @@ static struct esdhc_soc_data esdhc_imx25_data = {
 	.flags = ESDHC_FLAG_ENGCM07207,
 };
 
-static struct esdhc_soc_data esdhc_imx50_data = {
-	.flags = ESDHC_FLAG_MULTIBLK_NO_INT,
-	/* .flags = 0, */
-};
-
-static struct esdhc_soc_data esdhc_imx51_data = {
-	.flags = ESDHC_FLAG_MULTIBLK_NO_INT,
-	/* .flags = 0, */
-};
-
 static struct esdhc_soc_data esdhc_imx53_data = {
 	.flags = ESDHC_FLAG_MULTIBLK_NO_INT,
 };
@@ -724,8 +724,8 @@ static struct esdhc_soc_data usdhc_imx6sx_data = {
 
 static __maybe_unused struct of_device_id fsl_esdhc_compatible[] = {
 	{ .compatible = "fsl,imx25-esdhc",  .data = &esdhc_imx25_data  },
-	{ .compatible = "fsl,imx50-esdhc",  .data = &esdhc_imx50_data  },
-	{ .compatible = "fsl,imx51-esdhc",  .data = &esdhc_imx51_data  },
+	{ .compatible = "fsl,imx50-esdhc",  .data = &esdhc_imx53_data  },
+	{ .compatible = "fsl,imx51-esdhc",  .data = &esdhc_imx53_data  },
 	{ .compatible = "fsl,imx53-esdhc",  .data = &esdhc_imx53_data  },
 	{ .compatible = "fsl,imx6q-usdhc",  .data = &usdhc_imx6q_data  },
 	{ .compatible = "fsl,imx6sl-usdhc", .data = &usdhc_imx6sl_data },
-- 
2.1.4


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

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

* Re: [PATCH 1/2] i.MX: i2c: fix i2c-fsl for non-OF boards
  2017-02-11 22:31 [PATCH 1/2] i.MX: i2c: fix i2c-fsl for non-OF boards Alexander Kurz
  2017-02-11 22:31 ` [PATCH 2/2] i.MX: esdhc: fix imx-esdhc driver " Alexander Kurz
@ 2017-02-14  7:50 ` Sascha Hauer
  2017-02-14 12:21   ` Alexander Kurz
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2017-02-14  7:50 UTC (permalink / raw)
  To: Alexander Kurz; +Cc: barebox

On Sat, Feb 11, 2017 at 11:31:38PM +0100, Alexander Kurz wrote:
> With commit 4ed5b778a56b ("i.MX: i2c: Add Vybrid support") i2c-fsl probe
> returns -EINVAL for all non-OF boards.
> Since newer planforms, especially vf610 are restricted OF-only it is safe to
> assume "fsl,imx21-i2c" if CONFIG_OFDEVICE is not set.
> 
> Signed-off-by: Alexander Kurz <akurz@blala.de>

Sorry, I should have read these mails before doing the release. Now they
have to wait for another month. Applied both to master.

Sascha

> ---
>  drivers/i2c/busses/i2c-imx.c | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 5677443..4ff4f5c 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -153,6 +153,8 @@ static struct fsl_i2c_clk_pair vf610_i2c_clk_div[] = {
>  	{ 3840, 0x3F }, { 4096, 0x7B }, { 5120, 0x7D }, { 6144, 0x7E },
>  };
>  
> +static const struct fsl_i2c_hwdata imx21_i2c_hwdata;
> +
>  struct fsl_i2c_hwdata {
>  	unsigned		regshift;
>  	struct fsl_i2c_clk_pair	*clk_div;
> @@ -676,10 +678,14 @@ static int __init i2c_fsl_probe(struct device_d *pdev)
>  	clk_enable(i2c_fsl->clk);
>  #endif
>  
> -	i2c_fsl->hwdata = of_device_get_match_data(pdev);
> -	if (!i2c_fsl->hwdata) {
> -		ret = -EINVAL;
> -		goto fail;
> +	if (IS_ENABLED(CONFIG_OFDEVICE)) {
> +		i2c_fsl->hwdata = of_device_get_match_data(pdev);
> +		if (!i2c_fsl->hwdata) {
> +			ret = -EINVAL;
> +			goto fail;
> +		}
> +	} else {
> +		i2c_fsl->hwdata = &imx21_i2c_hwdata;
>  	}
>  
>  	/* Setup i2c_fsl driver structure */
> -- 
> 2.1.4
> 
> 
> _______________________________________________
> 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] 4+ messages in thread

* Re: [PATCH 1/2] i.MX: i2c: fix i2c-fsl for non-OF boards
  2017-02-14  7:50 ` [PATCH 1/2] i.MX: i2c: fix i2c-fsl " Sascha Hauer
@ 2017-02-14 12:21   ` Alexander Kurz
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Kurz @ 2017-02-14 12:21 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox



On Tue, 14 Feb 2017, Sascha Hauer wrote:

> On Sat, Feb 11, 2017 at 11:31:38PM +0100, Alexander Kurz wrote:
> > With commit 4ed5b778a56b ("i.MX: i2c: Add Vybrid support") i2c-fsl probe
> > returns -EINVAL for all non-OF boards.
> > Since newer planforms, especially vf610 are restricted OF-only it is safe to
> > assume "fsl,imx21-i2c" if CONFIG_OFDEVICE is not set.
> > 
> > Signed-off-by: Alexander Kurz <akurz@blala.de>
> 
> Sorry, I should have read these mails before doing the release. Now they
> have to wait for another month. Applied both to master.
Actually I have noticed this when 2017.02 was already released during an 
installation of 2017.02. Sorry for not having tested next before.
Regards, Alexander
> 
> Sascha
> 
> > ---
> >  drivers/i2c/busses/i2c-imx.c | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> > index 5677443..4ff4f5c 100644
> > --- a/drivers/i2c/busses/i2c-imx.c
> > +++ b/drivers/i2c/busses/i2c-imx.c
> > @@ -153,6 +153,8 @@ static struct fsl_i2c_clk_pair vf610_i2c_clk_div[] = {
> >  	{ 3840, 0x3F }, { 4096, 0x7B }, { 5120, 0x7D }, { 6144, 0x7E },
> >  };
> >  
> > +static const struct fsl_i2c_hwdata imx21_i2c_hwdata;
> > +
> >  struct fsl_i2c_hwdata {
> >  	unsigned		regshift;
> >  	struct fsl_i2c_clk_pair	*clk_div;
> > @@ -676,10 +678,14 @@ static int __init i2c_fsl_probe(struct device_d *pdev)
> >  	clk_enable(i2c_fsl->clk);
> >  #endif
> >  
> > -	i2c_fsl->hwdata = of_device_get_match_data(pdev);
> > -	if (!i2c_fsl->hwdata) {
> > -		ret = -EINVAL;
> > -		goto fail;
> > +	if (IS_ENABLED(CONFIG_OFDEVICE)) {
> > +		i2c_fsl->hwdata = of_device_get_match_data(pdev);
> > +		if (!i2c_fsl->hwdata) {
> > +			ret = -EINVAL;
> > +			goto fail;
> > +		}
> > +	} else {
> > +		i2c_fsl->hwdata = &imx21_i2c_hwdata;
> >  	}
> >  
> >  	/* Setup i2c_fsl driver structure */
> > -- 
> > 2.1.4
> > 
> > 
> > _______________________________________________
> > 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] 4+ messages in thread

end of thread, other threads:[~2017-02-14 12:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-11 22:31 [PATCH 1/2] i.MX: i2c: fix i2c-fsl for non-OF boards Alexander Kurz
2017-02-11 22:31 ` [PATCH 2/2] i.MX: esdhc: fix imx-esdhc driver " Alexander Kurz
2017-02-14  7:50 ` [PATCH 1/2] i.MX: i2c: fix i2c-fsl " Sascha Hauer
2017-02-14 12:21   ` Alexander Kurz

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