Skip to contentSkip to conversation

For MPC831x the bus probing function needs the fixup to assign addresses to the PCI devices as it was for MPC85xx and MPC86xx. The fixup of the bridge vendor and device ID should be done early in PCI probing. Else the bridge is not detected as FIXUP_HEADER is called too late.

PATCH In review Sergey Gerasimov 2 participants 2 messages Mar 18, 2013 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 For MPC831x the bus probing function needs the fixup to assign addresses to the PCI devices as it was for MPC85xx and MPC86xx. The fixup of the bridge vendor and device ID should be done early in PCI probing. Else the bridge is not detected as FIXUP_HEADER is called too late.

---
 arch/powerpc/sysdev/fsl_pci.c | 71 +++++++++++++++++++++----------------------
 1 file changed, 34 insertions(+), 37 deletions(-)
arch/powerpc/sysdev/fsl_pci.c +34 -37
index 682084d..2e41a68 100644
@@ -64,6 +64,34 @@ static int __init fsl_pcie_check_link(struct pci_controller *hose)
 	return 0;
 }
 
+void fsl_pcibios_fixup_bus(struct pci_bus *bus)
+{
+	struct pci_controller *hose = (struct pci_controller *) bus->sysdata;
+	int i;
+
+
+	if ((bus->parent == hose->bus)
+		&& ((fsl_pcie_bus_fixup
+			&& pci_bus_find_capability(bus, 0, PCI_CAP_ID_EXP))
+				|| (hose->indirect_type
+					& PPC_INDIRECT_TYPE_NO_PCIE_LINK))) {
+		for (i = 0; i < 4; ++i) {
+			struct resource *res = bus->resource[i];
+			struct resource *par = bus->parent->resource[i];
+			if (res) {
+				res->start = 0;
+				res->end   = 0;
+				res->flags = 0;
+			}
+			if (res && par) {
+				res->start = par->start;
+				res->end   = par->end;
+				res->flags = par->flags;
+			}
+		}
+	}
+}
+
 #if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
 
 #define MAX_PHYS_ADDR_BITS	40
@@ -384,42 +412,6 @@ static void __init setup_pci_cmd(struct pci_controller *hose)
 	}
 }
 
-void fsl_pcibios_fixup_bus(struct pci_bus *bus)
-{
-	struct pci_controller *hose = pci_bus_to_host(bus);
-	int i, is_pcie = 0, no_link;
-
-	/* The root complex bridge comes up with bogus resources,
-	 * we copy the PHB ones in.
-	 *
-	 * With the current generic PCI code, the PHB bus no longer
-	 * has bus->resource[0..4] set, so things are a bit more
-	 * tricky.
-	 */
-
-	if (fsl_pcie_bus_fixup)
-		is_pcie = early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP);
-	no_link = !!(hose->indirect_type & PPC_INDIRECT_TYPE_NO_PCIE_LINK);
-
-	if (bus->parent == hose->bus && (is_pcie || no_link)) {
-		for (i = 0; i < PCI_BRIDGE_RESOURCE_NUM; ++i) {
-			struct resource *res = bus->resource[i];
-			struct resource *par;
-
-			if (!res)
-				continue;
-			if (i == 0)
-				par = &hose->io_resource;
-			else if (i < 4)
-				par = &hose->mem_resources[i-1];
-			else par = NULL;
-
-			res->start = par ? par->start : 0;
-			res->end   = par ? par->end   : 0;
-			res->flags = par ? par->flags : 0;
-		}
-	}
-}
 
 int __init fsl_add_bridge(struct platform_device *pdev, int is_primary)
 {
@@ -515,7 +507,8 @@ no_bridge:
 }
 #endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */
 
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, quirk_fsl_pcie_header);
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID,
+	quirk_fsl_pcie_header);
 
 #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
 struct mpc83xx_pcie_priv {
@@ -813,6 +806,10 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose)
 	}
 #endif
 
