Improvements for the Raspberry Pi 3+, Fixes and minor improvements to Raspberry Pi 2/3

This commit is contained in:
Peter Robinson 2018-04-02 18:38:27 +01:00
parent 8b84f3eb40
commit 494688df84
6 changed files with 420 additions and 112 deletions

31
bcm2837-enable-pmu.patch Normal file
View File

@ -0,0 +1,31 @@
From 69e52712002cb6768b894cde9620fb426fd8728d Mon Sep 17 00:00:00 2001
From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Fri, 16 Mar 2018 21:49:37 +0100
Subject: [PATCH] ARM: dts: bcm2837: Enable PMU on Raspberry Pi 3
This enables the PMU (performance monitoring unit) on Raspberry Pi 3.
In order to make it work on ARM and ARM64, we need to specify two
compatible strings.
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
arch/arm/boot/dts/bcm2837.dtsi | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/arm/boot/dts/bcm2837.dtsi b/arch/arm/boot/dts/bcm2837.dtsi
index 7704bb029605..1f5e5c782835 100644
--- a/arch/arm/boot/dts/bcm2837.dtsi
+++ b/arch/arm/boot/dts/bcm2837.dtsi
@@ -17,6 +17,12 @@
};
};
+ arm-pmu {
+ compatible = "arm,cortex-a53-pmu", "arm,cortex-a7-pmu";
+ interrupt-parent = <&local_intc>;
+ interrupts = <9 IRQ_TYPE_LEVEL_HIGH>;
+ };
+
timer {
compatible = "arm,armv7-timer";
interrupt-parent = <&local_intc>;

View File

@ -636,3 +636,72 @@ index 3e4ed7c5b0b3..0b31d995a066 100644
/* uart0 communicates with the BT module */ /* uart0 communicates with the BT module */
&uart0 { &uart0 {
pinctrl-names = "default"; pinctrl-names = "default";
From 257f497bb3e58f88500971145761ed55428618eb Mon Sep 17 00:00:00 2001
From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Wed, 7 Mar 2018 15:56:20 +0100
Subject: [PATCH] ARM: dts: bcm2837: Add missing GPIOs of Expander
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
arch/arm/boot/dts/bcm2837-rpi-3-b.dts | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
index 0b31d995a066..3e87ed05918e 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b.dts
@@ -20,9 +20,14 @@
leds {
act {
- gpios = <&gpio 47 GPIO_ACTIVE_HIGH>;
+ gpios = <&expgpio 2 GPIO_ACTIVE_HIGH>;
};
};
+
+ wifi_pwrseq: wifi-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>;
+ };
};
&firmware {
@@ -42,6 +47,10 @@
};
};
+&hdmi {
+ hpd-gpios = <&expgpio 4 GPIO_ACTIVE_LOW>;
+};
+
/* uart0 communicates with the BT module */
&uart0 {
pinctrl-names = "default";
@@ -51,6 +60,7 @@
bluetooth {
compatible = "brcm,bcm43438-bt";
max-speed = <2000000>;
+ shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
};
};
@@ -63,11 +73,19 @@
/* SDHCI is used to control the SDIO for wireless */
&sdhci {
+ #address-cells = <1>;
+ #size-cells = <0>;
pinctrl-names = "default";
pinctrl-0 = <&emmc_gpio34>;
status = "okay";
bus-width = <4>;
non-removable;
+ mmc-pwrseq = <&wifi_pwrseq>;
+
+ brcmf: wifi@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ };
};
/* SDHOST is used to drive the SD card */

108
bcm2837-lan78xx-fixes.patch Normal file
View File

