Skip to contentSkip to conversation

i.MX refactoring patchset

PATCH Superseded Otavio Salvador 5 participants 32 messages Jun 17, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover i.MX refactoring patchset

This patchset include minor changes for i.MX; mainly:

1/3: improves the rare case of unkown booting machine 2/3: generalize the code so it works for i.MX23 and i.MX28

The patch 3/3 is what we've been using in Yocto and has been change to affect only mx28evk.

Otavio Salvador (3):
imx: Use a clear identification of an unidentified CPU type
mxs: generalize code for print_cpuinfo()
mx28evk: extend default environment

 arch/arm/cpu/arm926ejs/mx28/mx28.c  |   29 +++++++++++-
 arch/arm/cpu/armv7/imx-common/cpu.c |    4 +-
 include/configs/mx28evk.h           |   83 +++++++++++++++++++++++++++++++----
 3 files changed, 104 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

In case an unidentified CPU type is detected it now returns i.MX<unidentified>, in a const char.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/armv7/imx-common/cpu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/imx-common/cpu.c +2 -2
index b3195dd..77aac7d 100644
@@ -66,7 +66,7 @@ char *get_reset_cause(void)
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 
-static char *get_imx_type(u32 imxtype)
+static const char *get_imx_type(u32 imxtype)
 {
 	switch (imxtype) {
 	case 0x63:
@@ -80,7 +80,7 @@ static char *get_imx_type(u32 imxtype)
 	case 0x53:
 		return "53";
 	default:
-		return "unknown";
+		return "<unidentified>";
 	}
 }
 
Signature · 1 line
1.7.10
reviewer
#2 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

arch/arm/cpu/armv7/imx-common/cpu.c char *get_reset_cause(void) · line 69

Quoted 2 lines · Otavio Salvador
arch/arm/cpu/armv7/imx-common/cpu.c +1 -1
-static char *get_imx_type(u32 imxtype)
+static const char *get_imx_type(u32 imxtype)

This is OK, but ...

Quoted 9 lines