+
+
+
+
 #if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
 	if (!is_mpc83xx_pci) {
 		u32 base;
Signature · 1 line
1.7.11.7
#1 lore raw
Quoted 1 line · Sergey Gerasimov
Signed-off-by Sergey Gerasimov =

<[email protected]>

Quoted 2 lines

---
arch/powerpc/sysdev/fsl_pci.c | 71 =

+++++++++++++++++++++----------------------

Quoted 2 lines
1 file changed, 34 insertions(+), 37 deletions(-)

=20

Can you repost with subject and commit log fixed? It appears your = subject & commit message are merged.

=

Quoted 1 line
= renamed from arch/powerpc/sysdev/fsl_pci.c +0 -0

b/arch/powerpc/sysdev/fsl_pci.c

arch/powerpc/sysdev/fsl_pci.c static int __init fsl_pcie_check_link(struct =

Quoted 4 lines

index 682084d..2e41a68 100644

arch/powerpc/sysdev/fsl_pci.c +0 -0
@@ -64,6 +64,34 @@ static int __init fsl_pcie_check_link(struct =

pci_controller *hose)

arch/powerpc/sysdev/fsl_pci.c static int __init fsl_pcie_check_link(struct pci_controller *hose)

Quoted 6 lines
arch/powerpc/sysdev/fsl_pci.c +0 -0
 	return 0;
 }

=20

arch/powerpc/sysdev/fsl_pci.c +3 -0
+void fsl_pcibios_fixup_bus(struct pci_bus *bus)
+{
+	struct pci_controller *hose =3D (struct pci_controller *) =

bus->sysdata;

arch/powerpc/sysdev/fsl_pci.c static int __init fsl_pcie_check_link(struct pci_controller *hose)

Quoted 6 lines
arch/powerpc/sysdev/fsl_pci.c +6 -0
+	int i;
+
+
+	if ((bus->parent =3D=3D hose->bus)
+		&& ((fsl_pcie_bus_fixup
+			&& pci_bus_find_capability(bus, 0, =

PCI_CAP_ID_EXP))

arch/powerpc/sysdev/fsl_pci.c

Quoted 2 lines
arch/powerpc/sysdev/fsl_pci.c +2 -0
+				|| (hose->indirect_type
+					& =

PPC_INDIRECT_TYPE_NO_PCIE_LINK))) {

arch/powerpc/sysdev/fsl_pci.c

Quoted 3 lines
arch/powerpc/sysdev/fsl_pci.c +3 -0
+		for (i =3D 0; i < 4; ++i) {
+			struct resource *res =3D bus->resource[i];
+			struct resource *par =3D =

bus->parent->resource[i];

arch/powerpc/sysdev/fsl_pci.c static void __init setup_pci_cmd(struct =

Quoted 18 lines
arch/powerpc/sysdev/fsl_pci.c +14 -0
+			if (res) {
+				res->start =3D 0;
+				res->end   =3D 0;
+				res->flags =3D 0;
+			}
+			if (res && par) {
+				res->start =3D par->start;
+				res->end   =3D par->end;
+				res->flags =3D par->flags;
+			}
+		}
+	}
+}
+

#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx) =20
#define MAX_PHYS_ADDR_BITS 40

arch/powerpc/sysdev/fsl_pci.c +0 -0
@@ -384,42 +412,6 @@ static void __init setup_pci_cmd(struct =

pci_controller *hose)

Quoted 8 lines
arch/powerpc/sysdev/fsl_pci.c +0 -0
 	}
 }

=20

arch/powerpc/sysdev/fsl_pci.c +0 -5
-void fsl_pcibios_fixup_bus(struct pci_bus *bus)
-{
-	struct pci_controller *hose =3D pci_bus_to_host(bus);
-	int i, is_pcie =3D 0, no_link;
-

arch/powerpc/sysdev/fsl_pci.c static void __init setup_pci_cmd(struct pci_controller *hose)

Quoted 10 lines
arch/powerpc/sysdev/fsl_pci.c +0 -10
-	/* The root complex bridge comes up with bogus resources,
-	 * we copy the PHB ones in.
-	 *
-	 * With the current generic PCI code, the PHB bus no longer
-	 * has bus->resource[0..4] set, so things are a bit more
-	 * tricky.
-	 */
-
-	if (fsl_pcie_bus_fixup)
-		is_pcie =3D early_find_capability(hose, 0, 0, =

PCI_CAP_ID_EXP);

arch/powerpc/sysdev/fsl_pci.c

Quoted 1 line
arch/powerpc/sysdev/fsl_pci.c +0 -1
-	no_link =3D !!(hose->indirect_type & =

PPC_INDIRECT_TYPE_NO_PCIE_LINK);

Quoted 20 lines
arch/powerpc/sysdev/fsl_pci.c +0 -20
-
-	if (bus->parent =3D=3D hose->bus && (is_pcie || no_link)) {
-		for (i =3D 0; i < PCI_BRIDGE_RESOURCE_NUM; ++i) {
-			struct resource *res =3D bus->resource[i];
-			struct resource *par;
-
-			if (!res)
-				continue;
-			if (i =3D=3D 0)
-				par =3D &hose->io_resource;
-			else if (i < 4)
-				par =3D &hose->mem_resources[i-1];
-			else par =3D NULL;
-
-			res->start =3D par ? par->start : 0;
-			res->end   =3D par ? par->end   : 0;
-			res->flags =3D par ? par->flags : 0;
-		}
-	}
-}
Quoted 2 lines

=20
int __init fsl_add_bridge(struct platform_device *pdev, int =

is_primary)

Quoted 6 lines

{

arch/powerpc/sysdev/fsl_pci.c +0 -0
@@ -515,7 +507,8 @@ no_bridge:
 }
 #endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */

=20
-DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, =

quirk_fsl_pcie_header);

arch/powerpc/sysdev/fsl_pci.c no_bridge: · line 511

Quoted 2 lines
arch/powerpc/sysdev/fsl_pci.c +2 -0
+DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID,
+	quirk_fsl_pcie_header);

why does this need to be done EARLY?

arch/powerpc/sysdev/fsl_pci.c u64 fsl_pci_immrbar_base(struct pci_controller =

Quoted 3 lines

#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) struct mpc83xx_pcie_priv {

arch/powerpc/sysdev/fsl_pci.c +0 -0
@@ -813,6 +806,10 @@ u64 fsl_pci_immrbar_base(struct pci_controller =

*hose)

arch/powerpc/sysdev/fsl_pci.c u64 fsl_pci_immrbar_base(struct pci_controller *hose) · line 812

Quoted 7 lines
arch/powerpc/sysdev/fsl_pci.c +0 -0
 	}
 #endif

=20

arch/powerpc/sysdev/fsl_pci.c +4 -0
+
+
+
+

don't add extra whitespace

Quoted 5 lines
#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
	if (!is_mpc83xx_pci) {
		u32 base;

--=20
1.7.11.7