Bladeren bron

mpc83xx: PCIe: Don't start bus enumeration at 0

Currently we assign first_busno = 0 for the first PCIe hose, but this
scheme won't work if we have ordinary PCI hose already registered (its
first_busno value is 0 too).

The old code worked fine only because we have PCI disabled on
MPC837XEMDS boards in stand-alone mode (see commit 00f7bbae92e3b13f2b3
"mpc83xx: fix PCI scan hang on the standalone MPC837xE-MDS boards").
But on MPC837XERDB boards we have PCI and PCIe, so the bug actually
triggers.

So, to fix the issue, we should use pci_last_busno() + 1 for the
first_busno (i.e. last available busno).

Reported-by: Huang Changming <Chang-Ming.Huang@freescale.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Anton Vorontsov 16 jaren geleden
bovenliggende
commit
e2d72ba543
1 gewijzigde bestanden met toevoegingen van 1 en 3 verwijderingen
  1. 1 3
      cpu/mpc83xx/pcie.c

+ 1 - 3
cpu/mpc83xx/pcie.c

@@ -86,7 +86,6 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
 {
 {
 	extern void disable_addr_trans(void); /* start.S */
 	extern void disable_addr_trans(void); /* start.S */
 	static struct pci_controller pcie_hose[PCIE_MAX_BUSES];
 	static struct pci_controller pcie_hose[PCIE_MAX_BUSES];
-	static int max_bus;
 	struct pci_controller *hose = &pcie_hose[bus];
 	struct pci_controller *hose = &pcie_hose[bus];
 	int i;
 	int i;
 
 
@@ -117,7 +116,7 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
 	hose->regions[i].size = 0x100000;
 	hose->regions[i].size = 0x100000;
 	hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_SYS_MEMORY;
 	hose->regions[i].flags = PCI_REGION_MEM | PCI_REGION_SYS_MEMORY;
 
 
-	hose->first_busno = max_bus;
+	hose->first_busno = pci_last_busno() + 1;
 	hose->last_busno = 0xff;
 	hose->last_busno = 0xff;
 
 
 	if (bus == 0)
 	if (bus == 0)
@@ -145,7 +144,6 @@ static void mpc83xx_pcie_register_hose(int bus, struct pci_region *reg,
 	 * Hose scan.
 	 * Hose scan.
 	 */
 	 */
 	hose->last_busno = pci_hose_scan(hose);
 	hose->last_busno = pci_hose_scan(hose);
-	max_bus = hose->last_busno + 1;
 }
 }
 
 
 #else
 #else