mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] ARM i.MX: Print silicon revision in common place
@ 2012-10-07 12:11 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2012-10-07 12:11 UTC (permalink / raw)
  To: barebox

Rather than doing this in the SoC specific code just print
it in imx_set_silicon_revision. This saves some lines of code
and also results in i.MX27 now also having the silicon revision
printed during startup.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/mach-imx/imx.c                   |    6 +++++-
 arch/arm/mach-imx/imx27.c                 |    2 +-
 arch/arm/mach-imx/imx35.c                 |    2 +-
 arch/arm/mach-imx/imx51.c                 |   16 +---------------
 arch/arm/mach-imx/imx53.c                 |   15 +--------------
 arch/arm/mach-imx/include/mach/revision.h |    2 +-
 6 files changed, 10 insertions(+), 33 deletions(-)

diff --git a/arch/arm/mach-imx/imx.c b/arch/arm/mach-imx/imx.c
index 1bc6e23..d36f3d9 100644
--- a/arch/arm/mach-imx/imx.c
+++ b/arch/arm/mach-imx/imx.c
@@ -21,7 +21,11 @@ int imx_silicon_revision(void)
 	return __imx_silicon_revision;
 }
 
-void imx_set_silicon_revision(int revision)
+void imx_set_silicon_revision(const char *soc, int revision)
 {
 	__imx_silicon_revision = revision;
+
+	printf("detected %s revision %d.%d\n", soc,
+			(revision >> 4) & 0xf,
+			revision & 0xf);
 }
diff --git a/arch/arm/mach-imx/imx27.c b/arch/arm/mach-imx/imx27.c
index d1aa213..fed9c8b 100644
--- a/arch/arm/mach-imx/imx27.c
+++ b/arch/arm/mach-imx/imx27.c
@@ -42,7 +42,7 @@ static int imx27_silicon_revision(void)
 		break;
 	}
 
-	imx_set_silicon_revision(rev);
+	imx_set_silicon_revision("i.MX27", rev);
 
 	return 0;
 }
diff --git a/arch/arm/mach-imx/imx35.c b/arch/arm/mach-imx/imx35.c
index f89bd10..7b743df 100644
--- a/arch/arm/mach-imx/imx35.c
+++ b/arch/arm/mach-imx/imx35.c
@@ -36,7 +36,7 @@ static void imx35_silicon_revision(void)
 	/* 0×00 = TO 1.0, First silicon */
 	reg += IMX_CHIP_REV_1_0;
 
-	imx_set_silicon_revision(reg & 0xFF);
+	imx_set_silicon_revision("i.MX35", reg & 0xFF);
 }
 
 /*
diff --git a/arch/arm/mach-imx/imx51.c b/arch/arm/mach-imx/imx51.c
index 805361d..f9c1a91 100644
--- a/arch/arm/mach-imx/imx51.c
+++ b/arch/arm/mach-imx/imx51.c
@@ -23,8 +23,6 @@
 
 #define SI_REV 0x48
 
-static char *mx51_rev_string = "unknown";
-
 static int imx51_silicon_revision(void)
 {
 	void __iomem *rom = MX51_IROM_BASE_ADDR;
@@ -35,36 +33,24 @@ static int imx51_silicon_revision(void)
 	switch (rev) {
 	case 0x1:
 		mx51_silicon_revision = IMX_CHIP_REV_1_0;
-		mx51_rev_string = "1.0";
 		break;
 	case 0x2:
 		mx51_silicon_revision = IMX_CHIP_REV_1_1;
-		mx51_rev_string = "1.1";
 		break;
 	case 0x10:
 		mx51_silicon_revision = IMX_CHIP_REV_2_0;
-		mx51_rev_string = "2.0";
 		break;
 	case 0x20:
 		mx51_silicon_revision = IMX_CHIP_REV_3_0;
-		mx51_rev_string = "3.0";
 		break;
 	default:
 		mx51_silicon_revision = 0;
 	}
 
-	imx_set_silicon_revision(mx51_silicon_revision);
-
-	return 0;
-}
-
-static int imx51_print_silicon_rev(void)
-{
-	printf("detected i.MX51 rev %s\n", mx51_rev_string);
+	imx_set_silicon_revision("i.MX51", mx51_silicon_revision);
 
 	return 0;
 }
-device_initcall(imx51_print_silicon_rev);
 
 static int imx51_init(void)
 {
diff --git a/arch/arm/mach-imx/imx53.c b/arch/arm/mach-imx/imx53.c
index 569d8f4..059ef72 100644
--- a/arch/arm/mach-imx/imx53.c
+++ b/arch/arm/mach-imx/imx53.c
@@ -23,8 +23,6 @@
 
 #define SI_REV 0x48
 
-static char *mx53_rev_string = "unknown";
-
 static int imx53_silicon_revision(void)
 {
 	void __iomem *rom = MX53_IROM_BASE_ADDR;
@@ -35,32 +33,21 @@ static int imx53_silicon_revision(void)
 	switch (rev) {
 	case 0x10:
 		mx53_silicon_revision = IMX_CHIP_REV_1_0;
-		mx53_rev_string = "1.0";
 		break;
 	case 0x20:
 		mx53_silicon_revision = IMX_CHIP_REV_2_0;
-		mx53_rev_string = "2.0";
 		break;
 	case 0x21:
 		mx53_silicon_revision = IMX_CHIP_REV_2_1;
-		mx53_rev_string = "2.1";
 		break;
 	default:
 		mx53_silicon_revision = 0;
 	}
 
-	imx_set_silicon_revision(mx53_silicon_revision);
-
-	return 0;
-}
-
-static int imx53_print_silicon_rev(void)
-{
-	printf("detected i.MX53 rev %s\n", mx53_rev_string);
+	imx_set_silicon_revision("i.MX53", mx53_silicon_revision);
 
 	return 0;
 }
-device_initcall(imx53_print_silicon_rev);
 
 static int imx53_init(void)
 {
diff --git a/arch/arm/mach-imx/include/mach/revision.h b/arch/arm/mach-imx/include/mach/revision.h
index b6b06ef..bc6f20a 100644
--- a/arch/arm/mach-imx/include/mach/revision.h
+++ b/arch/arm/mach-imx/include/mach/revision.h
@@ -17,6 +17,6 @@
 
 int imx_silicon_revision(void);
 
-void imx_set_silicon_revision(int revision);
+void imx_set_silicon_revision(const char *soc, int revision);
 
 #endif /* __MACH_REVISION_H__ */
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-10-07 12:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-07 12:11 [PATCH] ARM i.MX: Print silicon revision in common place Sascha Hauer

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