From 30b61b0138f61ecd9077232109cdffc4cab83304 Mon Sep 17 00:00:00 2001 From: Ycarus Date: Wed, 4 Jul 2018 16:16:41 +0200 Subject: [PATCH] Update brcm2708 to latest 4.14 patches --- ...Disable-TCP-Segmentation-Offload-TSO.patch | 61 ++++++++++ ...dget-ethernet-Re-enable-Jumbo-frames.patch | 36 ++++++ ...349-overlays-Add-gpio-no-irq-overlay.patch | 70 +++++++++++ ...-Add-missing-interrupt-for-RNG-block.patch | 33 ++++++ ...-Document-BCM283x-CSI2-CCP2-receiver.patch | 109 ++++++++++++++++++ ...cm2710-rpi-3-b-plus-fix-hpd-gpio-pin.patch | 26 +++++ ...ly-set-text-back-to-ro-after-kernel-.patch | 84 ++++++++++++++ 7 files changed, 419 insertions(+) create mode 100644 root/target/linux/brcm2708/patches-4.14/0345-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch create mode 100644 root/target/linux/brcm2708/patches-4.14/0346-usb-gadget-ethernet-Re-enable-Jumbo-frames.patch create mode 100644 root/target/linux/brcm2708/patches-4.14/0349-overlays-Add-gpio-no-irq-overlay.patch create mode 100644 root/target/linux/brcm2708/patches-4.14/0353-ARM-bcm283x-Add-missing-interrupt-for-RNG-block.patch create mode 100644 root/target/linux/brcm2708/patches-4.14/0364-dt-bindings-Document-BCM283x-CSI2-CCP2-receiver.patch create mode 100644 root/target/linux/brcm2708/patches-4.14/0371-arm-dts-bcm2710-rpi-3-b-plus-fix-hpd-gpio-pin.patch create mode 100644 root/target/linux/brcm2708/patches-4.14/0374-Arm-mm-ftrace-Only-set-text-back-to-ro-after-kernel-.patch diff --git a/root/target/linux/brcm2708/patches-4.14/0345-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch b/root/target/linux/brcm2708/patches-4.14/0345-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch new file mode 100644 index 00000000..b6b7c9a5 --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0345-net-lan78xx-Disable-TCP-Segmentation-Offload-TSO.patch @@ -0,0 +1,61 @@ +From 5762758699e1ddab22bf4c14eb225941761c52c8 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Wed, 13 Jun 2018 15:21:10 +0100 +Subject: [PATCH 345/374] net: lan78xx: Disable TCP Segmentation Offload (TSO) + +TSO seems to be having issues when packets are dropped and the +remote end uses Selective Acknowledge (SACK) to denote that +data is missing. The missing data is never resent, so the +connection eventually stalls. + +There is a module parameter of enable_tso added to allow +further debugging without forcing a rebuild of the kernel. + +https://github.com/raspberrypi/linux/issues/2449 +https://github.com/raspberrypi/linux/issues/2482 + +Signed-off-by: Dave Stevenson +--- + drivers/net/usb/lan78xx.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c +index 28c47345420a..9eada927f572 100644 +--- a/drivers/net/usb/lan78xx.c ++++ b/drivers/net/usb/lan78xx.c +@@ -415,6 +415,15 @@ static int msg_level = -1; + module_param(msg_level, int, 0); + MODULE_PARM_DESC(msg_level, "Override default message level"); + ++/* TSO seems to be having some issue with Selective Acknowledge (SACK) that ++ * results in lost data never being retransmitted. ++ * Disable it by default now, but adds a module parameter to enable it for ++ * debug purposes (the full cause is not currently understood). ++ */ ++static bool enable_tso; ++module_param(enable_tso, bool, 0644); ++MODULE_PARM_DESC(enable_tso, "Enables TCP segmentation offload"); ++ + static int lan78xx_read_reg(struct lan78xx_net *dev, u32 index, u32 *data) + { + u32 *buf = kmalloc(sizeof(u32), GFP_KERNEL); +@@ -2912,8 +2921,14 @@ static int lan78xx_bind(struct lan78xx_net *dev, struct usb_interface *intf) + if (DEFAULT_RX_CSUM_ENABLE) + dev->net->features |= NETIF_F_RXCSUM; + +- if (DEFAULT_TSO_CSUM_ENABLE) +- dev->net->features |= NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_SG; ++ if (DEFAULT_TSO_CSUM_ENABLE) { ++ dev->net->features |= NETIF_F_SG; ++ /* Use module parameter to control TCP segmentation offload as ++ * it appears to cause issues. ++ */ ++ if (enable_tso) ++ dev->net->features |= NETIF_F_TSO | NETIF_F_TSO6; ++ } + + if (DEFAULT_VLAN_RX_OFFLOAD) + dev->net->features |= NETIF_F_HW_VLAN_CTAG_RX; +-- +2.16.1 + diff --git a/root/target/linux/brcm2708/patches-4.14/0346-usb-gadget-ethernet-Re-enable-Jumbo-frames.patch b/root/target/linux/brcm2708/patches-4.14/0346-usb-gadget-ethernet-Re-enable-Jumbo-frames.patch new file mode 100644 index 00000000..dc96908b --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0346-usb-gadget-ethernet-Re-enable-Jumbo-frames.patch @@ -0,0 +1,36 @@ +From 8024dcb1164fd8266f3815aea1ebf7232365de61 Mon Sep 17 00:00:00 2001 +From: John Greb +Date: Sun, 6 May 2018 20:01:57 +0000 +Subject: [PATCH 346/374] usb: gadget ethernet: Re-enable Jumbo frames. + +Commit upstream + +Fixes: ("net: use core MTU range checking") +which patched only one of two functions used to setup the +USB Gadget Ethernet driver, causing a serious performance +regression in the ability to increase mtu size above 1500. + +Signed-off-by: John Greb +Signed-off-by: Felipe Balbi +--- + drivers/usb/gadget/function/u_ether.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c +index bdbc3fdc7c4f..4801ab3ae26f 100644 +--- a/drivers/usb/gadget/function/u_ether.c ++++ b/drivers/usb/gadget/function/u_ether.c +@@ -848,6 +848,10 @@ struct net_device *gether_setup_name_default(const char *netname) + net->ethtool_ops = &ops; + SET_NETDEV_DEVTYPE(net, &gadget_type); + ++ /* MTU range: 14 - 15412 */ ++ net->min_mtu = ETH_HLEN; ++ net->max_mtu = GETHER_MAX_ETH_FRAME_LEN; ++ + return net; + } + EXPORT_SYMBOL_GPL(gether_setup_name_default); +-- +2.16.1 + diff --git a/root/target/linux/brcm2708/patches-4.14/0349-overlays-Add-gpio-no-irq-overlay.patch b/root/target/linux/brcm2708/patches-4.14/0349-overlays-Add-gpio-no-irq-overlay.patch new file mode 100644 index 00000000..48166b2a --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0349-overlays-Add-gpio-no-irq-overlay.patch @@ -0,0 +1,70 @@ +From 3b01f059d2ef9e48aca5174fc7f3b5c40fe2488c Mon Sep 17 00:00:00 2001 +From: Phil Elwell +Date: Tue, 19 Jun 2018 15:04:45 +0100 +Subject: [PATCH 349/374] overlays: Add gpio-no-irq overlay + +An overlay to disable all GPIO interrupts. + +See: https://github.com/raspberrypi/linux/issues/2550 + +Signed-off-by: Phil Elwell +--- + arch/arm/boot/dts/overlays/Makefile | 1 + + arch/arm/boot/dts/overlays/README | 7 +++++++ + arch/arm/boot/dts/overlays/gpio-no-irq-overlay.dts | 14 ++++++++++++++ + 3 files changed, 22 insertions(+) + create mode 100644 arch/arm/boot/dts/overlays/gpio-no-irq-overlay.dts + +diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile +index a22141d24850..d9439370d7ed 100644 +--- a/arch/arm/boot/dts/overlays/Makefile ++++ b/arch/arm/boot/dts/overlays/Makefile +@@ -35,6 +35,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \ + gpio-ir.dtbo \ + gpio-ir-tx.dtbo \ + gpio-key.dtbo \ ++ gpio-no-irq.dtbo \ + gpio-poweroff.dtbo \ + gpio-shutdown.dtbo \ + hifiberry-amp.dtbo \ +diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README +index a9e56efd6532..61bfe29cfb8f 100644 +--- a/arch/arm/boot/dts/overlays/README ++++ b/arch/arm/boot/dts/overlays/README +@@ -583,6 +583,13 @@ Params: gpio GPIO pin to trigger on (default 3) + keycode Set the key code for the button + + ++Name: gpio-no-irq ++Info: Use this overlay to disable all GPIO interrupts, which can be useful ++ for user-space GPIO edge detection systems. ++Load: dtoverlay=gpio-no-irq ++Params: ++ ++ + Name: gpio-poweroff + Info: Drives a GPIO high or low on poweroff (including halt). Enabling this + overlay will prevent the ability to boot by driving GPIO3 low. +diff --git a/arch/arm/boot/dts/overlays/gpio-no-irq-overlay.dts b/arch/arm/boot/dts/overlays/gpio-no-irq-overlay.dts +new file mode 100644 +index 000000000000..55f9bff3a8f6 +--- /dev/null ++++ b/arch/arm/boot/dts/overlays/gpio-no-irq-overlay.dts +@@ -0,0 +1,14 @@ ++/dts-v1/; ++/plugin/; ++ ++/ { ++ compatible = "brcm,bcm2835"; ++ ++ fragment@0 { ++ // Configure the gpio pin controller ++ target = <&gpio>; ++ __overlay__ { ++ interrupts; ++ }; ++ }; ++}; +-- +2.16.1 + diff --git a/root/target/linux/brcm2708/patches-4.14/0353-ARM-bcm283x-Add-missing-interrupt-for-RNG-block.patch b/root/target/linux/brcm2708/patches-4.14/0353-ARM-bcm283x-Add-missing-interrupt-for-RNG-block.patch new file mode 100644 index 00000000..9709a125 --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0353-ARM-bcm283x-Add-missing-interrupt-for-RNG-block.patch @@ -0,0 +1,33 @@ +From 3b9d32ac99cbbaf8c6b4d7fd477a5dc48fee344d Mon Sep 17 00:00:00 2001 +From: Stefan Wahren +Date: Sat, 18 Nov 2017 14:04:13 +0100 +Subject: [PATCH 353/374] ARM: bcm283x: Add missing interrupt for RNG block + +commit 4034600e6f72f7e0a7d8112db3de61469e47fc36 upstream. + +This patch adds the missing interrupt property to the RNG block +of BCM283x. + +Link: https://github.com/raspberrypi/linux/issues/2195 +CC: Florian Fainelli +Signed-off-by: Stefan Wahren +Signed-off-by: Florian Fainelli +--- + arch/arm/boot/dts/bcm283x.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/bcm283x.dtsi b/arch/arm/boot/dts/bcm283x.dtsi +index 9a378177ca4f..4afd31d96acf 100644 +--- a/arch/arm/boot/dts/bcm283x.dtsi ++++ b/arch/arm/boot/dts/bcm283x.dtsi +@@ -135,6 +135,7 @@ + rng@7e104000 { + compatible = "brcm,bcm2835-rng"; + reg = <0x7e104000 0x10>; ++ interrupts = <2 29>; + }; + + mailbox: mailbox@7e00b880 { +-- +2.16.1 + diff --git a/root/target/linux/brcm2708/patches-4.14/0364-dt-bindings-Document-BCM283x-CSI2-CCP2-receiver.patch b/root/target/linux/brcm2708/patches-4.14/0364-dt-bindings-Document-BCM283x-CSI2-CCP2-receiver.patch new file mode 100644 index 00000000..0a071791 --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0364-dt-bindings-Document-BCM283x-CSI2-CCP2-receiver.patch @@ -0,0 +1,109 @@ +From 46228643a5f4a990312f4d9156f03c82a933f49f Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Mon, 11 Sep 2017 15:42:17 +0100 +Subject: [PATCH 364/374] dt-bindings: Document BCM283x CSI2/CCP2 receiver + +Document the DT bindings for the CSI2/CCP2 receiver peripheral +(known as Unicam) on BCM283x SoCs. + +Signed-off-by: Dave Stevenson +Acked-by: Rob Herring +--- + .../devicetree/bindings/media/bcm2835-unicam.txt | 85 ++++++++++++++++++++++ + 1 file changed, 85 insertions(+) + create mode 100644 Documentation/devicetree/bindings/media/bcm2835-unicam.txt + +diff --git a/Documentation/devicetree/bindings/media/bcm2835-unicam.txt b/Documentation/devicetree/bindings/media/bcm2835-unicam.txt +new file mode 100644 +index 000000000000..7714fb374b34 +--- /dev/null ++++ b/Documentation/devicetree/bindings/media/bcm2835-unicam.txt +@@ -0,0 +1,85 @@ ++Broadcom BCM283x Camera Interface (Unicam) ++------------------------------------------ ++ ++The Unicam block on BCM283x SoCs is the receiver for either ++CSI-2 or CCP2 data from image sensors or similar devices. ++ ++The main platform using this SoC is the Raspberry Pi family of boards. ++On the Pi the VideoCore firmware can also control this hardware block, ++and driving it from two different processors will cause issues. ++To avoid this, the firmware checks the device tree configuration ++during boot. If it finds device tree nodes called csi0 or csi1 then ++it will stop the firmware accessing the block, and it can then ++safely be used via the device tree binding. ++ ++Required properties: ++=================== ++- compatible : must be "brcm,bcm2835-unicam". ++- reg : physical base address and length of the register sets for the ++ device. ++- interrupts : should contain the IRQ line for this Unicam instance. ++- clocks : list of clock specifiers, corresponding to entries in ++ clock-names property. ++- clock-names : must contain an "lp" entry, matching entries in the ++ clocks property. ++ ++Unicam supports a single port node. It should contain one 'port' child node ++with child 'endpoint' node. Please refer to the bindings defined in ++Documentation/devicetree/bindings/media/video-interfaces.txt. ++ ++Within the endpoint node the "remote-endpoint" and "data-lanes" properties ++are mandatory. ++Data lane reordering is not supported so the data lanes must be in order, ++starting at 1. The number of data lanes should represent the number of ++usable lanes for the hardware block. That may be limited by either the SoC or ++how the platform presents the interface, and the lower value must be used. ++ ++Lane reordering is not supported on the clock lane either, so the optional ++property "clock-lane" will implicitly be <0>. ++Similarly lane inversion is not supported, therefore "lane-polarities" will ++implicitly be <0 0 0 0 0>. ++Neither of these values will be checked. ++ ++Example: ++ csi1: csi1@7e801000 { ++ compatible = "brcm,bcm2835-unicam"; ++ reg = <0x7e801000 0x800>, ++ <0x7e802004 0x4>; ++ interrupts = <2 7>; ++ clocks = <&clocks BCM2835_CLOCK_CAM1>; ++ clock-names = "lp"; ++ ++ port { ++ csi1_ep: endpoint { ++ remote-endpoint = <&tc358743_0>; ++ data-lanes = <1 2>; ++ }; ++ }; ++ }; ++ ++ i2c0: i2c@7e205000 { ++ tc358743: csi-hdmi-bridge@0f { ++ compatible = "toshiba,tc358743"; ++ reg = <0x0f>; ++ ++ clocks = <&tc358743_clk>; ++ clock-names = "refclk"; ++ ++ tc358743_clk: bridge-clk { ++ compatible = "fixed-clock"; ++ #clock-cells = <0>; ++ clock-frequency = <27000000>; ++ }; ++ ++ port { ++ tc358743_0: endpoint { ++ remote-endpoint = <&csi1_ep>; ++ clock-lanes = <0>; ++ data-lanes = <1 2>; ++ clock-noncontinuous; ++ link-frequencies = ++ /bits/ 64 <297000000>; ++ }; ++ }; ++ }; ++ }; +-- +2.16.1 + diff --git a/root/target/linux/brcm2708/patches-4.14/0371-arm-dts-bcm2710-rpi-3-b-plus-fix-hpd-gpio-pin.patch b/root/target/linux/brcm2708/patches-4.14/0371-arm-dts-bcm2710-rpi-3-b-plus-fix-hpd-gpio-pin.patch new file mode 100644 index 00000000..1e0ae1e5 --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0371-arm-dts-bcm2710-rpi-3-b-plus-fix-hpd-gpio-pin.patch @@ -0,0 +1,26 @@ +From 72f72b6c6044462fab31bb1109b7572e418a2e07 Mon Sep 17 00:00:00 2001 +From: Lukas Rusak +Date: Fri, 29 Jun 2018 10:13:59 -0700 +Subject: [PATCH 371/374] arm: dts: bcm2710-rpi-3-b-plus: fix hpd gpio pin + +Signed-off-by: Lukas Rusak +--- + arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts +index 7641360a63a8..7821483f7d50 100644 +--- a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts ++++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts +@@ -162,7 +162,7 @@ + }; + + &hdmi { +- hpd-gpios = <&expgpio 4 GPIO_ACTIVE_LOW>; ++ hpd-gpios = <&gpio 28 GPIO_ACTIVE_LOW>; + }; + + &audio { +-- +2.16.1 + diff --git a/root/target/linux/brcm2708/patches-4.14/0374-Arm-mm-ftrace-Only-set-text-back-to-ro-after-kernel-.patch b/root/target/linux/brcm2708/patches-4.14/0374-Arm-mm-ftrace-Only-set-text-back-to-ro-after-kernel-.patch new file mode 100644 index 00000000..214cb28b --- /dev/null +++ b/root/target/linux/brcm2708/patches-4.14/0374-Arm-mm-ftrace-Only-set-text-back-to-ro-after-kernel-.patch @@ -0,0 +1,84 @@ +From 786b6ff17f8612ba9af84ac379d4b494f39f55c5 Mon Sep 17 00:00:00 2001 +From: Steven Rostedt +Date: Wed, 23 Aug 2017 13:58:36 -0400 +Subject: [PATCH 374/374] Arm: mm: ftrace: Only set text back to ro after + kernel has been marked ro + +ftrace needs to modify the kernel text in order to enable function tracing. +For security reasons, the kernel text is marked to read-only (ro) at the end +of system bootup. When enabling function tracing after that, ftrace calls +arch specific code that needs to enable the modification of kernel text +while ftrace does the update, and reset it back again when finished. + +The issue arises when function tracing is enabled during system bootup. The +text hasn't been marked as read-only yet, but the same code to modify the +kernel is executed, and when it is finished, it will cause the kernel to +become read-only. This causes issues for other init code that requires +modification of kernel text during system bootup. This appears to cause +issue with Raspberry Pi 2. + +By implementing the feature that is used in x86 to deal with this issue, it +fixes the problem. The solution is simple. Have a variable +(kernel_set_to_readonly) get set when the system finished boot and marks the +kernel to readonly. If that variable is not set, both +kernel_set_to_readonly() and kernel_set_to_rw() return without doing any +modifications. Those functions are used by ftrace to change the permissions +of the kernel text. By not doing anything, ftrace will not mess with the +permissions when it is enabled at system bootup. + +Link: http://lkml.kernel.org/r/20170821153402.7so2u364htvt6tnf@camel2.lan +Link: https://github.com/raspberrypi/linux/issues/2166#issuecomment-323355145 +Reported-by: Matthias Reichl +Cc: Russell King +Cc: Kees Cook +Cc: Eric Anholt +Cc: Stefan Wahren +Cc: Phil Elwell +Cc: linux-rpi-kernel@lists.infradead.org +Cc: linux-arm-kernel@lists.infradead.org +Cc: stable@vger.kernel.org +Fixes: 80d6b0c2ee ("ARM: mm: allow text and rodata sections to be read-only") +Signed-off-by: Steven Rostedt (VMware) +Tested-by: Matthias Reichl +Acked-by: Kees Cook +--- + arch/arm/mm/init.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c +index 0f6d1537f330..82175c047222 100644 +--- a/arch/arm/mm/init.c ++++ b/arch/arm/mm/init.c +@@ -745,19 +745,29 @@ static int __mark_rodata_ro(void *unused) + return 0; + } + ++static int kernel_set_to_readonly; ++ + void mark_rodata_ro(void) + { ++ kernel_set_to_readonly = 1; ++ + stop_machine(__mark_rodata_ro, NULL, NULL); + } + + void set_kernel_text_rw(void) + { ++ if (!kernel_set_to_readonly) ++ return; ++ + set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), false, + current->active_mm); + } + + void set_kernel_text_ro(void) + { ++ if (!kernel_set_to_readonly) ++ return; ++ + set_section_perms(ro_perms, ARRAY_SIZE(ro_perms), true, + current->active_mm); + } +-- +2.16.1 +