summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2016-11-09 23:52:15 +0000
committerAndre Przywara <andre.przywara@arm.com>2016-11-10 00:09:52 +0000
commit64536e6028348c20cc5bb4491a9ee8bc267f1d47 (patch)
tree05596ae23ce4fe171ced1988fffca03d73e32406
parentef4454b4da54b95f67bfc91c35f261974aac3d3f (diff)
sunxi: print SoC ID on startup
Each Allwinner SoC contains a SoC ID, which can be used to identify a chip. Add a function to retrieve this value and print it upon initializing ATF.
-rw-r--r--plat/sun50iw1p1/aarch64/sunxi_common.c13
-rw-r--r--plat/sun50iw1p1/bl31_sunxi_setup.c13
-rw-r--r--plat/sun50iw1p1/sunxi_private.h2
3 files changed, 27 insertions, 1 deletions
diff --git a/plat/sun50iw1p1/aarch64/sunxi_common.c b/plat/sun50iw1p1/aarch64/sunxi_common.c
index 20d185a..a2fa37a 100644
--- a/plat/sun50iw1p1/aarch64/sunxi_common.c
+++ b/plat/sun50iw1p1/aarch64/sunxi_common.c
@@ -137,3 +137,16 @@ uint32_t sunxi_get_spsr_for_bl33_entry(int aarch)
return spsr;
}
+
+#define SRAM_VER_REG 0x01c00024
+
+uint16_t sunxi_get_socid(void)
+{
+ uint32_t reg;
+
+ reg = mmio_read_32(SRAM_VER_REG);
+ mmio_write_32(SRAM_VER_REG, reg | (1 << 15));
+ reg = mmio_read_32(SRAM_VER_REG);
+ mmio_write_32(0x01c00024, reg & ~(1 << 15));
+ return reg >> 16;
+}
diff --git a/plat/sun50iw1p1/bl31_sunxi_setup.c b/plat/sun50iw1p1/bl31_sunxi_setup.c
index 16b27d7..473438a 100644
--- a/plat/sun50iw1p1/bl31_sunxi_setup.c
+++ b/plat/sun50iw1p1/bl31_sunxi_setup.c
@@ -144,6 +144,8 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
{
unsigned long load_addr;
const char *mem_name = "unknown memory region";
+ const char *soc_name = "unknown SoC";
+ uint16_t soc_id;
/* Initialize the console to provide early debug support */
console_init(SUNXI_UART0_BASE, UART0_CLK_IN_HZ, UART0_BAUDRATE);
@@ -157,7 +159,16 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
} else if (load_addr >= 0x40000000)
mem_name = "DRAM";
- NOTICE("BL3-1: Running in %s (@0x%lx)\n", mem_name, load_addr);
+ soc_id = sunxi_get_socid();
+
+ switch (soc_id) {
+ case 0x1689:
+ soc_name = "A64/H64";
+ break;
+ }
+
+ NOTICE("BL3-1: Running on %s (%x) in %s (@0x%lx)\n",
+ soc_name, soc_id, mem_name, load_addr);
#if 0
#if RESET_TO_BL31
diff --git a/plat/sun50iw1p1/sunxi_private.h b/plat/sun50iw1p1/sunxi_private.h
index c41c431..6f1f637 100644
--- a/plat/sun50iw1p1/sunxi_private.h
+++ b/plat/sun50iw1p1/sunxi_private.h
@@ -56,6 +56,8 @@ void sunxi_configure_mmu_el3(unsigned long total_base,
unsigned long);
int sunxi_config_setup(void);
+uint16_t sunxi_get_socid(void);
+
/* Declarations for sunxi_topology.c */
int plat_setup_topology(void);