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 1/6] powerpc/fsl-pci: Unify pci/pcie initialization code
Date: Tue, 24 Jul 2012 18:20:05 +0800 [thread overview]
Message-ID: <1343125210-16720-1-git-send-email-B38951@freescale.com> (raw)
We unified the Freescale pci/pcie initialization by changing the fsl_pci
to a platform driver.
In previous version pci/pcie initialization is in platform code which
Initialize pci bridge base on EP/RC or host/agent settings.
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
arch/powerpc/sysdev/fsl_pci.c | 60 +++++++++++++++++++++++++++++++++++++++++
arch/powerpc/sysdev/fsl_pci.h | 1 +
2 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index edbf794..feed364 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -807,3 +807,63 @@ u64 fsl_pci_immrbar_base(struct pci_controller *hose)
return 0;
}
+
+#if defined(CONFIG_FSL_SOC_BOOKE) || defined(CONFIG_PPC_86xx)
+static const struct of_device_id pci_ids[] = {
+ { .compatible = "fsl,mpc8540-pci", },
+ { .compatible = "fsl,mpc8548-pcie", },
+ { .compatible = "fsl,mpc8641-pcie", },
+ { .compatible = "fsl,p1022-pcie", },
+ { .compatible = "fsl,p1010-pcie", },
+ { .compatible = "fsl,p1023-pcie", },
+ { .compatible = "fsl,p4080-pcie", },
+ { .compatible = "fsl,qoriq-pcie-v2.3", },
+ { .compatible = "fsl,qoriq-pcie-v2.2", },
+ {},
+};
+
+int primary_phb_addr;
+static int __devinit fsl_pci_probe(struct platform_device *pdev)
+{
+ struct pci_controller *hose;
+ bool is_primary;
+
+ 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);
+ fsl_add_bridge(pdev->dev.of_node, is_primary);
+
+#ifdef CONFIG_SWIOTLB
+ hose = pci_find_hose_for_OF_device(pdev->dev.of_node);
+ /*
+ * if we couldn't map all of DRAM via the dma windows
+ * we need SWIOTLB to handle buffers located outside of
+ * dma capable memory region
+ */
+ if (memblock_end_of_DRAM() > hose->dma_window_base_cur
+ + hose->dma_window_size) {
+ ppc_swiotlb_enable = 1;
+ set_pci_dma_ops(&swiotlb_dma_ops);
+ ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
+ }
+#endif
+ }
+
+ return 0;
+}
+
+static struct platform_driver fsl_pci_driver = {
+ .driver = {
+ .name = "fsl-pci",
+ .of_match_table = pci_ids,
+ },
+ .probe = fsl_pci_probe,
+};
+
+static int __init fsl_pci_init(void)
+{
+ return platform_driver_register(&fsl_pci_driver);
+}
+arch_initcall(fsl_pci_init);
+#endif
diff --git a/arch/powerpc/sysdev/fsl_pci.h b/arch/powerpc/sysdev/fsl_pci.h
index a39ed5c..df9fc44 100644
--- a/arch/powerpc/sysdev/fsl_pci.h
+++ b/arch/powerpc/sysdev/fsl_pci.h
@@ -88,6 +88,7 @@ struct ccsr_pci {
__be32 pex_err_cap_r3; /* 0x.e34 - PCIE error capture register 0 */
};
+extern int primary_phb_addr;
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 reply other threads:[~2012-07-24 10:43 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-24 10:20 Jia Hongtao [this message]
2012-07-24 10:20 ` [PATCH 2/6] powerpc/fsl-pci: Check swiotlb enable at board setup_arch stage Jia Hongtao
2012-07-24 10:20 ` [PATCH 3/6] powerpc/fsl-pci: Determine primary bus by looking for ISA node Jia Hongtao
2012-07-24 18:47 ` Scott Wood
2012-07-25 2:42 ` Jia Hongtao-B38951
2012-07-25 17:25 ` Scott Wood
2012-07-26 2:20 ` Jia Hongtao-B38951
2012-07-27 1:34 ` Scott Wood
2012-07-27 2:07 ` Jia Hongtao-B38951
2012-07-27 16:37 ` Scott Wood
2012-07-25 9:01 ` Jia Hongtao-B38951
2012-07-25 17:27 ` Scott Wood
2012-07-24 10:20 ` [PATCH 4/6] powerpc/mpc85xx_ds: convert to unified PCI init Jia Hongtao
2012-07-24 10:20 ` [PATCH 5/6] powerpc/fsl-pci: Add pci inbound/outbound PM support Jia Hongtao
2012-07-27 13:24 ` Kumar Gala
2012-07-30 6:09 ` Jia Hongtao-B38951
2012-07-31 13:37 ` Kumar Gala
2012-08-02 11:35 ` Jia Hongtao-B38951
2012-08-07 10:11 ` Jia Hongtao-B38951
2012-08-07 15:34 ` Scott Wood
2012-08-07 17:34 ` Kumar Gala
2012-08-08 3:07 ` Jia Hongtao-B38951
2012-08-08 9:54 ` Jia Hongtao-B38951
2012-08-08 12:46 ` Kumar Gala
2012-08-08 21:04 ` Scott Wood
2012-08-09 10:32 ` Jia Hongtao-B38951
2012-08-09 2:52 ` Jia Hongtao-B38951
2012-08-09 5:05 ` Li Yang
2012-08-09 13:08 ` Kumar Gala
2012-08-10 2:17 ` Jia Hongtao-B38951
2012-07-24 10:20 ` [PATCH 6/6] Edac/85xx: Register mpc85xx_pci_err_driver by fsl_pci_driver Jia Hongtao
2012-07-24 18:42 ` [PATCH 1/6] powerpc/fsl-pci: Unify pci/pcie initialization code Scott Wood
2012-07-25 2:35 ` Jia Hongtao-B38951
2012-07-25 17:23 ` Scott Wood
2012-07-26 2:09 ` Jia Hongtao-B38951
2012-07-26 2:38 ` Jia Hongtao-B38951
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=1343125210-16720-1-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).