[U-Boot] [PATCH] ppc/8xxx: Delete PCI nodes from device tree if not configured

Kumar Gala galak at kernel.crashing.org
Tue Mar 30 17:10:12 CEST 2010


If the PCI controller wasn't configured or enabled delete from the
device tree (include its alias).

For the case that we didn't even configure u-boot with knowledge of
the controller we can use the fact that the pci_controller pointer
is NULL to delete the node in the device tree.  We determine that
a controller was not setup (because of HW config) based on the fact
that cfg_addr wasn't setup.

Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
---
 drivers/pci/fsl_pci_init.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index fe57926..3a60236 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -513,10 +513,18 @@ void ft_fsl_pci_setup(void *blob, const char *pci_alias,
 			struct pci_controller *hose)
 {
 	int off = fdt_path_offset(blob, pci_alias);
+	u32 bus_range[2];
 
-	if (off >= 0) {
-		u32 bus_range[2];
+	if (off < 0)
+		return;
+
+	/* We assume a cfg_addr not being set means we didn't setup the controller */
+	if ((hose == NULL) || (hose->cfg_addr == NULL)) {
+		fdt_del_node(blob, off);
 
+		off = fdt_path_offset(blob, "/aliases");
+		fdt_delprop(blob, off, pci_alias);
+	} else {
 		bus_range[0] = 0;
 		bus_range[1] = hose->last_busno - hose->first_busno;
 		fdt_setprop(blob, off, "bus-range", &bus_range[0], 2*4);
-- 
1.6.0.6



More information about the U-Boot mailing list