Hauke Mehrtens | 5b293eb | 2014-02-04 00:01:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Broadcom BCM470X / BCM5301X ARM platform code. |
| 3 | * |
| 4 | * Copyright 2013 Hauke Mehrtens <hauke@hauke-m.de> |
| 5 | * |
| 6 | * Licensed under the GNU/GPL. See COPYING for details. |
| 7 | */ |
| 8 | #include <linux/of_platform.h> |
| 9 | #include <asm/hardware/cache-l2x0.h> |
| 10 | |
| 11 | #include <asm/mach/arch.h> |
Hauke Mehrtens | fdf4850 | 2014-02-04 00:01:46 +0100 | [diff] [blame] | 12 | #include <asm/siginfo.h> |
| 13 | #include <asm/signal.h> |
Hauke Mehrtens | 5b293eb | 2014-02-04 00:01:43 +0100 | [diff] [blame] | 14 | |
| 15 | |
Hauke Mehrtens | fdf4850 | 2014-02-04 00:01:46 +0100 | [diff] [blame] | 16 | static bool first_fault = true; |
| 17 | |
| 18 | static int bcm5301x_abort_handler(unsigned long addr, unsigned int fsr, |
| 19 | struct pt_regs *regs) |
| 20 | { |
Rafał Miłecki | 7eb68a2 | 2015-02-11 16:40:58 +0100 | [diff] [blame] | 21 | if ((fsr == 0x1406 || fsr == 0x1c06) && first_fault) { |
Hauke Mehrtens | fdf4850 | 2014-02-04 00:01:46 +0100 | [diff] [blame] | 22 | first_fault = false; |
| 23 | |
| 24 | /* |
Rafał Miłecki | 7eb68a2 | 2015-02-11 16:40:58 +0100 | [diff] [blame] | 25 | * These faults with codes 0x1406 (BCM4709) or 0x1c06 happens |
| 26 | * for no good reason, possibly left over from the CFE boot |
| 27 | * loader. |
Hauke Mehrtens | fdf4850 | 2014-02-04 00:01:46 +0100 | [diff] [blame] | 28 | */ |
| 29 | pr_warn("External imprecise Data abort at addr=%#lx, fsr=%#x ignored.\n", |
Rafał Miłecki | 7eb68a2 | 2015-02-11 16:40:58 +0100 | [diff] [blame] | 30 | addr, fsr); |
Hauke Mehrtens | fdf4850 | 2014-02-04 00:01:46 +0100 | [diff] [blame] | 31 | |
| 32 | /* Returning non-zero causes fault display and panic */ |
| 33 | return 0; |
| 34 | } |
| 35 | |
| 36 | /* Others should cause a fault */ |
| 37 | return 1; |
| 38 | } |
| 39 | |
| 40 | static void __init bcm5301x_init_early(void) |
| 41 | { |
| 42 | /* Install our hook */ |
| 43 | hook_fault_code(16 + 6, bcm5301x_abort_handler, SIGBUS, BUS_OBJERR, |
| 44 | "imprecise external abort"); |
| 45 | } |
| 46 | |
Nicolas Pitre | 19c233b | 2015-07-27 18:27:52 -0400 | [diff] [blame^] | 47 | static const char *const bcm5301x_dt_compat[] __initconst = { |
Hauke Mehrtens | 5b293eb | 2014-02-04 00:01:43 +0100 | [diff] [blame] | 48 | "brcm,bcm4708", |
| 49 | NULL, |
| 50 | }; |
| 51 | |
| 52 | DT_MACHINE_START(BCM5301X, "BCM5301X") |
Russell King | d458773f | 2014-04-28 15:27:59 +0100 | [diff] [blame] | 53 | .l2c_aux_val = 0, |
| 54 | .l2c_aux_mask = ~0, |
Hauke Mehrtens | fdf4850 | 2014-02-04 00:01:46 +0100 | [diff] [blame] | 55 | .init_early = bcm5301x_init_early, |
Hauke Mehrtens | 5b293eb | 2014-02-04 00:01:43 +0100 | [diff] [blame] | 56 | .dt_compat = bcm5301x_dt_compat, |
| 57 | MACHINE_END |