mac80211: move (& update) upstream accepted brcmfmac patches
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-4.4 / 045-ARM-BCM5301X-Add-back-handler-ignoring-external-impr.patch
1 From 09f3510fb70a46c8921f2cf4a90dbcae460a6820 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <rafal@milecki.pl>
3 Date: Sat, 29 Oct 2016 13:12:29 +0200
4 Subject: [PATCH] ARM: BCM5301X: Add back handler ignoring external imprecise
5 aborts
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 Since early BCM5301X days we got abort handler that was removed by
11 commit 937b12306ea79 ("ARM: BCM5301X: remove workaround imprecise abort
12 fault handler"). It assumed we need to deal only with pending aborts
13 left by the bootloader. Unfortunately this isn't true for BCM5301X.
14
15 When probing PCI config space (device enumeration) it is expected to
16 have master aborts on the PCI bus. Most bridges don't forward (or they
17 allow disabling it) these errors onto the AXI/AMBA bus but not the
18 Northstar (BCM5301X) one.
19
20 iProc PCIe controller on Northstar seems to be some older one, without
21 a control register for errors forwarding. It means we need to workaround
22 this at platform level. All newer platforms are not affected by this
23 issue.
24
25 Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
26 Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
27 ---
28 arch/arm/mach-bcm/bcm_5301x.c | 28 ++++++++++++++++++++++++++++
29 1 file changed, 28 insertions(+)
30
31 --- a/arch/arm/mach-bcm/bcm_5301x.c
32 +++ b/arch/arm/mach-bcm/bcm_5301x.c
33 @@ -9,14 +9,42 @@
34 #include <asm/hardware/cache-l2x0.h>
35
36 #include <asm/mach/arch.h>
37 +#include <asm/siginfo.h>
38 +#include <asm/signal.h>
39 +
40 +#define FSR_EXTERNAL (1 << 12)
41 +#define FSR_READ (0 << 10)
42 +#define FSR_IMPRECISE 0x0406
43
44 static const char *const bcm5301x_dt_compat[] __initconst = {
45 "brcm,bcm4708",
46 NULL,
47 };
48
49 +static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr,
50 + struct pt_regs *regs)
51 +{
52 + /*
53 + * We want to ignore aborts forwarded from the PCIe bus that are
54 + * expected and shouldn't really be passed by the PCIe controller.
55 + * The biggest disadvantage is the same FSR code may be reported when
56 + * reading non-existing APB register and we shouldn't ignore that.
57 + */
58 + if (fsr == (FSR_EXTERNAL | FSR_READ | FSR_IMPRECISE))
59 + return 0;
60 +
61 + return 1;
62 +}
63 +
64 +static void __init bcm5301x_init_early(void)
65 +{
66 + hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR,
67 + "imprecise external abort");
68 +}
69 +
70 DT_MACHINE_START(BCM5301X, "BCM5301X")
71 .l2c_aux_val = 0,
72 .l2c_aux_mask = ~0,
73 .dt_compat = bcm5301x_dt_compat,
74 + .init_early = bcm5301x_init_early,
75 MACHINE_END