1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright (C) 2012 Thomas Langer <thomas.langer@lantiq.com>
5 * Copyright (C) 2012 John Crispin <john@phrozen.org>
8 #include <linux/kernel.h>
9 #include <asm/cacheflush.h>
10 #include <asm/traps.h>
13 #include <lantiq_soc.h>
17 #define SOC_FALCON "Falcon"
18 #define SOC_FALCON_D "Falcon-D"
19 #define SOC_FALCON_V "Falcon-V"
20 #define SOC_FALCON_M "Falcon-M"
22 #define COMP_FALCON "lantiq,falcon"
25 #define PART_MASK 0x0FFFF000
27 #define REV_MASK 0xF0000000
29 #define SREV_MASK 0x03C00000
31 #define TYPE_MASK 0x3C000000
33 /* reset, nmi and ejtag exception vectors */
34 #define BOOT_REG_BASE (KSEG1 | 0x1F200000)
35 #define BOOT_RVEC (BOOT_REG_BASE | 0x00)
36 #define BOOT_NVEC (BOOT_REG_BASE | 0x04)
37 #define BOOT_EVEC (BOOT_REG_BASE | 0x08)
39 void __init
ltq_soc_nmi_setup(void)
41 extern void (*nmi_handler
)(void);
43 ltq_w32((unsigned long)&nmi_handler
, (void *)BOOT_NVEC
);
46 void __init
ltq_soc_ejtag_setup(void)
48 extern void (*ejtag_debug_handler
)(void);
50 ltq_w32((unsigned long)&ejtag_debug_handler
, (void *)BOOT_EVEC
);
53 void __init
ltq_soc_detect(struct ltq_soc_info
*i
)
56 i
->partnum
= (ltq_r32(FALCON_CHIPID
) & PART_MASK
) >> PART_SHIFT
;
57 i
->rev
= (ltq_r32(FALCON_CHIPID
) & REV_MASK
) >> REV_SHIFT
;
58 i
->srev
= ((ltq_r32(FALCON_CHIPCONF
) & SREV_MASK
) >> SREV_SHIFT
);
59 i
->compatible
= COMP_FALCON
;
60 i
->type
= SOC_TYPE_FALCON
;
61 sprintf(i
->rev_type
, "%c%d%d", (i
->srev
& 0x4) ? ('B') : ('A'),
62 i
->rev
& 0x7, (i
->srev
& 0x3) + 1);
66 type
= (ltq_r32(FALCON_CHIPTYPE
) & TYPE_MASK
) >> TYPE_SHIFT
;
69 i
->name
= SOC_FALCON_D
;
72 i
->name
= SOC_FALCON_V
;
75 i
->name
= SOC_FALCON_M
;
88 board_nmi_handler_setup
= ltq_soc_nmi_setup
;
89 board_ejtag_handler_setup
= ltq_soc_ejtag_setup
;