Skip to contentSkip to conversation

mx5/6: Fix cpu_mmc_init() return value

PATCH New Benoît Thébaudeau 2 participants 6 messages Aug 14, 2012 – Aug 20, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mx5/6: Fix cpu_mmc_init() return value

Do not pretend to have initialized mmc successfully if CONFIG_FSL_ESDHC is not defined.

---
 .../arch/arm/cpu/armv7/imx-common/cpu.c            |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/imx-common/cpu.c +5 -3
index b3195dd..e736e9a 100644
@@ -117,11 +117,13 @@ int cpu_eth_init(bd_t *bis)
  */
 int cpu_mmc_init(bd_t *bis)
 {
+	int rc = -ENODEV;
+
 #ifdef CONFIG_FSL_ESDHC
-	return fsl_esdhc_mmc_init(bis);
-#else
-	return 0;
+	rc = fsl_esdhc_mmc_init(bis);
 #endif
+
+	return rc;
 }
 
 void reset_cpu(ulong addr)
#1 lore raw

PATCH 1/1 mx5/6: Fix cpu_mmc_init() return value

Quoted 6 lines · Beno?t Th?baudeau

Do not pretend to have initialized mmc successfully if CONFIG_FSL_ESDHC is not defined.

---

Hi Beno?t,

arch/arm/cpu/armv7/imx-common/cpu.c int cpu_eth_init(bd_t *bis) · line 117

Quoted 9 lines
 .../arch/arm/cpu/armv7/imx-common/cpu.c            |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
arch/arm/cpu/armv7/imx-common/cpu.c +0 -0
index b3195dd..e736e9a 100644
@@ -117,11 +117,13 @@ int cpu_eth_init(bd_t *bis)
  */

Let's see if we can even make it more readable. This is for i.MX5 and i.MX6. The only way to get it working is to set CONFIG_FSL_ESDHC. There is no other driver available.

Quoted 4 lines
arch/arm/cpu/armv7/imx-common/cpu.c +2 -0
 int cpu_mmc_init(bd_t *bis)
 {
+	int rc = -ENODEV;
+

arch/arm/cpu/armv7/imx-common/cpu.c int cpu_eth_init(bd_t *bis) · line 128

Quoted 10 lines
arch/arm/cpu/armv7/imx-common/cpu.c +3 -3
 #ifdef CONFIG_FSL_ESDHC
-	return fsl_esdhc_mmc_init(bis);
-#else
-	return 0;
+	rc = fsl_esdhc_mmc_init(bis);
 #endif
+
+	return rc;
 }
 

Then why not:

ifdef CONFIG_FSL_ESDHC
int cpu_mmc_init(bd_t *bis)

{
	return fsl_esdhc_mmc_init(bis);
}

#endif

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#2 lore raw

PATCH 1/1 mx5/6: Fix cpu_mmc_init() return value

Hi Stefano,

Quoted 44 lines · Beno?t Th?baudeau
Quoted 7 lines

Do not pretend to have initialized mmc successfully if CONFIG_FSL_ESDHC is not
defined.

---

Hi Beno?t,

arch/arm/cpu/armv7/imx-common/cpu.c int cpu_eth_init(bd_t *bis) · line 117

Quoted 10 lines
 .../arch/arm/cpu/armv7/imx-common/cpu.c            |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

u-boot-4d3c95f/arch/arm/cpu/armv7/imx-common/cpu.c index b3195dd..e736e9a 100644

arch/arm/cpu/armv7/imx-common/cpu.c +0 -0
@@ -117,11 +117,13 @@ int cpu_eth_init(bd_t *bis)
  */

Let's see if we can even make it more readable. This is for i.MX5 and i.MX6. The only way to get it working is to set CONFIG_FSL_ESDHC. There
is no other driver available.

Quoted 4 lines
arch/arm/cpu/armv7/imx-common/cpu.c +2 -0
 int cpu_mmc_init(bd_t *bis)
 {
+	int rc = -ENODEV;
+

arch/arm/cpu/armv7/imx-common/cpu.c int cpu_eth_init(bd_t *bis) · line 128

Quoted 10 lines
arch/arm/cpu/armv7/imx-common/cpu.c +3 -3
 #ifdef CONFIG_FSL_ESDHC
-	return fsl_esdhc_mmc_init(bis);
-#else
-	return 0;
+	rc = fsl_esdhc_mmc_init(bis);
 #endif
+
+	return rc;
 }
 

