diff options
author | Sergey Ryazanov <ryazanov.s.a@gmail.com> | 2014-10-29 03:18:45 +0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 07:45:28 +0100 |
commit | 1654861f6e02e74a2ba059d1f62dc0356429d7cf (patch) | |
tree | 06ca7f47a494bf1e24bd186e2b82a95d1e2ced25 /arch/mips/ath25/ar2315.c | |
parent | a7473717483ef3bb78563611bf1b3b82c5515b2e (diff) |
MIPS: ath25: add SoC type detection
Detect SoC type based on device ID and board configuration data.
Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
Cc: Linux MIPS <linux-mips@linux-mips.org>
Patchwork: https://patchwork.linux-mips.org/patch/8244/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/ath25/ar2315.c')
-rw-r--r-- | arch/mips/ath25/ar2315.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/mips/ath25/ar2315.c b/arch/mips/ath25/ar2315.c index 3ba8e757add6..52805b725a67 100644 --- a/arch/mips/ath25/ar2315.c +++ b/arch/mips/ath25/ar2315.c @@ -24,6 +24,8 @@ #include <asm/reboot.h> #include <asm/time.h> +#include <ath25_platform.h> + #include "devices.h" #include "ar2315.h" #include "ar2315_regs.h" @@ -249,6 +251,7 @@ void __init ar2315_plat_mem_setup(void) { void __iomem *sdram_base; u32 memsize, memcfg; + u32 devid; u32 config; /* Detect memory size */ @@ -264,6 +267,25 @@ void __init ar2315_plat_mem_setup(void) ar2315_rst_base = ioremap_nocache(AR2315_RST_BASE, AR2315_RST_SIZE); + /* Detect the hardware based on the device ID */ + devid = ar2315_rst_reg_read(AR2315_SREV) & AR2315_REV_CHIP; + switch (devid) { + case 0x91: /* Need to check */ + ath25_soc = ATH25_SOC_AR2318; + break; + case 0x90: + ath25_soc = ATH25_SOC_AR2317; + break; + case 0x87: + ath25_soc = ATH25_SOC_AR2316; + break; + case 0x86: + default: + ath25_soc = ATH25_SOC_AR2315; + break; + } + ath25_board.devid = devid; + /* Clear any lingering AHB errors */ config = read_c0_config(); write_c0_config(config & ~0x3); |