1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter.git synced 2025-03-09 15:40:20 +00:00

Add some 4.19 RPI patches

This commit is contained in:
Ycarus 2019-06-05 21:05:32 +02:00
parent a9f369770a
commit eeca0ba318
4 changed files with 445 additions and 0 deletions

View file

@ -0,0 +1,60 @@
From 6f91b5dbfdb62a434571a73f2dc15181963e3bea Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Tue, 28 May 2019 16:36:04 +0100
Subject: [PATCH 516/520] BCM270X_DT: Rename Pi Zero W DT files
The downtream Pi Zero W dts file uses the digit 0, whereas upstream
chose to spell it out - "zero-w". The firmware has, for a long time,
looked for bcm2708-rpi-zero-w.dtb first before falling back to the
numerical version. Therefore it is better to follow upstream and
make the switch to "bcm2708-rpi-zero-w".
At the same time, remove some overrides that duplicate values
inherited from the shared .dtsi files.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/boot/dts/Makefile | 2 +-
.../boot/dts/{bcm2708-rpi-0-w.dts => bcm2708-rpi-zero-w.dts} | 5 -----
2 files changed, 1 insertion(+), 6 deletions(-)
rename arch/arm/boot/dts/{bcm2708-rpi-0-w.dts => bcm2708-rpi-zero-w.dts} (97%)
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index ffd515b94cb8..8ba7c562ccfc 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -4,7 +4,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
bcm2708-rpi-b.dtb \
bcm2708-rpi-b-plus.dtb \
bcm2708-rpi-cm.dtb \
- bcm2708-rpi-0-w.dtb \
+ bcm2708-rpi-zero-w.dtb \
bcm2709-rpi-2-b.dtb \
bcm2710-rpi-3-b.dtb \
bcm2710-rpi-3-b-plus.dtb \
diff --git a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
similarity index 97%
rename from arch/arm/boot/dts/bcm2708-rpi-0-w.dts
rename to arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
index 23ff3e4970ae..087f39106bef 100644
--- a/arch/arm/boot/dts/bcm2708-rpi-0-w.dts
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
@@ -132,15 +132,10 @@
};
&i2s {
- #sound-dai-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&i2s_pins>;
};
-&random {
- status = "okay";
-};
-
&leds {
act_led: act {
label = "led0";
--
2.19.1

View file

@ -0,0 +1,156 @@
From bd1336d8b6544ce5c7ddb197c3d8c539082dac66 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Tue, 28 May 2019 16:23:51 +0100
Subject: [PATCH 517/520] BCM270X_DT: Create bcm2708-rpi-zero.dts
The Pi Zero deserves a dedicated .dtb file - sharing the b-plus .dtb
has been observed to cause an issue with the MAC address of some
Ethernet dongles.
See: https://github.com/raspberrypi/linux/issues/2990
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/bcm2708-rpi-zero.dts | 117 +++++++++++++++++++++++++
2 files changed, 118 insertions(+)
create mode 100644 arch/arm/boot/dts/bcm2708-rpi-zero.dts
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 8ba7c562ccfc..232f95f8fef4 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -4,6 +4,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
bcm2708-rpi-b.dtb \
bcm2708-rpi-b-plus.dtb \
bcm2708-rpi-cm.dtb \
+ bcm2708-rpi-zero.dtb \
bcm2708-rpi-zero-w.dtb \
bcm2709-rpi-2-b.dtb \
bcm2710-rpi-3-b.dtb \
diff --git a/arch/arm/boot/dts/bcm2708-rpi-zero.dts b/arch/arm/boot/dts/bcm2708-rpi-zero.dts
new file mode 100644
index 000000000000..dba3ece8eac5
--- /dev/null
+++ b/arch/arm/boot/dts/bcm2708-rpi-zero.dts
@@ -0,0 +1,117 @@
+/dts-v1/;
+
+#include "bcm2708.dtsi"
+#include "bcm283x-rpi-csi1-2lane.dtsi"
+
+/ {
+ compatible = "raspberrypi,model-zero", "brcm,bcm2835";
+ model = "Raspberry Pi Zero";
+
+ chosen {
+ bootargs = "coherent_pool=1M";
+ };
+};
+
+&gpio {
+ 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 */
+ };
+
+ audio_pins: audio_pins {
+ brcm,pins = <>;
+ brcm,function = <>;
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+&spi0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_pins &spi0_cs_pins>;
+ cs-gpios = <&gpio 8 1>, <&gpio 7 1>;
+
+ spidev0: spidev@0{
+ compatible = "spidev";
+ reg = <0>; /* CE0 */
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi-max-frequency = <125000000>;
+ };
+
+ spidev1: spidev@1{
+ compatible = "spidev";
+ reg = <1>; /* CE1 */
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi-max-frequency = <125000000>;
+ };
+};
+
+&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 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2s_pins>;
+};
+
+&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>;
+};
+
+/ {
+ __overrides__ {
+ act_led_gpio = <&act_led>,"gpios:4";
+ act_led_activelow = <&act_led>,"gpios:8";
+ act_led_trigger = <&act_led>,"linux,default-trigger";
+ };
+};
--
2.19.1

