ARM: mx27: Print silicon revision on boot
Subsystems (3)
PATCH 1/1 ARM: mx27: Print silicon revision on boot
Silicon revision is useful information to have during kernel boot.
Print the MX27 silicon revision.
--- arch/arm/mach-imx/clock-imx27.c | 1 + arch/arm/mach-imx/cpu-imx27.c | 23 +++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/mx27.h | 1 + 3 files changed, 25 insertions(+), 0 deletions(-)
arch/arm/mach-imx/clock-imx27.c +1 -0
@@ -756,6 +756,7 @@ int __init mx27_clocks_init(unsigned long fref)clk_enable (&uart1_clk);#endif +mx27_read_cpu_rev ();mxc_timer_init (&gpt1_clk,MX27_IO_ADDRESS (MX27_GPT1_BASE_ADDR ),MX27_INT_GPT1 );
arch/arm/mach-imx/cpu-imx27.c +23 -0
@@ -74,3 +74,26 @@ int mx27_revision(void)return cpu_silicon_rev; }EXPORT_SYMBOL (mx27_revision); + +void __init mx27_read_cpu_rev (void ) +{ +u32 rev; +char *srev; + + rev =mx27_revision (); +switch (rev) { +case IMX_CHIP_REVISION_1_0 : + srev =IMX_CHIP_REVISION_1_0_STRING ; +break ; +case IMX_CHIP_REVISION_2_0 : + srev =IMX_CHIP_REVISION_2_0_STRING ; +break ; +case IMX_CHIP_REVISION_2_1 : + srev =IMX_CHIP_REVISION_2_1_STRING ; +break ; +default : + srev =IMX_CHIP_REVISION_UNKNOWN_STRING ; + } + +pr_info ("CPU identified as i.MX27, silicon rev %s\n" , srev); +}
arch/arm/plat-mxc/include/mach/mx27.h +1 -0
@@ -246,6 +246,7 @@ static inline void mx27_setup_weimcs(size_t cs,#ifndef __ASSEMBLY__extern int mx27_revision (void ); +extern void mx27_read_cpu_rev (void );#endif #endif /* ifndef __MACH_MX27_H__ */
Signature · 1 line
1.7.1
PATCH 1/1 ARM: mx27: Print silicon revision on boot
Quoted 41 lines · Fabio Estevam
Silicon revision is useful information to have during kernel boot.
Print the MX27 silicon revision.
Signed-off-by Fabio Estevam <[email protected]>--- arch/arm/mach-imx/clock-imx27.c | 1 + arch/arm/mach-imx/cpu-imx27.c | 23 +++++++++++++++++++++++ arch/arm/plat-mxc/include/mach/mx27.h | 1 + 3 files changed, 25 insertions(+), 0 deletions(-)(quoted diff) +0
-0
b/arch/arm/mach-imx/clock-imx27.cindex 6912b82..2858137 100644arch/arm/mach-imx/clock-imx27.c +1
-0@@ -756,6 +756,7 @@ int __init mx27_clocks_init(unsigned long fref)clk_enable (&uart1_clk);#endif +mx27_read_cpu_rev ();mxc_timer_init (&gpt1_clk,MX27_IO_ADDRESS (MX27_GPT1_BASE_ADDR ),MX27_INT_GPT1 );arch/arm/mach-imx/cpu-imx27.c +10
-0@@ -74,3 +74,26 @@ int mx27_revision(void)return cpu_silicon_rev; }EXPORT_SYMBOL (mx27_revision); + +void __init mx27_read_cpu_rev (void ) +{ +u32 rev; +char *srev; + + rev =mx27_revision (); +switch (rev) { +case IMX_CHIP_REVISION_1_0 : + srev =IMX_CHIP_REVISION_1_0_STRING ;
arch/arm/mach-imx/cpu-imx27.c int mx27_revision(void) · line 96
Quoted 10 lines
arch/arm/mach-imx/cpu-imx27.c +10
-0+break ; +case IMX_CHIP_REVISION_2_0 : + srev =IMX_CHIP_REVISION_2_0_STRING ; +break ; +case IMX_CHIP_REVISION_2_1 : + srev =IMX_CHIP_REVISION_2_1_STRING ; +break ; +default : + srev =IMX_CHIP_REVISION_UNKNOWN_STRING ; + }
I didn't check really, but can't you just do some kind of a numeric transformation instead of storing strings ?
Cheers
Quoted 15 lines
arch/arm/mach-imx/cpu-imx27.c +3
-0+ +pr_info ("CPU identified as i.MX27, silicon rev %s\n" , srev); +}(quoted diff) +0
-0
b/arch/arm/plat-mxc/include/mach/mx27.hindex 1dc1c52..76edec7 100644arch/arm/plat-mxc/include/mach/mx27.h +1
-0@@ -246,6 +246,7 @@ static inline void mx27_setup_weimcs(size_t cs,#ifndef __ASSEMBLY__extern int mx27_revision (void ); +extern void mx27_read_cpu_rev (void );#endif #endif /* ifndef __MACH_MX27_H__ */
Fabio Estevam
reviewerPATCH 1/1 ARM: mx27: Print silicon revision on boot
On Mon, Aug 22, 2011 at 1:05 PM, Marek Vasut <[email protected]> wrote:
...
Quoted 3 lines
I didn't check really, but can't you just do some kind of a numeric transformation instead of storing strings ?
I am using the same approach used by other i.MX processors.
Regards,
Fabio Estevam
PATCH 1/1 ARM: mx27: Print silicon revision on boot
Quoted 7 lines · Fabio Estevam
On Mon, Aug 22, 2011 at 1:05 PM, Marek Vasut <[email protected]> wrote:
...Quoted 2 lines
I didn't check really, but can't you just do some kind of a numeric transformation instead of storing strings ?
I am using the same approach used by other i.MX processors.
Hi,
does that mean it's "obviously correct (TM)" ? To do it differently can sometimes introduce smarted solution etc etc. Taking a quick look, it shouldn't be difficult even.
Cheers
Quoted 4 lines
Regards,
Fabio Estevam
Sascha Hauer
maintainerPATCH 1/1 ARM: mx27: Print silicon revision on boot
In reply to Fabio EstevamQuoted 7 lines · Fabio Estevam
On Mon, Aug 22, 2011 at 1:05 PM, Marek Vasut <[email protected]> wrote:
...Quoted 3 lines
I didn't check really, but can't you just do some kind of a numeric transformation instead of storing strings ?
I am using the same approach used by other i.MX processors.
How about
imx_print_silicon_rev(const char *cpu, int srev)
{
if (srev == IMX_CHIP_REVISION_UNKNOWN)
pr_info("CPU identified as %s, unknown revision\n");
else
pr_info("CPU identified as %s, silicon rev %d.%d\n",
cpu, (srev >> 4) & 0xf, srev & 0xf);
}Sascha
Signature · 4 lines
Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
PATCH 1/1 ARM: mx27: Print silicon revision on boot
Quoted 20 lines · Sascha Hauer
Quoted 7 lines · Fabio Estevam
On Mon, Aug 22, 2011 at 1:05 PM, Marek Vasut <[email protected]>
wrote: ...Quoted 2 lines
I didn't check really, but can't you just do some kind of a numeric transformation instead of storing strings ?
I am using the same approach used by other i.MX processors.
How about
imx_print_silicon_rev(const char *cpu, int srev){ if (srev == IMX_CHIP_REVISION_UNKNOWN) pr_info("CPU identified as %s, unknown revision\n"); else pr_info("CPU identified as %s, silicon rev %d.%d\n", cpu, (srev >> 4) & 0xf, srev & 0xf); }
Quoted 1 line
Sascha
Looks good