Browse Source

vf610twr: Adding Silicon Revision

Add soc.c file that includes the get_cpu_revision function
and display this information at boot time.

Signed-off-by: Juan Gutierrez <b44802@freescale.com>
Signed-off-by: Anthony Felice <tony.felice@timesys.com>
Juan Gutierrez 11 years ago
parent
commit
8d94bc4251

+ 1 - 1
arch/arm/cpu/armv7/vf610/Makefile

@@ -22,7 +22,7 @@ include $(TOPDIR)/config.mk
 LIB	= $(obj)lib$(SOC).o
 
 COBJS	+= generic.o
-COBJS	+= timer.o
+COBJS	+= timer.o soc.o
 
 SRCS	:= $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(COBJS))

+ 7 - 1
arch/arm/cpu/armv7/vf610/generic.c

@@ -24,6 +24,7 @@
 #include <asm/arch/crm_regs.h>
 #include <usb/regs-usbphy-mx6.h>
 #include <netdev.h>
+#include <asm/arch/sys_proto.h>
 #ifdef CONFIG_FSL_ESDHC
 #include <fsl_esdhc.h>
 #endif
@@ -295,7 +296,12 @@ static char *get_reset_cause(void)
 
 int print_cpuinfo(void)
 {
-	printf("CPU:   Freescale Vybrid VF610 at %d MHz\n",
+	u32 cpurev;
+	cpurev = get_cpu_rev();
+	printf("CPU:   Freescale Vybrid %x family rev%d.%d at %d MHz\n",
+                (cpurev & 0xFFF000) >> 12,
+                (cpurev & 0x000F0) >> 4,
+                (cpurev & 0x0000F) >> 0,
 		mxc_get_clock(MXC_ARM_CLK) / 1000000);
 	printf("Reset cause: %s\n", get_reset_cause());
 

+ 41 - 0
arch/arm/cpu/armv7/vf610/soc.c

@@ -0,0 +1,41 @@
+/*
+ * (C) Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch-vf610/imx-regs.h>
+#include <asm/arch/sys_proto.h>
+
+u32 get_cpu_rev(void)
+{
+        int system_rev = 0x600000;
+        int reg = __raw_readl(ROM_SI_REV);
+        /* We are reading HAB version, if this is 1.3 then
+ *          * Silicon version is 1.2.
+ *                   */
+        if (reg == 0x13)
+                reg = 0x12;
+
+        system_rev |= reg;
+        return system_rev;
+}
+

+ 2 - 0
arch/arm/include/asm/arch-vf610/imx-regs.h

@@ -28,6 +28,8 @@
 #define AIPS0_BASE_ADDR		0x40000000
 #define AIPS1_BASE_ADDR		0x40080000
 
+#define ROM_SI_REV		0x80
+
 /* AIPS 0 */
 #define MSCM_BASE_ADDR		(AIPS0_BASE_ADDR + 0x00001000)
 #define MSCM_IR_BASE_ADDR	(AIPS0_BASE_ADDR + 0x00001800)

+ 30 - 0
arch/arm/include/asm/arch-vf610/sys_proto.h

@@ -0,0 +1,30 @@
+/*
+ * (C) Copyright 2014 Freescale Semiconductor, Inc.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef _SYS_PROTO_H_
+#define _SYS_PROTO_H_
+
+#define is_soc_rev(rev)	((get_cpu_rev() & 0xFF) - rev)
+
+u32 get_cpu_rev(void);
+
+#endif