Skip to contentSkip to conversation

mx6: Fix get_board_rev() for the mx6 solo case

PATCH New Fabio Estevam 6 participants 8 messages Mar 27, 2013 – Apr 3, 2013 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

When booting a Freescale kernel 3.0.35 on a Wandboard solo, the get_board_rev() returns 0x62xxx, which is not a value understood by the VPU
(Video Processing Unit) library in the kernel and causes the video playback to fail.

The expected values for get_board_rev are:
0x63xxx: For mx6quad/dual
0x61xxx: For mx6dual-lite/solo

So adjust get_board_rev() accordingly and make it as weak function, so that we do not need to define it in every mx6 board file.

---
Changes since v1:
- Avoid extra call to get_cpu_rev()

 arch/arm/cpu/armv7/mx6/soc.c                  |   12 ++++++++++++
 board/boundary/nitrogen6x/nitrogen6x.c        |    5 -----
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |    5 -----
 board/freescale/mx6qsabresd/mx6qsabresd.c     |    5 -----
 board/wandboard/wandboard.c                   |    5 -----
 5 files changed, 12 insertions(+), 20 deletions(-)
arch/arm/cpu/armv7/mx6/soc.c +12 -0
index 193ba12..4f3cd14 100644
@@ -61,6 +61,18 @@ u32 get_cpu_rev(void)
 	return (type << 12) | (reg + 0x10);
 }
 
+#ifdef CONFIG_REVISION_TAG
+u32 __weak get_board_rev(void)
+{
+	u32 cpurev = get_cpu_rev();
+	u32 type = ((cpurev >> 12) & 0xff);
+	if (type == MXC_CPU_MX6SOLO)
+		cpurev = (MXC_CPU_MX6DL) << 12 | (cpurev & 0xFFF);
+
+	return cpurev;
+}
+#endif
+
 void init_aips(void)
 {
 	struct aipstz_regs *aips1, *aips2;
board/boundary/nitrogen6x/nitrogen6x.c +0 -5
index 229c237..1b1bedf 100644
@@ -328,11 +328,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-u32 get_board_rev(void)
-{
-	return 0x63000;
-}
-
 #ifdef CONFIG_MXC_SPI
 iomux_v3_cfg_t const ecspi1_pads[] = {
 	/* SS1 */
board/freescale/mx6qsabrelite/mx6qsabrelite.c +0 -5
index 5b69a6d..782e5ba 100644
@@ -298,11 +298,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-u32 get_board_rev(void)
-{
-	return 0x63000 ;
-}
-
 #ifdef CONFIG_MXC_SPI
 iomux_v3_cfg_t const ecspi1_pads[] = {
 	/* SS1 */
board/freescale/mx6qsabresd/mx6qsabresd.c +0 -5
index 2b3926a..806769f 100644
@@ -239,11 +239,6 @@ int board_eth_init(bd_t *bis)
 	return 0;
 }
 
-u32 get_board_rev(void)
-{
-	return 0x63000;
-}
-
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
board/wandboard/wandboard.c +0 -5
index d95189f..1e379fb 100644
@@ -168,11 +168,6 @@ int board_init(void)
 	return 0;
 }
 
-u32 get_board_rev(void)
-{
-	return get_cpu_rev();
-}
-
 int checkboard(void)
 {
 	puts("Board: Wandboard\n");
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

Hi Fabio,

Quoted 33 lines · Fabio Estevam

When booting a Freescale kernel 3.0.35 on a Wandboard solo, the get_board_rev() returns 0x62xxx, which is not a value understood by the VPU
(Video Processing Unit) library in the kernel and causes the video playback to fail.

The expected values for get_board_rev are:
0x63xxx: For mx6quad/dual
0x61xxx: For mx6dual-lite/solo

So adjust get_board_rev() accordingly and make it as weak function, so that we do not need to define it in every mx6 board file.

---
Changes since v1:
- Avoid extra call to get_cpu_rev()

  arch/arm/cpu/armv7/mx6/soc.c                  |   12 ++++++++++++
  board/boundary/nitrogen6x/nitrogen6x.c        |    5 -----
  board/freescale/mx6qsabrelite/mx6qsabrelite.c |    5 -----
  board/freescale/mx6qsabresd/mx6qsabresd.c     |    5 -----
  board/wandboard/wandboard.c                   |    5 -----
  5 files changed, 12 insertions(+), 20 deletions(-)
arch/arm/cpu/armv7/mx6/soc.c +1 -0
index 193ba12..4f3cd14 100644
@@ -61,6 +61,18 @@ u32 get_cpu_rev(void)
  	return (type << 12) | (reg + 0x10);
  }
 
+#ifdef CONFIG_REVISION_TAG

arch/arm/cpu/armv7/mx6/soc.c u32 get_cpu_rev(void) · line 74

Quoted 10 lines
arch/arm/cpu/armv7/mx6/soc.c +10 -0
+u32 __weak get_board_rev(void)
+{
+	u32 cpurev = get_cpu_rev();
+	u32 type = ((cpurev >> 12) & 0xff);
+	if (type == MXC_CPU_MX6SOLO)
+		cpurev = (MXC_CPU_MX6DL) << 12 | (cpurev & 0xFFF);
+
+	return cpurev;
+}
+#endif

This is much better than changing Troy's get_cpu_rev(). Thanks :)

But what's about to add this code to

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/kernel/setup.c?h=imx_3.0.35_1.1.0#n655

?

Best regards

Dirk

#2 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

Hi Dirk,

Quoted 1 line · Dirk Behme

This is much better than changing Troy's get_cpu_rev(). Thanks :)

I am glad you like it :-)

