linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
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 4/6] powerpc/mpc85xx_ds: convert to unified PCI init
Date: Tue, 24 Jul 2012 18:20:08 +0800	[thread overview]
Message-ID: <1343125210-16720-4-git-send-email-B38951@freescale.com> (raw)
In-Reply-To: <1343125210-16720-1-git-send-email-B38951@freescale.com>

PCI initialization is now done by PCI controller driver. In board setup_arch
stage we don't need PCI init any more but swiotlb should be determined at this
stage.

Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
---
 arch/powerpc/platforms/85xx/common.c     |    9 ++++
 arch/powerpc/platforms/85xx/mpc85xx_ds.c |   75 +++--------------------------
 2 files changed, 17 insertions(+), 67 deletions(-)

diff --git a/arch/powerpc/platforms/85xx/common.c b/arch/powerpc/platforms/85xx/common.c
index 67dac22..303fedb 100644
--- a/arch/powerpc/platforms/85xx/common.c
+++ b/arch/powerpc/platforms/85xx/common.c
@@ -27,6 +27,15 @@ static struct of_device_id __initdata mpc85xx_common_ids[] = {
 	{ .compatible = "fsl,mpc8548-guts", },
 	/* Probably unnecessary? */
 	{ .compatible = "gpio-leds", },
+	/* For all PCI controllers */
+	{ .compatible = "fsl,mpc8540-pci", },
+	{ .compatible = "fsl,mpc8548-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", },
 	{},
 };
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index d30f6c4..b7ef007 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -114,22 +114,14 @@ void __init mpc85xx_ds_pic_init(void)
 }
 
 #ifdef CONFIG_PCI
-static int primary_phb_addr;
 extern int uli_exclude_device(struct pci_controller *hose,
 				u_char bus, u_char devfn);
 
 static int mpc85xx_exclude_device(struct pci_controller *hose,
 				   u_char bus, u_char devfn)
 {
-	struct device_node* node;
-	struct resource rsrc;
-
-	node = hose->dn;
-	of_address_to_resource(node, 0, &rsrc);
-
-	if ((rsrc.start & 0xfffff) == primary_phb_addr) {
+	if (hose->is_primary)
 		return uli_exclude_device(hose, bus, devfn);
-	}
 
 	return PCIBIOS_SUCCESSFUL;
 }
@@ -140,46 +132,16 @@ static int mpc85xx_exclude_device(struct pci_controller *hose,
  */
 static void __init mpc85xx_ds_setup_arch(void)
 {
-#ifdef CONFIG_PCI
-	struct device_node *np;
-	struct pci_controller *hose;
-#endif
-	dma_addr_t max = 0xffffffff;
-
 	if (ppc_md.progress)
 		ppc_md.progress("mpc85xx_ds_setup_arch()", 0);
 
 #ifdef CONFIG_PCI
-	for_each_node_by_type(np, "pci") {
-		if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
-		    of_device_is_compatible(np, "fsl,mpc8548-pcie") ||
-		    of_device_is_compatible(np, "fsl,p2020-pcie")) {
-			struct resource rsrc;
-			of_address_to_resource(np, 0, &rsrc);
-			if ((rsrc.start & 0xfffff) == primary_phb_addr)
-				fsl_add_bridge(np, 1);
-			else
-				fsl_add_bridge(np, 0);
-
-			hose = pci_find_hose_for_OF_device(np);
-			max = min(max, hose->dma_window_base_cur +
-					hose->dma_window_size);
-		}
-	}
-
+	pci_check_swiotlb();
 	ppc_md.pci_exclude_device = mpc85xx_exclude_device;
 #endif
 
 	mpc85xx_smp_init();
 
-#ifdef CONFIG_SWIOTLB
-	if ((memblock_end_of_DRAM() - 1) > max) {
-		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_dma_ops);
-		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
-	}
-#endif
-
 	printk("MPC85xx DS board from Freescale Semiconductor\n");
 }
 
@@ -190,19 +152,12 @@ static int __init mpc8544_ds_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
 
-	if (of_flat_dt_is_compatible(root, "MPC8544DS")) {
-#ifdef CONFIG_PCI
-		primary_phb_addr = 0xb000;
-#endif
-		return 1;
-	}
-
-	return 0;
+	return of_flat_dt_is_compatible(root, "MPC8544DS");
 }
 
-machine_device_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
-machine_device_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
-machine_device_initcall(p2020_ds, mpc85xx_common_publish_devices);
+machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
+machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
+machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
 
 machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier);
 machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
@@ -215,14 +170,7 @@ static int __init mpc8572_ds_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
 
-	if (of_flat_dt_is_compatible(root, "fsl,MPC8572DS")) {
-#ifdef CONFIG_PCI
-		primary_phb_addr = 0x8000;
-#endif
-		return 1;
-	}
-
-	return 0;
+	return of_flat_dt_is_compatible(root, "fsl,MPC8572DS");
 }
 
 /*
@@ -232,14 +180,7 @@ static int __init p2020_ds_probe(void)
 {
 	unsigned long root = of_get_flat_dt_root();
 
-	if (of_flat_dt_is_compatible(root, "fsl,P2020DS")) {
-#ifdef CONFIG_PCI
-		primary_phb_addr = 0x9000;
-#endif
-		return 1;
-	}
-
-	return 0;
+	return of_flat_dt_is_compatible(root, "fsl,P2020DS");
 }
 
 define_machine(mpc8544_ds) {
-- 
1.7.5.1

  parent 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 [PATCH 1/6] powerpc/fsl-pci: Unify pci/pcie initialization code Jia Hongtao
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 ` Jia Hongtao [this message]
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-4-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).