powerpc: Remove addr_needs_map in struct dma_mapping_ops
[deliverable/linux.git] / arch / powerpc / platforms / 85xx / mpc8536_ds.c
index 63efca20d7bd12d0de6d143f02b227d290209efc..bf052c05610665f7ec4c6b466dfed0e15c13081a 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/seq_file.h>
 #include <linux/interrupt.h>
 #include <linux/of_platform.h>
+#include <linux/lmb.h>
 
 #include <asm/system.h>
 #include <asm/time.h>
@@ -26,6 +27,7 @@
 #include <asm/prom.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
+#include <asm/swiotlb.h>
 
 #include <sysdev/fsl_soc.h>
 #include <sysdev/fsl_pci.h>
@@ -65,7 +67,9 @@ static void __init mpc8536_ds_setup_arch(void)
 {
 #ifdef CONFIG_PCI
        struct device_node *np;
+       struct pci_controller *hose;
 #endif
+       dma_addr_t max = 0xffffffff;
 
        if (ppc_md.progress)
                ppc_md.progress("mpc8536_ds_setup_arch()", 0);
@@ -80,11 +84,23 @@ static void __init mpc8536_ds_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
 
+#ifdef CONFIG_SWIOTLB
+       if (lmb_end_of_DRAM() > max) {
+               ppc_swiotlb_enable = 1;
+               set_pci_dma_ops(&swiotlb_pci_dma_ops);
+               ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
+       }
+#endif
+
        printk("MPC8536 DS board from Freescale Semiconductor\n");
 }
 
@@ -102,6 +118,8 @@ static int __init mpc8536_ds_publish_devices(void)
 }
 machine_device_initcall(mpc8536_ds, mpc8536_ds_publish_devices);
 
+machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);
+
 /*
  * Called very early, device-tree isn't unflattened
  */
This page took 0.024433 seconds and 5 git commands to generate.