public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type
@ 2012-06-30 15:07 Otavio Salvador
  2012-06-30 15:07 ` [U-Boot] [PATCH v3 2/2] mxs: generalize code for print_cpuinfo() Otavio Salvador
  2012-07-16 11:03 ` [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type Stefano Babic
  0 siblings, 2 replies; 5+ messages in thread
From: Otavio Salvador @ 2012-06-30 15:07 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Cc: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>

---
Changes for v2:
 * use i.MX?? for unidentified CPU type

 arch/arm/cpu/armv7/imx-common/cpu.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/armv7/imx-common/cpu.c b/arch/arm/cpu/armv7/imx-common/cpu.c
index b3195dd..e7bd0bf 100644
--- a/arch/arm/cpu/armv7/imx-common/cpu.c
+++ b/arch/arm/cpu/armv7/imx-common/cpu.c
@@ -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 "??";
 	}
 }
 
-- 
1.7.10

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

* [U-Boot] [PATCH v3 2/2] mxs: generalize code for print_cpuinfo()
  2012-06-30 15:07 [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type Otavio Salvador
@ 2012-06-30 15:07 ` Otavio Salvador
  2012-07-16 11:04   ` Stefano Babic
  2012-07-16 11:03 ` [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type Stefano Babic
  1 sibling, 1 reply; 5+ messages in thread
From: Otavio Salvador @ 2012-06-30 15:07 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Cc: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>

---
Changes for v3:
 * fix info order (first rev, then clock)

Changes for v2:
 * use ?? for unidentified revision and cpu type
 * use numeric revisions

 arch/arm/cpu/arm926ejs/mx28/mx28.c           |   55 +++++++++++++++++++++++++-
 arch/arm/include/asm/arch-mx28/regs-digctl.h |    5 +++
 2 files changed, 58 insertions(+), 2 deletions(-)

diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mx28/mx28.c
index a82ff25..56e10ad 100644
--- a/arch/arm/cpu/arm926ejs/mx28/mx28.c
+++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
@@ -190,13 +190,64 @@ 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) & HW_DIGCTL_CHIPID_MASK) {
+	case HW_DIGCTL_CHIPID_MX28:
+		return "28";
+	case HW_DIGCTL_CHIPID_MX23:
+		return "23";
+	default:
+		return "??";
+	}
+}
+
+static const char *get_cpu_rev(void)
+{
+	struct mx28_digctl_regs *digctl_regs =
+		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
+	uint8_t rev = readl(&digctl_regs->hw_digctl_chipid) & 0x000000FF;
+
+	switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) {
+	case HW_DIGCTL_CHIPID_MX28:
+		switch (rev) {
+		case 0x1:
+			return "1.2";
+		default:
+			return "??";
+		}
+	case HW_DIGCTL_CHIPID_MX23:
+		switch (rev) {
+		case 0x0:
+			return "1.0";
+		case 0x1:
+			return "1.1";
+		case 0x2:
+			return "1.2";
+		case 0x3:
+			return "1.3";
+		case 0x4:
+			return "1.4";
+		default:
+			return "??";
+		}
+	default:
+		return "??";
+	}
+}
+
 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%s 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;
 }
diff --git a/arch/arm/include/asm/arch-mx28/regs-digctl.h b/arch/arm/include/asm/arch-mx28/regs-digctl.h
index 9a63594..67f91e7 100644
--- a/arch/arm/include/asm/arch-mx28/regs-digctl.h
+++ b/arch/arm/include/asm/arch-mx28/regs-digctl.h
@@ -152,4 +152,9 @@ struct mx28_digctl_regs {
 };
 #endif
 
+/* Product code identification */
+#define HW_DIGCTL_CHIPID_MASK	(0xffff << 16)
+#define HW_DIGCTL_CHIPID_MX23	(0x3780 << 16)
+#define HW_DIGCTL_CHIPID_MX28	(0x2800 << 16)
+
 #endif /* __MX28_REGS_DIGCTL_H__ */
-- 
1.7.10

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

* [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type
  2012-06-30 15:07 [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type Otavio Salvador
  2012-06-30 15:07 ` [U-Boot] [PATCH v3 2/2] mxs: generalize code for print_cpuinfo() Otavio Salvador
@ 2012-07-16 11:03 ` Stefano Babic
  1 sibling, 0 replies; 5+ messages in thread
From: Stefano Babic @ 2012-07-16 11:03 UTC (permalink / raw)
  To: u-boot

On 30/06/2012 17:07, Otavio Salvador wrote:
> In case an unidentified CPU type is detected it now returns
> i.MX??, in a const char.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> 
> ---

Applied to u-boot-imx, next branch, thanks.

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] 5+ messages in thread

* [U-Boot] [PATCH v3 2/2] mxs: generalize code for print_cpuinfo()
  2012-06-30 15:07 ` [U-Boot] [PATCH v3 2/2] mxs: generalize code for print_cpuinfo() Otavio Salvador
@ 2012-07-16 11:04   ` Stefano Babic
  2012-07-16 12:32     ` Otavio Salvador
  0 siblings, 1 reply; 5+ messages in thread
From: Stefano Babic @ 2012-07-16 11:04 UTC (permalink / raw)
  To: u-boot

On 30/06/2012 17:07, Otavio Salvador wrote:
> The information now is gathered from HW_DIGCTL_CHIPID register and
> includes the revision of the chip on the output.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> 
> ---


Hi Otavio,

could you take a look and rebase it ? It does not apply anymore - thanks.

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] 5+ messages in thread

* [U-Boot] [PATCH v3 2/2] mxs: generalize code for print_cpuinfo()
  2012-07-16 11:04   ` Stefano Babic
@ 2012-07-16 12:32     ` Otavio Salvador
  0 siblings, 0 replies; 5+ messages in thread
From: Otavio Salvador @ 2012-07-16 12:32 UTC (permalink / raw)
  To: u-boot

On Mon, Jul 16, 2012 at 8:04 AM, Stefano Babic <sbabic@denx.de> wrote:
> On 30/06/2012 17:07, Otavio Salvador wrote:
>> The information now is gathered from HW_DIGCTL_CHIPID register and
>> includes the revision of the chip on the output.
>
> could you take a look and rebase it ? It does not apply anymore - thanks.

Sure; I splitted it to apply i.MX28 part for now and leave i.MX233
info for the another patchset. Will send it.

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

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

end of thread, other threads:[~2012-07-16 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-30 15:07 [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type Otavio Salvador
2012-06-30 15:07 ` [U-Boot] [PATCH v3 2/2] mxs: generalize code for print_cpuinfo() Otavio Salvador
2012-07-16 11:04   ` Stefano Babic
2012-07-16 12:32     ` Otavio Salvador
2012-07-16 11:03 ` [U-Boot] [PATCH v2 1/2] imx: Use a clear identification of an unidentified CPU type Stefano Babic

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