[U-Boot] [PATCH] at91: move get_chip_id() and get_extension_chip_id() to cpu.c, which can share with all at91 board.
Josh Wu
josh.wu at atmel.com
Thu Nov 1 11:57:27 CET 2012
Signed-off-by: Josh Wu <josh.wu at atmel.com>
---
arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c | 12 ------------
arch/arm/cpu/arm926ejs/at91/cpu.c | 11 +++++++++++
arch/arm/include/asm/arch-at91/at91_dbu.h | 4 ++++
arch/arm/include/asm/arch-at91/at91sam9x5.h | 1 -
4 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
index 9348552..6855d3e 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c
@@ -26,18 +26,6 @@
#include <asm/arch/gpio.h>
#include <asm/io.h>
-unsigned int get_chip_id(void)
-{
- /* The 0x40 is the offset of cidr in DBGU */
- return readl(ATMEL_BASE_DBGU + 0x40) & ~ARCH_ID_VERSION_MASK;
-}
-
-unsigned int get_extension_chip_id(void)
-{
- /* The 0x44 is the offset of exid in DBGU */
- return readl(ATMEL_BASE_DBGU + 0x44);
-}
-
unsigned int has_emac1()
{
return cpu_is_at91sam9x25();
diff --git a/arch/arm/cpu/arm926ejs/at91/cpu.c b/arch/arm/cpu/arm926ejs/at91/cpu.c
index 5cf4fad..351e19c 100644
--- a/arch/arm/cpu/arm926ejs/at91/cpu.c
+++ b/arch/arm/cpu/arm926ejs/at91/cpu.c
@@ -26,6 +26,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
+#include <asm/arch/at91_dbu.h>
#include <asm/arch/at91_pmc.h>
#include <asm/arch/at91_pit.h>
#include <asm/arch/at91_gpbr.h>
@@ -71,3 +72,13 @@ int print_cpuinfo(void)
return 0;
}
#endif
+
+unsigned int get_chip_id(void)
+{
+ return readl(ATMEL_BASE_DBGU + AT91_DBU_CIDR) & ~AT91_DBU_CIDR_VERSION;
+}
+
+unsigned int get_extension_chip_id(void)
+{
+ return readl(ATMEL_BASE_DBGU + AT91_DBU_EXID);
+}
diff --git a/arch/arm/include/asm/arch-at91/at91_dbu.h b/arch/arm/include/asm/arch-at91/at91_dbu.h
index 3429293..fe64198 100644
--- a/arch/arm/include/asm/arch-at91/at91_dbu.h
+++ b/arch/arm/include/asm/arch-at91/at91_dbu.h
@@ -38,4 +38,8 @@ typedef struct at91_dbu {
#define AT91_DBU_CID_ARCH_9xx 0x01900000
#define AT91_DBU_CID_ARCH_9XExx 0x02900000
+#define AT91_DBU_CIDR_VERSION (0x1f << 0)
+#define AT91_DBU_CIDR 0x40
+#define AT91_DBU_EXID 0x44
+
#endif
diff --git a/arch/arm/include/asm/arch-at91/at91sam9x5.h b/arch/arm/include/asm/arch-at91/at91sam9x5.h
index 0e728c9..659c01d 100644
--- a/arch/arm/include/asm/arch-at91/at91sam9x5.h
+++ b/arch/arm/include/asm/arch-at91/at91sam9x5.h
@@ -118,7 +118,6 @@
/* 9x5 series chip id definitions */
#define ARCH_ID_AT91SAM9X5 0x819a05a0
-#define ARCH_ID_VERSION_MASK 0x1f
#define ARCH_EXID_AT91SAM9G15 0x00000000
#define ARCH_EXID_AT91SAM9G35 0x00000001
#define ARCH_EXID_AT91SAM9X35 0x00000002
--
1.7.9.5
More information about the U-Boot
mailing list