Return-Path: Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 611572C0086 for ; Fri, 27 Jul 2012 04:21:51 +1000 (EST) Subject: Re: [PATCH V3 2/5] powerpc/fsl-pci: Determine primary bus by looking for ISA node Mime-Version: 1.0 (Apple Message framework v1278) Content-Type: text/plain; charset=us-ascii From: Kumar Gala In-Reply-To: <1343305827-26734-2-git-send-email-B38951@freescale.com> Date: Thu, 26 Jul 2012 13:21:46 -0500 Message-Id: References: <1343305827-26734-1-git-send-email-B38951@freescale.com> <1343305827-26734-2-git-send-email-B38951@freescale.com> To: Jia Hongtao Cc: B07421@freescale.com, linuxppc-dev@lists.ozlabs.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Jul 26, 2012, at 7:30 AM, Jia Hongtao wrote: > PCI host bridge is primary bus if it contains an ISA node. But not all = boards > fit this rule. Device tree should be updated for all these boards. I don't really seen any reason for this patch. We can just use the code = as Scott wrote it that sets fsl_pci_primary based on search for the isa = node. >=20 > Signed-off-by: Jia Hongtao > Signed-off-by: Li Yang > --- > Changed for V3: > - Using non-recursive function to find ISA under PCI >=20 > arch/powerpc/include/asm/pci-bridge.h | 1 + > arch/powerpc/sysdev/fsl_pci.c | 31 = ++++++++++++++++++++++++------- > arch/powerpc/sysdev/fsl_pci.h | 12 +++++++++++- > 3 files changed, 36 insertions(+), 8 deletions(-) >=20 > diff --git a/arch/powerpc/include/asm/pci-bridge.h = b/arch/powerpc/include/asm/pci-bridge.h > index ac39e6a..b48fa7f 100644 > --- a/arch/powerpc/include/asm/pci-bridge.h > +++ b/arch/powerpc/include/asm/pci-bridge.h > @@ -20,6 +20,7 @@ struct device_node; > struct pci_controller { > struct pci_bus *bus; > char is_dynamic; > + int is_primary; > #ifdef CONFIG_PPC64 > int node; > #endif > diff --git a/arch/powerpc/sysdev/fsl_pci.c = b/arch/powerpc/sysdev/fsl_pci.c > index 5228b6b..97557c5 100644 > --- a/arch/powerpc/sysdev/fsl_pci.c > +++ b/arch/powerpc/sysdev/fsl_pci.c > @@ -453,6 +453,7 @@ int __init fsl_add_bridge(struct device_node *dev, = int is_primary) >=20 > hose->first_busno =3D bus_range ? bus_range[0] : 0x0; > hose->last_busno =3D bus_range ? bus_range[1] : 0xff; > + hose->is_primary =3D is_primary; >=20 > setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4, > PPC_INDIRECT_TYPE_BIG_ENDIAN); > @@ -933,18 +934,34 @@ void pci_determine_swiotlb(void) > } > #endif >=20 > -int primary_phb_addr; > +/* Checkout if PCI contains ISA node (Only scan the children of PCI) = */ > +static int of_pci_has_isa(struct device_node *pci_node) > +{ > + struct device_node *np; > + > + read_lock(&devtree_lock); > + if (!pci_node) > + return 0; > + np =3D pci_node->allnext; > + for (; np !=3D pci_node->sibling; np =3D np->allnext) { > + if (np->type && (of_node_cmp(np->type, "isa") =3D=3D 0) > + && of_node_get(np)) { > + of_node_put(pci_node); > + return 1; > + } > + } > + of_node_put(pci_node); > + read_unlock(&devtree_lock); > + return 0; > +} > + > static int __devinit fsl_pci_probe(struct platform_device *pdev) > { > - struct pci_controller *hose; > bool is_primary; > + is_primary =3D of_pci_has_isa(pdev->dev.of_node); >=20 > - if (of_match_node(pci_ids, pdev->dev.of_node)) { > - struct resource rsrc; > - of_address_to_resource(pdev->dev.of_node, 0, &rsrc); > - is_primary =3D ((rsrc.start & 0xfffff) =3D=3D = primary_phb_addr); > + if (of_match_node(pci_ids, pdev->dev.of_node)) > fsl_add_bridge(pdev->dev.of_node, is_primary); > - } >=20 > return 0; > } > diff --git a/arch/powerpc/sysdev/fsl_pci.h = b/arch/powerpc/sysdev/fsl_pci.h > index 095392d..c884e06 100644 > --- a/arch/powerpc/sysdev/fsl_pci.h > +++ b/arch/powerpc/sysdev/fsl_pci.h > @@ -88,7 +88,17 @@ struct ccsr_pci { > __be32 pex_err_cap_r3; /* 0x.e34 - PCIE error capture = register 0 */ > }; >=20 > -extern int primary_phb_addr; > + > +#ifdef CONFIG_SUSPEND > +struct fsl_pci_private_data { > + int inbound_num; > + struct pci_outbound_window_regs __iomem *pci_pow; > + struct pci_inbound_window_regs __iomem *pci_piw; > + void *saved_regs; > +}; > +#endif > + This struct has nothing to do with this patch > +extern int is_has_isa_node(struct device_node *parent); Where is is_has_isa_node() defined or used? > extern int fsl_add_bridge(struct device_node *dev, int is_primary); > extern void fsl_pcibios_fixup_bus(struct pci_bus *bus); > extern int mpc83xx_add_bridge(struct device_node *dev); > --=20 > 1.7.5.1 >=20