Add support for RaspberryPi RP1 PCI device using a DT overlay
Subsystems (7)
Andrea della Porta
maintainerv11 cover Add support for RaspberryPi RP1 PCI device using a DT overlay
*** RESENDING PATCHSET AS V11 SINCE LAST ONE HAS CLOBBERED SEQUENCE NUMBER ***
RP1 is an MFD chipset that acts as a south-bridge PCIe endpoint sporting a pletora of subdevices (i.e. Ethernet, USB host controller, I2C, PWM, etc.) whose registers are all reachable starting from an offset from the BAR address. The main point here is that while the RP1 as an endpoint itself is discoverable via usual PCI enumeraiton, the devices it contains are not discoverable and must be declared e.g. via the devicetree.
This patchset is an attempt to provide a minimum infrastructure to allow the RP1 chipset to be discovered and perpherals it contains to be added from a devictree overlay loaded during RP1 PCI endpoint enumeration. To ensure compatibility with downstream, a devicetree already comprising the RP1 node is also provided, so it's not strictly necessary to use the dynamically loaded overlay if the devicetree is already fully defined at the origin.
To achieve this modularity, the RP1 node DT definitions are arranged by file inclusion as per following schema (the arrow points to the includer, see also [9]):
rp1-pci.dtso rp1.dtso
^ ^
| |rp1-common.dtsi ----> rp1-nexus.dtsi ----> bcm2712-rpi-5-b.dts
^
|
bcm2712-rpi-5-b-ovl-rp1.dtsFollowup patches should add support for the several peripherals contained in RP1.
This work is based upon dowstream drivers code and the proposal from RH et al. (see [1] and [2]). A similar approach is also pursued in [3].
The patches are ordered as follows:
-PATCHES 1 to 3: add binding schemas for clock, gpio and RP1 peripherals.
They are needed to support the other peripherals, e.g. the ethernet mac depends on a clock generated by RP1 and the phy is reset through the on-board gpio controller.
-PATCH 4 and 5: add clock and gpio device drivers.
-PATCH 6: the devicetree node describing the RP1 chipset.
-PATCH 7: this is the main patch to support RP1 chipset. It can work
either with a fully defined devicetree (i.e. one that already included the rp1 node since boot time) or with a runtime loaded dtb overlay which is linked as binary blob in the driver obj. This duality is useful to comply with both downstream and upstream needs (see [9]). The real dtso is in devicetree folder while the dtso in driver folder is just a placeholder to include the real dtso.
In this way it is possible to check the dtso against dt-bindings. The reason why drivers/misc has been selected as containing folder for this driver can be seen in [6], [7] and [8].
-PATCH 8: add the external clock node (used by RP1) to the main dts.
-PATCH 9: the fully fledged devictree containing also the rp1 node.
This devicetree is functionally similar to the one downstream is using.
-PATCH 10 (OPTIONAL): this patch introduces a new scenario about how
the rp1 node is specified and loaded in DT. On top of the base DT (without rp1 node), the fw loads this overlay and the end result is the same devicetree as in patch 9, which is then passed to the next stage (either the kernel or u-boot/bootloader).
While this patch is not strictly necessary and can therefore be dropped (see [10]), it's not introducing much extra work and maybe can come in handy while debugging.
-PATCH 11: add the relevant kernel CONFIG_ options to defconfig.
-PATCH 12: enable CONFIG_OF_OVERLAY in order for 'make defconfig'
to produce a configuration valid for the RP1 driver. Without this patch, the user has to explicitly enable it since the misc driver depends on OF_OVERLAY.
-PATCH 13: collect all changes for MAINTAINERS file.
This patchset is also a first attempt to be more agnostic wrt hardware description standards such as OF devicetree and ACPI, where 'agnostic' means "using DT in coexistence with ACPI", as been already promoted by e.g. AL (see [4]). Although there's currently no evidence it will also run out of the box on purely ACPI system, it is a first step towards that direction.
Many thanks,
Andrea della Porta
Links:
- [1]: https://lpc.events/event/17/contributions/1421/attachments/1337/2680/LPC2023%20Non-discoverable%20devices%20in%20PCI.pdf
- [2]: https://lore.kernel.org/lkml/[email protected]/t/
- [3]: https://lore.kernel.org/all/[email protected]/#t
- [4]: https://lore.kernel.org/all/[email protected]/
- [5]: https://lore.kernel.org/all/[email protected]/
- [6]: https://lore.kernel.org/all/[email protected]/
- [7]: https://lore.kernel.org/all/[email protected]/
- [8]: https://lore.kernel.org/all/2024081356-mutable-everyday-6f9d@gregkh/
- [9]: https://lore.kernel.org/all/Z87wTfChRC5Ruwc0@apocalypse/
- [10]: https://lore.kernel.org/all/CAMEGJJ0f4YUgdWBhxvQ_dquZHztve9KO7pvQjoDWJ3=zd3cgcg@mail.gmail.com/#t
CHANGES IN V11
PATCH RELATED -------------------------------------------------
- Patch 10,11,12: Added: Reviewed-by: Reviewed-by: Florian Fainelli <[email protected]>
- Patches reworked to apply cleanly on broadcom/stblinux branches:
patch 1,2,3,6,8,9,10 -> devicetree/next
patch 11,12 -> defconfig/next
patch 4,5,7 -> drivers/next
patch 13 -> maintainers/next
- Patch 13: new patch gathering all changes for MAINTAINERS
RP1 CLOCK DRIVER ------------------------------------
- Dropped some WARN_ONCE() lines that are basically useless
- rp1_clock_set_parent() now returns EINVAL in case the parent check is failing. As a result, rp1_clock_set_rate_and_parent() has also been adapted to return rp1_clock_set_parent() retcode.
- Return an ERR_PTR from rp1_register_clock() instead of just NULL
- Dropped some unaesthetic blank lines
- Disabled the builtin locking in regmap since we're already dealing with concurrency in the code
- rp1_clk_probe(): dropped dev_err_probe() as redundant due to commit 12a0fd23e870 ("clk: Print an error when clk registration fails")
Andrea della Porta
maintainerPATCH v11 6/13 arm64: dts: rp1: Add support for RaspberryPi's RP1 device
RaspberryPi RP1 is a multi function PCI endpoint device that exposes several subperipherals via PCI BAR.
Add a dtb overlay that will be compiled into a binary blob and linked in the RP1 driver.
This overlay offers just minimal support to represent the RP1 device itself, the sub-peripherals will be added by future patches.
--- arch/arm64/boot/dts/broadcom/rp1-common.dtsi | 42 ++++++++++++++++++++ arch/arm64/boot/dts/broadcom/rp1-nexus.dtsi | 14 +++++++ 2 files changed, 56 insertions(+) create mode 100644 arch/arm64/boot/dts/broadcom/rp1-common.dtsi create mode 100644 arch/arm64/boot/dts/broadcom/rp1-nexus.dtsi
arch/arm64/boot/dts/broadcom/rp1-common.dtsi new file +42 -0
@@ -0,0 +1,42 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/clock/raspberrypi,rp1-clocks.h> + +pci_ep_bus: pci-ep-bus@1 { + compatible = "simple-bus"; + ranges = <0x00 0x40000000 0x01 0x00 0x00000000 0x00 0x00400000>; + dma-ranges = <0x10 0x00000000 0x43000000 0x10 0x00000000 0x10 0x00000000>; + #address-cells = <2>; + #size-cells = <2>; + + rp1_clocks: clocks@40018000 { + compatible = "raspberrypi,rp1-clocks"; + reg = <0x00 0x40018000 0x0 0x10038>; + #clock-cells = <1>; + clocks = <&clk_rp1_xosc>; + assigned-clocks = <&rp1_clocks RP1_PLL_SYS_CORE>, + <&rp1_clocks RP1_PLL_SYS>, + <&rp1_clocks RP1_PLL_SYS_SEC>, + <&rp1_clocks RP1_CLK_SYS>; + assigned-clock-rates = <1000000000>, // RP1_PLL_SYS_CORE + <200000000>, // RP1_PLL_SYS + <125000000>, // RP1_PLL_SYS_SEC + <200000000>; // RP1_CLK_SYS + }; + + rp1_gpio: pinctrl@400d0000 { + compatible = "raspberrypi,rp1-gpio"; + reg = <0x00 0x400d0000 0x0 0xc000>, + <0x00 0x400e0000 0x0 0xc000>, + <0x00 0x400f0000 0x0 0xc000>; + gpio-controller; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + interrupts = <0 IRQ_TYPE_LEVEL_HIGH>, + <1 IRQ_TYPE_LEVEL_HIGH>, + <2 IRQ_TYPE_LEVEL_HIGH>; + }; +};
arch/arm64/boot/dts/broadcom/rp1-nexus.dtsi new file +14 -0
@@ -0,0 +1,14 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +rp1_nexus { + compatible = "pci1de4,1"; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x01 0x00 0x00000000 + 0x02000000 0x00 0x00000000 + 0x0 0x400000>; + interrupt-controller; + #interrupt-cells = <2>; + + #include "rp1-common.dtsi" +};
Signature · 1 line
2.35.3
Andrea della Porta
maintainerPATCH v11 7/13 misc: rp1: RaspberryPi RP1 misc driver
In reply to Andrea della PortaThe RaspberryPi RP1 is a PCI multi function device containing peripherals ranging from Ethernet to USB controller, I2C, SPI and others.
Implement a bare minimum driver to operate the RP1, leveraging actual OF based driver implementations for the on-board peripherals by loading a devicetree overlay during driver probe if the RP1 node is not already present in the DT.
The peripherals are accessed by mapping MMIO registers starting from PCI BAR1 region.
With the overlay approach we can achieve more generic and agnostic approach to managing this chipset, being that it is a PCI endpoint and could possibly be reused in other hw implementations. The presented approach is also used by Bootlin's Microchip LAN966x patchset (see link) as well, for a similar chipset.
In this case, the inclusion tree for the DT overlay is as follow (the arrow points to the includer):
rp1-pci.dtso <---- rp1-common.dtsi
On the other hand, to ensure compatibility with downstream, this driver can also work with a DT already comprising the RP1 node, so the dynamically loaded overlay will not be used if the DT is already fully defined.
The reason why this driver is contained in drivers/misc has been paved by Bootlin's LAN966X driver, which first used the overlay approach to implement non discoverable peripherals behind a PCI bus. For RP1, the same arguments apply: it's not used as an SoC since the driver code is not running on-chip and is not like an MFD since it does not really need all the MFD infrastructure (shared regs, etc.). So, for this particular use, misc has been proposed and deemed as a good choice. For further details about that please check the links.
This driver is heavily based on downstream code from RaspberryPi Foundation, and the original author is Phil Elwell.
--- drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/rp1/Kconfig | 20 ++ drivers/misc/rp1/Makefile | 3 + drivers/misc/rp1/rp1-pci.dtso | 25 +++ drivers/misc/rp1/rp1_pci.c | 333 ++++++++++++++++++++++++++++++++++ drivers/pci/quirks.c | 1 + include/linux/pci_ids.h | 3 + 8 files changed, 387 insertions(+) create mode 100644 drivers/misc/rp1/Kconfig create mode 100644 drivers/misc/rp1/Makefile create mode 100644 drivers/misc/rp1/rp1-pci.dtso create mode 100644 drivers/misc/rp1/rp1_pci.c
drivers/misc/Kconfig +1 -0
@@ -648,4 +648,5 @@ source "drivers/misc/uacce/Kconfig" source "drivers/misc/pvpanic/Kconfig" source "drivers/misc/mchp_pci1xxxx/Kconfig" source "drivers/misc/keba/Kconfig" +source "drivers/misc/rp1/Kconfig" endmenu
drivers/misc/Makefile +1 -0
@@ -74,3 +74,4 @@ lan966x-pci-objs := lan966x_pci.o lan966x-pci-objs += lan966x_pci.dtbo.o obj-$(CONFIG_MCHP_LAN966X_PCI) += lan966x-pci.o obj-y += keba/ +obj-$(CONFIG_MISC_RP1) += rp1/
drivers/misc/rp1/Kconfig new file +20 -0
@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# RaspberryPi RP1 misc device +# + +config MISC_RP1 + tristate "RaspberryPi RP1 misc device" + depends on OF_IRQ && OF_OVERLAY && PCI_MSI && PCI_QUIRKS + select PCI_DYNAMIC_OF_NODES + help + Support the RP1 peripheral chip found on Raspberry Pi 5 board. + + This device supports several sub-devices including e.g. Ethernet + controller, USB controller, I2C, SPI and UART. + + The driver is responsible for enabling the DT node once the PCIe + endpoint has been configured, and handling interrupts. + + This driver uses an overlay to load other drivers to support for + RP1 internal sub-devices.
drivers/misc/rp1/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only +obj-$(CONFIG_MISC_RP1) += rp1-pci.o +rp1-pci-objs := rp1_pci.o rp1-pci.dtbo.o
drivers/misc/rp1/rp1-pci.dtso new file +25 -0
@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/* + * The dts overlay is included from the dts directory so + * it can be possible to check it with CHECK_DTBS while + * also compile it from the driver source directory. + */ + +/dts-v1/; +/plugin/; + +/ { + fragment@0 { + target-path=""; + __overlay__ { + compatible = "pci1de4,1"; + #address-cells = <3>; + #size-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + + #include "arm64/broadcom/rp1-common.dtsi" + }; + }; +};
drivers/misc/rp1/rp1_pci.c new file +333 -0
333 lines not on this page · raw message
drivers/pci/quirks.c +1 -0
@@ -6284,6 +6284,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_XILINX, 0x5020, of_pci_make_dev_node);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_XILINX ,0x5021 , of_pci_make_dev_node);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_REDHAT ,0x0005 , of_pci_make_dev_node);DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_EFAR ,0x9660 , of_pci_make_dev_node); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_RPI ,PCI_DEVICE_ID_RPI_RP1_C0 , of_pci_make_dev_node);/* * Devices known to require a longer delay before first config space access
include/linux/pci_ids.h +3 -0
@@ -2624,6 +2624,9 @@#define PCI_VENDOR_ID_TEKRAM 0x1de1#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29 +#define PCI_VENDOR_ID_RPI 0x1de4 +#define PCI_DEVICE_ID_RPI_RP1_C0 0x0001 +#define PCI_VENDOR_ID_ALIBABA 0x1ded#define PCI_VENDOR_ID_CXL 0x1e98
Signature · 1 line
2.35.3
Re: [PATCH v11 07/13] misc: rp1: RaspberryPi RP1 misc driver
Quoted 39 lines · Andrea della Porta
The RaspberryPi RP1 is a PCI multi function device containing peripherals ranging from Ethernet to USB controller, I2C, SPI and others.
Implement a bare minimum driver to operate the RP1, leveraging actual OF based driver implementations for the on-board peripherals by loading a devicetree overlay during driver probe if the RP1 node is not already present in the DT.
The peripherals are accessed by mapping MMIO registers starting from PCI BAR1 region.
With the overlay approach we can achieve more generic and agnostic approach to managing this chipset, being that it is a PCI endpoint and could possibly be reused in other hw implementations. The presented approach is also used by Bootlin's Microchip LAN966x patchset (see link) as well, for a similar chipset.
In this case, the inclusion tree for the DT overlay is as follow (the arrow points to the includer):rp1-pci.dtso <----
rp1-common.dtsiOn the other hand, to ensure compatibility with downstream, this driver can also work with a DT already comprising the RP1 node, so the dynamically loaded overlay will not be used if the DT is already fully defined.
The reason why this driver is contained in
drivers/mischas been paved by Bootlin's LAN966X driver, which first used the overlay approach to implement non discoverable peripherals behind a PCI bus. For RP1, the same arguments apply: it's not used as an SoC since the driver code is not running on-chip and is not like an MFD since it does not really need all the MFD infrastructure (shared regs, etc.). So, for this particular use, misc has been proposed and deemed as a good choice. For further details about that please check the links.This driver is heavily based on downstream code from RaspberryPi Foundation, and the original author is Phil Elwell.
Quoted 8 lines
What changed in this patch so that you didn't include the Acked-by from Greg [1], or is this an oversight?
Regards,
Matthias
[1] https://lore.kernel.org/linux-arm-kernel/2025042551-agency-boozy-dc3b@gregkh/
Andrea della Porta
maintainerRe: [PATCH v11 07/13] misc: rp1: RaspberryPi RP1 misc driver
Hi Matthias,
Quoted 48 lines · Matthias Brugger
Quoted 45 lines · Andrea della Porta
The RaspberryPi RP1 is a PCI multi function device containing peripherals ranging from Ethernet to USB controller, I2C, SPI and others.
Implement a bare minimum driver to operate the RP1, leveraging actual OF based driver implementations for the on-board peripherals by loading a devicetree overlay during driver probe if the RP1 node is not already present in the DT.
The peripherals are accessed by mapping MMIO registers starting from PCI BAR1 region.
With the overlay approach we can achieve more generic and agnostic approach to managing this chipset, being that it is a PCI endpoint and could possibly be reused in other hw implementations. The presented approach is also used by Bootlin's Microchip LAN966x patchset (see link) as well, for a similar chipset.
In this case, the inclusion tree for the DT overlay is as follow (the arrow points to the includer):rp1-pci.dtso <----
rp1-common.dtsiOn the other hand, to ensure compatibility with downstream, this driver can also work with a DT already comprising the RP1 node, so the dynamically loaded overlay will not be used if the DT is already fully defined.
The reason why this driver is contained in
drivers/mischas been paved by Bootlin's LAN966X driver, which first used the overlay approach to implement non discoverable peripherals behind a PCI bus. For RP1, the same arguments apply: it's not used as an SoC since the driver code is not running on-chip and is not like an MFD since it does not really need all the MFD infrastructure (shared regs, etc.). So, for this particular use, misc has been proposed and deemed as a good choice. For further details about that please check the links.This driver is heavily based on downstream code from RaspberryPi Foundation, and the original author is Phil Elwell.
Quoted 5 lines
Quoted 2 lines
What changed in this patch so that you didn't include the Acked-by from Greg [1], or is this an oversight?
Nothing really, just an oversight. Thanks for spotting that out. I will resend V12 with it as I also notice that are some inconsistencies with mail Message-id, as a result of subseqeunt invokation of git-format-patch from different branch.
Thanks,
Andrea
Quoted 6 lines
Regards,
Matthias[1] https://lore.kernel.org/linux-arm-kernel/2025042551-agency-boozy-dc3b@gregkh/
Andrea della Porta
maintainerPATCH v11 8/13 arm64: dts: bcm2712: Add external clock for RP1 chipset on Rpi5
In reply to Andrea della PortaThe RP1 found on Raspberry Pi 5 board needs an external crystal at 50MHz. Add clk_rp1_xosc node to provide that.
--- arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +7 -0
@@ -16,6 +16,13 @@ chosen: chosen { stdout-path = "serial10:115200n8"; }; + clk_rp1_xosc: clock-50000000 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-output-names = "rp1-xosc"; + clock-frequency = <50000000>; + }; + /* Will be filled by the bootloader */ memory@0 { device_type = "memory";
Signature · 1 line
2.35.3
Andrea della Porta
maintainerPATCH v11 9/13 arm64: dts: broadcom: Add board DTS for Rpi5 which includes RP1 node
In reply to Andrea della PortaAdd the fully populated DTS for RaspberryPi 5 which includes the RP1 node definition. The inclusion tree is as follow (the arrow points to the includer):
rp1-common.dtsi ----> rp1-nexus.dtsi ----> bcm2712-rpi-5-b.dts
^
|
bcm2712-rpi-5-b-ovl-rp1.dtsThis is designed to maximize the compatibility with downstream DT while ensuring that a fully defined DT (one which includes the RP1 node as opposed to load it from overlay at runtime) is present since early boot stage.
Since the preferred board DT is the fully populated one, name it bcm2712-rpi-5-b.dts and move the previous one into bcm2712-rpi-5-b-ovl-rp1.dts.
--- arch/arm64/boot/dts/broadcom/Makefile | 1 + .../dts/broadcom/bcm2712-rpi-5-b-ovl-rp1.dts | 121 ++++++++++++++++++ .../boot/dts/broadcom/bcm2712-rpi-5-b.dts | 118 ++--------------- 3 files changed, 133 insertions(+), 107 deletions(-) create mode 100644 arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b-ovl-rp1.dts
arch/arm64/boot/dts/broadcom/Makefile +1 -0
@@ -7,6 +7,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \ bcm2711-rpi-4-b.dtb \ bcm2711-rpi-cm4-io.dtb \ bcm2712-rpi-5-b.dtb \ + bcm2712-rpi-5-b-ovl-rp1.dtb \ bcm2712-d-rpi-5-b.dtb \ bcm2837-rpi-2-b.dtb \ bcm2837-rpi-3-a-plus.dtb \
arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b-ovl-rp1.dts new file +121 -0
121 lines not on this page · raw message
arch/arm64/boot/dts/broadcom/bcm2712-rpi-5-b.dts +11 -107
124 lines not on this page · raw message
Signature · 1 line
2.35.3
Andrea della Porta
maintainerPATCH v11 10/13 arm64: dts: broadcom: Add overlay for RP1 device
In reply to Andrea della PortaDefine the RP1 node in an overlay. The inclusion tree is as follow (the arrow points to the includer):
rp1.dtso
^
|rp1-common.dtsi ----> rp1-nexus.dtsi
--- arch/arm64/boot/dts/broadcom/Makefile | 3 ++- arch/arm64/boot/dts/broadcom/rp1.dtso | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 arch/arm64/boot/dts/broadcom/rp1.dtso
arch/arm64/boot/dts/broadcom/Makefile +2 -1
@@ -14,7 +14,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += bcm2711-rpi-400.dtb \ bcm2837-rpi-3-b.dtb \ bcm2837-rpi-3-b-plus.dtb \ bcm2837-rpi-cm3-io3.dtb \ - bcm2837-rpi-zero-2-w.dtb + bcm2837-rpi-zero-2-w.dtb \ + rp1.dtbo subdir-y += bcmbca subdir-y += northstar2
arch/arm64/boot/dts/broadcom/rp1.dtso new file +11 -0
@@ -0,0 +1,11 @@ +// SPDX-License-Identifier: (GPL-2.0 OR MIT) + +/dts-v1/; +/plugin/; + +&pcie2 { + #address-cells = <3>; + #size-cells = <2>; + + #include "rp1-nexus.dtsi" +};
Signature · 1 line
2.35.3
Andrea della Porta
maintainerPATCH v11 11/13 arm64: defconfig: Enable RP1 misc/clock/gpio drivers
In reply to Andrea della PortaSelect the RP1 drivers needed to operate the PCI endpoint containing several peripherals such as Ethernet and USB Controller. This chip is present on RaspberryPi 5.
--- arch/arm64/configs/defconfig | 3 +++ 1 file changed, 3 insertions(+)
arch/arm64/configs/defconfig +3 -0
@@ -620,6 +620,7 @@ CONFIG_PINCTRL_QCS615=y CONFIG_PINCTRL_QCS8300=y CONFIG_PINCTRL_QDF2XXX=y CONFIG_PINCTRL_QDU1000=y +CONFIG_PINCTRL_RP1=m CONFIG_PINCTRL_SA8775P=y CONFIG_PINCTRL_SC7180=y CONFIG_PINCTRL_SC7280=y
@@ -702,6 +703,7 @@ CONFIG_SENSORS_RASPBERRYPI_HWMON=m CONFIG_SENSORS_SL28CPLD=m CONFIG_SENSORS_INA2XX=m CONFIG_SENSORS_INA3221=m +CONFIG_MISC_RP1=m CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y CONFIG_CPU_THERMAL=y CONFIG_DEVFREQ_THERMAL=y
@@ -1299,6 +1301,7 @@ CONFIG_COMMON_CLK_CS2000_CP=y CONFIG_COMMON_CLK_FSL_SAI=y CONFIG_COMMON_CLK_S2MPS11=y CONFIG_COMMON_CLK_PWM=y +CONFIG_COMMON_CLK_RP1=m CONFIG_COMMON_CLK_RS9_PCIE=y CONFIG_COMMON_CLK_VC3=y CONFIG_COMMON_CLK_VC5=y
Signature · 1 line
2.35.3
Andrea della Porta
maintainerPATCH v11 12/13 arm64: defconfig: Enable OF_OVERLAY option
In reply to Andrea della PortaThe RP1 driver uses the infrastructure enabled by OF_OVERLAY config option. Enable that option in defconfig in order to produce a kernel usable on RaspberryPi5 avoiding to enable it separately.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -1659,6 +1659,7 @@ CONFIG_FPGA_BRIDGE=m CONFIG_ALTERA_FREEZE_BRIDGE=m CONFIG_FPGA_REGION=m CONFIG_OF_FPGA_REGION=m +CONFIG_OF_OVERLAY=y CONFIG_TEE=y CONFIG_OPTEE=y CONFIG_MUX_GPIO=m
Signature · 1 line
2.35.3
Andrea della Porta
maintainerPATCH v11 13/13 MAINTAINERS: add Raspberry Pi RP1 section
In reply to Andrea della PortaRaspberry Pi RP1 is a southbridge PCIe device which embeds several peripherals.
Add a new section to cover the main RP1 driver, DTS and specific subperipherals (such as clock and pinconf/pinmux/gpio controller).
--- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
@@ -20197,6 +20197,14 @@ S: Maintained F: Documentation/devicetree/bindings/media/raspberrypi,rp1-cfe.yaml F: drivers/media/platform/raspberrypi/rp1-cfe/ +RASPBERRY PI RP1 PCI DRIVER +M: Andrea della Porta <[email protected]> +S: Maintained +F: arch/arm64/boot/dts/broadcom/rp1*.dts* +F: drivers/clk/clk-rp1.c +F: drivers/misc/rp1/ +F: drivers/pinctrl/pinctrl-rp1.c + RC-CORE / LIRC FRAMEWORK M: Sean Young <[email protected]> L: [email protected]
Signature · 1 line
2.35.3
Andrea della Porta
maintainerAgain, this patchset for some reason has duplicated Message-Id for patches 1 to 5, so they will result as clobbered up. Please ignore V10 and V11, I'll send V12 which should be, hopefully, the correct one. Sorry for that.
Andrea
Quoted 135 lines · Andrea della Porta
*** RESENDING PATCHSET AS V11 SINCE LAST ONE HAS CLOBBERED SEQUENCE NUMBER ***
RP1 is an MFD chipset that acts as a south-bridge PCIe endpoint sporting a pletora of subdevices (i.e. Ethernet, USB host controller, I2C, PWM, etc.) whose registers are all reachable starting from an offset from the BAR address. The main point here is that while the RP1 as an endpoint itself is discoverable via usual PCI enumeraiton, the devices it contains are not discoverable and must be declared e.g. via the devicetree.
This patchset is an attempt to provide a minimum infrastructure to allow the RP1 chipset to be discovered and perpherals it contains to be added from a devictree overlay loaded during RP1 PCI endpoint enumeration. To ensure compatibility with downstream, a devicetree already comprising the RP1 node is also provided, so it's not strictly necessary to use the dynamically loaded overlay if the devicetree is already fully defined at the origin.
To achieve this modularity, the RP1 node DT definitions are arranged by file inclusion as per following schema (the arrow points to the includer, see also [9]):rp1-pci.dtso rp1.dtso
^ ^
| |rp1-common.dtsi---->rp1-nexus.dtsi---->bcm2712-rpi-5-b.dts^ | bcm2712-rpi-5-b-ovl-rp1.dtsFollowup patches should add support for the several peripherals contained in RP1.
This work is based upon dowstream drivers code and the proposal from RH et al. (see [1] and [2]). A similar approach is also pursued in [3].
The patches are ordered as follows:
(quoted diff) +0
-10-PATCHES 1 to 3: add binding schemas for clock, gpio and RP1 peripherals. They are needed to support the other peripherals, e.g. the ethernet mac depends on a clock generated by RP1 and the phy is reset through the on-board gpio controller. -PATCH 4 and 5: add clock and gpio device drivers. -PATCH 6: the devicetree node describing the RP1 chipset. -PATCH 7: this is the main patch to support RP1 chipset. It can work either with a fully defined devicetree (i.e. one that already included the rp1 node since boot time) or with a runtime loaded dtb overlay which is linked as binary blob in the driver obj. This duality is useful to comply with both downstream and upstream needs (see [9]). The real dtso is in devicetree folder while the dtso in driver folder is just a placeholder to include the real dtso. In this way it is possible to check the dtso against dt-bindings. The reason why drivers/misc has been selected as containing folder for this driver can be seen in [6], [7] and [8]. -PATCH 8: add the external clock node (used by RP1) to the main dts. -PATCH 9: the fully fledged devictree containing also the rp1 node. This devicetree is functionally similar to the one downstream is using. -PATCH 10 (OPTIONAL): this patch introduces a new scenario about how the rp1 node is specified and loaded in DT. On top of the base DT (without rp1 node), the fw loads this overlay and the end result is the same devicetree as in patch 9, which is then passed to the next stage (either the kernel or u-boot/bootloader). While this patch is not strictly necessary and can therefore be dropped (see [10]), it's not introducing much extra work and maybe can come in handy while debugging. -PATCH 11: add the relevant kernel CONFIG_ options to defconfig. -PATCH 12: enable CONFIG_OF_OVERLAY in order for 'make defconfig' to produce a configuration valid for the RP1 driver. Without this patch, the user has to explicitly enable it since the misc driver depends on OF_OVERLAY. -PATCH 13: collect all changes for MAINTAINERS file.This patchset is also a first attempt to be more agnostic wrt hardware description standards such as OF devicetree and ACPI, where 'agnostic' means "using DT in coexistence with ACPI", as been already promoted by e.g. AL (see [4]). Although there's currently no evidence it will also run out of the box on purely ACPI system, it is a first step towards that direction.
Many thanks,
Andrea della PortaLinks:
- [1]: https://lpc.events/event/17/contributions/1421/attachments/1337/2680/LPC2023%20Non-discoverable%20devices%20in%20PCI.pdf
- [2]: https://lore.kernel.org/lkml/[email protected]/t/
- [3]: https://lore.kernel.org/all/[email protected]/#t
- [4]: https://lore.kernel.org/all/[email protected]/
- [5]: https://lore.kernel.org/all/[email protected]/
- [6]: https://lore.kernel.org/all/[email protected]/
- [7]: https://lore.kernel.org/all/[email protected]/
- [8]: https://lore.kernel.org/all/2024081356-mutable-everyday-6f9d@gregkh/
- [9]: https://lore.kernel.org/all/Z87wTfChRC5Ruwc0@apocalypse/
- [10]: https://lore.kernel.org/all/CAMEGJJ0f4YUgdWBhxvQ_dquZHztve9KO7pvQjoDWJ3=zd3cgcg@mail.gmail.com/#tCHANGES IN V11
PATCH RELATED -------------------------------------------------
- Patch 10,11,12: Added: Reviewed-by: Reviewed-by: Florian Fainelli <[email protected]>
- Patches reworked to apply cleanly on broadcom/stblinux branches:
patch 1,2,3,6,8,9,10 -> devicetree/next
patch 11,12 -> defconfig/next
patch 4,5,7 ->drivers/next
patch 13 -> maintainers/next- Patch 13: new patch gathering all changes for
MAINTAINERSRP1 CLOCK DRIVER ------------------------------------
- Dropped some
WARN_ONCE()lines that are basically useless-
rp1_clock_set_parent()now returns EINVAL in case the parent check is failing. As a result,rp1_clock_set_rate_and_parent()has also been adapted to returnrp1_clock_set_parent()retcode.- Return an
ERR_PTRfromrp1_register_clock()instead of just NULL- Dropped some unaesthetic blank lines
- Disabled the builtin locking in regmap since we're already dealing with concurrency in the code
-
rp1_clk_probe(): droppeddev_err_probe()as redundant due to commit12a0fd23e870("clk: Print an error when clk registration fails")