Quoted 4 lines

But what's about to add this code to

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/kernel/setup.c?h=imx_3.0.35_1.1.0#n655

Because I cannot post a patch in the U-boot list to fix an internal FSL kernel :-)

I can certainly suggest this (and yes, I fully agree that the kernel should handle the CPU detection without relying at the bootloader at all), but from a U-boot perspective we cannot really know which kernel version the user will deploy.

If we want mainline U-boot to work with this particular kernel version on mx6 solo, then we need to adjust ATAGS as proposed by my patch.

Regards,

Fabio Estevam

#3 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

Am 27.03.2013 20:36, schrieb Fabio Estevam:

Quoted 16 lines

Hi Dirk,

Quoted 1 line · Dirk Behme

This is much better than changing Troy's get_cpu_rev(). Thanks :)

I am glad you like it :-)

Quoted 4 lines

But what's about to add this code to

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/kernel/setup.c?h=imx_3.0.35_1.1.0#n655

Because I cannot post a patch in the U-boot list to fix an internal FSL kernel :-)

Quoted 7 lines

I can certainly suggest this (and yes, I fully agree that the kernel should handle the CPU detection without relying at the bootloader at all), but from a U-boot perspective we cannot really know which kernel version the user will deploy.

If we want mainline U-boot to work with this particular kernel version on mx6 solo, then we need to adjust ATAGS as proposed by my patch.

Ok, sounds reasonable, agreed.

Even if someone might complain that this is off-topic here, again ( ;) ): Do you like to check if the recent _mainline_ kernel wants something similar?

Best regards

Dirk

#4 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

Hi Dirk,

Quoted 23 lines · Dirk Behme

Am 27.03.2013 20:36, schrieb Fabio Estevam:

Quoted 22 lines

Hi Dirk,

Quoted 1 line · Dirk Behme

This is much better than changing Troy's get_cpu_rev(). Thanks :)

I am glad you like it :-)

Quoted 5 lines

But what's about to add this code to

http://git.freescale.com/git/cgit.cgi/imx/linux-2.6-imx.git/tree/arch/arm/kernel/setup.c?h=imx_3.0.35_1.1.0#n655

Because I cannot post a patch in the U-boot list to fix an internal FSL kernel :-)

I can certainly suggest this (and yes, I fully agree that the kernel should handle the CPU detection without relying at the bootloader at all), but from a U-boot perspective we cannot really know which kernel version the user will deploy.

Quoted 9 lines
Quoted 2 lines

If we want mainline U-boot to work with this particular kernel version on mx6 solo, then we need to adjust ATAGS as proposed by my patch.

Ok, sounds reasonable, agreed.

Even if someone might complain that this is off-topic here, again ( ;) ): Do you like to check if the recent _mainline_ kernel wants something similar?

It wasn't a complaint from me, but I can assure you that the offending bit of code that I found (in imx-lib) won't function against a main-line kernel without some serious re-work.

Regards,

Eric

#5 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

In reply to Fabio Estevam
Quoted 5 lines · Fabio Estevam

When booting a Freescale kernel 3.0.35 on a Wandboard solo, the get_board_rev() returns 0x62xxx, which is not a value understood by the VPU
(Video Processing Unit) library in the kernel and causes the video playback to fail.

Quoted 8 lines

The expected values for get_board_rev are:
0x63xxx: For mx6quad/dual
0x61xxx: For mx6dual-lite/solo

So adjust get_board_rev() accordingly and make it as weak function, so that we do not need to define it in every mx6 board file.

Thanks

Dirk

Quoted 98 lines

---
Changes since v1:
- Avoid extra call to get_cpu_rev()

 arch/arm/cpu/armv7/mx6/soc.c                  |   12 ++++++++++++
 board/boundary/nitrogen6x/nitrogen6x.c        |    5 -----
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |    5 -----
 board/freescale/mx6qsabresd/mx6qsabresd.c     |    5 -----
 board/wandboard/wandboard.c                   |    5 -----
 5 files changed, 12 insertions(+), 20 deletions(-)
arch/arm/cpu/armv7/mx6/soc.c +12 -0
index 193ba12..4f3cd14 100644
@@ -61,6 +61,18 @@ u32 get_cpu_rev(void)
 	return (type << 12) | (reg + 0x10);
 }
 
+#ifdef CONFIG_REVISION_TAG
+u32 __weak get_board_rev(void)
+{
+	u32 cpurev = get_cpu_rev();
+	u32 type = ((cpurev >> 12) & 0xff);
+	if (type == MXC_CPU_MX6SOLO)
+		cpurev = (MXC_CPU_MX6DL) << 12 | (cpurev & 0xFFF);
+
+	return cpurev;
+}
+#endif
+
 void init_aips(void)
 {
 	struct aipstz_regs *aips1, *aips2;
board/boundary/nitrogen6x/nitrogen6x.c +0 -5
index 229c237..1b1bedf 100644
@@ -328,11 +328,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-u32 get_board_rev(void)
-{
-	return 0x63000;
-}
-
 #ifdef CONFIG_MXC_SPI
 iomux_v3_cfg_t const ecspi1_pads[] = {
 	/* SS1 */
board/freescale/mx6qsabrelite/mx6qsabrelite.c +0 -5
index 5b69a6d..782e5ba 100644
@@ -298,11 +298,6 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
-u32 get_board_rev(void)
-{
-	return 0x63000 ;
-}
-
 #ifdef CONFIG_MXC_SPI
 iomux_v3_cfg_t const ecspi1_pads[] = {
 	/* SS1 */
board/freescale/mx6qsabresd/mx6qsabresd.c +0 -5
index 2b3926a..806769f 100644
@@ -239,11 +239,6 @@ int board_eth_init(bd_t *bis)
 	return 0;
 }
 
-u32 get_board_rev(void)
-{
-	return 0x63000;
-}
-
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
board/wandboard/wandboard.c +0 -5
index d95189f..1e379fb 100644
@@ -168,11 +168,6 @@ int board_init(void)
 	return 0;
 }
 
-u32 get_board_rev(void)
-{
-	return get_cpu_rev();
-}
-
 int checkboard(void)
 {
 	puts("Board: Wandboard\n");
#6 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

In reply to Fabio Estevam
Quoted 17 lines · Fabio Estevam

When booting a Freescale kernel 3.0.35 on a Wandboard solo, the get_board_rev() returns 0x62xxx, which is not a value understood by the VPU
(Video Processing Unit) library in the kernel and causes the video playback to fail.

The expected values for get_board_rev are:
0x63xxx: For mx6quad/dual
0x61xxx: For mx6dual-lite/solo

So adjust get_board_rev() accordingly and make it as weak function, so that we do not need to define it in every mx6 board file.

---
Changes since v1:
- Avoid extra call to get_cpu_rev()

Quoted 7 lines
  arch/arm/cpu/armv7/mx6/soc.c                  |   12 ++++++++++++
  board/boundary/nitrogen6x/nitrogen6x.c        |    5 -----
  board/freescale/mx6qsabrelite/mx6qsabrelite.c |    5 -----
  board/freescale/mx6qsabresd/mx6qsabresd.c     |    5 -----
  board/wandboard/wandboard.c                   |    5 -----
  5 files changed, 12 insertions(+), 20 deletions(-)
#7 lore raw

PATCH v2 1/1 mx6: Fix get_board_rev() for the mx6 solo case

In reply to Fabio Estevam
Quoted 9 lines · Fabio Estevam

When booting a Freescale kernel 3.0.35 on a Wandboard solo, the get_board_rev() returns 0x62xxx, which is not a value understood by the VPU
(Video Processing Unit) library in the kernel and causes the video playback to fail.

The expected values for get_board_rev are:
0x63xxx: For mx6quad/dual
0x61xxx: For mx6dual-lite/solo

Quoted 5 lines

So adjust get_board_rev() accordingly and make it as weak function, so that we do not need to define it in every mx6 board file.

---

Hi Fabio,

Quoted 20 lines

Changes since v1:
- Avoid extra call to get_cpu_rev()

 arch/arm/cpu/armv7/mx6/soc.c                  |   12 ++++++++++++
 board/boundary/nitrogen6x/nitrogen6x.c        |    5 -----
 board/freescale/mx6qsabrelite/mx6qsabrelite.c |    5 -----
 board/freescale/mx6qsabresd/mx6qsabresd.c     |    5 -----
 board/wandboard/wandboard.c                   |    5 -----
 5 files changed, 12 insertions(+), 20 deletions(-)
arch/arm/cpu/armv7/mx6/soc.c +2 -0
index 193ba12..4f3cd14 100644
@@ -61,6 +61,18 @@ u32 get_cpu_rev(void)
 	return (type << 12) | (reg + 0x10);
 }
 
+#ifdef CONFIG_REVISION_TAG
+u32 __weak get_board_rev(void)

arch/arm/cpu/armv7/mx6/soc.c u32 get_cpu_rev(void) · line 75

Quoted 10 lines
arch/arm/cpu/armv7/mx6/soc.c +10 -0
+{
+	u32 cpurev = get_cpu_rev();
+	u32 type = ((cpurev >> 12) & 0xff);
+	if (type == MXC_CPU_MX6SOLO)
+		cpurev = (MXC_CPU_MX6DL) << 12 | (cpurev & 0xFFF);
+
+	return cpurev;
+}
+#endif
+

We use a cpu revision as board revision, and this seems quite perverse. Anyway, I understand the reasons, and this seems a good way to work around bugs in other (FSL) code without breaking U-Boot.

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
=====================================================================