You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
freifunkist-firmware/target/linux/brcm2708/patches-4.14/950-0362-dwc-otg-FIQ-Fix-ba...

129 lines
4.2 KiB

brcm2708: add kernel 4.14 support Patch generation process: - rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable - git format-patch v4.14.89 Patches skipped during rebase: - lan78xx: Read MAC address from DT if present - lan78xx: Enable LEDs and auto-negotiation - Revert "softirq: Let ksoftirqd do its job" - sc16is7xx: Fix for multi-channel stall - lan78xx: Ignore DT MAC address if already valid - lan78xx: Simple patch to prevent some crashes - tcp_write_queue_purge clears all the SKBs in the write queue - Revert "lan78xx: Simple patch to prevent some crashes" - lan78xx: Connect phy early - Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro - Revert "Revert "softirq: Let ksoftirqd do its job"" - ASoC: cs4265: SOC_SINGLE register value error fix - Revert "ASoC: cs4265: SOC_SINGLE register value error fix" - Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends" - Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"" Patches dropped after rebase: - net: Add non-mainline source for rtl8192cu wlan - net: Fix rtl8192cu build errors on other platforms - brcm: adds support for BCM43341 wifi - brcmfmac: Mute expected startup 'errors' - ARM64: Fix build break for RTL8187/RTL8192CU wifi - ARM64: Enable RTL8187/RTL8192CU wifi in build config - This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator - brcmfmac: add CLM download support - brcmfmac: request_firmware_direct is quieter - Sets the BCDC priority to constant 0 - brcmfmac: Disable ARP offloading when promiscuous - brcmfmac: Avoid possible out-of-bounds read - brcmfmac: Delete redundant length check - net: rtl8192cu: Normalize indentation - net: rtl8192cu: Fix implicit fallthrough warnings - Revert "Sets the BCDC priority to constant 0" - media: cxd2880: Bump to match 4.18.y version - media: cxd2880-spi: Bump to match 4.18.y version - Revert "mm: alloc_contig: re-allow CMA to compact FS pages" - Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages"" - cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with MEDIA_SUBDRV_AUTOSELECT - 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch - 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch Make I2C built-in instead of modular as in upstream defconfig; also the easiest way to get MFD_ARIZONA enabled, which is required by kmod-sound-soc-rpi-cirrus. Add missing compatible strings from 4.9/960-add-rasbperrypi-compatible.patch, using upstream names for compute modules. Add extra patch to enable the LEDs on lan78xx. Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y) Runtime-tested: bcm2708, bcm2710 Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
6 years ago
From 8edeb93cec4b7ca6771348fafbf4676920b052c9 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Mon, 16 Jul 2018 14:40:13 +0100
Subject: [PATCH 362/454] dwc-otg: FIQ: Fix "bad mode in data abort handler"
Create a semi-static mapping for the USB registers early in the boot
process, before additional kernel threads are started, so all threads
will have the mappings from the start. This avoids the need for
data aborts to lazily update them.
See: https://github.com/raspberrypi/linux/issues/2450
Signed-off-by: Floris Bos <bos@je-eigen-domein.nl>
---
arch/arm/mach-bcm/board_bcm2835.c | 69 +++++++++++++++++++++++
drivers/usb/host/dwc_otg/dwc_otg_driver.c | 2 +-
2 files changed, 70 insertions(+), 1 deletion(-)
--- a/arch/arm/mach-bcm/board_bcm2835.c
+++ b/arch/arm/mach-bcm/board_bcm2835.c
@@ -15,6 +15,7 @@
#include <linux/init.h>
#include <linux/irqchip.h>
#include <linux/of_address.h>
+#include <linux/of_fdt.h>
#include <linux/clk/bcm2835.h>
#include <asm/system_info.h>
@@ -24,6 +25,9 @@
#include "platsmp.h"
#include <linux/dma-mapping.h>
+#define BCM2835_USB_VIRT_BASE 0xf0980000
+#define BCM2835_USB_VIRT_MPHI 0xf0006000
+
static void __init bcm2835_init(void)
{
struct device_node *np = of_find_node_by_path("/system");
@@ -44,6 +48,70 @@ static void __init bcm2835_init_early(vo
init_dma_coherent_pool_size(SZ_1M);
}
+/*
+ * We need to map registers that are going to be accessed by the FIQ
+ * very early, before any kernel threads are spawned. Because if done
+ * later, the mapping tables are not updated instantly but lazily upon
+ * first access through a data abort handler. While that is fine
+ * when executing regular kernel code, if the first access in a specific
+ * thread happens while running FIQ code this will result in a panic.
+ *
+ * For more background see the following old mailing list thread:
+ * https://www.spinics.net/lists/arm-kernel/msg325250.html
+ */
+static int __init bcm2835_map_usb(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ struct map_desc map[2];
+ const __be32 *reg;
+ int len;
+ unsigned long p2b_offset = *((unsigned long *) data);
+
+ if (!of_flat_dt_is_compatible(node, "brcm,bcm2708-usb"))
+ return 0;
+ reg = of_get_flat_dt_prop(node, "reg", &len);
+ if (!reg || len != (sizeof(unsigned long) * 4))
+ return 0;
+
+ /* Use information about the physical addresses of the
+ * registers from the device tree, but use legacy
+ * iotable_init() static mapping function to map them,
+ * as ioremap() is not functional at this stage in boot.
+ */
+ map[0].virtual = (unsigned long) BCM2835_USB_VIRT_BASE;
+ map[0].pfn = __phys_to_pfn(be32_to_cpu(reg[0]) - p2b_offset);
+ map[0].length = be32_to_cpu(reg[1]);
+ map[0].type = MT_DEVICE;
+ map[1].virtual = (unsigned long) BCM2835_USB_VIRT_MPHI;
+ map[1].pfn = __phys_to_pfn(be32_to_cpu(reg[2]) - p2b_offset);
+ map[1].length = be32_to_cpu(reg[3]);
+ map[1].type = MT_DEVICE;
+ iotable_init(map, 2);
+
+ return 1;
+}
+
+static void __init bcm2835_map_io(void)
+{
+ const __be32 *ranges;
+ int soc, len;
+ unsigned long p2b_offset;
+
+ debug_ll_io_init();
+
+ /* Find out how to map bus to physical address first from soc/ranges */
+ soc = of_get_flat_dt_subnode_by_name(of_get_flat_dt_root(), "soc");
+ if (soc < 0)
+ return;
+ ranges = of_get_flat_dt_prop(soc, "ranges", &len);
+ if (!ranges || len < (sizeof(unsigned long) * 3))
+ return;
+ p2b_offset = be32_to_cpu(ranges[0]) - be32_to_cpu(ranges[1]);
+
+ /* Now search for bcm2708-usb node in device tree */
+ of_scan_flat_dt(bcm2835_map_usb, &p2b_offset);
+}
+
static const char * const bcm2835_compat[] = {
#ifdef CONFIG_ARCH_MULTI_V6
"brcm,bcm2835",
@@ -56,6 +124,7 @@ static const char * const bcm2835_compat
};
DT_MACHINE_START(BCM2835, "BCM2835")
+ .map_io = bcm2835_map_io,
.init_machine = bcm2835_init,
.init_early = bcm2835_init_early,
.dt_compat = bcm2835_compat,
--- a/drivers/usb/host/dwc_otg/dwc_otg_driver.c
+++ b/drivers/usb/host/dwc_otg/dwc_otg_driver.c
@@ -837,7 +837,7 @@ static int dwc_otg_driver_probe(
retval = -ENOMEM;
goto fail;
}
- dev_dbg(&_dev->dev, "base=0x%08x\n",
+ dev_info(&_dev->dev, "base=0x%08x\n",
(unsigned)dwc_otg_device->os_dep.base);
#endif