View file

@ -0,0 +1,82 @@
From 55e0334cf5a43948b65788980cd8ab729427230e Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Thu, 30 May 2019 12:25:29 +0100
Subject: [PATCH 518/520] overlays: Fix mmc-related overlays after refactor
The addition of the mmcnr node to the base dtbs caused some overlays to
not work as they should. Patch up pi3-disable-wifi, balena-fin and
sdhost.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
arch/arm/boot/dts/overlays/balena-fin-overlay.dts | 7 ++++---
arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts | 7 +++++++
arch/arm/boot/dts/overlays/sdhost-overlay.dts | 7 +++++++
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/arch/arm/boot/dts/overlays/balena-fin-overlay.dts b/arch/arm/boot/dts/overlays/balena-fin-overlay.dts
index b10675c02757..8c1cba99fc8f 100644
--- a/arch/arm/boot/dts/overlays/balena-fin-overlay.dts
+++ b/arch/arm/boot/dts/overlays/balena-fin-overlay.dts
@@ -5,13 +5,12 @@
compatible = "brcm,bcm2835";
fragment@0 {
- target = <&mmc>;
- sdio_wifi: __overlay__ {
+ target = <&mmcnr>;
+ __overlay__ {
pinctrl-names = "default";
pinctrl-0 = <&sdio_pins>;
bus-width = <4>;
brcm,overclock-50 = <35>;
- non-removable;
status = "okay";
};
};
@@ -43,6 +42,8 @@
compatible = "gpio-poweroff";
gpios = <&gpio 40 1>;
force;
+ pinctrl-names = "default";
+ pinctrl-0 = <&power_ctrl_pins>;
};
i2c_soft: i2c@0 {
diff --git a/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
index 1d061bdd40f3..75e046463900 100644
--- a/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
+++ b/arch/arm/boot/dts/overlays/pi3-disable-wifi-overlay.dts
@@ -10,4 +10,11 @@
status = "disabled";
};
};
+
+ fragment@1 {
+ target = <&mmcnr>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
};
diff --git a/arch/arm/boot/dts/overlays/sdhost-overlay.dts b/arch/arm/boot/dts/overlays/sdhost-overlay.dts
index ae6c6ad83076..0b72b4eeac88 100644
--- a/arch/arm/boot/dts/overlays/sdhost-overlay.dts
+++ b/arch/arm/boot/dts/overlays/sdhost-overlay.dts
@@ -22,6 +22,13 @@
};
};
+ fragment@2 {
+ target = <&mmcnr>;
+ __overlay__ {
+ status = "disabled";
+ };
+ };
+
__overrides__ {
overclock_50 = <&frag0>,"brcm,overclock-50:0";
force_pio = <&frag0>,"brcm,force-pio?";
--
2.19.1

View file

@ -0,0 +1,147 @@
From 8bff48328aff10c1e9c134a55337620929e449c2 Mon Sep 17 00:00:00 2001
From: Frank Rowand <frank.rowand@sony.com>
Date: Fri, 12 Oct 2018 19:21:16 -0700
Subject: [PATCH 519/520] of: overlay: set node fields from properties when add
new overlay node
commit f96278810150fc39085d1872e5b39ea06366d03e upstream.
See: https://github.com/raspberrypi/linux/issues/2995
Overlay nodes added by add_changeset_node() do not have the node
fields name, phandle, and type set.
The node passed to __of_attach_node() when the add node changeset
entry is processed does not contain any properties. The node's
properties are located in add property changeset entries that will
be processed after the add node changeset is applied.
Set the node's fields in the node contained in the add node
changeset entry and do not set them to incorrect values in
add_changeset_node().
A visible symptom that is fixed by this patch is the names of nodes
added by overlays that have an entry in /sys/bus/platform/drivers/*/
will contain the unit-address but the node-name will be <NULL>, for
example, "fc4ab000.<NULL>". After applying the patch the name, in
this example, for node restart@fc4ab000 is "fc4ab000.restart".
Tested-by: Alan Tull <atull@kernel.org>
Signed-off-by: Frank Rowand <frank.rowand@sony.com>
---
drivers/of/dynamic.c | 27 ++++++++++++++++++---------
drivers/of/overlay.c | 34 +++++++++++++++++++++++++++-------
2 files changed, 45 insertions(+), 16 deletions(-)
diff --git a/drivers/of/dynamic.c b/drivers/of/dynamic.c
index 45c0b1f4cb69..a09c1c3cf831 100644
--- a/drivers/of/dynamic.c
+++ b/drivers/of/dynamic.c
@@ -205,15 +205,24 @@ static void __of_attach_node(struct device_node *np)
const __be32 *phandle;
int sz;
- np->name = __of_get_property(np, "name", NULL) ? : "<NULL>";
- np->type = __of_get_property(np, "device_type", NULL) ? : "<NULL>";
-
- phandle = __of_get_property(np, "phandle", &sz);
- if (!phandle)
- phandle = __of_get_property(np, "linux,phandle", &sz);
- if (IS_ENABLED(CONFIG_PPC_PSERIES) && !phandle)
- phandle = __of_get_property(np, "ibm,phandle", &sz);
- np->phandle = (phandle && (sz >= 4)) ? be32_to_cpup(phandle) : 0;
+ if (!of_node_check_flag(np, OF_OVERLAY)) {
+ np->name = __of_get_property(np, "name", NULL);
+ np->type = __of_get_property(np, "device_type", NULL);
+ if (!np->name)
+ np->name = "<NULL>";
+ if (!np->type)
+ np->type = "<NULL>";
+
+ phandle = __of_get_property(np, "phandle", &sz);
+ if (!phandle)
+ phandle = __of_get_property(np, "linux,phandle", &sz);
+ if (IS_ENABLED(CONFIG_PPC_PSERIES) && !phandle)
+ phandle = __of_get_property(np, "ibm,phandle", &sz);
+ if (phandle && (sz >= 4))
+ np->phandle = be32_to_cpup(phandle);
+ else
+ np->phandle = 0;
+ }
np->child = NULL;
np->sibling = np->parent->child;
diff --git a/drivers/of/overlay.c b/drivers/of/overlay.c
index 9808aae4621a..b2704badd987 100644
--- a/drivers/of/overlay.c
+++ b/drivers/of/overlay.c
@@ -301,10 +301,11 @@ static int add_changeset_property(struct overlay_changeset *ovcs,
struct property *new_prop = NULL, *prop;
int ret = 0;
- if (!of_prop_cmp(overlay_prop->name, "name") ||
- !of_prop_cmp(overlay_prop->name, "phandle") ||
- !of_prop_cmp(overlay_prop->name, "linux,phandle"))
- return 0;
+ if (target->in_livetree)
+ if (!of_prop_cmp(overlay_prop->name, "name") ||
+ !of_prop_cmp(overlay_prop->name, "phandle") ||
+ !of_prop_cmp(overlay_prop->name, "linux,phandle"))
+ return 0;
if (target->in_livetree)
prop = of_find_property(target->np, overlay_prop->name, NULL);
@@ -322,12 +323,17 @@ static int add_changeset_property(struct overlay_changeset *ovcs,
if (!new_prop)
return -ENOMEM;
- if (!prop)
+ if (!prop) {
+ if (!target->in_livetree) {
+ new_prop->next = target->np->deadprops;
+ target->np->deadprops = new_prop;
+ }
ret = of_changeset_add_property(&ovcs->cset, target->np,
new_prop);
- else
+ } else {
ret = of_changeset_update_property(&ovcs->cset, target->np,
new_prop);
+ }
if (ret) {
kfree(new_prop->name);
@@ -382,9 +388,10 @@ static int add_changeset_node(struct overlay_changeset *ovcs,
struct target *target, struct device_node *node)
{
const char *node_kbasename;
+ const __be32 *phandle;
struct device_node *tchild;
struct target target_child;
- int ret = 0;
+ int ret = 0, size;
node_kbasename = kbasename(node->full_name);
@@ -398,6 +405,19 @@ static int add_changeset_node(struct overlay_changeset *ovcs,
return -ENOMEM;
tchild->parent = target->np;
+ tchild->name = __of_get_property(node, "name", NULL);
+ tchild->type = __of_get_property(node, "device_type", NULL);
+
+ if (!tchild->name)
+ tchild->name = "<NULL>";
+ if (!tchild->type)
+ tchild->type = "<NULL>";
+
+ /* ignore obsolete "linux,phandle" */
+ phandle = __of_get_property(node, "phandle", &size);
+ if (phandle && (size == 4))
+ tchild->phandle = be32_to_cpup(phandle);
+
of_node_set_flag(tchild, OF_OVERLAY);
ret = of_changeset_attach_node(&ovcs->cset, tchild);
--
2.19.1