diff options
author | Jia Hongtao <B38951@freescale.com> | 2012-08-28 03:44:08 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2012-09-12 15:57:12 -0400 |
commit | 905e75c46dba5f3061049277e4eb7110beedba43 (patch) | |
tree | 3a83c25efa8f93360772520c23f3d8b8b9d9aef1 /arch/powerpc/platforms/85xx/ge_imp3a.c | |
parent | 9e67886becd7fab36c97ef43bb81515c18a66be1 (diff) |
powerpc/fsl-pci: Unify pci/pcie initialization code
We unified the Freescale pci/pcie initialization by changing the fsl_pci
to a platform driver. In previous PCI code architecture the initialization
routine is called at board_setup_arch stage. Now the initialization is done
in probe function which is architectural better. Also It's convenient for
adding PM support for PCI controller in later patch.
Now we registered pci controllers as platform devices. So we combine two
initialization code as one platform driver.
Signed-off-by: Jia Hongtao <B38951@freescale.com>
Signed-off-by: Li Yang <leoli@freescale.com>
Signed-off-by: Chunhe Lan <Chunhe.Lan@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/85xx/ge_imp3a.c')
-rw-r--r-- | arch/powerpc/platforms/85xx/ge_imp3a.c | 62 |
1 files changed, 20 insertions, 42 deletions
diff --git a/arch/powerpc/platforms/85xx/ge_imp3a.c b/arch/powerpc/platforms/85xx/ge_imp3a.c index b6a728b0a8ca..e6285ae6f423 100644 --- a/arch/powerpc/platforms/85xx/ge_imp3a.c +++ b/arch/powerpc/platforms/85xx/ge_imp3a.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
23 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
24 | #include <linux/of_platform.h> | 24 | #include <linux/of_platform.h> |
25 | #include <linux/memblock.h> | ||
26 | 25 | ||
27 | #include <asm/time.h> | 26 | #include <asm/time.h> |
28 | #include <asm/machdep.h> | 27 | #include <asm/machdep.h> |
@@ -84,53 +83,39 @@ void __init ge_imp3a_pic_init(void) | |||
84 | of_node_put(cascade_node); | 83 | of_node_put(cascade_node); |
85 | } | 84 | } |
86 | 85 | ||
87 | #ifdef CONFIG_PCI | 86 | static void ge_imp3a_pci_assign_primary(void) |
88 | static int primary_phb_addr; | ||
89 | #endif /* CONFIG_PCI */ | ||
90 | |||
91 | /* | ||
92 | * Setup the architecture | ||
93 | */ | ||
94 | static void __init ge_imp3a_setup_arch(void) | ||
95 | { | 87 | { |
96 | struct device_node *regs; | ||
97 | #ifdef CONFIG_PCI | 88 | #ifdef CONFIG_PCI |
98 | struct device_node *np; | 89 | struct device_node *np; |
99 | struct pci_controller *hose; | 90 | struct resource rsrc; |
100 | #endif | ||
101 | dma_addr_t max = 0xffffffff; | ||
102 | 91 | ||
103 | if (ppc_md.progress) | ||
104 | ppc_md.progress("ge_imp3a_setup_arch()", 0); | ||
105 | |||
106 | #ifdef CONFIG_PCI | ||
107 | for_each_node_by_type(np, "pci") { | 92 | for_each_node_by_type(np, "pci") { |
108 | if (of_device_is_compatible(np, "fsl,mpc8540-pci") || | 93 | if (of_device_is_compatible(np, "fsl,mpc8540-pci") || |
109 | of_device_is_compatible(np, "fsl,mpc8548-pcie") || | 94 | of_device_is_compatible(np, "fsl,mpc8548-pcie") || |
110 | of_device_is_compatible(np, "fsl,p2020-pcie")) { | 95 | of_device_is_compatible(np, "fsl,p2020-pcie")) { |
111 | struct resource rsrc; | ||
112 | of_address_to_resource(np, 0, &rsrc); | 96 | of_address_to_resource(np, 0, &rsrc); |
113 | if ((rsrc.start & 0xfffff) == primary_phb_addr) | 97 | if ((rsrc.start & 0xfffff) == 0x9000) |
114 | fsl_add_bridge(np, 1); | 98 | fsl_pci_primary = np; |
115 | else | ||
116 | fsl_add_bridge(np, 0); | ||
117 | |||
118 | hose = pci_find_hose_for_OF_device(np); | ||
119 | max = min(max, hose->dma_window_base_cur + | ||
120 | hose->dma_window_size); | ||
121 | } | 99 | } |
122 | } | 100 | } |
123 | #endif | 101 | #endif |
102 | } | ||
103 | |||
104 | /* | ||
105 | * Setup the architecture | ||
106 | */ | ||
107 | static void __init ge_imp3a_setup_arch(void) | ||
108 | { | ||
109 | struct device_node *regs; | ||
110 | |||
111 | if (ppc_md.progress) | ||
112 | ppc_md.progress("ge_imp3a_setup_arch()", 0); | ||
124 | 113 | ||
125 | mpc85xx_smp_init(); | 114 | mpc85xx_smp_init(); |
126 | 115 | ||
127 | #ifdef CONFIG_SWIOTLB | 116 | ge_imp3a_pci_assign_primary(); |
128 | if ((memblock_end_of_DRAM() - 1) > max) { | 117 | |
129 | ppc_swiotlb_enable = 1; | 118 | swiotlb_detect_4g(); |
130 | set_pci_dma_ops(&swiotlb_dma_ops); | ||
131 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; | ||
132 | } | ||
133 | #endif | ||
134 | 119 | ||
135 | /* Remap basic board registers */ | 120 | /* Remap basic board registers */ |
136 | regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs"); | 121 | regs = of_find_compatible_node(NULL, NULL, "ge,imp3a-fpga-regs"); |
@@ -215,17 +200,10 @@ static int __init ge_imp3a_probe(void) | |||
215 | { | 200 | { |
216 | unsigned long root = of_get_flat_dt_root(); | 201 | unsigned long root = of_get_flat_dt_root(); |
217 | 202 | ||
218 | if (of_flat_dt_is_compatible(root, "ge,IMP3A")) { | 203 | return of_flat_dt_is_compatible(root, "ge,IMP3A"); |
219 | #ifdef CONFIG_PCI | ||
220 | primary_phb_addr = 0x9000; | ||
221 | #endif | ||
222 | return 1; | ||
223 | } | ||
224 | |||
225 | return 0; | ||
226 | } | 204 | } |
227 | 205 | ||
228 | machine_device_initcall(ge_imp3a, mpc85xx_common_publish_devices); | 206 | machine_arch_initcall(ge_imp3a, mpc85xx_common_publish_devices); |
229 | 207 | ||
230 | machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier); | 208 | machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier); |
231 | 209 | ||