diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2009-05-15 00:37:35 -0500 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2009-06-15 21:45:29 -0500 |
commit | 152d0182822e871a3fe1f6d97949d83fad950e26 (patch) | |
tree | 0e09bbe9b3a5b2982dc501db4240238314f54743 /arch/powerpc/platforms/85xx/mpc85xx_mds.c | |
parent | 5cef379b34ffcd96567066ddc1012bd40e6e7675 (diff) | |
download | talos-obmc-linux-152d0182822e871a3fe1f6d97949d83fad950e26.tar.gz talos-obmc-linux-152d0182822e871a3fe1f6d97949d83fad950e26.zip |
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/mpc85xx_mds.c')
-rw-r--r-- | arch/powerpc/platforms/85xx/mpc85xx_mds.c | 20 |
1 files changed, 20 insertions, 0 deletions
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 @@ #include <linux/of_platform.h> #include <linux/of_device.h> #include <linux/phy.h> +#include <linux/lmb.h> #include <asm/system.h> #include <asm/atomic.h> @@ -49,6 +50,7 @@ #include <asm/qe.h> #include <asm/qe_ic.h> #include <asm/mpic.h> +#include <asm/swiotlb.h> #undef DEBUG #ifdef DEBUG @@ -155,6 +157,10 @@ static void __init mpc85xx_mds_setup_arch(void) { struct device_node *np; static u8 __iomem *bcsr_regs = NULL; +#ifdef CONFIG_PCI + struct pci_controller *hose; +#endif + dma_addr_t max = 0xffffffff; if (ppc_md.progress) ppc_md.progress("mpc85xx_mds_setup_arch()", 0); @@ -179,6 +185,10 @@ static void __init mpc85xx_mds_setup_arch(void) 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); } } #endif @@ -227,6 +237,13 @@ static void __init mpc85xx_mds_setup_arch(void) iounmap(bcsr_regs); } #endif /* CONFIG_QUICC_ENGINE */ + +#ifdef CONFIG_SWIOTLB + if (lmb_end_of_DRAM() > max) { + ppc_swiotlb_enable = 1; + set_pci_dma_ops(&swiotlb_pci_dma_ops); + } +#endif } @@ -281,6 +298,9 @@ static int __init mpc85xx_publish_devices(void) machine_device_initcall(mpc8568_mds, mpc85xx_publish_devices); machine_device_initcall(mpc8569_mds, mpc85xx_publish_devices); +machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier); +machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier); + static void __init mpc85xx_mds_pic_init(void) { struct mpic *mpic; |