kernel: generic: spi: allow empty (un)prepare transfer
[openwrt.git] / target / linux / brcm63xx / patches-3.3 / 310-MIPS-BCM63XX-use-the-Chip-ID-register-for-identifyin.patch
1 From d831de57b1995eff51f43310b4bbfa85b1a3df42 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Fri, 30 Dec 2011 02:37:47 +0100
4 Subject: [PATCH 38/79] MIPS: BCM63XX: use the Chip ID register for
5  identifying the SoC
6
7 Newer BCM63XX SoCs use virtually the same cpu ID. But since they all have
8 the Chip ID register at the same location, we can use that to identify
9 the SoC we are running on.
10
11 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
12 ---
13  arch/mips/bcm63xx/cpu.c |   20 ++++++++++++--------
14  1 file changed, 12 insertions(+), 8 deletions(-)
15
16 --- a/arch/mips/bcm63xx/cpu.c
17 +++ b/arch/mips/bcm63xx/cpu.c
18 @@ -228,17 +228,21 @@ void __init bcm63xx_cpu_init(void)
19                 bcm63xx_irqs = bcm6345_irqs;
20                 break;
21         case CPU_BMIPS4350:
22 -               switch (read_c0_prid() & 0xf0) {
23 -               case 0x10:
24 +               if ((read_c0_prid() & 0xf0) == 0x10) {
25                         expected_cpu_id = BCM6358_CPU_ID;
26                         bcm63xx_regs_base = bcm6358_regs_base;
27                         bcm63xx_irqs = bcm6358_irqs;
28 -                       break;
29 -               case 0x30:
30 -                       expected_cpu_id = BCM6368_CPU_ID;
31 -                       bcm63xx_regs_base = bcm6368_regs_base;
32 -                       bcm63xx_irqs = bcm6368_irqs;
33 -                       break;
34 +               } else {
35 +                       /* all newer chips have the same chip id location */
36 +                       u16 chip_id = bcm_readw(BCM_6368_PERF_BASE);
37 +
38 +                       switch (chip_id) {
39 +                       case BCM6368_CPU_ID:
40 +                               expected_cpu_id = BCM6368_CPU_ID;
41 +                               bcm63xx_regs_base = bcm6368_regs_base;
42 +                               bcm63xx_irqs = bcm6368_irqs;
43 +                               break;
44 +                       }
45                 }
46                 break;
47         }