Then why not:

Quoted 6 lines

ifdef CONFIG_FSL_ESDHC
int cpu_mmc_init(bd_t *bis)

{
	return fsl_esdhc_mmc_init(bis);
}

#endif

This sounds good. I'll do that and update the corresponding patches for all i.MXs.

Best regards,
Beno?t

#3 lore raw

PATCH v2 1/1 mx5/6: Fix cpu_mmc_init() return value

Do not pretend to have initialized mmc successfully if CONFIG_FSL_ESDHC is not defined. Instead, only implement a custom cpu_mmc_init() when it does something.

---
Changes for v2:
- Do not define cpu_mmc_init() if CONFIG_FSL_ESDHC is not defined.

 .../arch/arm/cpu/armv7/imx-common/cpu.c            |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/imx-common/cpu.c +2 -4
index b3195dd..7313fc0 100644
@@ -111,18 +111,16 @@ int cpu_eth_init(bd_t *bis)
 	return rc;
 }
 
+#ifdef CONFIG_FSL_ESDHC
 /*
  * Initializes on-chip MMC controllers.
  * to override, implement board_mmc_init()
  */
 int cpu_mmc_init(bd_t *bis)
 {
-#ifdef CONFIG_FSL_ESDHC
 	return fsl_esdhc_mmc_init(bis);
-#else
-	return 0;
-#endif
 }
+#endif
 
 void reset_cpu(ulong addr)
 {
#4 lore raw

PATCH v2 1/1 mx5/6: Fix cpu_mmc_init() return value

Quoted 28 lines · Beno?t Th?baudeau

Do not pretend to have initialized mmc successfully if CONFIG_FSL_ESDHC is not defined. Instead, only implement a custom cpu_mmc_init() when it does something.

---
Changes for v2:
- Do not define cpu_mmc_init() if CONFIG_FSL_ESDHC is not defined.

 .../arch/arm/cpu/armv7/imx-common/cpu.c            |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/imx-common/cpu.c +1 -0
index b3195dd..7313fc0 100644
@@ -111,18 +111,16 @@ int cpu_eth_init(bd_t *bis)
 	return rc;
 }
 
+#ifdef CONFIG_FSL_ESDHC
 /*
  * Initializes on-chip MMC controllers.
  * to override, implement board_mmc_init()
  */
 int cpu_mmc_init(bd_t *bis)
 {

arch/arm/cpu/armv7/imx-common/cpu.c int cpu_eth_init(bd_t *bis) · line 126

Quoted 10 lines
arch/arm/cpu/armv7/imx-common/cpu.c +1 -4
-#ifdef CONFIG_FSL_ESDHC
 	return fsl_esdhc_mmc_init(bis);
-#else
-	return 0;
-#endif
 }
+#endif
 
 void reset_cpu(ulong addr)
 {

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH v2 1/1 mx5/6: Fix cpu_mmc_init() return value

In reply to Benoît Thébaudeau
Quoted 28 lines · Beno?t Th?baudeau

Do not pretend to have initialized mmc successfully if CONFIG_FSL_ESDHC is not defined. Instead, only implement a custom cpu_mmc_init() when it does something.

---
Changes for v2:
- Do not define cpu_mmc_init() if CONFIG_FSL_ESDHC is not defined.

 .../arch/arm/cpu/armv7/imx-common/cpu.c            |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/imx-common/cpu.c +1 -0
index b3195dd..7313fc0 100644
@@ -111,18 +111,16 @@ int cpu_eth_init(bd_t *bis)
 	return rc;
 }
 
+#ifdef CONFIG_FSL_ESDHC
 /*
  * Initializes on-chip MMC controllers.
  * to override, implement board_mmc_init()
  */
 int cpu_mmc_init(bd_t *bis)
 {

arch/arm/cpu/armv7/imx-common/cpu.c int cpu_eth_init(bd_t *bis) · line 126

Quoted 10 lines
arch/arm/cpu/armv7/imx-common/cpu.c +1 -4
-#ifdef CONFIG_FSL_ESDHC
 	return fsl_esdhc_mmc_init(bis);
-#else
-	return 0;
-#endif
 }
+#endif
 
 void reset_cpu(ulong addr)
 {

Applied to u-boot-imx, thanks.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================