@ -0,0 +1,108 @@
From 6ed88d188a8240ba44da6578eab7d17e036d0e61 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Tue, 17 Oct 2017 15:04:29 +0100
Subject: [PATCH] lan78xx: Enable LEDs if no valid EEPROM or OTP
For applications of the LAN78xx that don't have valid programmed
EEPROMs or OTPs, enabling both LEDs by default seems reasonable.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index a21039852f8d..cd20ce4ed87d 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -2414,6 +2414,12 @@ static int lan78xx_reset(struct lan78xx_net *dev)
ret = lan78xx_read_reg(dev, HW_CFG, &buf);
buf |= HW_CFG_MEF_;
+
+ /* If no valid EEPROM and no valid OTP, enable the LEDs by default */
+ if (lan78xx_read_eeprom(dev, 0, 0, NULL) &&
+ lan78xx_read_otp(dev, 0, 0, NULL))
+ buf |= HW_CFG_LED0_EN_ | HW_CFG_LED1_EN_;
+
ret = lan78xx_write_reg(dev, HW_CFG, buf);
ret = lan78xx_read_reg(dev, USB_CFG0, &buf);
From f8a798bb45ae15cbec980c8e921eb377fd1a3df6 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Tue, 28 Nov 2017 12:02:37 +0000
Subject: [PATCH] lan78xx: Correctly indicate invalid OTP
lan78xx_read_otp tries to return -EINVAL in the event of invalid OTP
content, but the value gets overwritten before it is returned and the
read goes ahead anyway. Make the read conditional as it should be
and preserve the error code.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index cd20ce4ed87d..b270935f3f8d 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -929,7 +929,8 @@ static int lan78xx_read_otp(struct lan78xx_net *dev, u32 offset,
offset += 0x100;
else
ret = -EINVAL;
- ret = lan78xx_read_raw_otp(dev, offset, length, data);
+ if (!ret)
+ ret = lan78xx_read_raw_otp(dev, offset, length, data);
}
return ret;
From 4a4710f3847cd087e150f83382dffd92e09d9914 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Sat, 17 Mar 2018 00:10:02 +0100
Subject: [PATCH] lan78xx: Read MAC address from DT if present
There is a standard mechanism for locating and using a MAC address from
the Device Tree. Use this facility in the lan78xx driver to support
applications without programmed EEPROM or OTP.
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
---
drivers/net/usb/lan78xx.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 60a604cc7647..a21039852f8d 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -36,6 +36,7 @@
#include <linux/irq.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/microchipphy.h>
+#include <linux/of_net.h>
#include <linux/phy.h>
#include "lan78xx.h"
@@ -1639,6 +1640,14 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
u32 addr_lo, addr_hi;
int ret;
u8 addr[6];
+ const u8 *mac_addr;
+
+ /* maybe the boot loader passed the MAC address in devicetree */
+ mac_addr = of_get_mac_address(dev->udev->dev.of_node);
+ if (mac_addr) {
+ ether_addr_copy(addr, mac_addr);
+ goto set_mac_addr;
+ }
ret = lan78xx_read_reg(dev, RX_ADDRL, &addr_lo);
ret = lan78xx_read_reg(dev, RX_ADDRH, &addr_hi);
@@ -1667,6 +1676,7 @@ static void lan78xx_init_mac_address(struct lan78xx_net *dev)
"MAC address set to random addr");
}
+set_mac_addr:
addr_lo = addr[0] | (addr[1] << 8) |
(addr[2] << 16) | (addr[3] << 24);
addr_hi = addr[4] | (addr[5] << 8);

View File

