[U-Boot-Users] [PATCH][RFC] pci: Remove CONFIG_PCI_SKIP_HOST_BRIDGE and Add check PCI class of host bridge (Re: PCI stopped working on MPC8343)

Nobuhiro Iwamatsu iwamatsu at nigauri.org
Mon Apr 28 10:00:42 CEST 2008


Hi, all.

Sorry for the delay.

On Fri, 18 Apr 2008 16:57:15 +0200
Stefan Roese <sr at denx.de> wrote:

> > The patch changes the behavior of the code _unless_
> > CONFIG_PCI_SKIP_HOST_BRIDGE is defined.  Defining that switch in the
> > Korat configuration fixes the problem.  The MPC8323ERDB configuration
> > has also been patched to add the switch, so maybe this is is the cause
> > of your problem as well.
> >
> > I was going to submit the patch for Korat, but then decided I'd first
> > like to ask Nobuhiro and the group whether it might not be better to
> > change the occurrences of
> >
> > #if defined(CONFIG_PCI_SKIP_HOST_BRIDGE)
> >
> > in "drivers/pci/pci.c" to
> >
> > #if !defined(CONFIG_PCI_NO_SKIP_HOST_BRIDGE)
> >
> > That would allow those boards that need to patch to specify it
> > explicity, while leaving the default functionality unchanged.
> >
> > Comments?
> 
> Yes, I totally agree. Patches should *not* change the default behavior. We 
> should change it as you suggested. Sorry, I must have missed this.
> 
> Nobuhiro, could you please send a new patch to fix this problem?

Thank you for your check.
It has troubled you with my patch. 

I rewirte new patch . Could you please check this patch and confirming the work?

Best regards,
 Nobuhiro 
-- 
Nobuhiro Iwamatsu

---
Remove CONFIG_PCI_SKIP_HOST_BRIDGE from drivers/pci/pci.c.
Add check PCI class of host bridge(CPU to PCI bridge).

Signed-off-by: Nobuhiro Iwamatsu <iwamatsu at nigauri.org>
---
 drivers/pci/pci.c |   20 ++++++++------------
 1 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 7944b66..129a6c9 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -425,14 +425,15 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
 	     dev <  PCI_BDF(bus,PCI_MAX_PCI_DEVICES-1,PCI_MAX_PCI_FUNCTIONS-1);
 	     dev += PCI_BDF(0,0,1))
 	{
-
-	/* Bus 0 is not necessarily PCI bridge. */
-#if defined(CONFIG_PCI_SKIP_HOST_BRIDGE)
+		/* Read class register */
+		pci_hose_read_config_word(hose, dev, PCI_CLASS_DEVICE, &class);
 		/* Skip our host bridge */
-		if ( dev == PCI_BDF(hose->first_busno,0,0) ) {
-#if defined(CONFIG_PCI_CONFIG_HOST_BRIDGE)              /* don't skip host bridge */
+		if ( (dev == PCI_BDF(hose->first_busno,0,0)) &&
+			(class == 0x0600)) { /* CPU to PCI bridge */
+#if defined(CONFIG_PCI_CONFIG_HOST_BRIDGE) /* don't skip host bridge */
 			/*
-			 * Only skip hostbridge configuration if "pciconfighost" is not set
+			 * Only skip hostbridge configuration if 
+			 * "pciconfighost" is not set
 			 */
 			if (getenv("pciconfighost") == NULL) {
 				continue; /* Skip our host bridge */
@@ -441,8 +442,6 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
 			continue; /* Skip our host bridge */
 #endif /* CONFIG_PCI_CONFIG_HOST_BRIDGE */
 		}
-#endif /* CONFIG_PCI_SKIP_HOST_BRIDGE */
-
 		if (PCI_FUNC(dev) && !found_multi)
 			continue;
 
@@ -477,11 +476,8 @@ int pci_hose_scan_bus(struct pci_controller *hose, int bus)
 				hose->fixup_irq(hose, dev);
 
 #ifdef CONFIG_PCI_SCAN_SHOW
-#if defined(CONFIG_PCI_SKIP_HOST_BRIDGE)
 			/* Skip our host bridge */
-			if ( dev != PCI_BDF(hose->first_busno,0,0) )
-#endif
-			{
+			if( class != 0x0600 ) { /* CPU to PCI bridge */
 			    unsigned char int_line;
 
 			    pci_hose_read_config_byte(hose, dev, PCI_INTERRUPT_LINE,
-- 
1.5.5





More information about the U-Boot mailing list