From: Jia Hongtao <B38951@freescale.com>
To: <linuxppc-dev@lists.ozlabs.org>, <galak@kernel.crashing.org>,
<B07421@freescale.com>
Cc: b38951@freescale.com
Subject: [PATCH V3 2/5] powerpc/fsl-pci: Determine primary bus by looking for ISA node
Date: Thu, 26 Jul 2012 20:30:24 +0800 [thread overview]
Message-ID: <1343305827-26734-2-git-send-email-B38951@freescale.com> (raw)
In-Reply-To: <1343305827-26734-1-git-send-email-B38951@freescale.com>
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.
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
Changed for V3:
- Using non-recursive function to find ISA under PCI
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(-)
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)
hose->first_busno = bus_range ? bus_range[0] : 0x0;
hose->last_busno = bus_range ? bus_range[1] : 0xff;
+ hose->is_primary = is_primary;
setup_indirect_pci(hose, rsrc.start, rsrc.start + 0x4,
PPC_INDIRECT_TYPE_BIG_ENDIAN);
@@ -933,18 +934,34 @@ void pci_determine_swiotlb(void)
}
#endif
-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 = pci_node->allnext;
+ for (; np != pci_node->sibling; np = np->allnext) {
+ if (np->type && (of_node_cmp(np->type, "isa") == 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 = of_pci_has_isa(pdev->dev.of_node);
- 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 = ((rsrc.start & 0xfffff) == primary_phb_addr);
+ if (of_match_node(pci_ids, pdev->dev.of_node))
fsl_add_bridge(pdev->dev.of_node, is_primary);
- }
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 */
};
-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
+
+extern int is_has_isa_node(struct device_node *parent);
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);
--
1.7.5.1
next prev parent reply other threads:[~2012-07-26 12:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-26 12:30 [PATCH V3 1/5] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
2012-07-26 12:30 ` Jia Hongtao [this message]
2012-07-26 18:21 ` [PATCH V3 2/5] powerpc/fsl-pci: Determine primary bus by looking for ISA node Kumar Gala
2012-07-27 2:16 ` Jia Hongtao-B38951
2012-07-27 2:56 ` Jia Hongtao-B38951
2012-07-26 12:30 ` [PATCH V3 3/5] powerpc/mpc85xx: convert to unified PCI init Jia Hongtao
2012-07-26 17:46 ` Kumar Gala
2012-07-26 17:47 ` Kumar Gala
2012-07-26 12:30 ` [PATCH V3 4/5] powerpc/fsl-pci: Add pci inbound/outbound PM support Jia Hongtao
2012-07-26 12:30 ` [PATCH V3 5/5] Edac/85xx: Register mpc85xx_pci_err_driver by fsl_pci_driver Jia Hongtao
2012-07-26 17:52 ` [PATCH V3 1/5] powerpc/fsl-pci: Unify pci/pcie initialization code Kumar Gala
2012-07-27 10:10 ` Jia Hongtao-B38951
2012-07-27 20:24 ` Scott Wood
2012-07-27 21:17 ` Kumar Gala
2012-07-30 8:26 ` Jia Hongtao-B38951
2012-07-30 14:46 ` Kumar Gala
2012-07-31 6:36 ` Jia Hongtao-B38951
2012-07-31 7:21 ` Li Yang
2012-07-31 13:37 ` Kumar Gala
2012-08-01 2:24 ` Jia Hongtao-B38951
2012-07-26 18:14 ` Kumar Gala
2012-07-27 8:35 ` Jia Hongtao-B38951
2012-07-27 12:47 ` Kumar Gala
2012-07-30 8:07 ` Jia Hongtao-B38951
2012-07-30 14:46 ` Kumar Gala
2012-07-31 2:22 ` Jia Hongtao-B38951
2012-08-01 17:42 ` Joakim Tjernlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1343305827-26734-2-git-send-email-B38951@freescale.com \
--to=b38951@freescale.com \
--cc=B07421@freescale.com \
--cc=galak@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).