diff options
author | Becky Bruce <beckyb@kernel.crashing.org> | 2009-05-14 18:42:29 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-06-15 22:45:29 -0400 |
commit | 5cef379b34ffcd96567066ddc1012bd40e6e7675 (patch) | |
tree | e31aca9b3a22df85e3982b07db60e004f4510963 /arch/powerpc/platforms/86xx | |
parent | 42e27bfc4bfa42bd905e53be93d862b8e3d80a00 (diff) |
powerpc: Add 86xx support for SWIOTLB
This is the final bit of code to allow enabling swiotlb on
mpc86xx. The platform-specific code is very small and consists
of enabling SWIOTLB in the config file, registering the
swiotlb_setup_bus_notifier initcall, and setting pci_dma_ops
to point to swiotlb_pci_dma_ops if we have more memory than
can be mapped by the inbound PCI windows.
Signed-off-by: Becky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/86xx')
-rw-r--r-- | arch/powerpc/platforms/86xx/Kconfig | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/86xx/Kconfig b/arch/powerpc/platforms/86xx/Kconfig index fdaf4ddaa955..9c7b64a3402b 100644 --- a/arch/powerpc/platforms/86xx/Kconfig +++ b/arch/powerpc/platforms/86xx/Kconfig | |||
@@ -15,6 +15,7 @@ config MPC8641_HPCN | |||
15 | select DEFAULT_UIMAGE | 15 | select DEFAULT_UIMAGE |
16 | select FSL_ULI1575 | 16 | select FSL_ULI1575 |
17 | select HAS_RAPIDIO | 17 | select HAS_RAPIDIO |
18 | select SWIOTLB | ||
18 | help | 19 | help |
19 | This option enables support for the MPC8641 HPCN board. | 20 | This option enables support for the MPC8641 HPCN board. |
20 | 21 | ||
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c index 7e9e83c04a8a..66327024a6a6 100644 --- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c +++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/seq_file.h> | 20 | #include <linux/seq_file.h> |
21 | #include <linux/of_platform.h> | 21 | #include <linux/of_platform.h> |
22 | #include <linux/lmb.h> | ||
22 | 23 | ||
23 | #include <asm/system.h> | 24 | #include <asm/system.h> |
24 | #include <asm/time.h> | 25 | #include <asm/time.h> |
@@ -27,6 +28,7 @@ | |||
27 | #include <asm/prom.h> | 28 | #include <asm/prom.h> |
28 | #include <mm/mmu_decl.h> | 29 | #include <mm/mmu_decl.h> |
29 | #include <asm/udbg.h> | 30 | #include <asm/udbg.h> |
31 | #include <asm/swiotlb.h> | ||
30 | 32 | ||
31 | #include <asm/mpic.h> | 33 | #include <asm/mpic.h> |
32 | 34 | ||
@@ -70,7 +72,9 @@ mpc86xx_hpcn_setup_arch(void) | |||
70 | { | 72 | { |
71 | #ifdef CONFIG_PCI | 73 | #ifdef CONFIG_PCI |
72 | struct device_node *np; | 74 | struct device_node *np; |
75 | struct pci_controller *hose; | ||
73 | #endif | 76 | #endif |
77 | dma_addr_t max = 0xffffffff; | ||
74 | 78 | ||
75 | if (ppc_md.progress) | 79 | if (ppc_md.progress) |
76 | ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); | 80 | ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); |
@@ -83,6 +87,9 @@ mpc86xx_hpcn_setup_arch(void) | |||
83 | fsl_add_bridge(np, 1); | 87 | fsl_add_bridge(np, 1); |
84 | else | 88 | else |
85 | fsl_add_bridge(np, 0); | 89 | fsl_add_bridge(np, 0); |
90 | hose = pci_find_hose_for_OF_device(np); | ||
91 | max = min(max, hose->dma_window_base_cur + | ||
92 | hose->dma_window_size); | ||
86 | } | 93 | } |
87 | 94 | ||
88 | ppc_md.pci_exclude_device = mpc86xx_exclude_device; | 95 | ppc_md.pci_exclude_device = mpc86xx_exclude_device; |
@@ -94,6 +101,13 @@ mpc86xx_hpcn_setup_arch(void) | |||
94 | #ifdef CONFIG_SMP | 101 | #ifdef CONFIG_SMP |
95 | mpc86xx_smp_init(); | 102 | mpc86xx_smp_init(); |
96 | #endif | 103 | #endif |
104 | |||
105 | #ifdef CONFIG_SWIOTLB | ||
106 | if (lmb_end_of_DRAM() > max) { | ||
107 | ppc_swiotlb_enable = 1; | ||
108 | set_pci_dma_ops(&swiotlb_pci_dma_ops); | ||
109 | } | ||
110 | #endif | ||
97 | } | 111 | } |
98 | 112 | ||
99 | 113 | ||
@@ -158,6 +172,7 @@ static int __init declare_of_platform_devices(void) | |||
158 | return 0; | 172 | return 0; |
159 | } | 173 | } |
160 | machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices); | 174 | machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices); |
175 | machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier); | ||
161 | 176 | ||
162 | define_machine(mpc86xx_hpcn) { | 177 | define_machine(mpc86xx_hpcn) { |
163 | .name = "MPC86xx HPCN", | 178 | .name = "MPC86xx HPCN", |