@ -1,22 +1,60 @@
From 383c32f69af61774ff3414f98c9bc29f28dca8fa Mon Sep 17 00:00:00 2001 From defa4876ece55751c691d17ffc928d9bfe049585 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com> From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Mon, 19 Mar 2018 09:26:57 +0000 Date: Fri, 16 Mar 2018 22:56:59 +0100
Subject: [PATCH] rpi: initial support for the 3+ Subject: [PATCH] arm64: dts: broadcom: Add reference to Raspberry Pi 3 B+
Signed-off-by: Peter Robinson <pbrobinson@gmail.com> This adds a reference to the dts file of the Raspberry Pi 3 B+
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
--- ---
arch/arm/boot/dts/Makefile | 1 + arch/arm64/boot/dts/broadcom/Makefile | 3 ++-
arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 62 ++++++++++++++++++++++ arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts | 2 ++
arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi | 36 +++++++++++++ 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/broadcom/Makefile | 4 +-
.../boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts | 2 +
5 files changed, 104 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
create mode 100644 arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts create mode 100644 arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
index 2a2591ef1fee..1193a9e34bbb 100644
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -1,5 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
-dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
+dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb \
+ bcm2837-rpi-3-b-plus.dtb
subdir-y += northstar2
subdir-y += stingray
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
new file mode 100644
index 000000000000..46ad2023cccf
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "arm/bcm2837-rpi-3-b-plus.dts"
From c7c06c54087dfadd065abcba0b7f614f7a88d549 Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.org>
Date: Fri, 16 Mar 2018 22:42:28 +0100
Subject: [PATCH] ARM: dts: bcm2837: Add Raspberry Pi 3 B+
The Raspberry Pi 3 B+ has the following major differences compared
to the model 3 B:
* Microchip LAN7515 (Gigabit Ethernet)
* Cypress CYW43455 (802.11ac and BT 4.2)
Signed-off-by: Phil Elwell <phil@raspberrypi.org>
Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
---
arch/arm/boot/dts/Makefile | 1 +
arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 102 +++++++++++++++++++++++++++++
arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi | 27 ++++++++
3 files changed, 130 insertions(+)
create mode 100644 arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
create mode 100644 arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index ade7a38543dc..05b49935d84b 100644 index 3b471e6787ff..dee85f848de9 100644
--- a/arch/arm/boot/dts/Makefile --- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile
@@ -75,6 +75,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ @@ -75,6 +75,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
@ -29,10 +67,10 @@ index ade7a38543dc..05b49935d84b 100644
dtb-$(CONFIG_ARCH_BCM_5301X) += \ dtb-$(CONFIG_ARCH_BCM_5301X) += \
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
new file mode 100644 new file mode 100644
index 000000000000..63ff6bc56e36 index 000000000000..fb9f6f7e965c
--- /dev/null --- /dev/null
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts +++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
@@ -0,0 +1,62 @@ @@ -0,0 +1,102 @@
+// SPDX-License-Identifier: GPL-2.0 +// SPDX-License-Identifier: GPL-2.0
+/dts-v1/; +/dts-v1/;
+#include "bcm2837.dtsi" +#include "bcm2837.dtsi"
@ -55,9 +93,40 @@ index 000000000000..63ff6bc56e36
+ +
+ leds { + leds {
+ act { + act {
+ gpios = <&gpio 47 GPIO_ACTIVE_HIGH>; + gpios = <&gpio 29 0>;
+ };
+
+ pwr {
+ label = "PWR";
+ gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
+ }; + };
+ }; + };
+
+ wifi_pwrseq: wifi-pwrseq {
+ compatible = "mmc-pwrseq-simple";
+ reset-gpios = <&expgpio 1 GPIO_ACTIVE_HIGH>;
+ };
+};
+
+&firmware {
+ expgpio: gpio {
+ compatible = "raspberrypi,firmware-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-line-names = "BT_ON",
+ "WL_ON",
+ "STATUS_LED",
+ "LAN_RUN",
+ "",
+ "CAM_GPIO0",
+ "CAM_GPIO1",
+ "";
+ status = "okay";
+ };
+};
+
+&hdmi {
+ hpd-gpios = <&gpio 28 GPIO_ACTIVE_LOW>;
+}; +};
+ +
+/* uart0 communicates with the BT module */ +/* uart0 communicates with the BT module */
@ -69,6 +138,7 @@ index 000000000000..63ff6bc56e36
+ bluetooth { + bluetooth {
+ compatible = "brcm,bcm43438-bt"; + compatible = "brcm,bcm43438-bt";
+ max-speed = <2000000>; + max-speed = <2000000>;
+ shutdown-gpios = <&expgpio 0 GPIO_ACTIVE_HIGH>;
+ }; + };
+}; +};
+ +
@ -81,11 +151,19 @@ index 000000000000..63ff6bc56e36
+ +
+/* SDHCI is used to control the SDIO for wireless */ +/* SDHCI is used to control the SDIO for wireless */
+&sdhci { +&sdhci {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pinctrl-names = "default"; + pinctrl-names = "default";
+ pinctrl-0 = <&emmc_gpio34>; + pinctrl-0 = <&emmc_gpio34>;
+ status = "okay"; + status = "okay";
+ bus-width = <4>; + bus-width = <4>;
+ non-removable; + non-removable;
+ mmc-pwrseq = <&wifi_pwrseq>;
+
+ brcmf: wifi@1 {
+ reg = <1>;
+ compatible = "brcm,bcm4329-fmac";
+ };
+}; +};
+ +
+/* SDHOST is used to drive the SD card */ +/* SDHOST is used to drive the SD card */
@ -97,10 +175,11 @@ index 000000000000..63ff6bc56e36
+}; +};
diff --git a/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi diff --git a/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
new file mode 100644 new file mode 100644
index 000000000000..1b1075d4aa5c index 000000000000..169203c5ce8b
--- /dev/null --- /dev/null
+++ b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi +++ b/arch/arm/boot/dts/bcm283x-rpi-lan7515.dtsi
@@ -0,0 +1,36 @@ @@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0
+/ { +/ {
+ aliases { + aliases {
+ ethernet0 = &ethernet; + ethernet0 = &ethernet;
@ -123,93 +202,8 @@ index 000000000000..1b1075d4aa5c
+ ethernet: usbether@1 { + ethernet: usbether@1 {
+ compatible = "usb424,7800"; + compatible = "usb424,7800";
+ reg = <1>; + reg = <1>;
+ microchip,eee-enabled;
+ microchip,tx-lpi-timer = <600>; /* non-aggressive*/
+ }; + };
+ }; + };
+ }; + };
+}; +};
+
+
+/ {
+ __overrides__ {
+ eee = <&ethernet>,"microchip,eee-enabled?";
+ tx_lpi_timer = <&ethernet>,"microchip,tx-lpi-timer:0";
+ };
+};
diff --git a/arch/arm64/boot/dts/broadcom/Makefile b/arch/arm64/boot/dts/broadcom/Makefile
index 2a2591ef1fee..6b5b70542dad 100644
--- a/arch/arm64/boot/dts/broadcom/Makefile
+++ b/arch/arm64/boot/dts/broadcom/Makefile
@@ -1,5 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
-dtb-$(CONFIG_ARCH_BCM2835) += bcm2837-rpi-3-b.dtb
+dtb-$(CONFIG_ARCH_BCM2835) += \
+ bcm2837-rpi-3-b.dtb \
+ bcm2837-rpi-3-b-plus.dtb
subdir-y += northstar2
subdir-y += stingray
diff --git a/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
new file mode 100644
index 000000000000..46ad2023cccf
--- /dev/null
+++ b/arch/arm64/boot/dts/broadcom/bcm2837-rpi-3-b-plus.dts
@@ -0,0 +1,2 @@
+// SPDX-License-Identifier: GPL-2.0
+#include "arm/bcm2837-rpi-3-b-plus.dts"
--
2.16.2
From patchwork Tue Feb 20 12:19:35 2018
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [v5,5/5] ARM: dts: bcm2837-rpi-3-b: add GPIO expander
From: Baruch Siach <baruch@tkos.co.il>
X-Patchwork-Id: 10229995
Message-Id: <a6d59692dc4847e0b1639a26542e28c95ad5240f.1519128054.git.baruch@tkos.co.il>
To: Linus Walleij <linus.walleij@linaro.org>,
Dave Stevenson <dave.stevenson@raspberrypi.org>,
Eric Anholt <eric@anholt.net>, Stefan Wahren <stefan.wahren@i2se.com>
Cc: devicetree@vger.kernel.org, Baruch Siach <baruch@tkos.co.il>,
linux-gpio@vger.kernel.org, Michael Zoran <mzoran@crowfest.net>,
Rob Herring <robh+dt@kernel.org>, linux-rpi-kernel@lists.infradead.org,
Frank Rowand <frowand.list@gmail.com>, linux-arm-kernel@lists.infradead.org
Date: Tue, 20 Feb 2018 14:19:35 +0200
Add a description of the RPi3 GPIO expander that the VC4 firmware controls.
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
index 3e4ed7c5b0b3..0b31d995a066 100644
--- a/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
+++ b/arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
@@ -25,6 +25,23 @@
};
};
+&firmware {
+ expgpio: gpio {
+ compatible = "raspberrypi,firmware-gpio";
+ gpio-controller;
+ #gpio-cells = <2>;
+ gpio-line-names = "BT_ON",
+ "WL_ON",
+ "STATUS_LED",
+ "LAN_RUN",
+ "HPD_N",
+ "CAM_GPIO0",
+ "CAM_GPIO1",
+ "PWR_LOW_N";
+ status = "okay";
+ };
+};
+
/* uart0 communicates with the BT module */
&uart0 {
pinctrl-names = "default";

View File

@ -0,0 +1,98 @@
From aa964d59aab2cb04bc011ffd370822ac79f82a0b Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@bootlin.com>
Date: Wed, 7 Mar 2018 15:39:17 +0100
Subject: [PATCH] clk: bcm2835: De-assert/assert PLL reset signal when
appropriate
In order to enable a PLL, not only the PLL has to be powered up and
locked, but you also have to de-assert the reset signal. The last part
was missing. Add it so PLLs that were not enabled by the FW/bootloader
can be enabled from Linux.
Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
drivers/clk/bcm/clk-bcm2835.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index a07f6451694a..6c5d4a8e426c 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -602,6 +602,9 @@ static void bcm2835_pll_off(struct clk_hw *hw)
const struct bcm2835_pll_data *data = pll->data;
spin_lock(&cprman->regs_lock);
+ cprman_write(cprman, data->a2w_ctrl_reg,
+ cprman_read(cprman, data->a2w_ctrl_reg) &
+ ~A2W_PLL_CTRL_PRST_DISABLE);
cprman_write(cprman, data->cm_ctrl_reg,
cprman_read(cprman, data->cm_ctrl_reg) |
CM_PLL_ANARST);
@@ -640,6 +643,10 @@ static int bcm2835_pll_on(struct clk_hw *hw)
cpu_relax();
}
+ cprman_write(cprman, data->a2w_ctrl_reg,
+ cprman_read(cprman, data->a2w_ctrl_reg) |
+ A2W_PLL_CTRL_PRST_DISABLE);
+
return 0;
}
From 1b6867ee05d84cc6ec23b5ec0b78684187d3190a Mon Sep 17 00:00:00 2001
From: Boris Brezillon <boris.brezillon@bootlin.com>
Date: Wed, 7 Mar 2018 15:41:14 +0100
Subject: [PATCH] clk: bcm2835: Make sure the PLL is gated before changing its
rate
All bcm2835 PLLs should be gated before their rate can be changed.
Setting CLK_SET_RATE_GATE will let the core enforce that, but this is
not enough to make the code work in all situations. Indeed, the
CLK_SET_RATE_GATE flag prevents a user from changing the rate while
the clock is enabled, but this check only guarantees there's no Linux
users. In our case, the clock might have been enabled by the
bootloader/FW, and, because we have CLK_IGNORE_UNUSED set, Linux never
disables the PLL. So we have to make sure the PLL is actually disabled
before changing the rate.
Fixes: 41691b8862e2 ("clk: bcm2835: Add support for programming the audio domain clocks")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
drivers/clk/bcm/clk-bcm2835.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
index 6c5d4a8e426c..051ce769c109 100644
--- a/drivers/clk/bcm/clk-bcm2835.c
+++ b/drivers/clk/bcm/clk-bcm2835.c
@@ -678,6 +678,18 @@ static int bcm2835_pll_set_rate(struct clk_hw *hw,
u32 ana[4];
int i;
+ /*
+ * Normally, the CLK_SET_RATE_GATE flag prevents a user from changing
+ * the rate while the clock is enabled, but this check only makes sure
+ * there's no Linux users.
+ * In our case, the clock might have been enabled by the bootloader/FW,
+ * and, since CLK_IGNORE_UNUSED flag is set, Linux never disables it.
+ * So we have to make sure the clk is actually disabled before changing
+ * the rate.
+ */
+ if (bcm2835_pll_is_on(hw))
+ bcm2835_pll_off(hw);
+
if (rate > data->max_fb_rate) {
use_fb_prediv = true;
rate /= 2;
@@ -1318,7 +1330,7 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
init.num_parents = 1;
init.name = data->name;
init.ops = &bcm2835_pll_clk_ops;
- init.flags = CLK_IGNORE_UNUSED;
+ init.flags = CLK_IGNORE_UNUSED | CLK_SET_RATE_GATE;
pll = kzalloc(sizeof(*pll), GFP_KERNEL);
if (!pll)

View File

@ -588,9 +588,6 @@ Patch305: qcom-msm89xx-fixes.patch
# https://patchwork.kernel.org/patch/10173115/ # https://patchwork.kernel.org/patch/10173115/
Patch306: arm-dts-imx6qdl-udoo-Disable-usbh1-to-avoid-kernel-hang.patch Patch306: arm-dts-imx6qdl-udoo-Disable-usbh1-to-avoid-kernel-hang.patch
# Fix USB on the RPi https://patchwork.kernel.org/patch/9879371/
Patch307: bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch
# http://patches.linaro.org/patch/131764/ # http://patches.linaro.org/patch/131764/
Patch308: wcn36xx-Fix-firmware-crash-due-to-corrupted-buffer-address.patch Patch308: wcn36xx-Fix-firmware-crash-due-to-corrupted-buffer-address.patch
@ -600,18 +597,25 @@ Patch309: wcn36xx-reduce-verbosity-of-drivers-messages.patch
# https://www.spinics.net/lists/arm-kernel/msg632925.html # https://www.spinics.net/lists/arm-kernel/msg632925.html
Patch313: arm-crypto-sunxi-ss-Add-MODULE_ALIAS-to-sun4i-ss.patch Patch313: arm-crypto-sunxi-ss-Add-MODULE_ALIAS-to-sun4i-ss.patch
Patch314: bcm283x-gpio-expander.patch # Fix USB on the RPi https://patchwork.kernel.org/patch/9879371/
Patch320: bcm283x-dma-mapping-skip-USB-devices-when-configuring-DMA-during-probe.patch
# https://www.spinics.net/lists/arm-kernel/msg621982.html # https://www.spinics.net/lists/arm-kernel/msg621982.html
Patch315: bcm283x-Fix-probing-of-bcm2835-i2s.patch Patch321: bcm283x-Fix-probing-of-bcm2835-i2s.patch
# https://www.spinics.net/lists/arm-kernel/msg633942.html # https://www.spinics.net/lists/arm-kernel/msg633942.html
Patch316: mmc-sdhci-iproc-Disable-preset-values-for-BCM2835.patch Patch322: mmc-sdhci-iproc-Disable-preset-values-for-BCM2835.patch
# https://www.spinics.net/lists/arm-kernel/msg633945.html # https://www.spinics.net/lists/arm-kernel/msg633945.html
Patch317: bcm2835-hwrng-Handle-deferred-clock-properly.patch Patch323: bcm2835-hwrng-Handle-deferred-clock-properly.patch
Patch318: bcm2837-rpi-initial-support-for-the-3.patch Patch324: bcm283x-clk-audio-fixes.patch
# Enabling Patches for the RPi3+
Patch330: bcm2837-rpi-initial-support-for-the-3.patch
Patch331: bcm2837-gpio-expander.patch
Patch332: bcm2837-enable-pmu.patch
Patch333: bcm2837-lan78xx-fixes.patch
# 400 - IBM (ppc/s390x) patches # 400 - IBM (ppc/s390x) patches
@ -1878,6 +1882,10 @@ fi
# #
# #
%changelog %changelog
* Mon Apr 2 2018 Peter Robinson <pbrobinson@fedoraproject.org>
- Improvements for the Raspberry Pi 3+
- Fixes and minor improvements to Raspberry Pi 2/3
* Mon Apr 02 2018 Jeremy Cline <jeremy@jcline.org> - 4.16.0-1 * Mon Apr 02 2018 Jeremy Cline <jeremy@jcline.org> - 4.16.0-1
- Linux v4.16 - Linux v4.16
- Disable debugging options. - Disable debugging options.