]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/pci/fsl_pci_init.c
Merge branch 'master' of git://git.denx.de/u-boot-net
[people/ms/u-boot.git] / drivers / pci / fsl_pci_init.c
index 170cc257cd35de8687b616adea6efc531660225e..5a63fa216835ef28a3dfd2a54e4c05d621310730 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright 2007-2009 Freescale Semiconductor, Inc.
+ * Copyright 2007-2010 Freescale Semiconductor, Inc.
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * Version 2 as published by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -86,6 +87,15 @@ static void set_inbound_window(volatile pit_t *pi,
        out_be32(&pi->piwar, flag | sz);
 }
 
+int fsl_setup_hose(struct pci_controller *hose, unsigned long addr)
+{
+       volatile ccsr_fsl_pci_t *pci = (ccsr_fsl_pci_t *) addr;
+
+       pci_setup_indirect(hose, (u32)&pci->cfg_addr, (u32)&pci->cfg_data);
+
+       return fsl_is_pci_agent(hose);
+}
+
 static int fsl_pci_setup_inbound_windows(struct pci_controller *hose,
                                         u64 out_lo, u8 pcie_cap,
                                         volatile pit_t *pi)
@@ -504,10 +514,15 @@ 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_and_alias(blob, 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);