Skip to content

Commit 187b4ac

Browse files
committed
Merge tag 'arm-soc/for-5.1/drivers' of https://github.com/Broadcom/stblinux into arm/drivers
This pull request contains Broadcom ARM/ARM64/MIPS based SoCs changes for 5.1, please pull the following: - Stefan updates the BCM2835 SoC driver with downstream properties and uses that to implement a reboot notifier to tell the VC4 firmware when Linux on the ARM CPU is rebooting - Eric adds a proper power domain driver for the BCM283x SoCs and updates a bunch of drivers to have a better and clearer Device Tree definition to support power domains/breaking up of functionality. This requires converting the existing watchdog driver into a MFD and then breaking up the functionality into separate drivers and finally updating the DTS files to leverage the power domains information. - Wei provides a fix for making a symbol static * tag 'arm-soc/for-5.1/drivers' of https://github.com/Broadcom/stblinux: ARM: bcm283x: Switch V3D over to using the PM driver instead of firmware. ARM: bcm283x: Extend the WDT DT node out to cover the whole PM block. (v4) soc: bcm: bcm2835-pm: Make local symbol static soc: bcm: Make PM driver default for BCM2835 soc: bcm: bcm2835-pm: Add support for power domains under a new binding. bcm2835-pm: Move bcm2835-watchdog's DT probe to an MFD. dt-bindings: soc: Add a new binding for the BCM2835 PM node. (v4) firmware: raspberrypi: notify VC4 firmware of a reboot soc: bcm2835: sync firmware properties with downstream Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2 parents 405bcff + 50de649 commit 187b4ac

14 files changed

Lines changed: 894 additions & 24 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
BCM2835 PM (Power domains, watchdog)
2+
3+
The PM block controls power domains and some reset lines, and includes
4+
a watchdog timer. This binding supersedes the brcm,bcm2835-pm-wdt
5+
binding which covered some of PM's register range and functionality.
6+
7+
Required properties:
8+
9+
- compatible: Should be "brcm,bcm2835-pm"
10+
- reg: Specifies base physical address and size of the two
11+
register ranges ("PM" and "ASYNC_BRIDGE" in that
12+
order)
13+
- clocks: a) v3d: The V3D clock from CPRMAN
14+
b) peri_image: The PERI_IMAGE clock from CPRMAN
15+
c) h264: The H264 clock from CPRMAN
16+
d) isp: The ISP clock from CPRMAN
17+
- #reset-cells: Should be 1. This property follows the reset controller
18+
bindings[1].
19+
- #power-domain-cells: Should be 1. This property follows the power domain
20+
bindings[2].
21+
22+
Optional properties:
23+
24+
- timeout-sec: Contains the watchdog timeout in seconds
25+
- system-power-controller: Whether the watchdog is controlling the
26+
system power. This node follows the power controller bindings[3].
27+
28+
[1] Documentation/devicetree/bindings/reset/reset.txt
29+
[2] Documentation/devicetree/bindings/power/power_domain.txt
30+
[3] Documentation/devicetree/bindings/power/power-controller.txt
31+
32+
Example:
33+
34+
pm {
35+
compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";
36+
#power-domain-cells = <1>;
37+
#reset-cells = <1>;
38+
reg = <0x7e100000 0x114>,
39+
<0x7e00a000 0x24>;
40+
clocks = <&clocks BCM2835_CLOCK_V3D>,
41+
<&clocks BCM2835_CLOCK_PERI_IMAGE>,
42+
<&clocks BCM2835_CLOCK_H264>,
43+
<&clocks BCM2835_CLOCK_ISP>;
44+
clock-names = "v3d", "peri_image", "h264", "isp";
45+
system-power-controller;
46+
};

‎arch/arm/boot/dts/bcm2835-rpi.dtsi‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,6 @@
8787
power-domains = <&power RPI_POWER_DOMAIN_USB>;
8888
};
8989

