mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mci: imx-esdhc-pbl: initialize fsl_esdhc_host
@ 2021-08-05  8:26 Rouven Czerwinski
  2021-08-05 13:52 ` Ahmad Fatoum
  2021-08-09 18:10 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Rouven Czerwinski @ 2021-08-05  8:26 UTC (permalink / raw)
  To: barebox; +Cc: Rouven Czerwinski

Since commit 56ca2c197e71 ("mci: sdhci: Get rid of many register ops")
the core checks whether there is an explicit write function for the
host. If the struct is not zero initialized, a bogus value is taken as
the function, resulting in an unbootable board. Zero initialize the
structs properly to let the PBL correctly load images. Fixes booting on
the i.MX8M* board, tested on i.MX8MP EVK.

Fixes: 56ca2c197e71 ("mci: sdhci: Get rid of many register ops")

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
---
 drivers/mci/imx-esdhc-pbl.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c
index c3a8b377e..2e04c78fd 100644
--- a/drivers/mci/imx-esdhc-pbl.c
+++ b/drivers/mci/imx-esdhc-pbl.c
@@ -233,7 +233,7 @@ static int imx8m_esdhc_init(struct fsl_esdhc_host *host,
 int imx6_esdhc_start_image(int instance)
 {
 	struct esdhc_soc_data data;
-	struct fsl_esdhc_host host;
+	struct fsl_esdhc_host host = { 0 };
 
 	switch (instance) {
 	case 0:
@@ -272,7 +272,7 @@ int imx6_esdhc_start_image(int instance)
 int imx7_esdhc_start_image(int instance)
 {
 	struct esdhc_soc_data data;
-	struct fsl_esdhc_host host;
+	struct fsl_esdhc_host host = { 0 };
 
 	switch (instance) {
 	case 0:
@@ -309,7 +309,7 @@ int imx7_esdhc_start_image(int instance)
 int imx8m_esdhc_load_image(int instance, bool start)
 {
 	struct esdhc_soc_data data;
-	struct fsl_esdhc_host host;
+	struct fsl_esdhc_host host = { 0 };
 	int ret;
 
 	ret = imx8m_esdhc_init(&host, &data, instance);
@@ -337,7 +337,7 @@ int imx8m_esdhc_load_image(int instance, bool start)
 int imx8mp_esdhc_load_image(int instance, bool start)
 {
 	struct esdhc_soc_data data;
-	struct fsl_esdhc_host host;
+	struct fsl_esdhc_host host = { 0 };
 	int ret;
 
 	ret = imx8m_esdhc_init(&host, &data, instance);
-- 
2.30.2


_______________________________________________
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] mci: imx-esdhc-pbl: initialize fsl_esdhc_host
  2021-08-05  8:26 [PATCH] mci: imx-esdhc-pbl: initialize fsl_esdhc_host Rouven Czerwinski
@ 2021-08-05 13:52 ` Ahmad Fatoum
  2021-08-09 18:10 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2021-08-05 13:52 UTC (permalink / raw)
  To: Rouven Czerwinski, barebox

On 05.08.21 10:26, Rouven Czerwinski wrote:
> Since commit 56ca2c197e71 ("mci: sdhci: Get rid of many register ops")
> the core checks whether there is an explicit write function for the
> host. If the struct is not zero initialized, a bogus value is taken as
> the function, resulting in an unbootable board. Zero initialize the
> structs properly to let the PBL correctly load images. Fixes booting on
> the i.MX8M* board, tested on i.MX8MP EVK.
> 
> Fixes: 56ca2c197e71 ("mci: sdhci: Get rid of many register ops")
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

> ---
>  drivers/mci/imx-esdhc-pbl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mci/imx-esdhc-pbl.c b/drivers/mci/imx-esdhc-pbl.c
> index c3a8b377e..2e04c78fd 100644
> --- a/drivers/mci/imx-esdhc-pbl.c
> +++ b/drivers/mci/imx-esdhc-pbl.c
> @@ -233,7 +233,7 @@ static int imx8m_esdhc_init(struct fsl_esdhc_host *host,
>  int imx6_esdhc_start_image(int instance)
>  {
>  	struct esdhc_soc_data data;
> -	struct fsl_esdhc_host host;
> +	struct fsl_esdhc_host host = { 0 };
>  
>  	switch (instance) {
>  	case 0:
> @@ -272,7 +272,7 @@ int imx6_esdhc_start_image(int instance)
>  int imx7_esdhc_start_image(int instance)
>  {
>  	struct esdhc_soc_data data;
> -	struct fsl_esdhc_host host;
> +	struct fsl_esdhc_host host = { 0 };
>  
>  	switch (instance) {
>  	case 0:
> @@ -309,7 +309,7 @@ int imx7_esdhc_start_image(int instance)
>  int imx8m_esdhc_load_image(int instance, bool start)
>  {
>  	struct esdhc_soc_data data;
> -	struct fsl_esdhc_host host;
> +	struct fsl_esdhc_host host = { 0 };
>  	int ret;
>  
>  	ret = imx8m_esdhc_init(&host, &data, instance);
> @@ -337,7 +337,7 @@ int imx8m_esdhc_load_image(int instance, bool start)
>  int imx8mp_esdhc_load_image(int instance, bool start)
>  {
>  	struct esdhc_soc_data data;
> -	struct fsl_esdhc_host host;
> +	struct fsl_esdhc_host host = { 0 };
>  	int ret;
>  
>  	ret = imx8m_esdhc_init(&host, &data, instance);
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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

* Re: [PATCH] mci: imx-esdhc-pbl: initialize fsl_esdhc_host
  2021-08-05  8:26 [PATCH] mci: imx-esdhc-pbl: initialize fsl_esdhc_host Rouven Czerwinski
  2021-08-05 13:52 ` Ahmad Fatoum
@ 2021-08-09 18:10 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2021-08-09 18:10 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox

On Thu, Aug 05, 2021 at 10:26:07AM +0200, Rouven Czerwinski wrote:
> Since commit 56ca2c197e71 ("mci: sdhci: Get rid of many register ops")
> the core checks whether there is an explicit write function for the
> host. If the struct is not zero initialized, a bogus value is taken as
> the function, resulting in an unbootable board. Zero initialize the
> structs properly to let the PBL correctly load images. Fixes booting on
> the i.MX8M* board, tested on i.MX8MP EVK.
> 
> Fixes: 56ca2c197e71 ("mci: sdhci: Get rid of many register ops")
> 
> Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
> ---
>  drivers/mci/imx-esdhc-pbl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied to master, thanks

Sascha


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
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:[~2021-08-09 18:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05  8:26 [PATCH] mci: imx-esdhc-pbl: initialize fsl_esdhc_host Rouven Czerwinski
2021-08-05 13:52 ` Ahmad Fatoum
2021-08-09 18:10 ` Sascha Hauer

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