brcm63xx: Add DT support for CT-5365
[openwrt.git] / target / linux / brcm63xx / patches-3.14 / 332-MIPS-BCM63XX-detect-BCM6328-variants.patch
1 From d59120f23279ef62a48d9f94847254b061d0a8b6 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sat, 7 Dec 2013 14:30:59 +0100
4 Subject: [PATCH 22/45] MIPS: BCM63XX: detect BCM6328 variants
5
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
7 ---
8  arch/mips/bcm63xx/cpu.c                          | 10 ++++++++++
9  arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h |  8 ++++++--
10  2 files changed, 16 insertions(+), 2 deletions(-)
11
12 --- a/arch/mips/bcm63xx/cpu.c
13 +++ b/arch/mips/bcm63xx/cpu.c
14 @@ -306,6 +306,7 @@ void __init bcm63xx_cpu_init(void)
15         struct cpuinfo_mips *c = &current_cpu_data;
16         unsigned int cpu = smp_processor_id();
17         u32 chipid_reg;
18 +       u8 __maybe_unused varid = 0;
19  
20         /* soc registers location depends on cpu type */
21         chipid_reg = 0;
22 @@ -345,6 +346,7 @@ void __init bcm63xx_cpu_init(void)
23         bcm63xx_cpu_id = (tmp & REV_CHIPID_MASK) >> REV_CHIPID_SHIFT;
24         bcm63xx_cpu_variant = bcm63xx_cpu_id;
25         bcm63xx_cpu_rev = (tmp & REV_REVID_MASK) >> REV_REVID_SHIFT;
26 +       varid = (tmp & REV_VARID_MASK) >> REV_VARID_SHIFT;
27  
28         switch (bcm63xx_cpu_id) {
29         case BCM3368_CPU_ID:
30 @@ -354,6 +356,14 @@ void __init bcm63xx_cpu_init(void)
31         case BCM6328_CPU_ID:
32                 bcm63xx_regs_base = bcm6328_regs_base;
33                 bcm63xx_irqs = bcm6328_irqs;
34 +
35 +               if (varid == 1)
36 +                       bcm63xx_cpu_variant = BCM63281_CPU_ID;
37 +               else if (varid == 3)
38 +                       bcm63xx_cpu_variant = BCM63283_CPU_ID;
39 +               else
40 +                       pr_warn("unknown BCM6328 variant: %x\n", varid);
41 +
42                 break;
43         case BCM6338_CPU_ID:
44                 bcm63xx_regs_base = bcm6338_regs_base;
45 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
46 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h
47 @@ -11,6 +11,8 @@
48   */
49  #define BCM3368_CPU_ID         0x3368
50  #define BCM6328_CPU_ID         0x6328
51 +#define BCM63281_CPU_ID                0x63281
52 +#define BCM63283_CPU_ID                0x63283
53  #define BCM6338_CPU_ID         0x6338
54  #define BCM6345_CPU_ID         0x6345
55  #define BCM6348_CPU_ID         0x6348
56 @@ -85,8 +87,10 @@ static inline u16 __pure bcm63xx_get_cpu
57  
58  #define BCMCPU_VARIANT_IS_3368() \
59         (bcm63xx_get_cpu_variant() == BCM3368_CPU_ID)
60 -#define BCMCPU_VARIANT_IS_6328() \
61 -       (bcm63xx_get_cpu_variant() == BCM6328_CPU_ID)
62 +#define BCMCPU_VARIANT_IS_63281() \
63 +       (bcm63xx_get_cpu_variant() == BCM63281_CPU_ID)
64 +#define BCMCPU_VARIANT_IS_63283() \
65 +       (bcm63xx_get_cpu_variant() == BCM63283_CPU_ID)
66  #define BCMCPU_VARIANT_IS_6338() \
67         (bcm63xx_get_cpu_variant() == BCM6338_CPU_ID)
68  #define BCMCPU_VARIANT_IS_6345() \