diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2009-05-15 01:37:35 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-06-15 22:45:29 -0400 |
commit | 152d0182822e871a3fe1f6d97949d83fad950e26 (patch) | |
tree | 0e09bbe9b3a5b2982dc501db4240238314f54743 /arch/powerpc/platforms/85xx | |
parent | 5cef379b34ffcd96567066ddc1012bd40e6e7675 (diff) |
powerpc/85xx: Add SWIOTLB support to FSL boards
Add the platform-specific code for enabling SWIOTLB if needed on P2020DS,
MPC85xx DS, and MPC85xx MDS boards as they are capable of having >4G of
memory.
We determine if we need to enable swiotlb based on how much memory is in
the board and if it exceeds 4G or what we can map via PCI inbound
windows.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/85xx')
-rw-r--r-- | arch/powerpc/platforms/85xx/Kconfig | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/mpc8536_ds.c | 17 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/mpc85xx_ds.c | 19 | ||||
-rw-r--r-- | arch/powerpc/platforms/85xx/mpc85xx_mds.c | 20 |
4 files changed, 59 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig index 43d385cedcd7..0ee5b12c7d95 100644 --- a/arch/powerpc/platforms/85xx/Kconfig +++ b/arch/powerpc/platforms/85xx/Kconfig | |||
@@ -35,12 +35,14 @@ config MPC85xx_MDS | |||
35 | select DEFAULT_UIMAGE | 35 | select DEFAULT_UIMAGE |
36 | select PHYLIB | 36 | select PHYLIB |
37 | select HAS_RAPIDIO | 37 | select HAS_RAPIDIO |
38 | select SWIOTLB | ||
38 | help | 39 | help |
39 | This option enables support for the MPC85xx MDS board | 40 | This option enables support for the MPC85xx MDS board |
40 | 41 | ||
41 | config MPC8536_DS | 42 | config MPC8536_DS |
42 | bool "Freescale MPC8536 DS" | 43 | bool "Freescale MPC8536 DS" |
43 | select DEFAULT_UIMAGE | 44 | select DEFAULT_UIMAGE |
45 | select SWIOTLB | ||
44 | help | 46 | help |
45 | This option enables support for the MPC8536 DS board | 47 | This option enables support for the MPC8536 DS board |
46 | 48 | ||
@@ -49,6 +51,7 @@ config MPC85xx_DS | |||
49 | select PPC_I8259 | 51 | select PPC_I8259 |
50 | select DEFAULT_UIMAGE | 52 | select DEFAULT_UIMAGE |
51 | select FSL_ULI1575 | 53 | select FSL_ULI1575 |
54 | select SWIOTLB | ||
52 | help | 55 | help |
53 | This option enables support for the MPC85xx DS (MPC8544 DS) board | 56 | This option enables support for the MPC85xx DS (MPC8544 DS) board |
54 | 57 | ||
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c index 63efca20d7bd..055ff417bae9 100644 --- a/arch/powerpc/platforms/85xx/mpc8536_ds.c +++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/seq_file.h> | 17 | #include <linux/seq_file.h> |
18 | #include <linux/interrupt.h> | 18 | #include <linux/interrupt.h> |
19 | #include <linux/of_platform.h> | 19 | #include <linux/of_platform.h> |
20 | #include <linux/lmb.h> | ||
20 | 21 | ||
21 | #include <asm/system.h> | 22 | #include <asm/system.h> |
22 | #include <asm/time.h> | 23 | #include <asm/time.h> |
@@ -26,6 +27,7 @@ | |||
26 | #include <asm/prom.h> | 27 | #include <asm/prom.h> |
27 | #include <asm/udbg.h> | 28 | #include <asm/udbg.h> |
28 | #include <asm/mpic.h> | 29 | #include <asm/mpic.h> |
30 | #include <asm/swiotlb.h> | ||
29 | 31 | ||
30 | #include <sysdev/fsl_soc.h> | 32 | #include <sysdev/fsl_soc.h> |
31 | #include <sysdev/fsl_pci.h> | 33 | #include <sysdev/fsl_pci.h> |
@@ -65,7 +67,9 @@ static void __init mpc8536_ds_setup_arch(void) | |||
65 | { | 67 | { |
66 | #ifdef CONFIG_PCI | 68 | #ifdef CONFIG_PCI |
67 | struct device_node *np; | 69 | struct device_node *np; |
70 | struct pci_controller *hose; | ||
68 | #endif | 71 | #endif |
72 | dma_addr_t max = 0xffffffff; | ||
69 | 73 | ||
70 | if (ppc_md.progress) | 74 | if (ppc_md.progress) |
71 | ppc_md.progress("mpc8536_ds_setup_arch()", 0); | 75 | ppc_md.progress("mpc8536_ds_setup_arch()", 0); |
@@ -80,11 +84,22 @@ static void __init mpc8536_ds_setup_arch(void) | |||
80 | fsl_add_bridge(np, 1); | 84 | fsl_add_bridge(np, 1); |
81 | else | 85 | else |
82 | fsl_add_bridge(np, 0); | 86 | fsl_add_bridge(np, 0); |
87 | |||
88 | hose = pci_find_hose_for_OF_device(np); | ||
89 | max = min(max, hose->dma_window_base_cur + | ||
90 | hose->dma_window_size); | ||
83 | } | 91 | } |
84 | } | 92 | } |
85 | 93 | ||
86 | #endif | 94 | #endif |
87 | 95 | ||
96 | #ifdef CONFIG_SWIOTLB | ||
97 | if (lmb_end_of_DRAM() > max) { | ||
98 | ppc_swiotlb_enable = 1; | ||
99 | set_pci_dma_ops(&swiotlb_pci_dma_ops); | ||
100 | } | ||
101 | #endif | ||
102 | |||
88 | printk("MPC8536 DS board from Freescale Semiconductor\n"); | 103 | printk("MPC8536 DS board from Freescale Semiconductor\n"); |
89 | } | 104 | } |
90 | 105 | ||
@@ -102,6 +117,8 @@ static int __init mpc8536_ds_publish_devices(void) | |||
102 | } | 117 | } |
103 | machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices); | 118 | machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices); |
104 | 119 | ||
120 | machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier); | ||
121 | |||
105 | /* | 122 | /* |
106 | * Called very early, device-tree isn't unflattened | 123 | * Called very early, device-tree isn't unflattened |
107 | */ | 124 | */ |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c index 53d5851a6c97..849c0ac0025f 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
22 | #include <linux/of_platform.h> | 22 | #include <linux/of_platform.h> |
23 | #include <linux/lmb.h> | ||
23 | 24 | ||
24 | #include <asm/system.h> | 25 | #include <asm/system.h> |
25 | #include <asm/time.h> | 26 | #include <asm/time.h> |
@@ -30,6 +31,7 @@ | |||
30 | #include <asm/udbg.h> | 31 | #include <asm/udbg.h> |
31 | #include <asm/mpic.h> | 32 | #include <asm/mpic.h> |
32 | #include <asm/i8259.h> | 33 | #include <asm/i8259.h> |
34 | #include <asm/swiotlb.h> | ||
33 | 35 | ||
34 | #include <sysdev/fsl_soc.h> | 36 | #include <sysdev/fsl_soc.h> |
35 | #include <sysdev/fsl_pci.h> | 37 | #include <sysdev/fsl_pci.h> |
@@ -155,7 +157,9 @@ static void __init mpc85xx_ds_setup_arch(void) | |||
155 | { | 157 | { |
156 | #ifdef CONFIG_PCI | 158 | #ifdef CONFIG_PCI |
157 | struct device_node *np; | 159 | struct device_node *np; |
160 | struct pci_controller *hose; | ||
158 | #endif | 161 | #endif |
162 | dma_addr_t max = 0xffffffff; | ||
159 | 163 | ||
160 | if (ppc_md.progress) | 164 | if (ppc_md.progress) |
161 | ppc_md.progress("mpc85xx_ds_setup_arch()", 0); | 165 | ppc_md.progress("mpc85xx_ds_setup_arch()", 0); |
@@ -171,6 +175,10 @@ static void __init mpc85xx_ds_setup_arch(void) | |||
171 | fsl_add_bridge(np, 1); | 175 | fsl_add_bridge(np, 1); |
172 | else | 176 | else |
173 | fsl_add_bridge(np, 0); | 177 | fsl_add_bridge(np, 0); |
178 | |||
179 | hose = pci_find_hose_for_OF_device(np); | ||
180 | max = min(max, hose->dma_window_base_cur + | ||
181 | hose->dma_window_size); | ||
174 | } | 182 | } |
175 | } | 183 | } |
176 | 184 | ||
@@ -181,6 +189,13 @@ static void __init mpc85xx_ds_setup_arch(void) | |||
181 | mpc85xx_smp_init(); | 189 | mpc85xx_smp_init(); |
182 | #endif | 190 | #endif |
183 | 191 | ||
192 | #ifdef CONFIG_SWIOTLB | ||
193 | if (lmb_end_of_DRAM() > max) { | ||
194 | ppc_swiotlb_enable = 1; | ||
195 | set_pci_dma_ops(&swiotlb_pci_dma_ops); | ||
196 | } | ||
197 | #endif | ||
198 | |||
184 | printk("MPC85xx DS board from Freescale Semiconductor\n"); | 199 | printk("MPC85xx DS board from Freescale Semiconductor\n"); |
185 | } | 200 | } |
186 | 201 | ||
@@ -217,6 +232,10 @@ machine_device_initcall(mpc8544_ds, mpc85xxds_publish_devices); | |||
217 | machine_device_initcall(mpc8572_ds, mpc85xxds_publish_devices); | 232 | machine_device_initcall(mpc8572_ds, mpc85xxds_publish_devices); |
218 | machine_device_initcall(p2020_ds, mpc85xxds_publish_devices); | 233 | machine_device_initcall(p2020_ds, mpc85xxds_publish_devices); |
219 | 234 | ||
235 | machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier); | ||
236 | machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier); | ||
237 | machine_arch_initcall(p2020_ds, swiotlb_setup_bus_notifier); | ||
238 | |||
220 | /* | 239 | /* |
221 | * Called very early, device-tree isn't unflattened | 240 | * Called very early, device-tree isn't unflattened |
222 | */ | 241 | */ |
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c index b2c0a4319973..77f90b356356 100644 --- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c +++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/of_platform.h> | 33 | #include <linux/of_platform.h> |
34 | #include <linux/of_device.h> | 34 | #include <linux/of_device.h> |
35 | #include <linux/phy.h> | 35 | #include <linux/phy.h> |
36 | #include <linux/lmb.h> | ||
36 | 37 | ||
37 | #include <asm/system.h> | 38 | #include <asm/system.h> |
38 | #include <asm/atomic.h> | 39 | #include <asm/atomic.h> |
@@ -49,6 +50,7 @@ | |||
49 | #include <asm/qe.h> | 50 | #include <asm/qe.h> |
50 | #include <asm/qe_ic.h> | 51 | #include <asm/qe_ic.h> |
51 | #include <asm/mpic.h> | 52 | #include <asm/mpic.h> |
53 | #include <asm/swiotlb.h> | ||
52 | 54 | ||
53 | #undef DEBUG | 55 | #undef DEBUG |
54 | #ifdef DEBUG | 56 | #ifdef DEBUG |
@@ -155,6 +157,10 @@ static void __init mpc85xx_mds_setup_arch(void) | |||
155 | { | 157 | { |
156 | struct device_node *np; | 158 | struct device_node *np; |
157 | static u8 __iomem *bcsr_regs = NULL; | 159 | static u8 __iomem *bcsr_regs = NULL; |
160 | #ifdef CONFIG_PCI | ||
161 | struct pci_controller *hose; | ||
162 | #endif | ||
163 | dma_addr_t max = 0xffffffff; | ||
158 | 164 | ||
159 | if (ppc_md.progress) | 165 | if (ppc_md.progress) |
160 | ppc_md.progress("mpc85xx_mds_setup_arch()", 0); | 166 | ppc_md.progress("mpc85xx_mds_setup_arch()", 0); |
@@ -179,6 +185,10 @@ static void __init mpc85xx_mds_setup_arch(void) | |||
179 | fsl_add_bridge(np, 1); | 185 | fsl_add_bridge(np, 1); |
180 | else | 186 | else |
181 | fsl_add_bridge(np, 0); | 187 | fsl_add_bridge(np, 0); |
188 | |||
189 | hose = pci_find_hose_for_OF_device(np); | ||
190 | max = min(max, hose->dma_window_base_cur + | ||
191 | hose->dma_window_size); | ||
182 | } | 192 | } |
183 | } | 193 | } |
184 | #endif | 194 | #endif |
@@ -227,6 +237,13 @@ static void __init mpc85xx_mds_setup_arch(void) | |||
227 | iounmap(bcsr_regs); | 237 | iounmap(bcsr_regs); |
228 | } | 238 | } |
229 | #endif /* CONFIG_QUICC_ENGINE */ | 239 | #endif /* CONFIG_QUICC_ENGINE */ |
240 | |||
241 | #ifdef CONFIG_SWIOTLB | ||
242 | if (lmb_end_of_DRAM() > max) { | ||
243 | ppc_swiotlb_enable = 1; | ||
244 | set_pci_dma_ops(&swiotlb_pci_dma_ops); | ||
245 | } | ||
246 | #endif | ||
230 | } | 247 | } |
231 | 248 | ||
232 | 249 | ||
@@ -281,6 +298,9 @@ static int __init mpc85xx_publish_devices(void) | |||
281 | machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); | 298 | machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); |
282 | machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices); | 299 | machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices); |
283 | 300 | ||
301 | machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier); | ||
302 | machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier); | ||
303 | |||
284 | static void __init mpc85xx_mds_pic_init(void) | 304 | static void __init mpc85xx_mds_pic_init(void) |
285 | { | 305 | { |
286 | struct mpic *mpic; | 306 | struct mpic *mpic; |