Commit 5cef379b authored by Becky Bruce's avatar Becky Bruce Committed by Kumar Gala

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: default avatarBecky Bruce <beckyb@kernel.crashing.org>
Signed-off-by: default avatarKumar Gala <galak@kernel.crashing.org>
parent 42e27bfc
...@@ -15,6 +15,7 @@ config MPC8641_HPCN ...@@ -15,6 +15,7 @@ config MPC8641_HPCN
select DEFAULT_UIMAGE select DEFAULT_UIMAGE
select FSL_ULI1575 select FSL_ULI1575
select HAS_RAPIDIO select HAS_RAPIDIO
select SWIOTLB
help help
This option enables support for the MPC8641 HPCN board. This option enables support for the MPC8641 HPCN board.
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/lmb.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/time.h> #include <asm/time.h>
...@@ -27,6 +28,7 @@ ...@@ -27,6 +28,7 @@
#include <asm/prom.h> #include <asm/prom.h>
#include <mm/mmu_decl.h> #include <mm/mmu_decl.h>
#include <asm/udbg.h> #include <asm/udbg.h>
#include <asm/swiotlb.h>
#include <asm/mpic.h> #include <asm/mpic.h>
...@@ -70,7 +72,9 @@ mpc86xx_hpcn_setup_arch(void) ...@@ -70,7 +72,9 @@ mpc86xx_hpcn_setup_arch(void)
{ {
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
struct device_node *np; struct device_node *np;
struct pci_controller *hose;
#endif #endif
dma_addr_t max = 0xffffffff;
if (ppc_md.progress) if (ppc_md.progress)
ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0); ppc_md.progress("mpc86xx_hpcn_setup_arch()", 0);
...@@ -83,6 +87,9 @@ mpc86xx_hpcn_setup_arch(void) ...@@ -83,6 +87,9 @@ mpc86xx_hpcn_setup_arch(void)
fsl_add_bridge(np, 1); fsl_add_bridge(np, 1);
else else
fsl_add_bridge(np, 0); 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);
} }
ppc_md.pci_exclude_device = mpc86xx_exclude_device; ppc_md.pci_exclude_device = mpc86xx_exclude_device;
...@@ -94,6 +101,13 @@ mpc86xx_hpcn_setup_arch(void) ...@@ -94,6 +101,13 @@ mpc86xx_hpcn_setup_arch(void)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
mpc86xx_smp_init(); mpc86xx_smp_init();
#endif #endif
#ifdef CONFIG_SWIOTLB
if (lmb_end_of_DRAM() > max) {
ppc_swiotlb_enable = 1;
set_pci_dma_ops(&swiotlb_pci_dma_ops);
}
#endif
} }
...@@ -158,6 +172,7 @@ static int __init declare_of_platform_devices(void) ...@@ -158,6 +172,7 @@ static int __init declare_of_platform_devices(void)
return 0; return 0;
} }
machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices); machine_device_initcall(mpc86xx_hpcn, declare_of_platform_devices);
machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier);
define_machine(mpc86xx_hpcn) { define_machine(mpc86xx_hpcn) {
.name = "MPC86xx HPCN", .name = "MPC86xx HPCN",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment