public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2] mx6: Distinguish mx6dual from mx6quad
@ 2014-01-22 20:19 Fabio Estevam
  2014-01-26 12:07 ` Stefano Babic
  0 siblings, 1 reply; 3+ messages in thread
From: Fabio Estevam @ 2014-01-22 20:19 UTC (permalink / raw)
  To: u-boot

From: Fabio Estevam <fabio.estevam@freescale.com>

Currently when we boot a mx6dual U-boot reports that it is a mx6quad.

Report it as MX6D instead:

CPU:   Freescale i.MX6D rev1.2 at 792 MHz

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Tested-by: Otavio Salvador <otavio@ossystems.com.br>
---
Changes since v1:
- Fix mx5 build error (Otavio)

 arch/arm/cpu/armv7/mx6/soc.c              | 14 +++++++++++---
 arch/arm/imx-common/cpu.c                 |  2 ++
 arch/arm/include/asm/arch-mx5/sys_proto.h |  1 +
 arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
 4 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 0208cba..9acd8c9 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -41,14 +41,19 @@ u32 get_cpu_rev(void)
 
 	if (type != MXC_CPU_MX6SL) {
 		reg = readl(&anatop->digprog);
+		struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
+		u32 cfg = readl(&scu->config) & 3;
 		type = ((reg >> 16) & 0xff);
 		if (type == MXC_CPU_MX6DL) {
-			struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
-			u32 cfg = readl(&scu->config) & 3;
-
 			if (!cfg)
 				type = MXC_CPU_MX6SOLO;
 		}
+
+		if (type == MXC_CPU_MX6Q) {
+			if (cfg == 1)
+				type = MXC_CPU_MX6D;
+		}
+
 	}
 	reg &= 0xff;		/* mx6 silicon revision */
 	return (type << 12) | (reg + 0x10);
@@ -62,6 +67,9 @@ u32 __weak get_board_rev(void)
 	if (type == MXC_CPU_MX6SOLO)
 		cpurev = (MXC_CPU_MX6DL) << 12 | (cpurev & 0xFFF);
 
+	if (type == MXC_CPU_MX6D)
+		cpurev = (MXC_CPU_MX6Q) << 12 | (cpurev & 0xFFF);
+
 	return cpurev;
 }
 #endif
diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 9231649..a77c4de 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -106,6 +106,8 @@ const char *get_imx_type(u32 imxtype)
 	switch (imxtype) {
 	case MXC_CPU_MX6Q:
 		return "6Q";	/* Quad-core version of the mx6 */
+	case MXC_CPU_MX6D:
+		return "6D";	/* Dual-core version of the mx6 */
 	case MXC_CPU_MX6DL:
 		return "6DL";	/* Dual Lite version of the mx6 */
 	case MXC_CPU_MX6SOLO:
diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h b/arch/arm/include/asm/arch-mx5/sys_proto.h
index 9949ad1..7dacc4c 100644
--- a/arch/arm/include/asm/arch-mx5/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
@@ -14,6 +14,7 @@
 #define MXC_CPU_MX6DL		0x61
 #define MXC_CPU_MX6SOLO		0x62
 #define MXC_CPU_MX6Q		0x63
+#define MXC_CPU_MX6D		0x64
 
 #define is_soc_rev(rev)	((get_cpu_rev() & 0xFF) - rev)
 u32 get_cpu_rev(void);
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h
index 17125a6..eda779e 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -16,6 +16,7 @@
 #define MXC_CPU_MX6DL		0x61
 #define MXC_CPU_MX6SOLO		0x62
 #define MXC_CPU_MX6Q		0x63
+#define MXC_CPU_MX6D		0x64
 
 #define is_soc_rev(rev)	((get_cpu_rev() & 0xFF) - rev)
 u32 get_cpu_rev(void);
-- 
1.8.1.2

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

* [U-Boot] [PATCH v2] mx6: Distinguish mx6dual from mx6quad
  2014-01-22 20:19 [U-Boot] [PATCH v2] mx6: Distinguish mx6dual from mx6quad Fabio Estevam
@ 2014-01-26 12:07 ` Stefano Babic
  2014-01-26 17:09   ` Fabio Estevam
  0 siblings, 1 reply; 3+ messages in thread
From: Stefano Babic @ 2014-01-26 12:07 UTC (permalink / raw)
  To: u-boot

Hi Fabio, hi Otavio,

On 22/01/2014 21:19, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Currently when we boot a mx6dual U-boot reports that it is a mx6quad.
>
> Report it as MX6D instead:
>
> CPU:   Freescale i.MX6D rev1.2 at 792 MHz
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> Tested-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
> Changes since v1:
> - Fix mx5 build error (Otavio)
>
>   arch/arm/cpu/armv7/mx6/soc.c              | 14 +++++++++++---
>   arch/arm/imx-common/cpu.c                 |  2 ++
>   arch/arm/include/asm/arch-mx5/sys_proto.h |  1 +
>   arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
>   4 files changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index 0208cba..9acd8c9 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -41,14 +41,19 @@ u32 get_cpu_rev(void)
>
>   	if (type != MXC_CPU_MX6SL) {
>   		reg = readl(&anatop->digprog);
> +		struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
> +		u32 cfg = readl(&scu->config) & 3;
>   		type = ((reg >> 16) & 0xff);
>   		if (type == MXC_CPU_MX6DL) {
> -			struct scu_regs *scu = (struct scu_regs *)SCU_BASE_ADDR;
> -			u32 cfg = readl(&scu->config) & 3;
> -
>   			if (!cfg)
>   				type = MXC_CPU_MX6SOLO;
>   		}
> +
> +		if (type == MXC_CPU_MX6Q) {
> +			if (cfg == 1)
> +				type = MXC_CPU_MX6D;
> +		}
> +
>   	}
>   	reg &= 0xff;		/* mx6 silicon revision */
>   	return (type << 12) | (reg + 0x10);
> @@ -62,6 +67,9 @@ u32 __weak get_board_rev(void)
>   	if (type == MXC_CPU_MX6SOLO)
>   		cpurev = (MXC_CPU_MX6DL) << 12 | (cpurev & 0xFFF);
>
> +	if (type == MXC_CPU_MX6D)
> +		cpurev = (MXC_CPU_MX6Q) << 12 | (cpurev & 0xFFF);
> +
>   	return cpurev;
>   }
>   #endif
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 9231649..a77c4de 100644
> --- a/arch/arm/imx-common/cpu.c
> +++ b/arch/arm/imx-common/cpu.c
> @@ -106,6 +106,8 @@ const char *get_imx_type(u32 imxtype)
>   	switch (imxtype) {
>   	case MXC_CPU_MX6Q:
>   		return "6Q";	/* Quad-core version of the mx6 */
> +	case MXC_CPU_MX6D:
> +		return "6D";	/* Dual-core version of the mx6 */
>   	case MXC_CPU_MX6DL:
>   		return "6DL";	/* Dual Lite version of the mx6 */
>   	case MXC_CPU_MX6SOLO:
> diff --git a/arch/arm/include/asm/arch-mx5/sys_proto.h b/arch/arm/include/asm/arch-mx5/sys_proto.h
> index 9949ad1..7dacc4c 100644
> --- a/arch/arm/include/asm/arch-mx5/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mx5/sys_proto.h
> @@ -14,6 +14,7 @@
>   #define MXC_CPU_MX6DL		0x61
>   #define MXC_CPU_MX6SOLO		0x62
>   #define MXC_CPU_MX6Q		0x63
> +#define MXC_CPU_MX6D		0x64
>

Agree generally with the patch, but it seems to me better, instead of 
fixing the MX5 here, to move all CPU definitions outside the specific 
MX5/MX6 files into imx-common. They can be then defined once else in 
each sys_proto.h.

I have nothing against a new file, maybe cpu.h ?

Best regards,
Stefano Babic

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

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

* [U-Boot] [PATCH v2] mx6: Distinguish mx6dual from mx6quad
  2014-01-26 12:07 ` Stefano Babic
@ 2014-01-26 17:09   ` Fabio Estevam
  0 siblings, 0 replies; 3+ messages in thread
From: Fabio Estevam @ 2014-01-26 17:09 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

On Sun, Jan 26, 2014 at 10:07 AM, Stefano Babic <sbabic@denx.de> wrote:

> Agree generally with the patch, but it seems to me better, instead of fixing
> the MX5 here, to move all CPU definitions outside the specific MX5/MX6 files
> into imx-common. They can be then defined once else in each sys_proto.h.
>
> I have nothing against a new file, maybe cpu.h ?

Yes, it looks better by having a common cpu.h. Just sent v4.

Regards,

Fabio Estevam

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

end of thread, other threads:[~2014-01-26 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-22 20:19 [U-Boot] [PATCH v2] mx6: Distinguish mx6dual from mx6quad Fabio Estevam
2014-01-26 12:07 ` Stefano Babic
2014-01-26 17:09   ` Fabio Estevam

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