?{
? ? ? ?switch (imxtype) {
? ? ? ?case 0x63:

(quoted diff) +0 -0
@@ -80,7 +80,7 @@ static char *get_imx_type(u32 imxtype)

? ? ? ?case 0x53:
? ? ? ? ? ? ? ?return "53";
? ? ? ?default:
- ? ? ? ? ? ? ? return "unknown";
+ ? ? ? ? ? ? ? return "<unidentified>";

I really don't see any improvement here.

#3 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Quoted 5 lines · Fabio Estevam
Quoted 3 lines

? ? ? ?default:
- ? ? ? ? ? ? ? return "unknown";
+ ? ? ? ? ? ? ? return "<unidentified>";

I really don't see any improvement here.

It is just to avoid a i.MXunkown return; besides this is how I am doing in the mx23 code too.

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
reviewer
#4 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Quoted 9 lines · Otavio Salvador
Quoted 5 lines · Fabio Estevam
Quoted 3 lines

? ? ? ?default:
- ? ? ? ? ? ? ? return "unknown";
+ ? ? ? ? ? ? ? return "<unidentified>";

I really don't see any improvement here.

It is just to avoid a i.MXunkown return; besides this is how I am doing in the mx23 code too.

This is OK. If you read "i.MXunkown" things are too broken already because the chip version could not be read.

Reading "i.MX<unidentified>" will make things no better.

#5 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Quoted 1 line · Fabio Estevam

Reading "i.MX<unidentified>" will make things no better.

OK; I'll drop it from the patch queue then.

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
#6 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

In reply to Fabio Estevam

Dear Fabio Estevam,

Quoted 10 lines

On Sun, Jun 17, 2012 at 10:09 AM, Otavio Salvador

Quoted 7 lines · <[email protected]> wrote:
Quoted 5 lines · Fabio Estevam

arch/arm/cpu/armv7/imx-common/cpu.c static char *get_imx_type(u32 imxtype) · line 83

Quoted 3 lines

default:

arch/arm/cpu/armv7/imx-common/cpu.c +1 -1
-               return "unknown";
+               return "<unidentified>";

I really don't see any improvement here.

Quoted 7 lines
Quoted 2 lines

It is just to avoid a i.MXunkown return; besides this is how I am doing in the mx23 code too.

This is OK. If you read "i.MXunkown" things are too broken already because the chip version could not be read.

Reading "i.MX<unidentified>" will make things no better.

This was from my head actually ... and I think this is better. The text is at least not mangled so badly. So let's keep it.

Best regards,
Marek Vasut

#7 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

In reply to Otavio Salvador
Quoted 8 lines · Otavio Salvador

In case an unidentified CPU type is detected it now returns i.MX<unidentified>, in a const char.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

---

Hi Otavio,

Quoted 17 lines
 arch/arm/cpu/armv7/imx-common/cpu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/imx-common/cpu.c +1 -1
index b3195dd..77aac7d 100644
@@ -66,7 +66,7 @@ char *get_reset_cause(void)
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 
-static char *get_imx_type(u32 imxtype)
+static const char *get_imx_type(u32 imxtype)
 {
 	switch (imxtype) {
 	case 0x63:

arch/arm/cpu/armv7/imx-common/cpu.c static char *get_imx_type(u32 imxtype) · line 83

Quoted 5 lines
arch/arm/cpu/armv7/imx-common/cpu.c +1 -1
@@ -80,7 +80,7 @@ static char *get_imx_type(u32 imxtype)
 	case 0x53:
 		return "53";
 	default:
-		return "unknown";
+		return "<unidentified>";

Taste ist taste... but why <unidentified> is better that unknown ?

Stefano

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
=====================================================================
#8 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Quoted 4 lines · Stefano Babic
Quoted 2 lines

- ? ? ? ? ? ? return "unknown";
+ ? ? ? ? ? ? return "<unidentified>";

Taste ist taste... but why <unidentified> is better that unknown ?

For me it gives a visual indication that we didn't meant to support a i.MXunknown processor ;-) i.MX<unidentified> make it easy to spot this.

But really, I don't mind it being included or not. I did it because Marek has comment about it when looking at my initial mx23 patches.

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
#9 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Dear Otavio Salvador,

Quoted 12 lines · Stefano Babic
Quoted 4 lines

arch/arm/cpu/armv7/imx-common/cpu.c static char *get_imx_type(u32 imxtype) · line 83

Quoted 2 lines
arch/arm/cpu/armv7/imx-common/cpu.c +1 -1
-             return "unknown";
+             return "<unidentified>";

Taste ist taste... but why <unidentified> is better that unknown ?

For me it gives a visual indication that we didn't meant to support a i.MXunknown processor ;-) i.MX<unidentified> make it easy to spot this.

But really, I don't mind it being included or not. I did it because Marek has comment about it when looking at my initial mx23 patches.

And I like it more, it looks less like a typo.

Best regards,
Marek Vasut

#10 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Quoted 4 lines · Marek Vasut
Quoted 2 lines

But really, I don't mind it being included or not. I did it because Marek has comment about it when looking at my initial mx23 patches.

And I like it more, it looks less like a typo.

Sorry; I didn't get what you meant ... should it go or not?

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
#11 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Quoted 7 lines · Otavio Salvador
Quoted 4 lines · Marek Vasut
Quoted 2 lines

But really, I don't mind it being included or not. I did it because Marek has comment about it when looking at my initial mx23 patches.

And I like it more, it looks less like a typo.

Sorry; I didn't get what you meant ... should it go or not?

Hi Otavio,

I make also my point clearer for Marek: my point is that the behavior for all i.MX must be consistent. If you change here, please change also for i.MX31 (that returns "unknown in print_cpuinfo) and for other SOCs that returns "unknown" in print_cpuinfo() - or let the code as now.

Best regards,
Stefano

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
=====================================================================
#12 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

Dear Stefano Babic,

Quoted 7 lines · Otavio Salvador
Quoted 6 lines · Marek Vasut
Quoted 4 lines
Quoted 2 lines

But really, I don't mind it being included or not. I did it because Marek has comment about it when looking at my initial mx23 patches.

And I like it more, it looks less like a typo.

Quoted 8 lines
Quoted 1 line

Sorry; I didn't get what you meant ... should it go or not?

Hi Otavio,

I make also my point clearer for Marek: my point is that the behavior for all i.MX must be consistent. If you change here, please change also for i.MX31 (that returns "unknown in print_cpuinfo) and for other SOCs that returns "unknown" in print_cpuinfo() - or let the code as now.

Ah, I thought it was about the revision. Ok, whatever way is fine by me.

Quoted 2 lines

Best regards,
Stefano

Best regards,
Marek Vasut

#13 lore raw

PATCH 1/3 imx: Use a clear identification of an unidentified CPU type

In reply to Otavio Salvador

Dear Otavio Salvador,

Quoted 7 lines · Marek Vasut
Quoted 4 lines
Quoted 2 lines

But really, I don't mind it being included or not. I did it because Marek has comment about it when looking at my initial mx23 patches.

And I like it more, it looks less like a typo.

Sorry; I didn't get what you meant ... should it go or not?

It doesn't look like a typing mistake (i.MX<unknown> vs. i.MXunknown) => I like it more with "<" ">".

Best regards,
Marek Vasut

#14 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

In reply to Otavio Salvador

The information now is gathered from HW_DIGCTL_CHIPID register and includes the revision of the chip on the output.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/arm926ejs/mx28/mx28.c |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/mx28/mx28.c +27 -2
index a82ff25..ac2f2e0 100644
@@ -190,13 +190,38 @@ int arch_cpu_init(void)
 #endif
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
+static const char *get_cpu_type(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {
+	case 0x2800:
+		return "28";
+	case 0x3728:
+		return "23";
+	default:
+		return "<unidentified>";
+	}
+}
+
+static u8 get_cpu_rev(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}
+
 int print_cpuinfo(void)
 {
 	struct mx28_spl_data *data = (struct mx28_spl_data *)
 		((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
 
-	printf("Freescale i.MX28 family at %d MHz\n",
-			mxc_get_clock(MXC_ARM_CLK) / 1000000);
+	printf("CPU:   Freescale i.MX%s rev%d at %d MHz\n",
+		get_cpu_type(),
+		get_cpu_rev(),
+		mxc_get_clock(MXC_ARM_CLK) / 1000000);
 	printf("BOOT:  %s\n", mx28_boot_modes[data->boot_mode_idx].mode);
 	return 0;
 }
Signature · 1 line
1.7.10
reviewer
#15 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Quoted 47 lines · Otavio Salvador

The information now is gathered from HW_DIGCTL_CHIPID register and includes the revision of the chip on the output.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

---
?arch/arm/cpu/arm926ejs/mx28/mx28.c | ? 29 +++++++++++++++++++++++++++-- ?1 file changed, 27 insertions(+), 2 deletions(-)

arch/arm/cpu/arm926ejs/mx28/mx28.c +0 -0
index a82ff25..ac2f2e0 100644
@@ -190,13 +190,38 @@ int arch_cpu_init(void)

?#endif

?#if defined(CONFIG_DISPLAY_CPUINFO)

arch/arm/cpu/arm926ejs/mx28/mx28.c +23 -0
+static const char *get_cpu_type(void)
+{
+ ? ? ? struct mx28_digctl_regs *digctl_regs =
+ ? ? ? ? ? ? ? (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+ ? ? ? switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {
+ ? ? ? case 0x2800:
+ ? ? ? ? ? ? ? return "28";
+ ? ? ? case 0x3728:
+ ? ? ? ? ? ? ? return "23";
+ ? ? ? default:
+ ? ? ? ? ? ? ? return "<unidentified>";
+ ? ? ? }
+}
+
+static u8 get_cpu_rev(void)
+{
+ ? ? ? struct mx28_digctl_regs *digctl_regs =
+ ? ? ? ? ? ? ? (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+ ? ? ? return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}
+

?int print_cpuinfo(void)
?{
? ? ? ?struct mx28_spl_data *data = (struct mx28_spl_data *)
? ? ? ? ? ? ? ?((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);

Quoted 3 lines

- ? ? ? printf("Freescale i.MX28 family at %d MHz\n",
- ? ? ? ? ? ? ? ? ? ? ? mxc_get_clock(MXC_ARM_CLK) / 1000000);
+ ? ? ? printf("CPU: ? Freescale i.MX%s rev%d at %d MHz\n",

In all other i.MX SoCs we display the revision as rev%d.%d, for example:

rev1.0 , rev1.1 , etc.

I think we should print it in the same format here (x.y)

reviewer
#16 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

In reply to Otavio Salvador

Review

Quoted 10 lines · Otavio Salvador

?#if defined(CONFIG_DISPLAY_CPUINFO)

(quoted diff) +9 -0
+static const char *get_cpu_type(void)
+{
+ ? ? ? struct mx28_digctl_regs *digctl_regs =
+ ? ? ? ? ? ? ? (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+ ? ? ? switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {
+ ? ? ? case 0x2800:
+ ? ? ? ? ? ? ? return "28";
+ ? ? ? case 0x3728:

Reading the Reference Manual I read 0x3780 instead.

#17 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Dear Fabio Estevam,

Quoted 13 lines

On Sun, Jun 17, 2012 at 9:58 AM, Otavio Salvador

Quoted 9 lines · <[email protected]> wrote:

#if defined(CONFIG_DISPLAY_CPUINFO)

arch/arm/cpu/arm926ejs/mx28/mx28.c +8 -0
+static const char *get_cpu_type(void)
+{
+       struct mx28_digctl_regs *digctl_regs =
+               (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+       switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {
+       case 0x2800:
+               return "28";
Quoted 2 lines
Quoted 1 line

+ case 0x3728:

Reading the Reference Manual I read 0x3780 instead.

Good catch ;-)

What's the code for mx6q? They dropped this register from it it seems ;-)

Best regards,
Marek Vasut

reviewer
#18 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Quoted 1 line · Marek Vasut

What's the code for mx6q? They dropped this register from it it seems ;-)

mx6 code does read the SoC type and revision correctly.

#19 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

In reply to Fabio Estevam
Quoted 1 line · Fabio Estevam

Reading the Reference Manual I read 0x3780 instead.

Indeed; I must have typoed it when writting it back.

I fixed it locally; Fabio will check the masking for mx28 revision and when I get it I update the patch according.

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
#20 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Dear Otavio Salvador,

Quoted 7 lines · Fabio Estevam
Quoted 1 line

Reading the Reference Manual I read 0x3780 instead.

Indeed; I must have typoed it when writting it back.

I fixed it locally; Fabio will check the masking for mx28 revision and when I get it I update the patch according.

It's 0x2800 ... roll out a new version ;-)

Best regards,
Marek Vasut

#21 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Quoted 4 lines · Marek Vasut
Quoted 2 lines

I fixed it locally; Fabio will check the masking for mx28 revision and when I get it I update the patch according.

It's 0x2800 ... roll out a new version ;-)

We are in doubt about the revision, not product code ;-)

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
#22 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

In reply to Otavio Salvador

Dear Otavio Salvador,

Quoted 16 lines

The information now is gathered from HW_DIGCTL_CHIPID register and includes the revision of the chip on the output.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 arch/arm/cpu/arm926ejs/mx28/mx28.c |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/mx28/mx28.c index a82ff25..ac2f2e0 100644

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 198

Quoted 9 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +6 -0
@@ -190,13 +190,38 @@ int arch_cpu_init(void)
 #endif
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
+static const char *get_cpu_type(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {

#define that >> 16 ... maybe offset? I'd define a mask though, see below.

#define PRODUCT_CODE_MASK (0xffff << 16)

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 199

Quoted 1 line
arch/arm/cpu/arm926ejs/mx28/mx28.c +1 -0
+	case 0x2800:

#define this as something ... #define PRODUCT_CODE_MX28 (0x2800 << 16)

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 204

Quoted 5 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +5 -0
+		return "28";
+	case 0x3728:
+		return "23";
+	default:
+		return "<unidentified>";

So X-Files-ish ;-)

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 208

Quoted 4 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +4 -0
+	}
+}
+
+static u8 get_cpu_rev(void)

uint8_t ... maybe? it's used throughout the code, so let's keep consistent.

Quoted 11 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +7 -0
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}
+
 int print_cpuinfo(void)
 {
 	struct mx28_spl_data *data = (struct mx28_spl_data *)
 		((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 227

Quoted 10 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +4 -2
 
-	printf("Freescale i.MX28 family at %d MHz\n",
-			mxc_get_clock(MXC_ARM_CLK) / 1000000);
+	printf("CPU:   Freescale i.MX%s rev%d at %d MHz\n",
+		get_cpu_type(),
+		get_cpu_rev(),
+		mxc_get_clock(MXC_ARM_CLK) / 1000000);
 	printf("BOOT:  %s\n", mx28_boot_modes[data->boot_mode_idx].mode);
 	return 0;
 }

Best regards,
Marek Vasut

#23 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

In reply to Otavio Salvador
Quoted 8 lines · Otavio Salvador

The information now is gathered from HW_DIGCTL_CHIPID register and includes the revision of the chip on the output.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

---

Hi Otavio,

Quoted 15 lines
 arch/arm/cpu/arm926ejs/mx28/mx28.c |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/mx28/mx28.c +4 -0
index a82ff25..ac2f2e0 100644
@@ -190,13 +190,38 @@ int arch_cpu_init(void)
 #endif
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
+static const char *get_cpu_type(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 206

Quoted 10 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +10 -0
+
+	switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {
+	case 0x2800:
+		return "28";
+	case 0x3728:
+		return "23";
+	default:
+		return "<unidentified>";
+	}
+}

I like that there will be support for i.MX23, too. But I dislike that everything takes the name "MX28". As you suggest in your subject, maybe it is time to rename directories, and use "mxs" (as in kernel) instead of mx28.

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 214

Quoted 8 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +8 -0
+
+static u8 get_cpu_rev(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}

Everywhere (i.MX, omap, ...) get_cpu_rev returns u32. The function is currently exported, too.

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
=====================================================================
#24 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Dear Stefano Babic,

Quoted 36 lines · Otavio Salvador
Quoted 8 lines

The information now is gathered from HW_DIGCTL_CHIPID register and includes the revision of the chip on the output.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Fabio Estevam <[email protected]>

---

Hi Otavio,

Quoted 24 lines
 arch/arm/cpu/arm926ejs/mx28/mx28.c |   29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/arch/arm/cpu/arm926ejs/mx28/mx28.c index a82ff25..ac2f2e0 100644

arch/arm/cpu/arm926ejs/mx28/mx28.c +11 -0
@@ -190,13 +190,38 @@ int arch_cpu_init(void)
 
 #endif
 
 #if defined(CONFIG_DISPLAY_CPUINFO)
 
+static const char *get_cpu_type(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {
+	case 0x2800:
+		return "28";
+	case 0x3728:
+		return "23";
+	default:
Quoted 8 lines

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 206

Quoted 3 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +3 -0
+		return "<unidentified>";
+	}
+}

I like that there will be support for i.MX23, too. But I dislike that everything takes the name "MX28". As you suggest in your subject, maybe it is time to rename directories, and use "mxs" (as in kernel) instead of mx28.

We can do that eventually, later ... it depends on the ordering of Otavio's patches, I'm fine either way.

Quoted 11 lines

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 214

Quoted 8 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +8 -0
+
+static u8 get_cpu_rev(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}

Everywhere (i.MX, omap, ...) get_cpu_rev returns u32. The function is currently exported, too.

Correct, but isn't the return value mangled somehow (like having major rev. << 16 and minor rev. << 0 )? Or that's only IMX?

Quoted 3 lines

Best regards,
Stefano Babic

Best regards,
Marek Vasut

#25 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Quoted 7 lines · Marek Vasut
Quoted 4 lines

I like that there will be support for i.MX23, too. But I dislike that everything takes the name "MX28". As you suggest in your subject, maybe it is time to rename directories, and use "mxs" (as in kernel) instead of mx28.

We can do that eventually, later ... it depends on the ordering of Otavio's patches, I'm fine either way.

Fine with me - anyway, it is something must be done.

Quoted 13 lines
Quoted 12 lines

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 214

Quoted 9 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +8 -0
+
+static u8 get_cpu_rev(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}

Everywhere (i.MX, omap, ...) get_cpu_rev returns u32. The function is currently exported, too.

Quoted 2 lines

Correct, but isn't the return value mangled somehow (like having major rev. << 16 and minor rev. << 0 )? Or that's only IMX?

Checking in current implementations for get_cpu_rev() (i.MX / OMAP24 / OMAP3 / AM33, and even board/apollon/sys_info.c: I do not know why the cpu detection is inseide this file), none of them requires strictly 32 bit. However, we should be coherent in all code - for this reason I dislike if one of the i.MX is implemented differently as for other SOCs.

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: [email protected]
=====================================================================
#26 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Quoted 8 lines · Stefano Babic
Quoted 2 lines

Correct, but isn't the return value mangled somehow (like having major rev. << 16 and minor rev. << 0 )? Or that's only IMX?

Checking in current implementations for get_cpu_rev() (i.MX / OMAP24 / OMAP3 / AM33, and even board/apollon/sys_info.c: I do not know why the cpu detection is inseide this file), none of them requires strictly 32 bit. However, we should be coherent in all code - for this reason I dislike if one of the i.MX is implemented differently as for other SOCs.

So, we change this one to follow the others or fix the others?

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
#27 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

Dear Otavio Salvador,

Quoted 11 lines · Stefano Babic
Quoted 8 lines
Quoted 2 lines

Correct, but isn't the return value mangled somehow (like having major rev. << 16 and minor rev. << 0 )? Or that's only IMX?

Checking in current implementations for get_cpu_rev() (i.MX / OMAP24 / OMAP3 / AM33, and even board/apollon/sys_info.c: I do not know why the cpu detection is inseide this file), none of them requires strictly 32 bit. However, we should be coherent in all code - for this reason I dislike if one of the i.MX is implemented differently as for other SOCs.

So, we change this one to follow the others or fix the others?

Fix the others ;-)

Best regards,
Marek Vasut

#28 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

In reply to Stefano Babic

Dear Stefano Babic,

Quoted 23 lines · Marek Vasut
Quoted 7 lines
Quoted 4 lines

I like that there will be support for i.MX23, too. But I dislike that everything takes the name "MX28". As you suggest in your subject, maybe it is time to rename directories, and use "mxs" (as in kernel) instead of mx28.

We can do that eventually, later ... it depends on the ordering of Otavio's patches, I'm fine either way.

Fine with me - anyway, it is something must be done.

Quoted 12 lines
Quoted 11 lines

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 214

Quoted 8 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +8 -0
+
+static u8 get_cpu_rev(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+	return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}

Everywhere (i.MX, omap, ...) get_cpu_rev returns u32. The function is currently exported, too.

Quoted 8 lines
Quoted 2 lines

Correct, but isn't the return value mangled somehow (like having major rev. << 16 and minor rev. << 0 )? Or that's only IMX?

Checking in current implementations for get_cpu_rev() (i.MX / OMAP24 / OMAP3 / AM33, and even board/apollon/sys_info.c: I do not know why the cpu detection is inseide this file), none of them requires strictly 32 bit. However, we should be coherent in all code - for this reason I dislike if one of the i.MX is implemented differently as for other SOCs.

+1

Quoted 2 lines

Best regards,
Stefano Babic

Best regards,
Marek Vasut

#29 lore raw

PATCH 2/3 mxs: generalize code for print_cpuinfo()

In reply to Stefano Babic
Quoted 4 lines · Stefano Babic

I like that there will be support for i.MX23, too. But I dislike that everything takes the name "MX28". As you suggest in your subject, maybe it is time to rename directories, and use "mxs" (as in kernel) instead of mx28.

I have it in my wip branch; I'd like to hold it until I have mx23 working so I have freedom to rework the patches.

I can split it on mx28 part and leave mx23 on my branch; this does looks nicer for me.

Quoted 10 lines

arch/arm/cpu/arm926ejs/mx28/mx28.c int arch_cpu_init(void) · line 214

Quoted 7 lines
arch/arm/cpu/arm926ejs/mx28/mx28.c +7 -0
+static u8 get_cpu_rev(void)
+{
+ ? ? struct mx28_digctl_regs *digctl_regs =
+ ? ? ? ? ? ? (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+
+ ? ? return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
+}

Everywhere (i.MX, omap, ...) get_cpu_rev returns u32. The function is currently exported, too.

I change it then.

Will fix it.

Signature · 3 lines
Otavio Salvador? ? ? ? ? ? ? ? ? ? ? ? ? ? ?O.S. Systems
E-mail: otavio at ossystems.com.br? http://www.ossystems.com.br
Mobile: +55 53 9981-7854? ? ? ?? ? ? ?http://projetos.ossystems.com.br
#30 lore raw

PATCH 3/3 mx28evk: extend default environment

In reply to Otavio Salvador

The environment has been based on mx53loco and m28evk but keeping the possibility to easy change the default console device as Freescale and mainline kernels differ on the device name.

Cc Marek Vasut <[email protected]>
Cc Stefano Babic <[email protected]>
Cc Wolfgang Denk <[email protected]>
Cc Fabio Estevam <[email protected]>
---
 include/configs/mx28evk.h |   83 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 75 insertions(+), 8 deletions(-)
include/configs/mx28evk.h +75 -8
index e98a746..889d58a 100644
@@ -234,7 +234,6 @@
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_BOOTDELAY	3
 #define CONFIG_BOOTFILE	"uImage"
-#define CONFIG_BOOTCOMMAND	"run bootcmd_net"
 #define CONFIG_LOADADDR	0x42000000
 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
 #define CONFIG_OF_LIBFDT
@@ -243,13 +242,81 @@
  * Extra Environments
  */
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"console_fsl=console=ttyAM0" \
-	"console_mainline=console=ttyAMA0" \
-	"netargs=setenv bootargs console=${console_mainline}" \
+	"update_nand_full_filename=u-boot.nand\0" \
+	"update_nand_firmware_filename=u-boot.sb\0"	\
+	"update_sd_firmware_filename=u-boot.sd\0" \
+	"update_nand_firmware_maxsz=0x100000\0"	\
+	"update_nand_stride=0x40\0"	/* MX28 datasheet ch. 12.12 */ \
+	"update_nand_count=0x4\0"	/* MX28 datasheet ch. 12.12 */ \
+	"update_nand_get_fcb_size="	/* Get size of FCB blocks */ \
+		"nand device 0 ; " \
+		"nand info ; " \
+		"setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
+		"setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
+	"update_nand_full="		    /* Update FCB, DBBT and FW */ \
+		"if tftp ${update_nand_full_filename} ; then " \
+		"run update_nand_get_fcb_size ; " \
+		"nand scrub -y 0x0 ${filesize} ; " \
+		"nand write.raw ${loadaddr} 0x0 ${update_nand_fcb} ; " \
+		"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
+		"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
+		"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
+		"fi\0" \
+	"update_nand_firmware="		/* Update only firmware */ \
+		"if tftp ${update_nand_firmware_filename} ; then " \
+		"run update_nand_get_fcb_size ; " \
+		"setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \
+		"setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; " \
+		"setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \
+		"nand erase ${fcb_sz} ${fw_sz} ; " \
+		"nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \
+		"nand write ${loadaddr} ${fw_off} ${filesize} ; " \
+		"fi\0" \
+	"update_sd_firmware="		/* Update the SD firmware partition */ \
+		"if mmc rescan ; then "	\
+		"if tftp ${update_sd_firmware_filename} ; then " \
+		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
+		"setexpr fw_sz ${fw_sz} + 1 ; "	\
+		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
+		"fi ; "	\
+		"fi\0" \
+	"script=boot.scr\0"	\
+	"uimage=uImage\0" \
+	"console_fsl=ttyAM0\0" \
+	"console_mainline=ttyAMA0\0" \
+	"console=${console_mainline}\0" \
+	"mmcdev=0\0" \
+	"mmcpart=2\0" \
+	"mmcroot=/dev/mmcblk0p3 rw\0" \
+	"mmcrootfstype=ext3 rootwait\0"	\
+	"mmcargs=setenv bootargs console=${console},${baudrate} " \
+		"root=${mmcroot} " \
+		"rootfstype=${mmcrootfstype}\0"	\
+	"loadbootscript="  \
+		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+	"bootscript=echo Running bootscript from mmc ...; "	\
+		"source\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+	"mmcboot=echo Booting from mmc ...; " \
+		"run mmcargs; "	\
+		"bootm\0" \
+	"netargs=setenv bootargs console=${console},${baudrate} " \
 		"root=/dev/nfs " \
-		"ip=dhcp nfsroot=${serverip}:${nfsroot}\0" \
-	"bootcmd_net=echo Booting from net ...; " \
-		"run netargs; " \
-		"dhcp ${uimage}; bootm\0" \
+		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+	"netboot=echo Booting from net ...; " \
+		"run netargs; "	\
+		"dhcp ${uimage}; bootm\0"
+
+#define CONFIG_BOOTCOMMAND \
+	"if mmc rescan ${mmcdev}; then " \
+		"if run loadbootscript; then " \
+			"run bootscript; " \
+		"else " \
+			"if run loaduimage; then " \
+				"run mmcboot; " \
+			"else run netboot; " \
+			"fi; " \
+		"fi; " \
+	"else run netboot; fi"
 
 #endif /* __MX28EVK_CONFIG_H__ */
Signature · 1 line
1.7.10
#31 lore raw

cover i.MX refactoring patchset

In reply to Otavio Salvador

Dear Otavio Salvador,

Quoted 3 lines

This patchset include minor changes for i.MX; mainly:

1/3: improves the rare case of unkown booting machine

<trolling>
The word's actually "unknown" ;-D
</trolling>

Quoted 9 lines

2/3: generalize the code so it works for i.MX23 and i.MX28

The patch 3/3 is what we've been using in Yocto and has been change to affect only mx28evk.

Otavio Salvador (3):
imx: Use a clear identification of an unidentified CPU type
mxs: generalize code for print_cpuinfo()
mx28evk: extend default environment

It's good, really good :-)

Quoted 5 lines
 arch/arm/cpu/arm926ejs/mx28/mx28.c  |   29 +++++++++++-
 arch/arm/cpu/armv7/imx-common/cpu.c |    4 +-
 include/configs/mx28evk.h           |   83

+++++++++++++++++++++++++++++++---- 3 files changed, 104 insertions(+), 12 deletions(-)

Best regards,
Marek Vasut