diff options
author | Sergey Ryazanov <ryazanov.s.a@gmail.com> | 2014-10-28 19:18:45 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:45:28 -0500 |
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 @@ | |||
24 | #include <asm/reboot.h> | 24 | #include <asm/reboot.h> |
25 | #include <asm/time.h> | 25 | #include <asm/time.h> |
26 | 26 | ||
27 | #include <ath25_platform.h> | ||
28 | |||
27 | #include "devices.h" | 29 | #include "devices.h" |
28 | #include "ar2315.h" | 30 | #include "ar2315.h" |
29 | #include "ar2315_regs.h" | 31 | #include "ar2315_regs.h" |
@@ -249,6 +251,7 @@ void __init ar2315_plat_mem_setup(void) | |||
249 | { | 251 | { |
250 | void __iomem *sdram_base; | 252 | void __iomem *sdram_base; |
251 | u32 memsize, memcfg; | 253 | u32 memsize, memcfg; |
254 | u32 devid; | ||
252 | u32 config; | 255 | u32 config; |
253 | 256 | ||
254 | /* Detect memory size */ | 257 | /* Detect memory size */ |
@@ -264,6 +267,25 @@ void __init ar2315_plat_mem_setup(void) | |||
264 | 267 | ||
265 | ar2315_rst_base = ioremap_nocache(AR2315_RST_BASE, AR2315_RST_SIZE); | 268 | ar2315_rst_base = ioremap_nocache(AR2315_RST_BASE, AR2315_RST_SIZE); |
266 | 269 | ||
270 | /* Detect the hardware based on the device ID */ | ||
271 | devid = ar2315_rst_reg_read(AR2315_SREV) & AR2315_REV_CHIP; | ||
272 | switch (devid) { | ||
273 | case 0x91: /* Need to check */ | ||
274 | ath25_soc = ATH25_SOC_AR2318; | ||
275 | break; | ||
276 | case 0x90: | ||
277 | ath25_soc = ATH25_SOC_AR2317; | ||
278 | break; | ||
279 | case 0x87: | ||
280 | ath25_soc = ATH25_SOC_AR2316; | ||
281 | break; | ||
282 | case 0x86: | ||
283 | default: | ||
284 | ath25_soc = ATH25_SOC_AR2315; | ||
285 | break; | ||
286 | } | ||
287 | ath25_board.devid = devid; | ||
288 | |||
267 | /* Clear any lingering AHB errors */ | 289 | /* Clear any lingering AHB errors */ |
268 | config = read_c0_config(); | 290 | config = read_c0_config(); |
269 | write_c0_config(config & ~0x3); | 291 | write_c0_config(config & ~0x3); |