Commit ce26f588 authored by Andrea della Porta's avatar Andrea della Porta Committed by Florian Fainelli
Browse files

misc: rp1: drop overlay support



The RP1 driver can load an overlay at runtime to describe the inner
peripherals. This has led to a lot of confusion regarding the naming
of nodes, their topology and the reclaiming of related node resources.

Since the overlay is currently not fully functional, drop its support
in the driver in favor of the fully described static DT.

This also means that this driver does not depend on CONFIG_PCI_DYNAMIC_OF_NODES
and no longer requires PCI quirks to dynamically create the intermediate
PCI nodes.

Signed-off-by: default avatarAndrea della Porta <andrea.porta@suse.com>
Reviewed-by: default avatarRob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/4b0aa7160877cf128b9bc713776bcac73c46eb24.1766077285.git.andrea.porta@suse.com


Signed-off-by: default avatarFlorian Fainelli <florian.fainelli@broadcom.com>
parent c6d0cdf7
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -5,8 +5,7 @@

config MISC_RP1
	tristate "RaspberryPi RP1 misc device"
	depends on OF_IRQ && OF_OVERLAY && PCI_MSI && PCI_QUIRKS
	select PCI_DYNAMIC_OF_NODES
	depends on OF_IRQ && PCI_MSI
	help
	  Support the RP1 peripheral chip found on Raspberry Pi 5 board.

@@ -15,6 +14,3 @@ config MISC_RP1

	  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.
+1 −2
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
obj-$(CONFIG_MISC_RP1)		+= rp1-pci.o
rp1-pci-objs			:= rp1_pci.o rp1-pci.dtbo.o
obj-$(CONFIG_MISC_RP1)		+= rp1_pci.o

drivers/misc/rp1/rp1-pci.dtso

deleted100644 → 0
+0 −25
Original line number Diff line number Diff line
// 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"
		};
	};
};
+4 −33
Original line number Diff line number Diff line
@@ -34,16 +34,11 @@
/* Interrupts */
#define RP1_INT_END		61

/* Embedded dtbo symbols created by cmd_wrap_S_dtb in scripts/Makefile.lib */
extern char __dtbo_rp1_pci_begin[];
extern char __dtbo_rp1_pci_end[];

struct rp1_dev {
	struct pci_dev *pdev;
	struct irq_domain *domain;
	struct irq_data *pcie_irqds[64];
	void __iomem *bar1;
	int ovcs_id;	/* overlay changeset id */
	bool level_triggered_irq[RP1_INT_END];
};

@@ -184,24 +179,13 @@ static void rp1_unregister_interrupts(struct pci_dev *pdev)

static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
{
	u32 dtbo_size = __dtbo_rp1_pci_end - __dtbo_rp1_pci_begin;
	void *dtbo_start = __dtbo_rp1_pci_begin;
	struct device *dev = &pdev->dev;
	struct device_node *rp1_node;
	bool skip_ovl = true;
	struct rp1_dev *rp1;
	int err = 0;
	int i;

	/*
	 * Either use rp1_nexus node if already present in DT, or
	 * set a flag to load it from overlay at runtime
	 */
	rp1_node = of_find_node_by_name(NULL, "rp1_nexus");
	if (!rp1_node) {
	rp1_node = dev_of_node(dev);
		skip_ovl = false;
	}

	if (!rp1_node) {
		dev_err(dev, "Missing of_node for device\n");
@@ -276,30 +260,19 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)
						 rp1_chained_handle_irq, rp1);
	}

	if (!skip_ovl) {
		err = of_overlay_fdt_apply(dtbo_start, dtbo_size, &rp1->ovcs_id,
					   rp1_node);
		if (err)
			goto err_unregister_interrupts;
	}

	err = of_platform_default_populate(rp1_node, NULL, dev);
	if (err) {
		dev_err_probe(&pdev->dev, err, "Error populating devicetree\n");
		goto err_unload_overlay;
		goto err_unregister_interrupts;
	}

	if (skip_ovl)
	of_node_put(rp1_node);

	return 0;

err_unload_overlay:
	of_overlay_remove(&rp1->ovcs_id);
err_unregister_interrupts:
	rp1_unregister_interrupts(pdev);
err_put_node:
	if (skip_ovl)
	of_node_put(rp1_node);

	return err;
@@ -307,11 +280,9 @@ static int rp1_probe(struct pci_dev *pdev, const struct pci_device_id *id)

static void rp1_remove(struct pci_dev *pdev)
{
	struct rp1_dev *rp1 = pci_get_drvdata(pdev);
	struct device *dev = &pdev->dev;

	of_platform_depopulate(dev);
	of_overlay_remove(&rp1->ovcs_id);
	rp1_unregister_interrupts(pdev);
}

+0 −1
Original line number Diff line number Diff line
@@ -6308,7 +6308,6 @@ 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