90-
&v3d {
91-
power-domains = <&power RPI_POWER_DOMAIN_V3D>;
92-
};
93-
9490
&hdmi {
9591
power-domains = <&power RPI_POWER_DOMAIN_HDMI>;
9692
status = "okay";

‎arch/arm/boot/dts/bcm283x.dtsi‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include <dt-bindings/clock/bcm2835-aux.h>
44
#include <dt-bindings/gpio/gpio.h>
55
#include <dt-bindings/interrupt-controller/irq.h>
6+
#include <dt-bindings/soc/bcm2835-pm.h>
67

78
/* firmware-provided startup stubs live here, where the secondary CPUs are
89
* spinning.
@@ -120,9 +121,18 @@
120121
#interrupt-cells = <2>;
121122
};
122123

123-
watchdog@7e100000 {
124-
compatible = "brcm,bcm2835-pm-wdt";
125-
reg = <0x7e100000 0x28>;
124+
pm: watchdog@7e100000 {
125+
compatible = "brcm,bcm2835-pm", "brcm,bcm2835-pm-wdt";
126+
#power-domain-cells = <1>;
127+
#reset-cells = <1>;
128+
reg = <0x7e100000 0x114>,
129+
<0x7e00a000 0x24>;
130+
clocks = <&clocks BCM2835_CLOCK_V3D>,
131+
<&clocks BCM2835_CLOCK_PERI_IMAGE>,
132+
<&clocks BCM2835_CLOCK_H264>,
133+
<&clocks BCM2835_CLOCK_ISP>;
134+
clock-names = "v3d", "peri_image", "h264", "isp";
135+
system-power-controller;
126136
};
127137

128138
clocks: cprman@7e101000 {
@@ -629,6 +639,7 @@
629639
compatible = "brcm,bcm2835-v3d";
630640
reg = <0x7ec00000 0x1000>;
631641
interrupts = <1 10>;
642+
power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>;
632643
};
633644

634645
vc4: gpu {

‎arch/arm/mach-bcm/Kconfig‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ config ARCH_BCM2835
167167
select BCM2835_TIMER
168168
select PINCTRL
169169
select PINCTRL_BCM2835
170+
select MFD_CORE
170171
help
171172
This enables support for the Broadcom BCM2835 and BCM2836 SoCs.
172173
This SoC is used in the Raspberry Pi and Roku 2 devices.

‎drivers/firmware/raspberrypi.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,16 @@ static int rpi_firmware_probe(struct platform_device *pdev)
238238
return 0;
239239
}
240240

241+
static void rpi_firmware_shutdown(struct platform_device *pdev)
242+
{
243+
struct rpi_firmware *fw = platform_get_drvdata(pdev);
244+
245+
if (!fw)
246+
return;
247+
248+
rpi_firmware_property(fw, RPI_FIRMWARE_NOTIFY_REBOOT, NULL, 0);
249+
}
250+
241251
static int rpi_firmware_remove(struct platform_device *pdev)
242252
{
243253
struct rpi_firmware *fw = platform_get_drvdata(pdev);
@@ -278,6 +288,7 @@ static struct platform_driver rpi_firmware_driver = {
278288
.of_match_table = rpi_firmware_of_match,
279289
},
280290
.probe = rpi_firmware_probe,
291+
.shutdown = rpi_firmware_shutdown,
281292
.remove = rpi_firmware_remove,
282293
};
283294
module_platform_driver(rpi_firmware_driver);

‎drivers/mfd/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ obj-$(CONFIG_MFD_88PM805) += 88pm805.o 88pm80x.o
1010
obj-$(CONFIG_MFD_ACT8945A) += act8945a.o
1111
obj-$(CONFIG_MFD_SM501) += sm501.o
1212
obj-$(CONFIG_MFD_ASIC3) += asic3.o tmio_core.o
13+
obj-$(CONFIG_ARCH_BCM2835) += bcm2835-pm.o
1314
obj-$(CONFIG_MFD_BCM590XX) += bcm590xx.o
1415
obj-$(CONFIG_MFD_BD9571MWV) += bd9571mwv.o
1516
cros_ec_core-objs := cros_ec.o

‎drivers/mfd/bcm2835-pm.c‎

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
/*
3+
* PM MFD driver for Broadcom BCM2835
4+
*
5+
* This driver binds to the PM block and creates the MFD device for
6+
* the WDT and power drivers.
7+
*/
8+
9+
#include <linux/delay.h>
10+
#include <linux/io.h>
11+
#include <linux/mfd/bcm2835-pm.h>
12+
#include <linux/mfd/core.h>
13+
#include <linux/module.h>
14+
#include <linux/of_address.h>
15+
#include <linux/of_platform.h>
16+
#include <linux/platform_device.h>
17+
#include <linux/types.h>
18+
#include <linux/watchdog.h>
19+
20+
static const struct mfd_cell bcm2835_pm_devs[] = {
21+
{ .name = "bcm2835-wdt" },
22+
};
23+
24+
static const struct mfd_cell bcm2835_power_devs[] = {
25+
{ .name = "bcm2835-power" },
26+
};
27+
28+
static int bcm2835_pm_probe(struct platform_device *pdev)
29+
{
30+
struct resource *res;
31+
struct device *dev = &pdev->dev;
32+
struct bcm2835_pm *pm;
33+
int ret;
34+
35+
pm = devm_kzalloc(dev, sizeof(*pm), GFP_KERNEL);
36+
if (!pm)
37+
return -ENOMEM;
38+
platform_set_drvdata(pdev, pm);
39+
40+
pm->dev = dev;
41+
42+
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
43+
pm->base = devm_ioremap_resource(dev, res);
44+
if (IS_ERR(pm->base))
45+
return PTR_ERR(pm->base);
46+
47+
ret = devm_mfd_add_devices(dev, -1,
48+
bcm2835_pm_devs, ARRAY_SIZE(bcm2835_pm_devs),
49+
NULL, 0, NULL);
50+
if (ret)
51+
return ret;
52+
53+
/* We'll use the presence of the AXI ASB regs in the
54+
* bcm2835-pm binding as the key for whether we can reference
55+
* the full PM register range and support power domains.
56+
*/
57+
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
58+
if (res) {
59+
pm->asb = devm_ioremap_resource(dev, res);
60+
if (IS_ERR(pm->asb))
61+
return PTR_ERR(pm->asb);
62+
63+
ret = devm_mfd_add_devices(dev, -1,
64+
bcm2835_power_devs,
65+
ARRAY_SIZE(bcm2835_power_devs),
66+
NULL, 0, NULL);
67+
if (ret)
68+
return ret;
69+
}
70+
71+
return 0;
72+
}
73+
74+
static const struct of_device_id bcm2835_pm_of_match[] = {
75+
{ .compatible = "brcm,bcm2835-pm-wdt", },
76+
{ .compatible = "brcm,bcm2835-pm", },
77+
{},
78+
};
79+
MODULE_DEVICE_TABLE(of, bcm2835_pm_of_match);
80+
81+
static struct platform_driver bcm2835_pm_driver = {
82+
.probe = bcm2835_pm_probe,
83+
.driver = {
84+
.name = "bcm2835-pm",
85+
.of_match_table = bcm2835_pm_of_match,
86+
},
87+
};
88+
module_platform_driver(bcm2835_pm_driver);
89+
90+
MODULE_AUTHOR("Eric Anholt <eric@anholt.net>");
91+
MODULE_DESCRIPTION("Driver for Broadcom BCM2835 PM MFD");
92+
MODULE_LICENSE("GPL");

‎drivers/soc/bcm/Kconfig‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
menu "Broadcom SoC drivers"
22

3+
config BCM2835_POWER
4+
bool "BCM2835 power domain driver"
5+
depends on ARCH_BCM2835 || (COMPILE_TEST && OF)
6+
default y if ARCH_BCM2835
7+
select PM_GENERIC_DOMAINS if PM
8+
select RESET_CONTROLLER
9+
help
10+
This enables support for the BCM2835 power domains and reset
11+
controller. Any usage of power domains by the Raspberry Pi
12+
firmware means that Linux usage of the same power domain
13+
must be accessed using the RASPBERRYPI_POWER driver
14+
315
config RASPBERRYPI_POWER
416
bool "Raspberry Pi power domain driver"
517
depends on ARCH_BCM2835 || (COMPILE_TEST && OF)

‎drivers/soc/bcm/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
obj-$(CONFIG_BCM2835_POWER) += bcm2835-power.o
12
obj-$(CONFIG_RASPBERRYPI_POWER) += raspberrypi-power.o
23
obj-$(CONFIG_SOC_BRCMSTB) += brcmstb/

0 commit comments

Comments
 (0)