diff mbox

[2/2] ARM: mxs: Pass the system revision

Message ID 1369856663-29314-2-git-send-email-fabio.estevam@freescale.com (mailing list archive)
State New, archived
Headers show

Commit Message

Fabio Estevam May 29, 2013, 7:44 p.m. UTC
Some mxs userspace tools, such as multimedia plugins and kobs-ng (tool used to 
burn boot images to NAND) rely on the 'Revision' field reported by 
'/proc/cpuinfo'.

Provide a mechanism to pass such information, so that now we can get:

$ cat /proc/cpuinfo                                             
processor       : 0                                                             
model name      : ARM926EJ-S rev 5 (v5l)                                        
BogoMIPS        : 226.09                                                        
Features        : swp half fastmult edsp java                                   
CPU implementer : 0x41                                                          
CPU architecture: 5TEJ                                                          
CPU variant     : 0x0                                                           
CPU part        : 0x926                                                         
CPU revision    : 5                                                             
                                                                                
Hardware        : Freescale i.MX28 Evaluation Kit                               
Revision        : 28012                                                         
Serial          : 0000000000000000                                              

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 arch/arm/mach-mxs/mach-mxs.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Shawn Guo May 30, 2013, 4:32 a.m. UTC | #1
On Wed, May 29, 2013 at 04:44:23PM -0300, Fabio Estevam wrote:
> Some mxs userspace tools, such as multimedia plugins and kobs-ng (tool used to 
> burn boot images to NAND) rely on the 'Revision' field reported by 
> '/proc/cpuinfo'.
> 
> Provide a mechanism to pass such information, so that now we can get:
> 
> $ cat /proc/cpuinfo                                             
> processor       : 0                                                             
> model name      : ARM926EJ-S rev 5 (v5l)                                        
> BogoMIPS        : 226.09                                                        
> Features        : swp half fastmult edsp java                                   
> CPU implementer : 0x41                                                          
> CPU architecture: 5TEJ                                                          
> CPU variant     : 0x0                                                           
> CPU part        : 0x926                                                         
> CPU revision    : 5                                                             
>                                                                                 
> Hardware        : Freescale i.MX28 Evaluation Kit                               
> Revision        : 28012                                                         
> Serial          : 0000000000000000                                              

We now have a standard way to report SoC revision to user space.  Check
drivers/base/soc.c and arch/arm/mach-tegra/tegra.c for example.

But I will be fine with populating system_rev for coping with those
user space which are already spread widely if people think it's
useful/helpful.

Shawn

> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/mach-mxs/mach-mxs.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
> index b632323..032812d 100644
> --- a/arch/arm/mach-mxs/mach-mxs.c
> +++ b/arch/arm/mach-mxs/mach-mxs.c
> @@ -29,6 +29,7 @@
>  #include <asm/mach/map.h>
>  #include <asm/mach/time.h>
>  #include <asm/system_misc.h>
> +#include <asm/system_info.h>
>  
>  #include "pm.h"
>  
> @@ -443,10 +444,24 @@ static void mxs_print_silicon_rev(const char *cpu, int srev)
>  				cpu, (srev >> 4) & 0xf, srev & 0xf);
>  }
>  
> +static void mxs_pass_sysrev(void)
> +{
> +	int cputype = 0;
> +
> +	if (strcmp(mxs_get_cpu_type(), "MX23"))
> +		cputype = 0x23000;
> +
> +	if (strcmp(mxs_get_cpu_type(), "MX28"))
> +		cputype = 0x28000;
> +
> +	system_rev = (cputype | mxs_get_cpu_rev());
> +}
> +
>  static void __init mxs_machine_init(void)
>  {
>  
>  	mxs_print_silicon_rev(mxs_get_cpu_type(), mxs_get_cpu_rev());
> +	mxs_pass_sysrev();
>  
>  	if (of_machine_is_compatible("fsl,imx28-evk"))
>  		imx28_evk_init();
> -- 
> 1.8.1.2
> 
>
diff mbox

Patch

diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index b632323..032812d 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -29,6 +29,7 @@ 
 #include <asm/mach/map.h>
 #include <asm/mach/time.h>
 #include <asm/system_misc.h>
+#include <asm/system_info.h>
 
 #include "pm.h"
 
@@ -443,10 +444,24 @@  static void mxs_print_silicon_rev(const char *cpu, int srev)
 				cpu, (srev >> 4) & 0xf, srev & 0xf);
 }
 
+static void mxs_pass_sysrev(void)
+{
+	int cputype = 0;
+
+	if (strcmp(mxs_get_cpu_type(), "MX23"))
+		cputype = 0x23000;
+
+	if (strcmp(mxs_get_cpu_type(), "MX28"))
+		cputype = 0x28000;
+
+	system_rev = (cputype | mxs_get_cpu_rev());
+}
+
 static void __init mxs_machine_init(void)
 {
 
 	mxs_print_silicon_rev(mxs_get_cpu_type(), mxs_get_cpu_rev());
+	mxs_pass_sysrev();
 
 	if (of_machine_is_compatible("fsl,imx28-evk"))
 		imx28_evk_init();