[source] brcm2708: update linux 4.4 patches to latest version
LEDE Commits
lede-commits at lists.infradead.org
Wed Mar 8 00:59:51 PST 2017
noltari pushed a commit to source.git, branch brcm2708-17.01:
https://git.lede-project.org/8b52a8906bf376610e5a8d051ead1d50610e6da1
commit 8b52a8906bf376610e5a8d051ead1d50610e6da1
Author: Álvaro Fernández Rojas <noltari at gmail.com>
AuthorDate: Wed Mar 8 09:46:30 2017 +0100
brcm2708: update linux 4.4 patches to latest version
As usual these patches were extracted and rebased from the raspberry pi repo:
https://github.com/raspberrypi/linux/tree/rpi-4.4.y
- led1 can't be controlled on rpi-3 for linux 4.4, remove it.
- Fix modules.mk typos.
Signed-off-by: Álvaro Fernández Rojas <noltari at gmail.com>
---
target/linux/brcm2708/base-files/etc/diag.sh | 3 +-
target/linux/brcm2708/modules.mk | 7 +-
.../patches-4.4/0551-kbuild-add-fno-PIE.patch | 45 ++++
...d-Steal-gcc-s-pie-from-the-very-beginning.patch | 54 ++++
...M-dts-Restore-dtbs_install-functionality.patch} | 7 +-
...-BCM270X_DT-Update-UART0-clock-frequency.patch} | 7 +-
...2835-v4l2-Fix-a-conformance-test-failure.patch} | 9 +-
...M270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch | 108 ++++++++
...i-Delete-vestigial-gpio_in_pull-parameter.patch | 43 +++
.../0558-BCM270X_DT-Add-i2c-sensor-overlay.patch | 102 +++++++
...-overlays-overlay.dtb-overlays-.dtbo-1752.patch | 26 ++
...dragonrise-fix-HID-Descriptor-for-0x0006-.patch | 104 +++++++
...rng-Avoid-initialising-if-already-enabled.patch | 31 +++
.../0562-Pisound-dynamic-overlay-1760.patch | 151 +++++++++++
...-for-Silicon-Labs-Si7013-20-21-humidity-t.patch | 95 +++++++
.../0564-pisound-improvements-1778.patch | 299 +++++++++++++++++++++
..._name-properties-to-JustBoom-drivers-1787.patch | 39 +++
...-Changes-for-allowing-asymmetric-sample-f.patch | 101 +++++++
...7-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch | 66 +++++
...move-ppos-increment-in-configfs_write_bin.patch | 54 ++++
.../0569-config-Add-CONFIG_DM_CACHE.patch | 38 +++
.../0570-BCM270X_DT-Add-spi0-cs-overlay.patch | 91 +++++++
...835-i2s-Changes-for-allowing-asymmetric-s.patch | 101 +++++++
.../0572-BCM270X_DT-Enable-UART0-on-CM3.patch | 28 ++
...dd-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch | 44 +++
...-USB-config-options-for-bcm2709_defconfig.patch | 53 ++++
..._DT-Add-reference-to-audio_pins-to-CM-dtb.patch | 33 +++
.../0576-Add-overlay-for-mcp3008-adc-1818.patch | 291 ++++++++++++++++++++
...Restore-IO-APIC-irq_chip-retrigger-callba.patch | 51 ++++
.../0578-config-add-slcan-kernel-module.patch | 38 +++
...-sending-of-page-flip-completion-events-i.patch | 47 ++++
...clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch | 32 +++
...port-rate-change-propagation-on-bcm2835-c.patch | 129 +++++++++
...ow-rate-change-propagation-to-PLLH_AUX-on.patch | 40 +++
...-maybe-uninitialized-warning-in-bcm2835_c.patch | 34 +++
...-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch | 177 ++++++++++++
...m-Remove-unnecessary-dev_info-output-1830.patch | 27 ++
...fill-user-BO-creation-requests-from-the-k.patch | 59 ++++
...-OOPSes-from-trying-to-cache-a-partially-.patch | 39 +++
...ify-at-boot-that-CMA-doesn-t-cross-a-256M.patch | 88 ++++++
.../patches-4.4/0589-Update-vfpmodule.c.patch | 143 ++++++++++
...-summarize-urb-actual_length-for-isochron.patch | 33 +++
.../0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch | 236 ++++++++++++++++
43 files changed, 3194 insertions(+), 9 deletions(-)
diff --git a/target/linux/brcm2708/base-files/etc/diag.sh b/target/linux/brcm2708/base-files/etc/diag.sh
index 2a866e4..ecc6242 100644
--- a/target/linux/brcm2708/base-files/etc/diag.sh
+++ b/target/linux/brcm2708/base-files/etc/diag.sh
@@ -12,8 +12,7 @@ set_state() {
status_led="led0"
;;
rpi-b-plus |\
- rpi-2-b |\
- rpi-3-b)
+ rpi-2-b)
status_led="led1"
;;
esac
diff --git a/target/linux/brcm2708/modules.mk b/target/linux/brcm2708/modules.mk
index e2b3fdb..f1c4ab1 100644
--- a/target/linux/brcm2708/modules.mk
+++ b/target/linux/brcm2708/modules.mk
@@ -1,5 +1,6 @@
#
# Copyright (C) 2012-2016 OpenWrt.org
+# Copyright (C) 2017 LEDE project
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
@@ -126,8 +127,8 @@ define KernelPackage/sound-soc-digidac1-soundcard
$(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8741.ko \
$(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804.ko \
$(LINUX_DIR)/sound/soc/codecs/snd-soc-wm8804-i2c.ko
- AUTOLOAD:=$(call AutoLoad,68,snd-soc-snd-soc-wm8741 \
- snd-soc-snd-soc-wm8804 snd-soc-snd-soc-wm8804-i2c \
+ AUTOLOAD:=$(call AutoLoad,68,snd-soc-wm8741 \
+ snd-soc-wm8804 snd-soc-wm8804-i2c \
snd-soc-digidac1-soundcard)
DEPENDS:= \
kmod-sound-soc-bcm2835-i2s \
@@ -149,7 +150,7 @@ define KernelPackage/sound-soc-dionaudio-loco
FILES:= \
$(LINUX_DIR)/sound/soc/bcm/snd-soc-dionaudio-loco.ko \
$(LINUX_DIR)/sound/soc/codecs/snd-soc-pcm5102a.ko
- AUTOLOAD:=$(call AutoLoad,68,snd-soc-snd-soc-pcm5102a \
+ AUTOLOAD:=$(call AutoLoad,68,snd-soc-pcm5102a \
snd-soc-dionaudio-loco)
DEPENDS:= \
kmod-sound-soc-bcm2835-i2s
diff --git a/target/linux/brcm2708/patches-4.4/0551-kbuild-add-fno-PIE.patch b/target/linux/brcm2708/patches-4.4/0551-kbuild-add-fno-PIE.patch
new file mode 100644
index 0000000..0d2c1a5
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0551-kbuild-add-fno-PIE.patch
@@ -0,0 +1,45 @@
+From d7c87b54cdabe76c12f2bb527f2a6b02b6255a0f Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
+Date: Fri, 4 Nov 2016 19:39:38 +0100
+Subject: [PATCH] kbuild: add -fno-PIE
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+commit 8ae94224c9d72fc4d9aaac93b2d7833cf46d7141 upstream.
+
+Debian started to build the gcc with -fPIE by default so the kernel
+build ends before it starts properly with:
+|kernel/bounds.c:1:0: error: code model kernel does not support PIC mode
+
+Also add to KBUILD_AFLAGS due to:
+
+|gcc -Wp,-MD,arch/x86/entry/vdso/vdso32/.note.o.d … -mfentry -DCC_USING_FENTRY … vdso/vdso32/note.S
+|arch/x86/entry/vdso/vdso32/note.S:1:0: sorry, unimplemented: -mfentry isn’t supported for 32-bit in combination with -fpic
+
+Tagging it stable so it is possible to compile recent stable kernels as
+well.
+
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
+Signed-off-by: Michal Marek <mmarek at suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ Makefile | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 1099371..c17219e 100644
+--- a/Makefile
++++ b/Makefile
+@@ -619,6 +619,8 @@ include arch/$(SRCARCH)/Makefile
+ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
+ KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
+ KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
++KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
++KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
+
+ ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+ KBUILD_CFLAGS += -Os
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0552-kbuild-Steal-gcc-s-pie-from-the-very-beginning.patch b/target/linux/brcm2708/patches-4.4/0552-kbuild-Steal-gcc-s-pie-from-the-very-beginning.patch
new file mode 100644
index 0000000..2361c75
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0552-kbuild-Steal-gcc-s-pie-from-the-very-beginning.patch
@@ -0,0 +1,54 @@
+From e1c194ad704d298d6914e5b1efc4afee41a18a4c Mon Sep 17 00:00:00 2001
+From: Borislav Petkov <bp at suse.de>
+Date: Mon, 14 Nov 2016 19:41:31 +0100
+Subject: [PATCH] kbuild: Steal gcc's pie from the very beginning
+
+commit c6a385539175ebc603da53aafb7753d39089f32e upstream.
+
+So Sebastian turned off the PIE for kernel builds but that was too late
+- Kbuild.include already uses KBUILD_CFLAGS and trying to disable gcc
+options with, say cc-disable-warning, fails:
+
+ gcc -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs
+ ...
+ -Wno-sign-compare -fno-asynchronous-unwind-tables -Wframe-address -c -x c /dev/null -o .31392.tmp
+ /dev/null:1:0: error: code model kernel does not support PIC mode
+
+because that returns an error and we can't disable the warning. For
+example in this case:
+
+KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
+
+which leads to gcc issuing all those warnings again.
+
+So let's turn off PIE/PIC at the earliest possible moment, when we
+declare KBUILD_CFLAGS so that cc-disable-warning picks it up too.
+
+Also, we need the $(call cc-option ...) because -fno-PIE is supported
+since gcc v3.4 and our lowest supported gcc version is 3.2 right now.
+
+Signed-off-by: Borislav Petkov <bp at suse.de>
+Cc: Ben Hutchings <ben at decadent.org.uk>
+Cc: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
+Signed-off-by: Michal Marek <mmarek at suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ Makefile | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index c17219e..1099371 100644
+--- a/Makefile
++++ b/Makefile
+@@ -619,8 +619,6 @@ include arch/$(SRCARCH)/Makefile
+ KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,)
+ KBUILD_CFLAGS += $(call cc-disable-warning,maybe-uninitialized,)
+ KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,)
+-KBUILD_CFLAGS += $(call cc-option,-fno-PIE)
+-KBUILD_AFLAGS += $(call cc-option,-fno-PIE)
+
+ ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
+ KBUILD_CFLAGS += -Os
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0551-ARM-dts-Restore-dtbs_install-functionality.patch b/target/linux/brcm2708/patches-4.4/0553-ARM-dts-Restore-dtbs_install-functionality.patch
similarity index 81%
rename from target/linux/brcm2708/patches-4.4/0551-ARM-dts-Restore-dtbs_install-functionality.patch
rename to target/linux/brcm2708/patches-4.4/0553-ARM-dts-Restore-dtbs_install-functionality.patch
index 5224e26..2fe4b16 100644
--- a/target/linux/brcm2708/patches-4.4/0551-ARM-dts-Restore-dtbs_install-functionality.patch
+++ b/target/linux/brcm2708/patches-4.4/0553-ARM-dts-Restore-dtbs_install-functionality.patch
@@ -1,4 +1,4 @@
-From 49b92b33aa6681e75f579b7369f34a53e9376e6c Mon Sep 17 00:00:00 2001
+From 192835cf562bf63050f3f4b3dab768f3481eb93d Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil at raspberrypi.org>
Date: Sat, 26 Nov 2016 14:01:52 +0000
Subject: [PATCH] ARM: dts: Restore dtbs_install functionality
@@ -8,6 +8,8 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
arch/arm/boot/dts/Makefile | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index cbfc8ba..14a491c 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -806,10 +806,11 @@ dtstree := $(srctree)/$(src)
@@ -23,3 +25,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
DTC_FLAGS ?= -@ -H epapr
+ dts-dirs += overlays
endif
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0552-BCM270X_DT-Update-UART0-clock-frequency.patch b/target/linux/brcm2708/patches-4.4/0554-BCM270X_DT-Update-UART0-clock-frequency.patch
similarity index 82%
rename from target/linux/brcm2708/patches-4.4/0552-BCM270X_DT-Update-UART0-clock-frequency.patch
rename to target/linux/brcm2708/patches-4.4/0554-BCM270X_DT-Update-UART0-clock-frequency.patch
index 2fc6396..3d3f911 100644
--- a/target/linux/brcm2708/patches-4.4/0552-BCM270X_DT-Update-UART0-clock-frequency.patch
+++ b/target/linux/brcm2708/patches-4.4/0554-BCM270X_DT-Update-UART0-clock-frequency.patch
@@ -1,4 +1,4 @@
-From 1efce478669516e7a0fad7fa9943c889fcc21d2e Mon Sep 17 00:00:00 2001
+From 70af0eca2c4a2a80a8edd6ce4c4c7a9eac038893 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil at raspberrypi.org>
Date: Sun, 27 Nov 2016 21:45:55 +0000
Subject: [PATCH] BCM270X_DT: Update UART0 clock-frequency
@@ -16,6 +16,8 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
arch/arm/boot/dts/bcm2708_common.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
+diff --git a/arch/arm/boot/dts/bcm2708_common.dtsi b/arch/arm/boot/dts/bcm2708_common.dtsi
+index c449493..a9fd97e 100644
--- a/arch/arm/boot/dts/bcm2708_common.dtsi
+++ b/arch/arm/boot/dts/bcm2708_common.dtsi
@@ -456,7 +456,7 @@
@@ -27,3 +29,6 @@ Signed-off-by: Phil Elwell <phil at raspberrypi.org>
};
clk_apb_p: clock at 3 {
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0553-BCM2835-v4l2-Fix-a-conformance-test-failure.patch b/target/linux/brcm2708/patches-4.4/0555-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
similarity index 75%
rename from target/linux/brcm2708/patches-4.4/0553-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
rename to target/linux/brcm2708/patches-4.4/0555-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
index 2ed182a..68dca0c 100644
--- a/target/linux/brcm2708/patches-4.4/0553-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
+++ b/target/linux/brcm2708/patches-4.4/0555-BCM2835-v4l2-Fix-a-conformance-test-failure.patch
@@ -1,4 +1,4 @@
-From 05b2785cb7e1f40900dad84579c6f7fd4ad8aeda Mon Sep 17 00:00:00 2001
+From e94e99c9650e48f0de0399cf04ec3ae597f05ed2 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <6by9 at users.noreply.github.com>
Date: Wed, 30 Nov 2016 20:17:14 +0000
Subject: [PATCH] BCM2835-v4l2: Fix a conformance test failure
@@ -13,9 +13,11 @@ Format ioctls:
drivers/media/platform/bcm2835/bcm2835-camera.c | 1 +
1 file changed, 1 insertion(+)
+diff --git a/drivers/media/platform/bcm2835/bcm2835-camera.c b/drivers/media/platform/bcm2835/bcm2835-camera.c
+index a2cfff9..23ba458 100644
--- a/drivers/media/platform/bcm2835/bcm2835-camera.c
+++ b/drivers/media/platform/bcm2835/bcm2835-camera.c
-@@ -1397,6 +1397,7 @@ static int vidioc_s_parm(struct file *fi
+@@ -1397,6 +1397,7 @@ static int vidioc_s_parm(struct file *file, void *priv,
dev->capture.timeperframe = tpf;
parm->parm.capture.timeperframe = tpf;
parm->parm.capture.readbuffers = 1;
@@ -23,3 +25,6 @@ Format ioctls:
fps_param.num = 0; /* Select variable fps, and then use
* FPS_RANGE to select the actual limits.
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch b/target/linux/brcm2708/patches-4.4/0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch
new file mode 100644
index 0000000..8aea6e4
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0556-BCM270X_DT-Add-overlay-for-enc28j60-on-SPI2.patch
@@ -0,0 +1,108 @@
+From ea006f68522d82b294094fd29585b16290758d29 Mon Sep 17 00:00:00 2001
+From: Alan Yiding Wang <y2366wan at uwaterloo.ca>
+Date: Sat, 3 Dec 2016 23:22:02 -0500
+Subject: [PATCH] BCM270X_DT: Add overlay for enc28j60 on SPI2
+
+Works on SPI2 for compute module
+---
+ arch/arm/boot/dts/overlays/Makefile | 1 +
+ arch/arm/boot/dts/overlays/README | 10 ++++-
+ .../boot/dts/overlays/enc28j60-spi2-overlay.dts | 47 ++++++++++++++++++++++
+ 3 files changed, 57 insertions(+), 1 deletion(-)
+ create mode 100644 arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
+
+diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
+index 57d60a4..c4186aa 100644
+--- a/arch/arm/boot/dts/overlays/Makefile
++++ b/arch/arm/boot/dts/overlays/Makefile
+@@ -28,6 +28,7 @@ dtbo-$(RPI_DT_OVERLAYS) += dpi24.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += dwc-otg.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += dwc2.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += enc28j60.dtbo
++dtbo-$(RPI_DT_OVERLAYS) += enc28j60-spi2.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += gpio-ir.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += gpio-poweroff.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += hifiberry-amp.dtbo
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index 35c0cec1..4a77ee6 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -344,13 +344,21 @@ Params: dr_mode Dual role mode: "host", "peripheral" or "otg"
+
+
+ Name: enc28j60
+-Info: Overlay for the Microchip ENC28J60 Ethernet Controller (SPI)
++Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI0
+ Load: dtoverlay=enc28j60,<param>=<val>
+ Params: int_pin GPIO used for INT (default 25)
+
+ speed SPI bus speed (default 12000000)
+
+
++Name: enc28j60-spi2
++Info: Overlay for the Microchip ENC28J60 Ethernet Controller on SPI2
++Load: dtoverlay=enc28j60-spi2,<param>=<val>
++Params: int_pin GPIO used for INT (default 39)
++
++ speed SPI bus speed (default 12000000)
++
++
+ Name: gpio-ir
+ Info: Use GPIO pin as rc-core style infrared receiver input. The rc-core-
+ based gpio_ir_recv driver maps received keys directly to a
+diff --git a/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
+new file mode 100644
+index 0000000..946c9d2
+--- /dev/null
++++ b/arch/arm/boot/dts/overlays/enc28j60-spi2-overlay.dts
+@@ -0,0 +1,47 @@
++// Overlay for the Microchip ENC28J60 Ethernet Controller - SPI2 Compute Module
++// Interrupt pin: 39
++/dts-v1/;
++/plugin/;
++
++/ {
++ compatible = "brcm,bcm2708";
++
++ fragment at 0 {
++ target = <&spi2>;
++ __overlay__ {
++ /* needed to avoid dtc warning */
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ status = "okay";
++
++ eth1: enc28j60 at 0{
++ compatible = "microchip,enc28j60";
++ reg = <0>; /* CE0 */
++ pinctrl-names = "default";
++ pinctrl-0 = <ð1_pins>;
++ interrupt-parent = <&gpio>;
++ interrupts = <39 0x2>; /* falling edge */
++ spi-max-frequency = <12000000>;
++ status = "okay";
++ };
++ };
++ };
++
++ fragment at 1 {
++ target = <&gpio>;
++ __overlay__ {
++ eth1_pins: eth1_pins {
++ brcm,pins = <39>;
++ brcm,function = <0>; /* in */
++ brcm,pull = <0>; /* none */
++ };
++ };
++ };
++
++ __overrides__ {
++ int_pin = <ð1>, "interrupts:0",
++ <ð1_pins>, "brcm,pins:0";
++ speed = <ð1>, "spi-max-frequency:0";
++ };
++};
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0557-lirc_rpi-Delete-vestigial-gpio_in_pull-parameter.patch b/target/linux/brcm2708/patches-4.4/0557-lirc_rpi-Delete-vestigial-gpio_in_pull-parameter.patch
new file mode 100644
index 0000000..9ebcc22
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0557-lirc_rpi-Delete-vestigial-gpio_in_pull-parameter.patch
@@ -0,0 +1,43 @@
+From a5cf7bed6a2d7267e2f0a3109807051e166930fb Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Mon, 5 Dec 2016 09:58:16 +0000
+Subject: [PATCH] lirc_rpi: Delete vestigial gpio_in_pull parameter
+
+The RPi GPIO no longer support run-time "pull" settings - one should
+Device Tree and pinctrl instead - so remove the parameter to avoid
+confusion.
+
+See: https://github.com/raspberrypi/linux/issues/1711
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ drivers/staging/media/lirc/lirc_rpi.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/drivers/staging/media/lirc/lirc_rpi.c b/drivers/staging/media/lirc/lirc_rpi.c
+index 6132896..ebbf0d6 100644
+--- a/drivers/staging/media/lirc/lirc_rpi.c
++++ b/drivers/staging/media/lirc/lirc_rpi.c
+@@ -64,8 +64,6 @@
+
+ /* set the default GPIO input pin */
+ static int gpio_in_pin = 18;
+-/* set the default pull behaviour for input pin */
+-static int gpio_in_pull = BCM2708_PULL_DOWN;
+ /* set the default GPIO output pin */
+ static int gpio_out_pin = 17;
+ /* enable debugging messages */
+@@ -716,10 +714,6 @@ module_param(gpio_in_pin, int, S_IRUGO);
+ MODULE_PARM_DESC(gpio_in_pin, "GPIO input pin number of the BCM processor."
+ " (default 18");
+
+-module_param(gpio_in_pull, int, S_IRUGO);
+-MODULE_PARM_DESC(gpio_in_pull, "GPIO input pin pull configuration."
+- " (0 = off, 1 = up, 2 = down, default down)");
+-
+ module_param(sense, int, S_IRUGO);
+ MODULE_PARM_DESC(sense, "Override autodetection of IR receiver circuit"
+ " (0 = active high, 1 = active low )");
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0558-BCM270X_DT-Add-i2c-sensor-overlay.patch b/target/linux/brcm2708/patches-4.4/0558-BCM270X_DT-Add-i2c-sensor-overlay.patch
new file mode 100644
index 0000000..2248fe8
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0558-BCM270X_DT-Add-i2c-sensor-overlay.patch
@@ -0,0 +1,102 @@
+From ec94d922b57bb7d6586eaf1e1af02e9383680d15 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Mon, 5 Dec 2016 17:10:44 +0000
+Subject: [PATCH] BCM270X_DT: Add i2c-sensor overlay
+
+The i2c-sensor overlay is a container for various pressure and
+temperature sensors, currently bmp085 and bmp280. The standalone
+bmp085_i2c-sensor overlay is now deprecated.
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ arch/arm/boot/dts/overlays/Makefile | 1 +
+ arch/arm/boot/dts/overlays/README | 12 ++++++--
+ arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 34 +++++++++++++++++++++++
+ 3 files changed, 45 insertions(+), 2 deletions(-)
+ create mode 100644 arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
+
+diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
+index c4186aa..bc7f4a9 100644
+--- a/arch/arm/boot/dts/overlays/Makefile
++++ b/arch/arm/boot/dts/overlays/Makefile
+@@ -42,6 +42,7 @@ dtbo-$(RPI_DT_OVERLAYS) += i2c-gpio.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += i2c-mux.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += i2c-pwm-pca9685a.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += i2c-rtc.dtbo
++dtbo-$(RPI_DT_OVERLAYS) += i2c-sensor.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += i2c0-bcm2708.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += i2c1-bcm2708.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += i2s-gpio28-31.dtbo
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index 4a77ee6..80ea3de 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -283,8 +283,7 @@ Params: swap_lr Reverse the channel allocation, which will also
+
+
+ Name: bmp085_i2c-sensor
+-Info: Configures the BMP085/BMP180 digital barometric pressure and temperature
+- sensors from Bosch Sensortec
++Info: This overlay is now deprecated - see i2c-sensor
+ Load: dtoverlay=bmp085_i2c-sensor
+ Params: <None>
+
+@@ -536,6 +535,15 @@ Params: abx80x Select one of the ABx80x family:
+ source
+
+
++Name: i2c-sensor
++Info: Adds support for a number of I2C barometric pressure and temperature
++ sensors on i2c_arm
++Load: dtoverlay=i2c-sensor,<param>=<val>
++Params: bmp085 Select the Bosch sensortronic BMP085
++
++ bmp280 Select the Bosch sensortronic BMP280
++
++
+ Name: i2c0-bcm2708
+ Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations
+ are usable on all platforms.
+diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
+new file mode 100644
+index 0000000..f6d134c
+--- /dev/null
++++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
+@@ -0,0 +1,34 @@
++// Definitions for a few digital barometric pressure and temperature sensors
++/dts-v1/;
++/plugin/;
++
++/ {
++ compatible = "brcm,bcm2708";
++
++ fragment at 0 {
++ target = <&i2c_arm>;
++ __overlay__ {
++ #address-cells = <1>;
++ #size-cells = <0>;
++ status = "okay";
++
++ bmp085: bmp085 at 77 {
++ compatible = "bosch,bmp085";
++ reg = <0x77>;
++ default-oversampling = <3>;
++ status = "disable";
++ };
++
++ bmp280: bmp280 at 76 {
++ compatible = "bosch,bmp280";
++ reg = <0x76>;
++ status = "disable";
++ };
++ };
++ };
++
++ __overrides__ {
++ bmp085 = <&bmp085>,"status";
++ bmp280 = <&bmp280>,"status";
++ };
++};
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0559-BCM270X_DT-overlays-overlay.dtb-overlays-.dtbo-1752.patch b/target/linux/brcm2708/patches-4.4/0559-BCM270X_DT-overlays-overlay.dtb-overlays-.dtbo-1752.patch
new file mode 100644
index 0000000..4b40d64
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0559-BCM270X_DT-overlays-overlay.dtb-overlays-.dtbo-1752.patch
@@ -0,0 +1,26 @@
+From 32b74f9dc3caa9d3422ffa735db0ecf088dbffbe Mon Sep 17 00:00:00 2001
+From: Georgii Staroselskii <gosha371 at gmail.com>
+Date: Wed, 7 Dec 2016 15:10:27 +0300
+Subject: [PATCH] BCM270X_DT: overlays/*-overlay.dtb -> overlays/*.dtbo (#1752)
+
+We now create overlays as .dtbo files.
+---
+ arch/arm/boot/dts/overlays/README | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index 80ea3de..7aee1af 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -61,7 +61,7 @@ this becomes a line in config.txt:
+
+ dtoverlay=lirc-rpi
+
+-This causes the file /boot/overlays/lirc-rpi-overlay.dtb to be loaded. By
++This causes the file /boot/overlays/lirc-rpi.dtbo to be loaded. By
+ default it will use GPIOs 17 (out) and 18 (in), but this can be modified using
+ DT parameters:
+
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0560-Revert-HID-dragonrise-fix-HID-Descriptor-for-0x0006-.patch b/target/linux/brcm2708/patches-4.4/0560-Revert-HID-dragonrise-fix-HID-Descriptor-for-0x0006-.patch
new file mode 100644
index 0000000..adfb1f6
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0560-Revert-HID-dragonrise-fix-HID-Descriptor-for-0x0006-.patch
@@ -0,0 +1,104 @@
+From e7b5643bfddd3ce80f4ade03a980da6b8979136d Mon Sep 17 00:00:00 2001
+From: Ioan-Adrian Ratiu <adi at adirat.com>
+Date: Tue, 27 Sep 2016 21:41:37 +0300
+Subject: [PATCH] Revert "HID: dragonrise: fix HID Descriptor for 0x0006 PID"
+
+[ Upstream commit 1bcaa05ebee115213e34f1806cc6a4f7a6175a88 ]
+This reverts commit 18339f59c3a6 ("HID: dragonrise: fix HID...") because it
+breaks certain dragonrise 0079:0006 gamepads. While it may fix a breakage
+caused by commit 79346d620e9d ("HID: input: force generic axis to be mapped
+to their user space axis"), it is probable that the manufacturer released
+different hardware with the same PID so this fix works for only a subset
+and breaks the other gamepads sharing the PID.
+
+What is needed is another more generic solution which fixes 79346d620e9d
+("HID: input: force generic axis ...") breakage for this controller: we
+need to add an exception for this driver to make it keep the old behaviour
+previous to the initial breakage (this is done in patch 2 of this series).
+
+Signed-off-by: Ioan-Adrian Ratiu <adi at adirat.com>
+Reviewed-by: Benjamin Tissoires <benjamin.tissoires at redhat.com>
+Signed-off-by: Jiri Kosina <jkosina at suse.cz>
+---
+ drivers/hid/hid-dr.c | 58 ----------------------------------------------------
+ 1 file changed, 58 deletions(-)
+
+diff --git a/drivers/hid/hid-dr.c b/drivers/hid/hid-dr.c
+index 1d78ba3..ce06444 100644
+--- a/drivers/hid/hid-dr.c
++++ b/drivers/hid/hid-dr.c
+@@ -234,58 +234,6 @@ static __u8 pid0011_rdesc_fixed[] = {
+ 0xC0 /* End Collection */
+ };
+
+-static __u8 pid0006_rdesc_fixed[] = {
+- 0x05, 0x01, /* Usage Page (Generic Desktop) */
+- 0x09, 0x04, /* Usage (Joystick) */
+- 0xA1, 0x01, /* Collection (Application) */
+- 0xA1, 0x02, /* Collection (Logical) */
+- 0x75, 0x08, /* Report Size (8) */
+- 0x95, 0x05, /* Report Count (5) */
+- 0x15, 0x00, /* Logical Minimum (0) */
+- 0x26, 0xFF, 0x00, /* Logical Maximum (255) */
+- 0x35, 0x00, /* Physical Minimum (0) */
+- 0x46, 0xFF, 0x00, /* Physical Maximum (255) */
+- 0x09, 0x30, /* Usage (X) */
+- 0x09, 0x33, /* Usage (Ry) */
+- 0x09, 0x32, /* Usage (Z) */
+- 0x09, 0x31, /* Usage (Y) */
+- 0x09, 0x34, /* Usage (Ry) */
+- 0x81, 0x02, /* Input (Variable) */
+- 0x75, 0x04, /* Report Size (4) */
+- 0x95, 0x01, /* Report Count (1) */
+- 0x25, 0x07, /* Logical Maximum (7) */
+- 0x46, 0x3B, 0x01, /* Physical Maximum (315) */
+- 0x65, 0x14, /* Unit (Centimeter) */
+- 0x09, 0x39, /* Usage (Hat switch) */
+- 0x81, 0x42, /* Input (Variable) */
+- 0x65, 0x00, /* Unit (None) */
+- 0x75, 0x01, /* Report Size (1) */
+- 0x95, 0x0C, /* Report Count (12) */
+- 0x25, 0x01, /* Logical Maximum (1) */
+- 0x45, 0x01, /* Physical Maximum (1) */
+- 0x05, 0x09, /* Usage Page (Button) */
+- 0x19, 0x01, /* Usage Minimum (0x01) */
+- 0x29, 0x0C, /* Usage Maximum (0x0C) */
+- 0x81, 0x02, /* Input (Variable) */
+- 0x06, 0x00, 0xFF, /* Usage Page (Vendor Defined) */
+- 0x75, 0x01, /* Report Size (1) */
+- 0x95, 0x08, /* Report Count (8) */
+- 0x25, 0x01, /* Logical Maximum (1) */
+- 0x45, 0x01, /* Physical Maximum (1) */
+- 0x09, 0x01, /* Usage (0x01) */
+- 0x81, 0x02, /* Input (Variable) */
+- 0xC0, /* End Collection */
+- 0xA1, 0x02, /* Collection (Logical) */
+- 0x75, 0x08, /* Report Size (8) */
+- 0x95, 0x07, /* Report Count (7) */
+- 0x46, 0xFF, 0x00, /* Physical Maximum (255) */
+- 0x26, 0xFF, 0x00, /* Logical Maximum (255) */
+- 0x09, 0x02, /* Usage (0x02) */
+- 0x91, 0x02, /* Output (Variable) */
+- 0xC0, /* End Collection */
+- 0xC0 /* End Collection */
+-};
+-
+ static __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+ unsigned int *rsize)
+ {
+@@ -296,12 +244,6 @@ static __u8 *dr_report_fixup(struct hid_device *hdev, __u8 *rdesc,
+ *rsize = sizeof(pid0011_rdesc_fixed);
+ }
+ break;
+- case 0x0006:
+- if (*rsize == sizeof(pid0006_rdesc_fixed)) {
+- rdesc = pid0006_rdesc_fixed;
+- *rsize = sizeof(pid0006_rdesc_fixed);
+- }
+- break;
+ }
+ return rdesc;
+ }
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch b/target/linux/brcm2708/patches-4.4/0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch
new file mode 100644
index 0000000..2892aea
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0561-bcm2835-rng-Avoid-initialising-if-already-enabled.patch
@@ -0,0 +1,31 @@
+From b7791eea502e0d98ae204750aff2abafc431fb11 Mon Sep 17 00:00:00 2001
+From: popcornmix <popcornmix at gmail.com>
+Date: Tue, 6 Dec 2016 17:05:39 +0000
+Subject: [PATCH] bcm2835-rng: Avoid initialising if already enabled
+
+Avoids the 0x40000 cycles of warmup again if firmware has already used it
+---
+ drivers/char/hw_random/bcm2835-rng.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/char/hw_random/bcm2835-rng.c b/drivers/char/hw_random/bcm2835-rng.c
+index 7192ec2..2ff49c1 100644
+--- a/drivers/char/hw_random/bcm2835-rng.c
++++ b/drivers/char/hw_random/bcm2835-rng.c
+@@ -62,9 +62,10 @@ static int bcm2835_rng_probe(struct platform_device *pdev)
+ bcm2835_rng_ops.priv = (unsigned long)rng_base;
+
+ /* set warm-up count & enable */
+- __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS);
+- __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL);
+-
++ if (!(__raw_readl(rng_base + RNG_CTRL) & RNG_RBGEN)) {
++ __raw_writel(RNG_WARMUP_COUNT, rng_base + RNG_STATUS);
++ __raw_writel(RNG_RBGEN, rng_base + RNG_CTRL);
++ }
+ /* register driver */
+ err = hwrng_register(&bcm2835_rng_ops);
+ if (err) {
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0562-Pisound-dynamic-overlay-1760.patch b/target/linux/brcm2708/patches-4.4/0562-Pisound-dynamic-overlay-1760.patch
new file mode 100644
index 0000000..b1aa05f
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0562-Pisound-dynamic-overlay-1760.patch
@@ -0,0 +1,151 @@
+From cdf6acdd6a6270538b0fdd08e79986d4a553062a Mon Sep 17 00:00:00 2001
+From: gtrainavicius <gtrainavicius at users.noreply.github.com>
+Date: Sat, 10 Dec 2016 16:05:25 +0200
+Subject: [PATCH] Pisound dynamic overlay (#1760)
+
+Restructuring pisound-overlay.dts, so it can be loaded and unloaded dynamically using dtoverlay.
+
+Print a logline when the kernel module is removed.
+---
+ arch/arm/boot/dts/overlays/pisound-overlay.dts | 94 ++++++++++++++------------
+ sound/soc/bcm/pisound.c | 2 +
+ 2 files changed, 52 insertions(+), 44 deletions(-)
+
+diff --git a/arch/arm/boot/dts/overlays/pisound-overlay.dts b/arch/arm/boot/dts/overlays/pisound-overlay.dts
+index 7cdfc29..5197e65 100644
+--- a/arch/arm/boot/dts/overlays/pisound-overlay.dts
++++ b/arch/arm/boot/dts/overlays/pisound-overlay.dts
+@@ -26,6 +26,54 @@
+ compatible = "brcm,bcm2708";
+
+ fragment at 0 {
++ target = <&spi0>;
++ __overlay__ {
++ status = "okay";
++ };
++ };
++
++ fragment at 1 {
++ target = <&spidev0>;
++ __overlay__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 2 {
++ target = <&spidev1>;
++ __overlay__ {
++ status = "okay";
++ };
++ };
++
++ fragment at 3 {
++ target = <&spi0>;
++ __overlay__ {
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ pisound_spi: pisound_spi at 0{
++ compatible = "blokaslabs,pisound-spi";
++ reg = <0>;
++ pinctrl-names = "default";
++ pinctrl-0 = <&spi0_pins>;
++ spi-max-frequency = <1000000>;
++ };
++ };
++ };
++
++ fragment at 4 {
++ target-path = "/";
++ __overlay__ {
++ pcm5102a-codec {
++ #sound-dai-cells = <0>;
++ compatible = "ti,pcm5102a";
++ status = "okay";
++ };
++ };
++ };
++
++ fragment at 5 {
+ target = <&sound>;
+ __overlay__ {
+ compatible = "blokaslabs,pisound";
+@@ -49,7 +97,7 @@
+ };
+ };
+
+- fragment at 1 {
++ fragment at 6 {
+ target = <&gpio>;
+ __overlay__ {
+ pinctrl-names = "default";
+@@ -63,52 +111,10 @@
+ };
+ };
+
+- fragment at 2 {
++ fragment at 7 {
+ target = <&i2s>;
+ __overlay__ {
+ status = "okay";
+ };
+ };
+-
+- fragment at 3 {
+- target-path = "/";
+- __overlay__ {
+- pcm5102a-codec {
+- #sound-dai-cells = <0>;
+- compatible = "ti,pcm5102a";
+- status = "okay";
+- };
+- };
+- };
+-
+- fragment at 4 {
+- target = <&spi0>;
+- __overlay__ {
+- status = "okay";
+-
+- spidev at 0{
+- status = "disabled";
+- };
+-
+- spidev at 1{
+- status = "okay";
+- };
+- };
+- };
+-
+- fragment at 5 {
+- target = <&spi0>;
+- __overlay__ {
+- #address-cells = <1>;
+- #size-cells = <0>;
+-
+- pisound_spi: pisound_spi at 0{
+- compatible = "blokaslabs,pisound-spi";
+- reg = <0>;
+- pinctrl-names = "default";
+- pinctrl-0 = <&spi0_pins>;
+- spi-max-frequency = <1000000>;
+- };
+- };
+- };
+ };
+diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c
+index a3cd089..30903fcf 100644
+--- a/sound/soc/bcm/pisound.c
++++ b/sound/soc/bcm/pisound.c
+@@ -954,6 +954,8 @@ static int pisnd_probe(struct platform_device *pdev)
+
+ static int pisnd_remove(struct platform_device *pdev)
+ {
++ printi("Unloading.\n");
++
+ if (pisnd_kobj) {
+ kobject_put(pisnd_kobj);
+ pisnd_kobj = NULL;
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0563-Add-support-for-Silicon-Labs-Si7013-20-21-humidity-t.patch b/target/linux/brcm2708/patches-4.4/0563-Add-support-for-Silicon-Labs-Si7013-20-21-humidity-t.patch
new file mode 100644
index 0000000..574702a
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0563-Add-support-for-Silicon-Labs-Si7013-20-21-humidity-t.patch
@@ -0,0 +1,95 @@
+From 72b5fe0084ce231fc0325cdf6151da0e83f5ef4e Mon Sep 17 00:00:00 2001
+From: Alex Tucker <alex at floop.org.uk>
+Date: Tue, 3 Jan 2017 21:30:41 +0000
+Subject: [PATCH] Add support for Silicon Labs Si7013/20/21
+ humidity/temperature sensor. (#1765)
+
+---
+ arch/arm/boot/dts/overlays/README | 3 ++
+ arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts | 49 +++++++++++++----------
+ 2 files changed, 31 insertions(+), 21 deletions(-)
+
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index 7aee1af..44ad21f 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -543,6 +543,9 @@ Params: bmp085 Select the Bosch sensortronic BMP085
+
+ bmp280 Select the Bosch sensortronic BMP280
+
++ si7020 Select the Silicon Labs Si7013/20/21 humidity/
++ temperature sensor
++
+
+ Name: i2c0-bcm2708
+ Info: Enable the i2c_bcm2708 driver for the i2c0 bus. Not all pin combinations
+diff --git a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
+index f6d134c..31bda8d 100644
+--- a/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
++++ b/arch/arm/boot/dts/overlays/i2c-sensor-overlay.dts
+@@ -1,34 +1,41 @@
+-// Definitions for a few digital barometric pressure and temperature sensors
++// Definitions for I2C based sensors using the Industrial IO interface.
+ /dts-v1/;
+ /plugin/;
+
+ / {
+- compatible = "brcm,bcm2708";
++ compatible = "brcm,bcm2708";
+
+- fragment at 0 {
+- target = <&i2c_arm>;
+- __overlay__ {
+- #address-cells = <1>;
+- #size-cells = <0>;
+- status = "okay";
++ fragment at 0 {
++ target = <&i2c_arm>;
++ __overlay__ {
++ #address-cells = <1>;
++ #size-cells = <0>;
++ status = "okay";
+
+- bmp085: bmp085 at 77 {
+- compatible = "bosch,bmp085";
+- reg = <0x77>;
+- default-oversampling = <3>;
+- status = "disable";
+- };
++ bmp085: bmp085 at 77 {
++ compatible = "bosch,bmp085";
++ reg = <0x77>;
++ default-oversampling = <3>;
++ status = "disable";
++ };
+
+- bmp280: bmp280 at 76 {
+- compatible = "bosch,bmp280";
+- reg = <0x76>;
+- status = "disable";
+- };
+- };
+- };
++ bmp280: bmp280 at 76 {
++ compatible = "bosch,bmp280";
++ reg = <0x76>;
++ status = "disable";
++ };
++
++ si7020: si7020 at 40 {
++ compatible = "si7020";
++ reg = <0x40>;
++ status = "disable";
++ };
++ };
++ };
+
+ __overrides__ {
+ bmp085 = <&bmp085>,"status";
+ bmp280 = <&bmp280>,"status";
++ si7020 = <&si7020>,"status";
+ };
+ };
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0564-pisound-improvements-1778.patch b/target/linux/brcm2708/patches-4.4/0564-pisound-improvements-1778.patch
new file mode 100644
index 0000000..4b6c569
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0564-pisound-improvements-1778.patch
@@ -0,0 +1,299 @@
+From ed621cdfdf0a5acf35079208818c9648f44ec638 Mon Sep 17 00:00:00 2001
+From: gtrainavicius <gtrainavicius at users.noreply.github.com>
+Date: Thu, 5 Jan 2017 17:08:45 +0200
+Subject: [PATCH] pisound improvements: (#1778)
+
+* Added a writable sysfs object to enable scripts / user space software
+to blink MIDI activity LEDs for variable duration.
+* Improved hw_param constraints setting.
+* Added compatibility with S16_LE sample format.
+* Exposed some simple placeholder volume controls, so the card appears
+in volumealsa widget.
+
+Signed-off-by: Giedrius Trainavicius <giedrius at blokas.io>
+---
+ sound/soc/bcm/pisound.c | 175 ++++++++++++++++++++++++++++++++++++++++++------
+ 1 file changed, 154 insertions(+), 21 deletions(-)
+
+diff --git a/sound/soc/bcm/pisound.c b/sound/soc/bcm/pisound.c
+index 30903fcf..d317eb9 100644
+--- a/sound/soc/bcm/pisound.c
++++ b/sound/soc/bcm/pisound.c
+@@ -36,6 +36,7 @@
+ #include <sound/jack.h>
+ #include <sound/rawmidi.h>
+ #include <sound/asequencer.h>
++#include <sound/control.h>
+
+ static int pisnd_spi_init(struct device *dev);
+ static void pisnd_spi_uninit(void);
+@@ -214,6 +215,9 @@ static char g_serial_num[11];
+ static char g_id[25];
+ static char g_version[5];
+
++static uint8_t g_ledFlashDuration;
++static bool g_ledFlashDurationChanged;
++
+ DEFINE_KFIFO(spi_fifo_in, uint8_t, FIFO_SIZE);
+ DEFINE_KFIFO(spi_fifo_out, uint8_t, FIFO_SIZE);
+
+@@ -396,8 +400,13 @@ static void pisnd_work_handler(struct work_struct *work)
+ val = 0;
+ tx = 0;
+
+- if (kfifo_get(&spi_fifo_out, &val))
++ if (g_ledFlashDurationChanged) {
++ tx = 0xf000 | g_ledFlashDuration;
++ g_ledFlashDuration = 0;
++ g_ledFlashDurationChanged = false;
++ } else if (kfifo_get(&spi_fifo_out, &val)) {
+ tx = 0x0f00 | val;
++ }
+
+ rx = spi_transfer16(tx);
+
+@@ -410,6 +419,7 @@ static void pisnd_work_handler(struct work_struct *work)
+ } while (rx != 0
+ || !kfifo_is_empty(&spi_fifo_out)
+ || pisnd_spi_has_more()
++ || g_ledFlashDurationChanged
+ );
+
+ if (!kfifo_is_empty(&spi_fifo_in) && g_recvCallback)
+@@ -569,7 +579,7 @@ static int pisnd_spi_init(struct device *dev)
+ }
+
+ /* Flash the LEDs. */
+- spi_transfer16(0xf000);
++ spi_transfer16(0xf008);
+
+ ret = pisnd_spi_gpio_irq_init(dev);
+ if (ret < 0) {
+@@ -610,6 +620,14 @@ static void pisnd_spi_uninit(void)
+ pisnd_spi_gpio_uninit();
+ }
+
++static void pisnd_spi_flash_leds(uint8_t duration)
++{
++ g_ledFlashDuration = duration;
++ g_ledFlashDurationChanged = true;
++ printd("schedule from spi_flash_leds\n");
++ pisnd_schedule_process(TASK_PROCESS);
++}
++
+ static void pisnd_spi_send(uint8_t val)
+ {
+ kfifo_put(&spi_fifo_out, val);
+@@ -658,6 +676,83 @@ static const struct of_device_id pisound_of_match[] = {
+ {},
+ };
+
++enum {
++ SWITCH = 0,
++ VOLUME = 1,
++};
++
++static int pisnd_ctl_info(struct snd_kcontrol *kcontrol,
++ struct snd_ctl_elem_info *uinfo)
++{
++ if (kcontrol->private_value == SWITCH) {
++ uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
++ uinfo->count = 1;
++ uinfo->value.integer.min = 0;
++ uinfo->value.integer.max = 1;
++ return 0;
++ } else if (kcontrol->private_value == VOLUME) {
++ uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
++ uinfo->count = 1;
++ uinfo->value.integer.min = 0;
++ uinfo->value.integer.max = 100;
++ return 0;
++ }
++ return -EINVAL;
++}
++
++static int pisnd_ctl_get(struct snd_kcontrol *kcontrol,
++ struct snd_ctl_elem_value *ucontrol)
++{
++ if (kcontrol->private_value == SWITCH) {
++ ucontrol->value.integer.value[0] = 1;
++ return 0;
++ } else if (kcontrol->private_value == VOLUME) {
++ ucontrol->value.integer.value[0] = 100;
++ return 0;
++ }
++
++ return -EINVAL;
++}
++
++static struct snd_kcontrol_new pisnd_ctl[] = {
++ {
++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
++ .name = "PCM Playback Switch",
++ .index = 0,
++ .private_value = SWITCH,
++ .access = SNDRV_CTL_ELEM_ACCESS_READ,
++ .info = pisnd_ctl_info,
++ .get = pisnd_ctl_get,
++ },
++ {
++ .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
++ .name = "PCM Playback Volume",
++ .index = 0,
++ .private_value = VOLUME,
++ .access = SNDRV_CTL_ELEM_ACCESS_READ,
++ .info = pisnd_ctl_info,
++ .get = pisnd_ctl_get,
++ },
++};
++
++static int pisnd_ctl_init(struct snd_card *card)
++{
++ int err, i;
++
++ for (i = 0; i < ARRAY_SIZE(pisnd_ctl); ++i) {
++ err = snd_ctl_add(card, snd_ctl_new1(&pisnd_ctl[i], NULL));
++ if (err < 0)
++ return err;
++ }
++
++ return 0;
++}
++
++static int pisnd_ctl_uninit(void)
++{
++ return 0;
++}
++
+ static struct gpio_desc *osr0, *osr1, *osr2;
+ static struct gpio_desc *reset;
+ static struct gpio_desc *button;
+@@ -667,6 +762,14 @@ static int pisnd_hw_params(
+ struct snd_pcm_hw_params *params
+ )
+ {
++ struct snd_soc_pcm_runtime *rtd = substream->private_data;
++ struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
++
++ /* pisound runs on fixed 32 clock counts per channel,
++ * as generated by the master ADC.
++ */
++ snd_soc_dai_set_bclk_ratio(cpu_dai, 32*2);
++
+ printd("rate = %d\n", params_rate(params));
+ printd("ch = %d\n", params_channels(params));
+ printd("bits = %u\n",
+@@ -711,16 +814,6 @@ static struct snd_pcm_hw_constraint_list constraints_rates = {
+ .mask = 0,
+ };
+
+-static unsigned int sample_bits[] = {
+- 24, 32
+-};
+-
+-static struct snd_pcm_hw_constraint_list constraints_sample_bits = {
+- .count = ARRAY_SIZE(sample_bits),
+- .list = sample_bits,
+- .mask = 0,
+-};
+-
+ static int pisnd_startup(struct snd_pcm_substream *substream)
+ {
+ int err = snd_pcm_hw_constraint_list(
+@@ -733,11 +826,21 @@ static int pisnd_startup(struct snd_pcm_substream *substream)
+ if (err < 0)
+ return err;
+
+- err = snd_pcm_hw_constraint_list(
++ err = snd_pcm_hw_constraint_single(
+ substream->runtime,
+- 0,
+- SNDRV_PCM_HW_PARAM_SAMPLE_BITS,
+- &constraints_sample_bits
++ SNDRV_PCM_HW_PARAM_CHANNELS,
++ 2
++ );
++
++ if (err < 0)
++ return err;
++
++ err = snd_pcm_hw_constraint_mask64(
++ substream->runtime,
++ SNDRV_PCM_HW_PARAM_FORMAT,
++ SNDRV_PCM_FMTBIT_S16_LE |
++ SNDRV_PCM_FMTBIT_S24_LE |
++ SNDRV_PCM_FMTBIT_S32_LE
+ );
+
+ if (err < 0)
+@@ -771,14 +874,23 @@ static int pisnd_card_probe(struct snd_soc_card *card)
+ {
+ int err = pisnd_midi_init(card->snd_card);
+
+- if (err < 0)
++ if (err < 0) {
+ printe("pisnd_midi_init failed: %d\n", err);
++ return err;
++ }
+
+- return err;
++ err = pisnd_ctl_init(card->snd_card);
++ if (err < 0) {
++ printe("pisnd_ctl_init failed: %d\n", err);
++ return err;
++ }
++
++ return 0;
+ }
+
+ static int pisnd_card_remove(struct snd_soc_card *card)
+ {
++ pisnd_ctl_uninit();
+ pisnd_midi_uninit();
+ return 0;
+ }
+@@ -870,17 +982,38 @@ static ssize_t pisnd_version_show(
+ return sprintf(buf, "%s\n", pisnd_spi_get_version());
+ }
+
++static ssize_t pisnd_led_store(
++ struct kobject *kobj,
++ struct kobj_attribute *attr,
++ const char *buf,
++ size_t length
++ )
++{
++ uint32_t timeout;
++ int err;
++
++ err = kstrtou32(buf, 10, &timeout);
++
++ if (err == 0 && timeout <= 255)
++ pisnd_spi_flash_leds(timeout);
++
++ return length;
++}
++
+ static struct kobj_attribute pisnd_serial_attribute =
+- __ATTR(serial, 0644, pisnd_serial_show, NULL);
++ __ATTR(serial, 0444, pisnd_serial_show, NULL);
+ static struct kobj_attribute pisnd_id_attribute =
+- __ATTR(id, 0644, pisnd_id_show, NULL);
++ __ATTR(id, 0444, pisnd_id_show, NULL);
+ static struct kobj_attribute pisnd_version_attribute =
+- __ATTR(version, 0644, pisnd_version_show, NULL);
++ __ATTR(version, 0444, pisnd_version_show, NULL);
++static struct kobj_attribute pisnd_led_attribute =
++ __ATTR(led, 0644, NULL, pisnd_led_store);
+
+ static struct attribute *attrs[] = {
+ &pisnd_serial_attribute.attr,
+ &pisnd_id_attribute.attr,
+ &pisnd_version_attribute.attr,
++ &pisnd_led_attribute.attr,
+ NULL
+ };
+
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0565-Add-driver_name-properties-to-JustBoom-drivers-1787.patch b/target/linux/brcm2708/patches-4.4/0565-Add-driver_name-properties-to-JustBoom-drivers-1787.patch
new file mode 100644
index 0000000..cee6180
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0565-Add-driver_name-properties-to-JustBoom-drivers-1787.patch
@@ -0,0 +1,39 @@
+From 0ec03b021ee12ab6c30bcc8cb617cc4b87384d25 Mon Sep 17 00:00:00 2001
+From: Aaron Shaw <shawaj at gmail.com>
+Date: Tue, 10 Jan 2017 16:22:53 +0000
+Subject: [PATCH] Add driver_name properties to JustBoom drivers (#1787)
+
+Add driver name properties for use with 5.1 passthrough audio in LibreElec
+and other Kodi based OSs
+---
+ sound/soc/bcm/justboom-dac.c | 1 +
+ sound/soc/bcm/justboom-digi.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/sound/soc/bcm/justboom-dac.c b/sound/soc/bcm/justboom-dac.c
+index 8fd50db..05a224e 100644
+--- a/sound/soc/bcm/justboom-dac.c
++++ b/sound/soc/bcm/justboom-dac.c
+@@ -98,6 +98,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_dac_dai[] = {
+ /* audio machine driver */
+ static struct snd_soc_card snd_rpi_justboom_dac = {
+ .name = "snd_rpi_justboom_dac",
++ .driver_name = "JustBoomDac",
+ .owner = THIS_MODULE,
+ .dai_link = snd_rpi_justboom_dac_dai,
+ .num_links = ARRAY_SIZE(snd_rpi_justboom_dac_dai),
+diff --git a/sound/soc/bcm/justboom-digi.c b/sound/soc/bcm/justboom-digi.c
+index 91acb66..abfdc5c 100644
+--- a/sound/soc/bcm/justboom-digi.c
++++ b/sound/soc/bcm/justboom-digi.c
+@@ -154,6 +154,7 @@ static struct snd_soc_dai_link snd_rpi_justboom_digi_dai[] = {
+ /* audio machine driver */
+ static struct snd_soc_card snd_rpi_justboom_digi = {
+ .name = "snd_rpi_justboom_digi",
++ .driver_name = "JustBoomDigi",
+ .owner = THIS_MODULE,
+ .dai_link = snd_rpi_justboom_digi_dai,
+ .num_links = ARRAY_SIZE(snd_rpi_justboom_digi_dai),
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0566-bcm2835-i2s-Changes-for-allowing-asymmetric-sample-f.patch b/target/linux/brcm2708/patches-4.4/0566-bcm2835-i2s-Changes-for-allowing-asymmetric-sample-f.patch
new file mode 100644
index 0000000..e435718
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0566-bcm2835-i2s-Changes-for-allowing-asymmetric-sample-f.patch
@@ -0,0 +1,101 @@
+From b97a67a14e5c5904b84e52150e0d13da794fc9d7 Mon Sep 17 00:00:00 2001
+From: gtrainavicius <gtrainavicius at users.noreply.github.com>
+Date: Tue, 10 Jan 2017 21:59:39 +0200
+Subject: [PATCH] bcm2835-i2s: Changes for allowing asymmetric sample formats.
+ (#1783)
+
+This is achieved by making changes only to the requested
+stream direction format, keeping the other stream direction
+configuration intact.
+
+Signed-off-by: Giedrius Trainavicius <giedrius at blokas.io>
+---
+ sound/soc/bcm/bcm2835-i2s.c | 54 +++++++++++++++++++++++++++++++--------------
+ 1 file changed, 38 insertions(+), 16 deletions(-)
+
+diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
+index aedb01f..d2b0801 100644
+--- a/sound/soc/bcm/bcm2835-i2s.c
++++ b/sound/soc/bcm/bcm2835-i2s.c
+@@ -310,6 +310,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+ unsigned int sampling_rate = params_rate(params);
+ unsigned int data_length, data_delay, bclk_ratio;
+ unsigned int ch1pos, ch2pos, mode, format;
++ unsigned int previous_ftxp, previous_frxp;
+ unsigned int mash = BCM2835_CLK_MASH_1;
+ unsigned int divi, divf, target_frequency;
+ int clk_src = -1;
+@@ -320,6 +321,7 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+ bool frame_master = (master == SND_SOC_DAIFMT_CBS_CFS
+ || master == SND_SOC_DAIFMT_CBM_CFS);
+ uint32_t csreg;
++ bool packed;
+
+ /*
+ * If a stream is already enabled,
+@@ -465,26 +467,46 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+ return -EINVAL;
+ }
+
+- /*
+- * Set format for both streams.
+- * We cannot set another frame length
+- * (and therefore word length) anyway,
+- * so the format will be the same.
+- */
+- regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
+- regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
++ /* Set the format for the matching stream direction. */
++ switch (substream->stream) {
++ case SNDRV_PCM_STREAM_PLAYBACK:
++ regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
++ break;
++ case SNDRV_PCM_STREAM_CAPTURE:
++ regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
++ break;
++ default:
++ return -EINVAL;
++ }
+
+ /* Setup the I2S mode */
++ /* Keep existing FTXP and FRXP values. */
++ regmap_read(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, &mode);
++
++ previous_ftxp = mode & BCM2835_I2S_FTXP;
++ previous_frxp = mode & BCM2835_I2S_FRXP;
++
+ mode = 0;
+
+- if (data_length <= 16) {
+- /*
+- * Use frame packed mode (2 channels per 32 bit word)
+- * We cannot set another frame length in the second stream
+- * (and therefore word length) anyway,
+- * so the format will be the same.
+- */
+- mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP;
++ /*
++ * Retain the frame packed mode (2 channels per 32 bit word)
++ * of the other direction stream intact. The formats of each
++ * direction can be different as long as the frame length is
++ * shared for both.
++ */
++ packed = data_length <= 16;
++
++ switch (substream->stream) {
++ case SNDRV_PCM_STREAM_PLAYBACK:
++ mode |= previous_frxp;
++ mode |= packed ? BCM2835_I2S_FTXP : 0;
++ break;
++ case SNDRV_PCM_STREAM_CAPTURE:
++ mode |= previous_ftxp;
++ mode |= packed ? BCM2835_I2S_FRXP : 0;
++ break;
++ default:
++ return -EINVAL;
+ }
+
+ mode |= BCM2835_I2S_FLEN(bclk_ratio - 1);
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0567-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch b/target/linux/brcm2708/patches-4.4/0567-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch
new file mode 100644
index 0000000..13aa1bd
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0567-BCM270X_DT-Add-pi3-disable-wifi-overlay.patch
@@ -0,0 +1,66 @@
+From 2abc666d62828bbc2889f31ebfb3754a55a51fb9 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Wed, 11 Jan 2017 13:01:21 +0000
+Subject: [PATCH] BCM270X_DT: Add pi3-disable-wifi overlay
+
+pi3-disable-wifi is a minimal overlay to disable the onboard WiFi.
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ arch/arm/boot/dts/overlays/Makefile | 1 +
+ arch/arm/boot/dts/overlays/README | 6 ++++++
+ arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts | 13 +++++++++++++
+ 3 files changed, 20 insertions(+)
+ create mode 100644 arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
+
+diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
+index bc7f4a9..05eda03 100644
+--- a/arch/arm/boot/dts/overlays/Makefile
++++ b/arch/arm/boot/dts/overlays/Makefile
+@@ -61,6 +61,7 @@ dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += mz61581.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += pi3-act-led.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += pi3-disable-bt.dtbo
++dtbo-$(RPI_DT_OVERLAYS) += pi3-disable-wifi.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += pi3-miniuart-bt.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += piscreen.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += piscreen2r.dtbo
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index 44ad21f..adb86bc 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -793,6 +793,12 @@ Load: dtoverlay=pi3-disable-bt
+ Params: <None>
+
+
++Name: pi3-disable-wifi
++Info: Disable Pi3 onboard WiFi
++Load: dtoverlay=pi3-disable-wifi
++Params: <None>
++
++
+ Name: pi3-miniuart-bt
+ Info: Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore
+ UART0/ttyAMA0 over GPIOs 14 & 15. Note that this may reduce the maximum
+diff --git a/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
+new file mode 100644
+index 0000000..0171995
+--- /dev/null
++++ b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
+@@ -0,0 +1,13 @@
++/dts-v1/;
++/plugin/;
++
++/{
++ compatible = "brcm,bcm2708";
++
++ fragment at 0 {
++ target = <&mmc>;
++ __overlay__ {
++ status = "disabled";
++ };
++ };
++};
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch b/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
new file mode 100644
index 0000000..fcc2d60
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0568-configfs-Remove-ppos-increment-in-configfs_write_bin.patch
@@ -0,0 +1,54 @@
+From b928add95c9ddaa70b591da00d129558535d14d3 Mon Sep 17 00:00:00 2001
+From: Marek Vasut <marex at denx.de>
+Date: Wed, 18 May 2016 16:16:51 +0200
+Subject: [PATCH] configfs: Remove ppos increment in configfs_write_bin_file
+
+[ Back-port of f8608985f851c917b3884b692d8e326b0210d34e ]
+
+The simple_write_to_buffer() already increments the @ppos on success,
+see fs/libfs.c simple_write_to_buffer() comment:
+
+"
+On success, the number of bytes written is returned and the offset @ppos
+advanced by this number, or negative value is returned on error.
+"
+
+If the configfs_write_bin_file() is invoked with @count smaller than the
+total length of the written binary file, it will be invoked multiple times.
+Since configfs_write_bin_file() increments @ppos on success, after calling
+simple_write_to_buffer(), the @ppos is incremented twice.
+
+Subsequent invocation of configfs_write_bin_file() will result in the next
+piece of data being written to the offset twice as long as the length of
+the previous write, thus creating buffer with "holes" in it.
+
+The simple testcase using DTO follows:
+ $ mkdir /sys/kernel/config/device-tree/overlays/1
+ $ dd bs=1 if=foo.dtbo of=/sys/kernel/config/device-tree/overlays/1/dtbo
+Without this patch, the testcase will result in twice as big buffer in the
+kernel, which is then passed to the cfs_overlay_item_dtbo_write() .
+
+Signed-off-by: Marek Vasut <marex at denx.de>
+Cc: Geert Uytterhoeven <geert+renesas at glider.be>
+Cc: Christoph Hellwig <hch at lst.de>
+Cc: Pantelis Antoniou <pantelis.antoniou at konsulko.com>
+---
+ fs/configfs/file.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/fs/configfs/file.c b/fs/configfs/file.c
+index 3687187..6e322f2 100644
+--- a/fs/configfs/file.c
++++ b/fs/configfs/file.c
+@@ -357,8 +357,6 @@ configfs_write_bin_file(struct file *file, const char __user *buf,
+
+ len = simple_write_to_buffer(buffer->bin_buffer,
+ buffer->bin_buffer_size, ppos, buf, count);
+- if (len > 0)
+- *ppos += len;
+ out:
+ mutex_unlock(&buffer->mutex);
+ return len;
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0569-config-Add-CONFIG_DM_CACHE.patch b/target/linux/brcm2708/patches-4.4/0569-config-Add-CONFIG_DM_CACHE.patch
new file mode 100644
index 0000000..929a12a
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0569-config-Add-CONFIG_DM_CACHE.patch
@@ -0,0 +1,38 @@
+From d560d7f385d0988d7747e9078a2330e4db4f28b8 Mon Sep 17 00:00:00 2001
+From: popcornmix <popcornmix at gmail.com>
+Date: Sun, 15 Jan 2017 21:56:59 +0000
+Subject: [PATCH] config: Add CONFIG_DM_CACHE See:
+ https://github.com/raspberrypi/linux/issues/1793
+
+---
+ arch/arm/configs/bcm2709_defconfig | 1 +
+ arch/arm/configs/bcmrpi_defconfig | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index c7606f2..0d07eed 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -438,6 +438,7 @@ CONFIG_BLK_DEV_DM=m
+ CONFIG_DM_CRYPT=m
+ CONFIG_DM_SNAPSHOT=m
+ CONFIG_DM_THIN_PROVISIONING=m
++CONFIG_DM_CACHE=m
+ CONFIG_DM_MIRROR=m
+ CONFIG_DM_LOG_USERSPACE=m
+ CONFIG_DM_RAID=m
+diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
+index 8121ad2..51640cb 100644
+--- a/arch/arm/configs/bcmrpi_defconfig
++++ b/arch/arm/configs/bcmrpi_defconfig
+@@ -431,6 +431,7 @@ CONFIG_BLK_DEV_DM=m
+ CONFIG_DM_CRYPT=m
+ CONFIG_DM_SNAPSHOT=m
+ CONFIG_DM_THIN_PROVISIONING=m
++CONFIG_DM_CACHE=m
+ CONFIG_DM_MIRROR=m
+ CONFIG_DM_LOG_USERSPACE=m
+ CONFIG_DM_RAID=m
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0570-BCM270X_DT-Add-spi0-cs-overlay.patch b/target/linux/brcm2708/patches-4.4/0570-BCM270X_DT-Add-spi0-cs-overlay.patch
new file mode 100644
index 0000000..3128cf2
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0570-BCM270X_DT-Add-spi0-cs-overlay.patch
@@ -0,0 +1,91 @@
+From 1a2339385e478e3ae3ee4f79edbfefd7fd22e96c Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Mon, 16 Jan 2017 14:53:12 +0000
+Subject: [PATCH] BCM270X_DT: Add spi0-cs overlay
+
+The spi0-cs overlay allows the software chip selectts to be modified
+using the cs0_pin and cs1_pin parameters.
+---
+ arch/arm/boot/dts/overlays/Makefile | 1 +
+ arch/arm/boot/dts/overlays/README | 9 +++++++-
+ arch/arm/boot/dts/overlays/spi0-cs-overlay.dts | 29 ++++++++++++++++++++++++++
+ 3 files changed, 38 insertions(+), 1 deletion(-)
+ create mode 100644 arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
+
+diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
+index 05eda03..72f2d90a 100644
+--- a/arch/arm/boot/dts/overlays/Makefile
++++ b/arch/arm/boot/dts/overlays/Makefile
+@@ -93,6 +93,7 @@ dtbo-$(RPI_DT_OVERLAYS) += smi-dev.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += smi-nand.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += spi-gpio35-39.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += spi-rtc.dtbo
++dtbo-$(RPI_DT_OVERLAYS) += spi0-cs.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += spi0-hw-cs.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += spi1-1cs.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += spi1-2cs.dtbo
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index adb86bc..7f4bd29 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -1131,7 +1131,7 @@ Params: <None>
+
+
+ Name: spi-gpio35-39
+-Info: move SPI function block to GPIO 35 to 39
++Info: Move SPI function block to GPIO 35 to 39
+ Load: dtoverlay=spi-gpio35-39
+ Params: <None>
+
+@@ -1142,6 +1142,13 @@ Load: dtoverlay=spi-rtc,<param>=<val>
+ Params: pcf2123 Select the PCF2123 device
+
+
++Name: spi0-cs
++Info: Allows the (software) CS pins for SPI0 to be changed
++Load: dtoverlay=spi0-cs,<param>=<val>
++Params: cs0_pin GPIO pin for CS0 (default 8)
++ cs1_pin GPIO pin for CS1 (default 7)
++
++
+ Name: spi0-hw-cs
+ Info: Re-enables hardware CS/CE (chip selects) for SPI0
+ Load: dtoverlay=spi0-hw-cs
+diff --git a/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts b/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
+new file mode 100644
+index 0000000..7f79029
+--- /dev/null
++++ b/arch/arm/boot/dts/overlays/spi0-cs-overlay.dts
+@@ -0,0 +1,29 @@
++/dts-v1/;
++/plugin/;
++
++
++/ {
++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
++
++ fragment at 0 {
++ target = <&spi0_cs_pins>;
++ frag0: __overlay__ {
++ brcm,pins = <8 7>;
++ };
++ };
++
++ fragment at 1 {
++ target = <&spi0>;
++ frag1: __overlay__ {
++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
++ status = "okay";
++ };
++ };
++
++ __overrides__ {
++ cs0_pin = <&frag0>,"brcm,pins:0",
++ <&frag1>,"cs-gpios:4";
++ cs1_pin = <&frag0>,"brcm,pins:4",
++ <&frag1>,"cs-gpios:16";
++ };
++};
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch b/target/linux/brcm2708/patches-4.4/0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch
new file mode 100644
index 0000000..3904abb
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch
@@ -0,0 +1,101 @@
+From ba1f22a0d2179a0201e764c341d9dbf8f1c27ffe Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Mon, 16 Jan 2017 20:58:18 +0000
+Subject: [PATCH] Revert "bcm2835-i2s: Changes for allowing asymmetric sample
+ formats. (#1783)"
+
+This reverts commit 4897c5c2f7adb4f77d638121e9959174dff87b9c.
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+
+See: https://github.com/raspberrypi/linux/issues/1799
+---
+ sound/soc/bcm/bcm2835-i2s.c | 54 ++++++++++++++-------------------------------
+ 1 file changed, 16 insertions(+), 38 deletions(-)
+
+diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
+index d2b0801..aedb01f 100644
+--- a/sound/soc/bcm/bcm2835-i2s.c
++++ b/sound/soc/bcm/bcm2835-i2s.c
+@@ -310,7 +310,6 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+ unsigned int sampling_rate = params_rate(params);
+ unsigned int data_length, data_delay, bclk_ratio;
+ unsigned int ch1pos, ch2pos, mode, format;
+- unsigned int previous_ftxp, previous_frxp;
+ unsigned int mash = BCM2835_CLK_MASH_1;
+ unsigned int divi, divf, target_frequency;
+ int clk_src = -1;
+@@ -321,7 +320,6 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+ bool frame_master = (master == SND_SOC_DAIFMT_CBS_CFS
+ || master == SND_SOC_DAIFMT_CBM_CFS);
+ uint32_t csreg;
+- bool packed;
+
+ /*
+ * If a stream is already enabled,
+@@ -467,46 +465,26 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
+ return -EINVAL;
+ }
+
+- /* Set the format for the matching stream direction. */
+- switch (substream->stream) {
+- case SNDRV_PCM_STREAM_PLAYBACK:
+- regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
+- break;
+- case SNDRV_PCM_STREAM_CAPTURE:
+- regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
+- break;
+- default:
+- return -EINVAL;
+- }
++ /*
++ * Set format for both streams.
++ * We cannot set another frame length
++ * (and therefore word length) anyway,
++ * so the format will be the same.
++ */
++ regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
++ regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
+
+ /* Setup the I2S mode */
+- /* Keep existing FTXP and FRXP values. */
+- regmap_read(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, &mode);
+-
+- previous_ftxp = mode & BCM2835_I2S_FTXP;
+- previous_frxp = mode & BCM2835_I2S_FRXP;
+-
+ mode = 0;
+
+- /*
+- * Retain the frame packed mode (2 channels per 32 bit word)
+- * of the other direction stream intact. The formats of each
+- * direction can be different as long as the frame length is
+- * shared for both.
+- */
+- packed = data_length <= 16;
+-
+- switch (substream->stream) {
+- case SNDRV_PCM_STREAM_PLAYBACK:
+- mode |= previous_frxp;
+- mode |= packed ? BCM2835_I2S_FTXP : 0;
+- break;
+- case SNDRV_PCM_STREAM_CAPTURE:
+- mode |= previous_ftxp;
+- mode |= packed ? BCM2835_I2S_FRXP : 0;
+- break;
+- default:
+- return -EINVAL;
++ if (data_length <= 16) {
++ /*
++ * Use frame packed mode (2 channels per 32 bit word)
++ * We cannot set another frame length in the second stream
++ * (and therefore word length) anyway,
++ * so the format will be the same.
++ */
++ mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP;
+ }
+
+ mode |= BCM2835_I2S_FLEN(bclk_ratio - 1);
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0572-BCM270X_DT-Enable-UART0-on-CM3.patch b/target/linux/brcm2708/patches-4.4/0572-BCM270X_DT-Enable-UART0-on-CM3.patch
new file mode 100644
index 0000000..a28b298
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0572-BCM270X_DT-Enable-UART0-on-CM3.patch
@@ -0,0 +1,28 @@
+From ab03c5487ebcb3f7a87609792d7f0888c2655657 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Tue, 17 Jan 2017 11:34:58 +0000
+Subject: [PATCH] BCM270X_DT: Enable UART0 on CM3
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
+index 98e6f92..7ceb16b 100644
+--- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
++++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
+@@ -7,6 +7,10 @@
+ model = "Raspberry Pi Compute Module 3";
+ };
+
++&uart0 {
++ status = "okay";
++};
++
+ &gpio {
+ sdhost_pins: sdhost_pins {
+ brcm,pins = <48 49 50 51 52 53>;
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0573-config-Add-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch b/target/linux/brcm2708/patches-4.4/0573-config-Add-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch
new file mode 100644
index 0000000..8075f6c
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0573-config-Add-CONFIG_MD_M25P80-and-CONFIG_MD_SPI_NOR.patch
@@ -0,0 +1,44 @@
+From 3a1a399aeeea62610498b5a54d6e28a9c8e4df3f Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Tue, 17 Jan 2017 14:39:39 +0000
+Subject: [PATCH] config: Add CONFIG_MD_M25P80 and CONFIG_MD_SPI_NOR
+
+See: https://github.com/raspberrypi/linux/issues/1781
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ arch/arm/configs/bcm2709_defconfig | 2 ++
+ arch/arm/configs/bcmrpi_defconfig | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index 0d07eed..1085058 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -407,7 +407,9 @@ CONFIG_DMA_CMA=y
+ CONFIG_CMA_SIZE_MBYTES=5
+ CONFIG_MTD=m
+ CONFIG_MTD_BLOCK=m
++CONFIG_MTD_M25P80=m
+ CONFIG_MTD_NAND=m
++CONFIG_MTD_SPI_NOR=m
+ CONFIG_MTD_UBI=m
+ CONFIG_OF_CONFIGFS=y
+ CONFIG_ZRAM=m
+diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
+index 51640cb..ca52c36 100644
+--- a/arch/arm/configs/bcmrpi_defconfig
++++ b/arch/arm/configs/bcmrpi_defconfig
+@@ -400,7 +400,9 @@ CONFIG_DMA_CMA=y
+ CONFIG_CMA_SIZE_MBYTES=5
+ CONFIG_MTD=m
+ CONFIG_MTD_BLOCK=m
++CONFIG_MTD_M25P80=m
+ CONFIG_MTD_NAND=m
++CONFIG_MTD_SPI_NOR=m
+ CONFIG_MTD_UBI=m
+ CONFIG_OF_CONFIGFS=y
+ CONFIG_ZRAM=m
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0574-config-More-USB-config-options-for-bcm2709_defconfig.patch b/target/linux/brcm2708/patches-4.4/0574-config-More-USB-config-options-for-bcm2709_defconfig.patch
new file mode 100644
index 0000000..f9f3d48
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0574-config-More-USB-config-options-for-bcm2709_defconfig.patch
@@ -0,0 +1,53 @@
+From f0f29d36c24d4dfa0a7197b83b2fb9ccec147421 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <pelwell at users.noreply.github.com>
+Date: Thu, 19 Jan 2017 16:44:43 +0000
+Subject: [PATCH] config: More USB config options for bcm2709_defconfig (#1805)
+
+Bring bcm2709_defconfig up to the level of bcmrpi_defconfig with
+respect to USB support. This is prompted by the introduction of CM3,
+which makes gadget mode on 2709/2710 a useful option.
+
+Note that the DWC2 driver is not loaded by default and must be enabled
+using a DT overlay or custom .dtb.
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ arch/arm/configs/bcm2709_defconfig | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index 1085058..19daca4 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -969,6 +969,7 @@ CONFIG_USB_MICROTEK=m
+ CONFIG_USBIP_CORE=m
+ CONFIG_USBIP_VHCI_HCD=m
+ CONFIG_USBIP_HOST=m
++CONFIG_USB_DWC2=m
+ CONFIG_USB_SERIAL=m
+ CONFIG_USB_SERIAL_GENERIC=y
+ CONFIG_USB_SERIAL_AIRCABLE=m
+@@ -1042,6 +1043,20 @@ CONFIG_USB_SPEEDTOUCH=m
+ CONFIG_USB_CXACRU=m
+ CONFIG_USB_UEAGLEATM=m
+ CONFIG_USB_XUSBATM=m
++CONFIG_USB_GADGET=m
++CONFIG_USB_ZERO=m
++CONFIG_USB_AUDIO=m
++CONFIG_USB_ETH=m
++CONFIG_USB_GADGETFS=m
++CONFIG_USB_MASS_STORAGE=m
++CONFIG_USB_G_SERIAL=m
++CONFIG_USB_MIDI_GADGET=m
++CONFIG_USB_G_PRINTER=m
++CONFIG_USB_CDC_COMPOSITE=m
++CONFIG_USB_G_ACM_MS=m
++CONFIG_USB_G_MULTI=m
++CONFIG_USB_G_HID=m
++CONFIG_USB_G_WEBCAM=m
+ CONFIG_MMC=y
+ CONFIG_MMC_BLOCK_MINORS=32
+ CONFIG_MMC_BCM2835=y
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0575-BCM270X_DT-Add-reference-to-audio_pins-to-CM-dtb.patch b/target/linux/brcm2708/patches-4.4/0575-BCM270X_DT-Add-reference-to-audio_pins-to-CM-dtb.patch
new file mode 100644
index 0000000..b1d8295
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0575-BCM270X_DT-Add-reference-to-audio_pins-to-CM-dtb.patch
@@ -0,0 +1,33 @@
+From 82f7e67564d89bba063b6b2e1cafee871aa22aaf Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Mon, 23 Jan 2017 17:36:50 +0000
+Subject: [PATCH] BCM270X_DT: Add reference to audio_pins to CM dtb
+
+The CM1 dtb contains an empty audio_pins node, but no reference to it.
+Adding the usual pinctrl reference from the audio node enables the
+audremap overlay (and others) to easily turn on audio.
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ arch/arm/boot/dts/bcm2708-rpi-cm.dtsi | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
+index 0a3a962..ba0f316 100644
+--- a/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
++++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dtsi
+@@ -36,6 +36,11 @@
+ status = "okay";
+ };
+
++&audio {
++ pinctrl-names = "default";
++ pinctrl-0 = <&audio_pins>;
++};
++
+ / {
+ __overrides__ {
+ core_freq = <&clk_core>,"clock-frequency:0";
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0576-Add-overlay-for-mcp3008-adc-1818.patch b/target/linux/brcm2708/patches-4.4/0576-Add-overlay-for-mcp3008-adc-1818.patch
new file mode 100644
index 0000000..ba30583
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0576-Add-overlay-for-mcp3008-adc-1818.patch
@@ -0,0 +1,291 @@
+From f6a9afad8ed6521991c138caf7f20fd5222c2a5a Mon Sep 17 00:00:00 2001
+From: Scott Ellis <scott at jumpnowtek.com>
+Date: Fri, 27 Jan 2017 06:42:42 -0500
+Subject: [PATCH] Add overlay for mcp3008 adc (#1818)
+
+Some example usage:
+
+SPI0.0
+dtparam=spi=on
+dtoverlay=mcp3008:spi0-0-present
+
+SPI0.1
+dtparam=spi=on
+dtoverlay=mcp3008:spi0-1-present
+
+SPI0.0 and SPI0.1
+dtparam=spi=on
+dtoverlay=mcp3008:spi0-0-present,spi0-1-present
+
+SPI1.0
+dtparam=spi=on
+dtoverlay=spi1-1cs
+dtoverlay=mcp3008:spi1-0-present
+
+SPI1.2
+dtparam=spi=on
+dtoverlay=spi1-1cs:cs0_pin=16
+dtoverlay=mcp3008:spi1-0-present
+
+SPI1.0 and SPI1.1
+dtoverlay=spi1-2cs
+dtoverlay=mcp3008:spi1-0-present,spi1-1-present
+
+Changing the speed
+
+SPI0.0
+dtparam=spi=on
+dtoverlay=mcp3008:spi0-0-present,spi0-0-speed=2000000
+---
+ arch/arm/boot/dts/overlays/Makefile | 1 +
+ arch/arm/boot/dts/overlays/README | 9 ++
+ arch/arm/boot/dts/overlays/mcp3008-overlay.dts | 205 +++++++++++++++++++++++++
+ 3 files changed, 215 insertions(+)
+ create mode 100755 arch/arm/boot/dts/overlays/mcp3008-overlay.dts
+
+diff --git a/arch/arm/boot/dts/overlays/Makefile b/arch/arm/boot/dts/overlays/Makefile
+index 72f2d90a..b13e340 100644
+--- a/arch/arm/boot/dts/overlays/Makefile
++++ b/arch/arm/boot/dts/overlays/Makefile
+@@ -57,6 +57,7 @@ dtbo-$(RPI_DT_OVERLAYS) += mcp23017.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += mcp23s17.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can0.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += mcp2515-can1.dtbo
++dtbo-$(RPI_DT_OVERLAYS) += mcp3008.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += mmc.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += mz61581.dtbo
+ dtbo-$(RPI_DT_OVERLAYS) += pi3-act-led.dtbo
+diff --git a/arch/arm/boot/dts/overlays/README b/arch/arm/boot/dts/overlays/README
+index 7f4bd29..72601f8 100644
+--- a/arch/arm/boot/dts/overlays/README
++++ b/arch/arm/boot/dts/overlays/README
+@@ -736,6 +736,15 @@ Params: oscillator Clock frequency for the CAN controller (Hz)
+ interrupt GPIO for interrupt signal
+
+
++Name: mcp3008
++Info: Configures MCP3008 A/D converters
++ For devices on spi1 or spi2, the interfaces should be enabled
++ with one of the spi1-1/2/3cs and/or spi2-1/2/3cs overlays.
++Load: dtoverlay=mcp3008,<param>[=<val>]
++Params: spi<n>-<m>-present boolean, configure device at spi<n>, cs<m>
++ spi<n>-<m>-speed integer, set the spi bus speed for this device
++
++
+ Name: mmc
+ Info: Selects the bcm2835-mmc SD/MMC driver, optionally with overclock
+ Load: dtoverlay=mmc,<param>=<val>
+diff --git a/arch/arm/boot/dts/overlays/mcp3008-overlay.dts b/arch/arm/boot/dts/overlays/mcp3008-overlay.dts
+new file mode 100755
+index 0000000..06bf426
+--- /dev/null
++++ b/arch/arm/boot/dts/overlays/mcp3008-overlay.dts
+@@ -0,0 +1,205 @@
++/*
++ * Device tree overlay for Microchip mcp3008 10-Bit A/D Converters
++ */
++
++/dts-v1/;
++/plugin/;
++
++/ {
++ compatible = "brcm,bcm2835", "brcm,bcm2708", "brcm,bcm2709";
++
++ fragment at 0 {
++ target = <&spidev0>;
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 1 {
++ target = <&spidev1>;
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 2 {
++ target-path = "spi1/spidev at 0";
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 3 {
++ target-path = "spi1/spidev at 1";
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 4 {
++ target-path = "spi1/spidev at 2";
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 5 {
++ target-path = "spi2/spidev at 0";
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 6 {
++ target-path = "spi2/spidev at 1";
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 7 {
++ target-path = "spi2/spidev at 2";
++ __dormant__ {
++ status = "disabled";
++ };
++ };
++
++ fragment at 8 {
++ target = <&spi0>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_00: mcp3008 at 0 {
++ compatible = "mcp3008";
++ reg = <0>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ fragment at 9 {
++ target = <&spi0>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_01: mcp3008 at 1 {
++ compatible = "mcp3008";
++ reg = <1>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ fragment at 10 {
++ target = <&spi1>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_10: mcp3008 at 0 {
++ compatible = "mcp3008";
++ reg = <0>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ fragment at 11 {
++ target = <&spi1>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_11: mcp3008 at 1 {
++ compatible = "mcp3008";
++ reg = <1>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ fragment at 12 {
++ target = <&spi1>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_12: mcp3008 at 2 {
++ compatible = "mcp3008";
++ reg = <2>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ fragment at 13 {
++ target = <&spi2>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_20: mcp3008 at 0 {
++ compatible = "mcp3008";
++ reg = <0>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ fragment at 14 {
++ target = <&spi2>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_21: mcp3008 at 1 {
++ compatible = "mcp3008";
++ reg = <1>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ fragment at 15 {
++ target = <&spi2>;
++ __dormant__ {
++ status = "okay";
++ #address-cells = <1>;
++ #size-cells = <0>;
++
++ mcp3008_22: mcp3008 at 2 {
++ compatible = "mcp3008";
++ reg = <2>;
++ spi-max-frequency = <1600000>;
++ };
++ };
++ };
++
++ __overrides__ {
++ spi0-0-present = <0>, "+0+8";
++ spi0-1-present = <0>, "+1+9";
++ spi1-0-present = <0>, "+2+10";
++ spi1-1-present = <0>, "+3+11";
++ spi1-2-present = <0>, "+4+12";
++ spi2-0-present = <0>, "+5+13";
++ spi2-1-present = <0>, "+6+14";
++ spi2-2-present = <0>, "+7+15";
++ spi0-0-speed = <&mcp3008_00>, "spi-max-frequency:0";
++ spi0-1-speed = <&mcp3008_01>, "spi-max-frequency:0";
++ spi1-0-speed = <&mcp3008_10>, "spi-max-frequency:0";
++ spi1-1-speed = <&mcp3008_11>, "spi-max-frequency:0";
++ spi1-2-speed = <&mcp3008_12>, "spi-max-frequency:0";
++ spi2-0-speed = <&mcp3008_20>, "spi-max-frequency:0";
++ spi2-1-speed = <&mcp3008_21>, "spi-max-frequency:0";
++ spi2-2-speed = <&mcp3008_22>, "spi-max-frequency:0";
++ };
++};
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0577-x86-ioapic-Restore-IO-APIC-irq_chip-retrigger-callba.patch b/target/linux/brcm2708/patches-4.4/0577-x86-ioapic-Restore-IO-APIC-irq_chip-retrigger-callba.patch
new file mode 100644
index 0000000..cacfc5d
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0577-x86-ioapic-Restore-IO-APIC-irq_chip-retrigger-callba.patch
@@ -0,0 +1,51 @@
+From 1dab2d7f80fa955ff493785033008b2c17f7cc53 Mon Sep 17 00:00:00 2001
+From: Ruslan Ruslichenko <rruslich at cisco.com>
+Date: Tue, 17 Jan 2017 16:13:52 +0200
+Subject: [PATCH] x86/ioapic: Restore IO-APIC irq_chip retrigger callback
+
+commit 020eb3daaba2857b32c4cf4c82f503d6a00a67de upstream.
+
+commit d32932d02e18 removed the irq_retrigger callback from the IO-APIC
+chip and did not add it to the new IO-APIC-IR irq chip.
+
+Unfortunately the software resend fallback is not enabled on X86, so edge
+interrupts which are received during the lazy disabled state of the
+interrupt line are not retriggered and therefor lost.
+
+Restore the callbacks.
+
+[ tglx: Massaged changelog ]
+
+Fixes: d32932d02e18 ("x86/irq: Convert IOAPIC to use hierarchical irqdomain interfaces")
+Signed-off-by: Ruslan Ruslichenko <rruslich at cisco.com>
+Cc: xe-linux-external at cisco.com
+Link: http://lkml.kernel.org/r/1484662432-13580-1-git-send-email-rruslich@cisco.com
+Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
+---
+ arch/x86/kernel/apic/io_apic.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
+index 8ca533b..1e5d2f0 100644
+--- a/arch/x86/kernel/apic/io_apic.c
++++ b/arch/x86/kernel/apic/io_apic.c
+@@ -1875,6 +1875,7 @@ static struct irq_chip ioapic_chip __read_mostly = {
+ .irq_ack = irq_chip_ack_parent,
+ .irq_eoi = ioapic_ack_level,
+ .irq_set_affinity = ioapic_set_affinity,
++ .irq_retrigger = irq_chip_retrigger_hierarchy,
+ .flags = IRQCHIP_SKIP_SET_WAKE,
+ };
+
+@@ -1886,6 +1887,7 @@ static struct irq_chip ioapic_ir_chip __read_mostly = {
+ .irq_ack = irq_chip_ack_parent,
+ .irq_eoi = ioapic_ir_ack_level,
+ .irq_set_affinity = ioapic_set_affinity,
++ .irq_retrigger = irq_chip_retrigger_hierarchy,
+ .flags = IRQCHIP_SKIP_SET_WAKE,
+ };
+
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0578-config-add-slcan-kernel-module.patch b/target/linux/brcm2708/patches-4.4/0578-config-add-slcan-kernel-module.patch
new file mode 100644
index 0000000..4330cb4
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0578-config-add-slcan-kernel-module.patch
@@ -0,0 +1,38 @@
+From 7342071952322e209c40dd3474c020c673814ada Mon Sep 17 00:00:00 2001
+From: popcornmix <popcornmix at gmail.com>
+Date: Fri, 27 Jan 2017 18:49:30 +0000
+Subject: [PATCH] config: add slcan kernel module
+
+See: https://github.com/raspberrypi/linux/issues/1819
+---
+ arch/arm/configs/bcm2709_defconfig | 1 +
+ arch/arm/configs/bcmrpi_defconfig | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/arch/arm/configs/bcm2709_defconfig b/arch/arm/configs/bcm2709_defconfig
+index 19daca4..783d2c2 100644
+--- a/arch/arm/configs/bcm2709_defconfig
++++ b/arch/arm/configs/bcm2709_defconfig
+@@ -358,6 +358,7 @@ CONFIG_BAYCOM_SER_HDX=m
+ CONFIG_YAM=m
+ CONFIG_CAN=m
+ CONFIG_CAN_VCAN=m
++CONFIG_CAN_SLCAN=m
+ CONFIG_CAN_MCP251X=m
+ CONFIG_IRDA=m
+ CONFIG_IRLAN=m
+diff --git a/arch/arm/configs/bcmrpi_defconfig b/arch/arm/configs/bcmrpi_defconfig
+index ca52c36..be7bf41 100644
+--- a/arch/arm/configs/bcmrpi_defconfig
++++ b/arch/arm/configs/bcmrpi_defconfig
+@@ -351,6 +351,7 @@ CONFIG_BAYCOM_SER_HDX=m
+ CONFIG_YAM=m
+ CONFIG_CAN=m
+ CONFIG_CAN_VCAN=m
++CONFIG_CAN_SLCAN=m
+ CONFIG_CAN_MCP251X=m
+ CONFIG_IRDA=m
+ CONFIG_IRLAN=m
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0579-drm-vc4-Fix-sending-of-page-flip-completion-events-i.patch b/target/linux/brcm2708/patches-4.4/0579-drm-vc4-Fix-sending-of-page-flip-completion-events-i.patch
new file mode 100644
index 0000000..c798546
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0579-drm-vc4-Fix-sending-of-page-flip-completion-events-i.patch
@@ -0,0 +1,47 @@
+From 5aecf0a83cc2271427aad4f1a313a3c01e581c03 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <eric at anholt.net>
+Date: Thu, 2 Feb 2017 09:42:18 -0800
+Subject: [PATCH] drm/vc4: Fix sending of page flip completion events in FKMS
+ mode.
+
+In the rewrite of vc4_crtc.c for fkms, I dropped the part of the
+CRTC's atomic flush handler that moved the completion event from the
+proposed atomic state change to the CRTC's current state. That meant
+that when full screen pageflipping happened (glxgears -fullscreen in
+X, compton, por weston), the app would end up blocked firever waiting
+to draw its next frame.
+
+Signed-off-by: Eric Anholt <eric at anholt.net>
+---
+ drivers/gpu/drm/vc4/vc4_firmware_kms.c | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/drivers/gpu/drm/vc4/vc4_firmware_kms.c b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
+index a1b6511..8f74382 100644
+--- a/drivers/gpu/drm/vc4/vc4_firmware_kms.c
++++ b/drivers/gpu/drm/vc4/vc4_firmware_kms.c
+@@ -312,6 +312,21 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
+ static void vc4_crtc_atomic_flush(struct drm_crtc *crtc,
+ struct drm_crtc_state *old_state)
+ {
++ struct vc4_crtc *vc4_crtc = to_vc4_crtc(crtc);
++ struct drm_device *dev = crtc->dev;
++
++ if (crtc->state->event) {
++ unsigned long flags;
++
++ crtc->state->event->pipe = drm_crtc_index(crtc);
++
++ WARN_ON(drm_crtc_vblank_get(crtc) != 0);
++
++ spin_lock_irqsave(&dev->event_lock, flags);
++ vc4_crtc->event = crtc->state->event;
++ crtc->state->event = NULL;
++ spin_unlock_irqrestore(&dev->event_lock, flags);
++ }
+ }
+
+ static void vc4_crtc_handle_page_flip(struct vc4_crtc *vc4_crtc)
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0580-clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch b/target/linux/brcm2708/patches-4.4/0580-clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch
new file mode 100644
index 0000000..c7946e5
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0580-clk-bcm2835-Fix-fixed_divider-of-pllh_aux.patch
@@ -0,0 +1,32 @@
+From 514dc56068291b52b6f8bb2fe29d8755d6126283 Mon Sep 17 00:00:00 2001
+From: Boris Brezillon <boris.brezillon at free-electrons.com>
+Date: Tue, 22 Nov 2016 12:45:28 -0800
+Subject: [PATCH] clk: bcm2835: Fix ->fixed_divider of pllh_aux
+
+There is no fixed divider on pllh_aux.
+
+Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
+Signed-off-by: Eric Anholt <eric at anholt.net>
+Reviewed-by: Eric Anholt <eric at anholt.net>
+Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
+(cherry picked from commit f2a46926aba1f0c33944901d2420a6a887455ddc)
+---
+ drivers/clk/bcm/clk-bcm2835.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
+index e9e8c25..3fbd2e8 100644
+--- a/drivers/clk/bcm/clk-bcm2835.c
++++ b/drivers/clk/bcm/clk-bcm2835.c
+@@ -1657,7 +1657,7 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLH_AUX,
+ .load_mask = CM_PLLH_LOADAUX,
+ .hold_mask = 0,
+- .fixed_divider = 10),
++ .fixed_divider = 1),
+ [BCM2835_PLLH_PIX] = REGISTER_PLL_DIV(
+ .name = "pllh_pix",
+ .source_pll = "pllh",
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0581-clk-bcm-Support-rate-change-propagation-on-bcm2835-c.patch b/target/linux/brcm2708/patches-4.4/0581-clk-bcm-Support-rate-change-propagation-on-bcm2835-c.patch
new file mode 100644
index 0000000..bd7405e
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0581-clk-bcm-Support-rate-change-propagation-on-bcm2835-c.patch
@@ -0,0 +1,129 @@
+From e75f021850a698fec611538e8ff293c22a4604f5 Mon Sep 17 00:00:00 2001
+From: Boris Brezillon <boris.brezillon at free-electrons.com>
+Date: Thu, 1 Dec 2016 22:00:19 +0100
+Subject: [PATCH] clk: bcm: Support rate change propagation on bcm2835 clocks
+
+Some peripheral clocks, like the VEC (Video EnCoder) clock need to be set
+to a precise rate (in our case 108MHz). With the current implementation,
+where peripheral clocks are not allowed to forward rate change requests
+to their parents, it is impossible to match this requirement unless the
+bootloader has configured things correctly, or a specific rate has been
+assigned through the DT (with the assigned-clk-rates property).
+
+Add a new field to struct bcm2835_clock_data to specify which parent
+clocks accept rate change propagation, and support set rate propagation
+in bcm2835_clock_determine_rate().
+
+Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
+Reviewed-by: Eric Anholt <eric at anholt.net>
+Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
+(cherry picked from commit 155e8b3b0ee320ae866b97dd31eba8a1f080a772)
+---
+ drivers/clk/bcm/clk-bcm2835.c | 67 ++++++++++++++++++++++++++++++++++++++++---
+ 1 file changed, 63 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
+index 3fbd2e8..5f0e2f3 100644
+--- a/drivers/clk/bcm/clk-bcm2835.c
++++ b/drivers/clk/bcm/clk-bcm2835.c
+@@ -457,6 +457,9 @@ struct bcm2835_clock_data {
+ const char *const *parents;
+ int num_mux_parents;
+
++ /* Bitmap encoding which parents accept rate change propagation. */
++ unsigned int set_rate_parent;
++
+ u32 ctl_reg;
+ u32 div_reg;
+
+@@ -1055,10 +1058,60 @@ bcm2835_clk_is_pllc(struct clk_hw *hw)
+ return strncmp(clk_hw_get_name(hw), "pllc", 4) == 0;
+ }
+
++static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw,
++ int parent_idx,
++ unsigned long rate,
++ u32 *div,
++ unsigned long *prate)
++{
++ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
++ struct bcm2835_cprman *cprman = clock->cprman;
++ const struct bcm2835_clock_data *data = clock->data;
++ unsigned long best_rate;
++ u32 curdiv, mindiv, maxdiv;
++ struct clk_hw *parent;
++
++ parent = clk_hw_get_parent_by_index(hw, parent_idx);
++
++ if (!(BIT(parent_idx) & data->set_rate_parent)) {
++ *prate = clk_hw_get_rate(parent);
++ *div = bcm2835_clock_choose_div(hw, rate, *prate, true);
++
++ return bcm2835_clock_rate_from_divisor(clock, *prate,
++ *div);
++ }
++
++ if (data->frac_bits)
++ dev_warn(cprman->dev,
++ "frac bits are not used when propagating rate change");
++
++ /* clamp to min divider of 2 if we're dealing with a mash clock */
++ mindiv = data->is_mash_clock ? 2 : 1;
++ maxdiv = BIT(data->int_bits) - 1;
++
++ /* TODO: Be smart, and only test a subset of the available divisors. */
++ for (curdiv = mindiv; curdiv <= maxdiv; curdiv++) {
++ unsigned long tmp_rate;
++
++ tmp_rate = clk_hw_round_rate(parent, rate * curdiv);
++ tmp_rate /= curdiv;
++ if (curdiv == mindiv ||
++ (tmp_rate > best_rate && tmp_rate <= rate))
++ best_rate = tmp_rate;
++
++ if (best_rate == rate)
++ break;
++ }
++
++ *div = curdiv << CM_DIV_FRAC_BITS;
++ *prate = curdiv * best_rate;
++
++ return best_rate;
++}
++
+ static int bcm2835_clock_determine_rate(struct clk_hw *hw,
+ struct clk_rate_request *req)
+ {
+- struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
+ struct clk_hw *parent, *best_parent = NULL;
+ bool current_parent_is_pllc;
+ unsigned long rate, best_rate = 0;
+@@ -1086,9 +1139,8 @@ static int bcm2835_clock_determine_rate(struct clk_hw *hw,
+ if (bcm2835_clk_is_pllc(parent) && !current_parent_is_pllc)
+ continue;
+
+- prate = clk_hw_get_rate(parent);
+- div = bcm2835_clock_choose_div(hw, req->rate, prate, true);
+- rate = bcm2835_clock_rate_from_divisor(clock, prate, div);
++ rate = bcm2835_clock_choose_div_and_prate(hw, i, req->rate,
++ &div, &prate);
+ if (rate > best_rate && rate <= req->rate) {
+ best_parent = parent;
+ best_prate = prate;
+@@ -1308,6 +1360,13 @@ static struct clk *bcm2835_register_clock(struct bcm2835_cprman *cprman,
+ if ((cprman_read(cprman, data->ctl_reg) & CM_ENABLE) == 0)
+ init.flags &= ~CLK_IS_CRITICAL;
+
++ /*
++ * Pass the CLK_SET_RATE_PARENT flag if we are allowed to propagate
++ * rate changes on at least of the parents.
++ */
++ if (data->set_rate_parent)
++ init.flags |= CLK_SET_RATE_PARENT;
++
+ if (data->is_vpu_clock) {
+ init.ops = &bcm2835_vpu_clock_clk_ops;
+ } else {
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0582-clk-bcm-Allow-rate-change-propagation-to-PLLH_AUX-on.patch b/target/linux/brcm2708/patches-4.4/0582-clk-bcm-Allow-rate-change-propagation-to-PLLH_AUX-on.patch
new file mode 100644
index 0000000..a66653e
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0582-clk-bcm-Allow-rate-change-propagation-to-PLLH_AUX-on.patch
@@ -0,0 +1,40 @@
+From 5c301af484ece3e61146572167bbe9418d536616 Mon Sep 17 00:00:00 2001
+From: Boris Brezillon <boris.brezillon at free-electrons.com>
+Date: Thu, 1 Dec 2016 22:00:20 +0100
+Subject: [PATCH] clk: bcm: Allow rate change propagation to PLLH_AUX on VEC
+ clock
+
+The VEC clock requires needs to be set at exactly 108MHz. Allow rate
+change propagation on PLLH_AUX to match this requirement wihtout
+impacting other IPs (PLLH is currently only used by the HDMI encoder,
+which cannot be enabled when the VEC encoder is enabled).
+
+Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
+Reviewed-by: Eric Anholt <eric at anholt.net>
+Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
+(cherry picked from commit d86d46af84855403c00018be1c3e7bc190f2a6cd)
+---
+ drivers/clk/bcm/clk-bcm2835.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
+index 5f0e2f3..d023e4a 100644
+--- a/drivers/clk/bcm/clk-bcm2835.c
++++ b/drivers/clk/bcm/clk-bcm2835.c
+@@ -1920,7 +1920,12 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .ctl_reg = CM_VECCTL,
+ .div_reg = CM_VECDIV,
+ .int_bits = 4,
+- .frac_bits = 0),
++ .frac_bits = 0,
++ /*
++ * Allow rate change propagation only on PLLH_AUX which is
++ * assigned index 7 in the parent array.
++ */
++ .set_rate_parent = BIT(7)),
+
+ /* dsi clocks */
+ [BCM2835_CLOCK_DSI0E] = REGISTER_PER_CLK(
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0583-clk-bcm-Fix-maybe-uninitialized-warning-in-bcm2835_c.patch b/target/linux/brcm2708/patches-4.4/0583-clk-bcm-Fix-maybe-uninitialized-warning-in-bcm2835_c.patch
new file mode 100644
index 0000000..5a004a6
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0583-clk-bcm-Fix-maybe-uninitialized-warning-in-bcm2835_c.patch
@@ -0,0 +1,34 @@
+From d4be0d5751c1bfe067a07a4ec95d7575ec03ab83 Mon Sep 17 00:00:00 2001
+From: Boris Brezillon <boris.brezillon at free-electrons.com>
+Date: Mon, 12 Dec 2016 09:00:53 +0100
+Subject: [PATCH] clk: bcm: Fix 'maybe-uninitialized' warning in
+ bcm2835_clock_choose_div_and_prate()
+
+best_rate is reported as potentially uninitialized by gcc.
+
+Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
+Fixes: 155e8b3b0ee3 ("clk: bcm: Support rate change propagation on bcm2835 clocks")
+Reported-by: Stephen Rothwell <sfr at canb.auug.org.au>
+Reviewed-by: Eric Anholt <eric at anholt.net>
+Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
+(cherry picked from commit 2aab7a2055a1705c9e30920d95a596226999eb21)
+---
+ drivers/clk/bcm/clk-bcm2835.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
+index d023e4a..89dad97 100644
+--- a/drivers/clk/bcm/clk-bcm2835.c
++++ b/drivers/clk/bcm/clk-bcm2835.c
+@@ -1067,7 +1067,7 @@ static unsigned long bcm2835_clock_choose_div_and_prate(struct clk_hw *hw,
+ struct bcm2835_clock *clock = bcm2835_clock_from_hw(hw);
+ struct bcm2835_cprman *cprman = clock->cprman;
+ const struct bcm2835_clock_data *data = clock->data;
+- unsigned long best_rate;
++ unsigned long best_rate = 0;
+ u32 curdiv, mindiv, maxdiv;
+ struct clk_hw *parent;
+
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch b/target/linux/brcm2708/patches-4.4/0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch
new file mode 100644
index 0000000..94f4be6
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0584-clk-bcm2835-Don-t-rate-change-PLLs-on-behalf-of-DSI-.patch
@@ -0,0 +1,177 @@
+From c08886564938df6796a7d98495cf5cc3f7a09337 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <eric at anholt.net>
+Date: Wed, 18 Jan 2017 07:31:55 +1100
+Subject: [PATCH] clk: bcm2835: Don't rate change PLLs on behalf of DSI PLL
+ dividers (v2).
+
+Our core PLLs are intended to be configured once and left alone. With
+the SET_RATE_PARENT, asking to set the PLLD_DSI1 clock rate would
+change PLLD just to get closer to the requested DSI clock, thus
+changing PLLD_PER, the UART and ethernet PHY clock rates downstream of
+it, and breaking ethernet.
+
+We *do* want PLLH to change so that PLLH_AUX can be exactly the value
+we want, though. Thus, we need to have a per-divider policy of
+whether to pass rate changes up.
+
+Signed-off-by: Eric Anholt <eric at anholt.net>
+Signed-off-by: Stephen Boyd <sboyd at codeaurora.org>
+(cherry picked from commit 55486091bd1e1c5ed28c43c0d6b3392468a9adb5)
+---
+ drivers/clk/bcm/clk-bcm2835.c | 42 ++++++++++++++++++++++++++++--------------
+ 1 file changed, 28 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
+index 89dad97..54cb4e1 100644
+--- a/drivers/clk/bcm/clk-bcm2835.c
++++ b/drivers/clk/bcm/clk-bcm2835.c
+@@ -449,6 +449,7 @@ struct bcm2835_pll_divider_data {
+ u32 load_mask;
+ u32 hold_mask;
+ u32 fixed_divider;
++ u32 flags;
+ };
+
+ struct bcm2835_clock_data {
+@@ -1286,7 +1287,7 @@ bcm2835_register_pll_divider(struct bcm2835_cprman *cprman,
+ init.num_parents = 1;
+ init.name = divider_name;
+ init.ops = &bcm2835_pll_divider_clk_ops;
+- init.flags = CLK_IGNORE_UNUSED;
++ init.flags = data->flags | CLK_IGNORE_UNUSED;
+
+ divider = devm_kzalloc(cprman->dev, sizeof(*divider), GFP_KERNEL);
+ if (!divider)
+@@ -1525,7 +1526,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLA_CORE,
+ .load_mask = CM_PLLA_LOADCORE,
+ .hold_mask = CM_PLLA_HOLDCORE,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLA_PER] = REGISTER_PLL_DIV(
+ .name = "plla_per",
+ .source_pll = "plla",
+@@ -1533,7 +1535,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLA_PER,
+ .load_mask = CM_PLLA_LOADPER,
+ .hold_mask = CM_PLLA_HOLDPER,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLA_DSI0] = REGISTER_PLL_DIV(
+ .name = "plla_dsi0",
+ .source_pll = "plla",
+@@ -1549,7 +1552,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLA_CCP2,
+ .load_mask = CM_PLLA_LOADCCP2,
+ .hold_mask = CM_PLLA_HOLDCCP2,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+
+ /* PLLB is used for the ARM's clock. */
+ [BCM2835_PLLB] = REGISTER_PLL(
+@@ -1573,7 +1577,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLB_ARM,
+ .load_mask = CM_PLLB_LOADARM,
+ .hold_mask = CM_PLLB_HOLDARM,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+
+ /*
+ * PLLC is the core PLL, used to drive the core VPU clock.
+@@ -1602,7 +1607,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLC_CORE0,
+ .load_mask = CM_PLLC_LOADCORE0,
+ .hold_mask = CM_PLLC_HOLDCORE0,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLC_CORE1] = REGISTER_PLL_DIV(
+ .name = "pllc_core1",
+ .source_pll = "pllc",
+@@ -1610,7 +1616,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLC_CORE1,
+ .load_mask = CM_PLLC_LOADCORE1,
+ .hold_mask = CM_PLLC_HOLDCORE1,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLC_CORE2] = REGISTER_PLL_DIV(
+ .name = "pllc_core2",
+ .source_pll = "pllc",
+@@ -1618,7 +1625,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLC_CORE2,
+ .load_mask = CM_PLLC_LOADCORE2,
+ .hold_mask = CM_PLLC_HOLDCORE2,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLC_PER] = REGISTER_PLL_DIV(
+ .name = "pllc_per",
+ .source_pll = "pllc",
+@@ -1626,7 +1634,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLC_PER,
+ .load_mask = CM_PLLC_LOADPER,
+ .hold_mask = CM_PLLC_HOLDPER,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+
+ /*
+ * PLLD is the display PLL, used to drive DSI display panels.
+@@ -1655,7 +1664,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLD_CORE,
+ .load_mask = CM_PLLD_LOADCORE,
+ .hold_mask = CM_PLLD_HOLDCORE,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLD_PER] = REGISTER_PLL_DIV(
+ .name = "plld_per",
+ .source_pll = "plld",
+@@ -1663,7 +1673,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLD_PER,
+ .load_mask = CM_PLLD_LOADPER,
+ .hold_mask = CM_PLLD_HOLDPER,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLD_DSI0] = REGISTER_PLL_DIV(
+ .name = "plld_dsi0",
+ .source_pll = "plld",
+@@ -1708,7 +1719,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLH_RCAL,
+ .load_mask = CM_PLLH_LOADRCAL,
+ .hold_mask = 0,
+- .fixed_divider = 10),
++ .fixed_divider = 10,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLH_AUX] = REGISTER_PLL_DIV(
+ .name = "pllh_aux",
+ .source_pll = "pllh",
+@@ -1716,7 +1728,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLH_AUX,
+ .load_mask = CM_PLLH_LOADAUX,
+ .hold_mask = 0,
+- .fixed_divider = 1),
++ .fixed_divider = 1,
++ .flags = CLK_SET_RATE_PARENT),
+ [BCM2835_PLLH_PIX] = REGISTER_PLL_DIV(
+ .name = "pllh_pix",
+ .source_pll = "pllh",
+@@ -1724,7 +1737,8 @@ static const struct bcm2835_clk_desc clk_desc_array[] = {
+ .a2w_reg = A2W_PLLH_PIX,
+ .load_mask = CM_PLLH_LOADPIX,
+ .hold_mask = 0,
+- .fixed_divider = 10),
++ .fixed_divider = 10,
++ .flags = CLK_SET_RATE_PARENT),
+
+ /* the clocks */
+
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0585-gpio_mem-Remove-unnecessary-dev_info-output-1830.patch b/target/linux/brcm2708/patches-4.4/0585-gpio_mem-Remove-unnecessary-dev_info-output-1830.patch
new file mode 100644
index 0000000..e440733
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0585-gpio_mem-Remove-unnecessary-dev_info-output-1830.patch
@@ -0,0 +1,27 @@
+From cc3ee0379f3b2d605234098568c8b4b7b33254ae Mon Sep 17 00:00:00 2001
+From: JamesH65 <JamesH65 at users.noreply.github.com>
+Date: Mon, 6 Feb 2017 15:24:47 +0000
+Subject: [PATCH] gpio_mem: Remove unnecessary dev_info output (#1830)
+
+The open function was spamming syslog every time
+called, so have removed call completely.
+---
+ drivers/char/broadcom/bcm2835-gpiomem.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/char/broadcom/bcm2835-gpiomem.c b/drivers/char/broadcom/bcm2835-gpiomem.c
+index 911f5b7..f5e7f1b 100644
+--- a/drivers/char/broadcom/bcm2835-gpiomem.c
++++ b/drivers/char/broadcom/bcm2835-gpiomem.c
+@@ -76,8 +76,6 @@ static int bcm2835_gpiomem_open(struct inode *inode, struct file *file)
+ int dev = iminor(inode);
+ int ret = 0;
+
+- dev_info(inst->dev, "gpiomem device opened.");
+-
+ if (dev != DEVICE_MINOR) {
+ dev_err(inst->dev, "Unknown minor device: %d", dev);
+ ret = -ENXIO;
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0586-drm-vc4-Fulfill-user-BO-creation-requests-from-the-k.patch b/target/linux/brcm2708/patches-4.4/0586-drm-vc4-Fulfill-user-BO-creation-requests-from-the-k.patch
new file mode 100644
index 0000000..2dab022
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0586-drm-vc4-Fulfill-user-BO-creation-requests-from-the-k.patch
@@ -0,0 +1,59 @@
+From 6b7250b2393653e5d08deed591b78b41a2ee8d43 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <eric at anholt.net>
+Date: Wed, 8 Feb 2017 15:00:54 -0800
+Subject: [PATCH] drm/vc4: Fulfill user BO creation requests from the kernel BO
+ cache.
+
+The from_cache flag was actually "the BO is invisible to userspace",
+so we can repurpose to just zero out a cached BO and return it to
+userspace.
+
+Improves wall time for a loop of 5 glsl-algebraic-add-add-1 by
+-1.44989% +/- 0.862891% (n=28, 1 outlier removed from each that
+appeared to be other system noise)
+
+Note that there's an intel-gpu-tools test to check for the proper
+zeroing behavior here, which we continue to pass.
+
+Signed-off-by: Eric Anholt <eric at anholt.net>
+---
+ drivers/gpu/drm/vc4/vc4_bo.c | 13 +++++++------
+ 1 file changed, 7 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
+index 56b779c..ce8a5fd 100644
+--- a/drivers/gpu/drm/vc4/vc4_bo.c
++++ b/drivers/gpu/drm/vc4/vc4_bo.c
+@@ -208,22 +208,23 @@ struct drm_gem_object *vc4_create_object(struct drm_device *dev, size_t size)
+ }
+
+ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size,
+- bool from_cache)
++ bool allow_unzeroed)
+ {
+ size_t size = roundup(unaligned_size, PAGE_SIZE);
+ struct vc4_dev *vc4 = to_vc4_dev(dev);
+ struct drm_gem_cma_object *cma_obj;
+ int pass, ret;
++ struct vc4_bo *bo;
+
+ if (size == 0)
+ return ERR_PTR(-EINVAL);
+
+ /* First, try to get a vc4_bo from the kernel BO cache. */
+- if (from_cache) {
+- struct vc4_bo *bo = vc4_bo_get_from_cache(dev, size);
+-
+- if (bo)
+- return bo;
++ bo = vc4_bo_get_from_cache(dev, size);
++ if (bo) {
++ if (!allow_unzeroed)
++ memset(bo->base.vaddr, 0, bo->base.base.size);
++ return bo;
+ }
+
+ /* Otherwise, make a new BO. */
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0587-drm-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-.patch b/target/linux/brcm2708/patches-4.4/0587-drm-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-.patch
new file mode 100644
index 0000000..c2381cb
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0587-drm-vc4-Fix-OOPSes-from-trying-to-cache-a-partially-.patch
@@ -0,0 +1,39 @@
+From 73042261439a2d73e4e7b711de55a8a135725739 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <eric at anholt.net>
+Date: Thu, 9 Feb 2017 09:23:34 -0800
+Subject: [PATCH] drm/vc4: Fix OOPSes from trying to cache a partially
+ constructed BO.
+
+If a CMA allocation failed, the partially constructed BO would be
+unreferenced through the normal path, and we might choose to put it in
+the BO cache. If we then reused it before it expired from the cache,
+the kernel would OOPS.
+
+Signed-off-by: Eric Anholt <eric at anholt.net>
+Fixes: c826a6e10644 ("drm/vc4: Add a BO cache.")
+---
+ drivers/gpu/drm/vc4/vc4_bo.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
+index ce8a5fd..d7474dd 100644
+--- a/drivers/gpu/drm/vc4/vc4_bo.c
++++ b/drivers/gpu/drm/vc4/vc4_bo.c
+@@ -334,6 +334,14 @@ void vc4_free_object(struct drm_gem_object *gem_bo)
+ goto out;
+ }
+
++ /* If this object was partially constructed but CMA allocation
++ * had failed, just free it.
++ */
++ if (!bo->base.vaddr) {
++ vc4_bo_destroy(bo);
++ goto out;
++ }
++
+ cache_list = vc4_get_cache_list_for_size(dev, gem_bo->size);
+ if (!cache_list) {
+ vc4_bo_destroy(bo);
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0588-drm-vc4-Verify-at-boot-that-CMA-doesn-t-cross-a-256M.patch b/target/linux/brcm2708/patches-4.4/0588-drm-vc4-Verify-at-boot-that-CMA-doesn-t-cross-a-256M.patch
new file mode 100644
index 0000000..d09e6d3
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0588-drm-vc4-Verify-at-boot-that-CMA-doesn-t-cross-a-256M.patch
@@ -0,0 +1,88 @@
+From bf4b7e8817115f839241e55add244cf60225e436 Mon Sep 17 00:00:00 2001
+From: Eric Anholt <eric at anholt.net>
+Date: Mon, 12 Oct 2015 08:58:08 -0700
+Subject: [PATCH] drm/vc4: Verify at boot that CMA doesn't cross a 256MB
+ boundary.
+
+I've seen lots of users cranking CMA up higher, so throw an error if
+they do.
+
+Signed-off-by: Eric Anholt <eric at anholt.net>
+---
+ drivers/base/dma-contiguous.c | 1 +
+ drivers/gpu/drm/vc4/vc4_v3d.c | 18 ++++++++++++++++++
+ mm/cma.c | 2 ++
+ 3 files changed, 21 insertions(+)
+
+diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
+index e167a1e1..60f5c25 100644
+--- a/drivers/base/dma-contiguous.c
++++ b/drivers/base/dma-contiguous.c
+@@ -35,6 +35,7 @@
+ #endif
+
+ struct cma *dma_contiguous_default_area;
++EXPORT_SYMBOL(dma_contiguous_default_area);
+
+ /*
+ * Default global CMA area size can be defined in kernel's .config.
+diff --git a/drivers/gpu/drm/vc4/vc4_v3d.c b/drivers/gpu/drm/vc4/vc4_v3d.c
+index 7cc346a..1d9e5a6 100644
+--- a/drivers/gpu/drm/vc4/vc4_v3d.c
++++ b/drivers/gpu/drm/vc4/vc4_v3d.c
+@@ -16,7 +16,10 @@
+ * this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
++#include "linux/init.h"
++#include "linux/cma.h"
+ #include "linux/component.h"
++#include "linux/dma-contiguous.h"
+ #include "linux/pm_runtime.h"
+ #include "vc4_drv.h"
+ #include "vc4_regs.h"
+@@ -185,8 +188,23 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data)
+ struct drm_device *drm = dev_get_drvdata(master);
+ struct vc4_dev *vc4 = to_vc4_dev(drm);
+ struct vc4_v3d *v3d = NULL;
++ struct cma *cma;
+ int ret;
+
++ cma = dev_get_cma_area(dev);
++ if (!cma)
++ return -EINVAL;
++
++ if ((cma_get_base(cma) & 0xf0000000) !=
++ ((cma_get_base(cma) + cma_get_size(cma) - 1) & 0xf0000000)) {
++ DRM_ERROR("V3D requires that the CMA area (0x%08lx - 0x%08lx) "
++ "not span a 256MB boundary, or memory corruption "
++ "would happen.\n",
++ (long)cma_get_base(cma),
++ cma_get_base(cma) + cma_get_size(cma));
++ return -EINVAL;
++ }
++
+ v3d = devm_kzalloc(&pdev->dev, sizeof(*v3d), GFP_KERNEL);
+ if (!v3d)
+ return -ENOMEM;
+diff --git a/mm/cma.c b/mm/cma.c
+index bd0e141..efac29b 100644
+--- a/mm/cma.c
++++ b/mm/cma.c
+@@ -47,11 +47,13 @@ phys_addr_t cma_get_base(const struct cma *cma)
+ {
+ return PFN_PHYS(cma->base_pfn);
+ }
++EXPORT_SYMBOL(cma_get_base);
+
+ unsigned long cma_get_size(const struct cma *cma)
+ {
+ return cma->count << PAGE_SHIFT;
+ }
++EXPORT_SYMBOL(cma_get_size);
+
+ static unsigned long cma_bitmap_aligned_mask(const struct cma *cma,
+ int align_order)
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0589-Update-vfpmodule.c.patch b/target/linux/brcm2708/patches-4.4/0589-Update-vfpmodule.c.patch
new file mode 100644
index 0000000..8bdfe2e
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0589-Update-vfpmodule.c.patch
@@ -0,0 +1,143 @@
+From 124370babf0428ec8db2d0ba314105cd9e6ea2c7 Mon Sep 17 00:00:00 2001
+From: Claggy3 <stephen.maclagan at hotmail.com>
+Date: Sat, 11 Feb 2017 14:00:30 +0000
+Subject: [PATCH] Update vfpmodule.c
+
+Christopher Alexander Tobias Schulze - May 2, 2015, 11:57 a.m.
+This patch fixes a problem with VFP state save and restore related
+to exception handling (panic with message "BUG: unsupported FP
+instruction in kernel mode") present on VFP11 floating point units
+(as used with ARM1176JZF-S CPUs, e.g. on first generation Raspberry
+Pi boards). This patch was developed and discussed on
+
+ https://github.com/raspberrypi/linux/issues/859
+
+A precondition to see the crashes is that floating point exception
+traps are enabled. In this case, the VFP11 might determine that a FPU
+operation needs to trap at a point in time when it is not possible to
+signal this to the ARM11 core any more. The VFP11 will then set the
+FPEXC.EX bit and store the trapped opcode in FPINST. (In some cases,
+a second opcode might have been accepted by the VFP11 before the
+exception was detected and could be reported to the ARM11 - in this
+case, the VFP11 also sets FPEXC.FP2V and stores the second opcode in
+FPINST2.)
+
+If FPEXC.EX is set, the VFP11 will "bounce" the next FPU opcode issued
+by the ARM11 CPU, which will be seen by the ARM11 as an undefined opcode
+trap. The VFP support code examines the FPEXC.EX and FPEXC.FP2V bits
+to decide what actions to take, i.e., whether to emulate the opcodes
+found in FPINST and FPINST2, and whether to retry the bounced instruction.
+
+If a user space application has left the VFP11 in this "pending trap"
+state, the next FPU opcode issued to the VFP11 might actually be the
+VSTMIA operation vfp_save_state() uses to store the FPU registers
+to memory (in our test cases, when building the signal stack frame).
+In this case, the kernel crashes as described above.
+
+This patch fixes the problem by making sure that vfp_save_state() is
+always entered with FPEXC.EX cleared. (The current value of FPEXC has
+already been saved, so this does not corrupt the context. Clearing
+FPEXC.EX has no effects on FPINST or FPINST2. Also note that many
+callers already modify FPEXC by setting FPEXC.EN before invoking
+vfp_save_state().)
+
+This patch also addresses a second problem related to FPEXC.EX: After
+returning from signal handling, the kernel reloads the VFP context
+from the user mode stack. However, the current code explicitly clears
+both FPEXC.EX and FPEXC.FP2V during reload. As VFP11 requires these
+bits to be preserved, this patch disables clearing them for VFP
+implementations belonging to architecture 1. There should be no
+negative side effects: the user can set both bits by executing FPU
+opcodes anyway, and while user code may now place arbitrary values
+into FPINST and FPINST2 (e.g., non-VFP ARM opcodes) the VFP support
+code knows which instructions can be emulated, and rejects other
+opcodes with "unhandled bounce" messages, so there should be no
+security impact from allowing reloading FPEXC.EX and FPEXC.FP2V.
+
+Signed-off-by: Christopher Alexander Tobias Schulze <cat.schulze at alice-dsl.net>
+---
+ arch/arm/vfp/vfpmodule.c | 27 ++++++++++++++++++++-------
+ 1 file changed, 20 insertions(+), 7 deletions(-)
+
+diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
+index 2a61e4b..7675518 100644
+--- a/arch/arm/vfp/vfpmodule.c
++++ b/arch/arm/vfp/vfpmodule.c
+@@ -183,8 +183,11 @@ static int vfp_notifier(struct notifier_block *self, unsigned long cmd, void *v)
+ * case the thread migrates to a different CPU. The
+ * restoring is done lazily.
+ */
+- if ((fpexc & FPEXC_EN) && vfp_current_hw_state[cpu])
+- vfp_save_state(vfp_current_hw_state[cpu], fpexc);
++ if ((fpexc & FPEXC_EN) && vfp_current_hw_state[cpu]) {
++ /* vfp_save_state oopses on VFP11 if EX bit set */
++ fmxr(FPEXC, fpexc & ~FPEXC_EX);
++ vfp_save_state(vfp_current_hw_state[cpu], fpexc);
++ }
+ #endif
+
+ /*
+@@ -467,13 +470,16 @@ static int vfp_pm_suspend(void)
+ /* if vfp is on, then save state for resumption */
+ if (fpexc & FPEXC_EN) {
+ pr_debug("%s: saving vfp state\n", __func__);
++ /* vfp_save_state oopses on VFP11 if EX bit set */
++ fmxr(FPEXC, fpexc & ~FPEXC_EX);
+ vfp_save_state(&ti->vfpstate, fpexc);
+
+ /* disable, just in case */
+ fmxr(FPEXC, fmrx(FPEXC) & ~FPEXC_EN);
+ } else if (vfp_current_hw_state[ti->cpu]) {
+ #ifndef CONFIG_SMP
+- fmxr(FPEXC, fpexc | FPEXC_EN);
++ /* vfp_save_state oopses on VFP11 if EX bit set */
++ fmxr(FPEXC, (fpexc & ~FPEXC_EX) | FPEXC_EN);
+ vfp_save_state(vfp_current_hw_state[ti->cpu], fpexc);
+ fmxr(FPEXC, fpexc);
+ #endif
+@@ -536,7 +542,8 @@ void vfp_sync_hwstate(struct thread_info *thread)
+ /*
+ * Save the last VFP state on this CPU.
+ */
+- fmxr(FPEXC, fpexc | FPEXC_EN);
++ /* vfp_save_state oopses on VFP11 if EX bit set */
++ fmxr(FPEXC, (fpexc & ~FPEXC_EX) | FPEXC_EN);
+ vfp_save_state(&thread->vfpstate, fpexc | FPEXC_EN);
+ fmxr(FPEXC, fpexc);
+ }
+@@ -608,6 +615,7 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
+ struct vfp_hard_struct *hwstate = &thread->vfpstate.hard;
+ unsigned long fpexc;
+ int err = 0;
++ u32 fpsid = fmrx(FPSID);
+
+ /* Disable VFP to avoid corrupting the new thread state. */
+ vfp_flush_hwstate(thread);
+@@ -631,8 +639,12 @@ int vfp_restore_user_hwstate(struct user_vfp __user *ufp,
+ /* Ensure the VFP is enabled. */
+ fpexc |= FPEXC_EN;
+
+- /* Ensure FPINST2 is invalid and the exception flag is cleared. */
+- fpexc &= ~(FPEXC_EX | FPEXC_FP2V);
++ /* Mask FPXEC_EX and FPEXC_FP2V if not required by VFP arch */
++ if ((fpsid & FPSID_ARCH_MASK) != (1 << FPSID_ARCH_BIT)) {
++ /* Ensure FPINST2 is invalid and the exception flag is cleared. */
++ fpexc &= ~(FPEXC_EX | FPEXC_FP2V);
++ }
++
+ hwstate->fpexc = fpexc;
+
+ __get_user_error(hwstate->fpinst, &ufp_exc->fpinst, err);
+@@ -702,7 +714,8 @@ void kernel_neon_begin(void)
+ cpu = get_cpu();
+
+ fpexc = fmrx(FPEXC) | FPEXC_EN;
+- fmxr(FPEXC, fpexc);
++ /* vfp_save_state oopses on VFP11 if EX bit set */
++ fmxr(FPEXC, fpexc & ~FPEXC_EX);
+
+ /*
+ * Save the userland NEON/VFP state. Under UP,
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0590-dwc_otg-fix-summarize-urb-actual_length-for-isochron.patch b/target/linux/brcm2708/patches-4.4/0590-dwc_otg-fix-summarize-urb-actual_length-for-isochron.patch
new file mode 100644
index 0000000..e799081
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0590-dwc_otg-fix-summarize-urb-actual_length-for-isochron.patch
@@ -0,0 +1,33 @@
+From 83672d68ed0199fbe119510626116a32622e4003 Mon Sep 17 00:00:00 2001
+From: Martin Cerveny <M.Cerveny at computer.org>
+Date: Mon, 13 Feb 2017 17:23:47 +0100
+Subject: [PATCH] dwc_otg: fix summarize urb->actual_length for isochronous
+ transfers
+
+Kernel does not copy input data of ISO transfers to userspace
+if actual_length is set only in ISO transfers and not summarized
+in urb->actual_length. Fixes raspberrypi/linux#903
+---
+ drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+index 2ceed42..5011750 100644
+--- a/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
++++ b/drivers/usb/host/dwc_otg/dwc_otg_hcd_linux.c
+@@ -325,10 +325,12 @@ static int _complete(dwc_otg_hcd_t * hcd, void *urb_handle,
+ int i;
+
+ urb->error_count = dwc_otg_hcd_urb_get_error_count(dwc_otg_urb);
++ urb->actual_length = 0;
+ for (i = 0; i < urb->number_of_packets; ++i) {
+ urb->iso_frame_desc[i].actual_length =
+ dwc_otg_hcd_urb_get_iso_desc_actual_length
+ (dwc_otg_urb, i);
++ urb->actual_length += urb->iso_frame_desc[i].actual_length;
+ urb->iso_frame_desc[i].status =
+ dwc_otg_hcd_urb_get_iso_desc_status(dwc_otg_urb, i);
+ }
+--
+2.1.4
+
diff --git a/target/linux/brcm2708/patches-4.4/0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch b/target/linux/brcm2708/patches-4.4/0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch
new file mode 100644
index 0000000..b4e1879
--- /dev/null
+++ b/target/linux/brcm2708/patches-4.4/0591-BCM270X_DT-Add-bcm2708-rpi-0-w.dts.patch
@@ -0,0 +1,236 @@
+From 97425acaefeeb2bf4a704225b544cdd863bc5bc6 Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil at raspberrypi.org>
+Date: Tue, 24 May 2016 16:30:05 +0100
+Subject: [PATCH] BCM270X_DT: Add bcm2708-rpi-0-w.dts
+
+Add DT support for the Pi Zero W. N.B. It will not be loaded
+automatically without a corresponding change to the firmware.
+
+Signed-off-by: Phil Elwell <phil at raspberrypi.org>
+---
+ arch/arm/boot/dts/Makefile | 1 +
+ arch/arm/boot/dts/bcm2708-rpi-0-w.dts | 200 ++++++++++++++++++++++++++++++++++
+ 2 files changed, 201 insertions(+)
+ create mode 100644 arch/arm/boot/dts/bcm2708-rpi-0-w.dts
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 14a491c..bd963ef 100644
+--- a/arch/arm/boot/dts/Makefile
++++ b/arch/arm/boot/dts/Makefile
+@@ -2,6 +2,7 @@ ifeq ($(CONFIG_OF),y)
+
+ dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b.dtb
+ dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-b-plus.dtb
++dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-0-w.dtb
+ dtb-$(CONFIG_ARCH_BCM2708) += bcm2708-rpi-cm.dtb
+ dtb-$(CONFIG_ARCH_BCM2835) += bcm2835-rpi-cm.dtb
+ dtb-$(CONFIG_ARCH_BCM2709) += bcm2709-rpi-2-b.dtb
+diff --git a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
+new file mode 100644
+index 0000000..9f7de60
+--- /dev/null
++++ b/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
+@@ -0,0 +1,200 @@
++/dts-v1/;
++
++#include "bcm2708.dtsi"
++
++/ {
++ compatible = "brcm,bcm2708";
++ model = "Raspberry Pi Zero W";
++};
++
++&gpio {
++ sdhost_pins: sdhost_pins {
++ brcm,pins = <48 49 50 51 52 53>;
++ brcm,function = <4>; /* alt0 */
++ };
++
++ spi0_pins: spi0_pins {
++ brcm,pins = <9 10 11>;
++ brcm,function = <4>; /* alt0 */
++ };
++
++ spi0_cs_pins: spi0_cs_pins {
++ brcm,pins = <8 7>;
++ brcm,function = <1>; /* output */
++ };
++
++ i2c0_pins: i2c0 {
++ brcm,pins = <0 1>;
++ brcm,function = <4>;
++ };
++
++ i2c1_pins: i2c1 {
++ brcm,pins = <2 3>;
++ brcm,function = <4>;
++ };
++
++ i2s_pins: i2s {
++ brcm,pins = <18 19 20 21>;
++ brcm,function = <4>; /* alt0 */
++ };
++
++ sdio_pins: sdio_pins {
++ brcm,pins = <34 35 36 37 38 39>;
++ brcm,function = <7 7 7 7 7 7>; /* ALT3 = SD1 */
++ brcm,pull = <0 2 2 2 2 2>;
++ };
++
++ bt_pins: bt_pins {
++ brcm,pins = <43>;
++ brcm,function = <4>; /* alt0:GPCLK2 */
++ brcm,pull = <0>; /* none */
++ };
++
++ uart0_pins: uart0_pins {
++ brcm,pins = <30 31 32 33>;
++ brcm,function = <7>; /* alt3=UART0 */
++ brcm,pull = <2 0 0 2>; /* up none none up */
++ };
++
++ uart1_pins: uart1_pins {
++ brcm,pins;
++ brcm,function;
++ brcm,pull;
++ };
++
++ audio_pins: audio_pins {
++ brcm,pins = <>;
++ brcm,function = <>;
++ };
++};
++
++&sdhost {
++ pinctrl-names = "default";
++ pinctrl-0 = <&sdhost_pins>;
++ bus-width = <4>;
++ status = "okay";
++};
++
++&mmc {
++ pinctrl-names = "default";
++ pinctrl-0 = <&sdio_pins>;
++ non-removable;
++ bus-width = <4>;
++ status = "okay";
++};
++
++&fb {
++ status = "okay";
++};
++
++&uart0 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&uart0_pins &bt_pins>;
++ status = "okay";
++};
++
++&uart1 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&uart1_pins>;
++ status = "okay";
++};
++
++&spi0 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
++ cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
++
++ spidev0: spidev at 0{
++ compatible = "spidev";
++ reg = <0>; /* CE0 */
++ #address-cells = <1>;
++ #size-cells = <0>;
++ spi-max-frequency = <500000>;
++ };
++
++ spidev1: spidev at 1{
++ compatible = "spidev";
++ reg = <1>; /* CE1 */
++ #address-cells = <1>;
++ #size-cells = <0>;
++ spi-max-frequency = <500000>;
++ };
++};
++
++&i2c0 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&i2c0_pins>;
++ clock-frequency = <100000>;
++};
++
++&i2c1 {
++ pinctrl-names = "default";
++ pinctrl-0 = <&i2c1_pins>;
++ clock-frequency = <100000>;
++};
++
++&i2c2 {
++ clock-frequency = <100000>;
++};
++
++&i2s {
++ #sound-dai-cells = <0>;
++ pinctrl-names = "default";
++ pinctrl-0 = <&i2s_pins>;
++};
++
++&random {
++ status = "okay";
++};
++
++&leds {
++ act_led: act {
++ label = "led0";
++ linux,default-trigger = "mmc0";
++ gpios = <&gpio 47 0>;
++ };
++};
++
++&hdmi {
++ hpd-gpios = <&gpio 46 GPIO_ACTIVE_LOW>;
++};
++
++&audio {
++ pinctrl-names = "default";
++ pinctrl-0 = <&audio_pins>;
++};
++
++/ {
++ chosen {
++ bootargs = "8250.nr_uarts=1";
++ };
++};
++
++/ {
++ __overrides__ {
++ uart0 = <&uart0>,"status";
++ uart0_clkrate = <&clk_uart0>,"clock-frequency:0";
++ uart1 = <&uart1>,"status";
++ i2s = <&i2s>,"status";
++ spi = <&spi0>,"status";
++ i2c0 = <&i2c0>,"status";
++ i2c1 = <&i2c1>,"status";
++ i2c2_iknowwhatimdoing = <&i2c2>,"status";
++ i2c0_baudrate = <&i2c0>,"clock-frequency:0";
++ i2c1_baudrate = <&i2c1>,"clock-frequency:0";
++ i2c2_baudrate = <&i2c2>,"clock-frequency:0";
++ core_freq = <&clk_core>,"clock-frequency:0";
++
++ act_led_gpio = <&act_led>,"gpios:4";
++ act_led_activelow = <&act_led>,"gpios:8";
++ act_led_trigger = <&act_led>,"linux,default-trigger";
++
++ audio = <&audio>,"status";
++ watchdog = <&watchdog>,"status";
++ random = <&random>,"status";
++ sd_overclock = <&sdhost>,"brcm,overclock-50:0";
++ sd_force_pio = <&sdhost>,"brcm,force-pio?";
++ sd_pio_limit = <&sdhost>,"brcm,pio-limit:0";
++ sd_debug = <&sdhost>,"brcm,debug";
++ };
++};
+--
+2.1.4
+
More information about the lede-commits
mailing list