diff options
Diffstat (limited to 'arch/powerpc/kernel/dma-swiotlb.c')
-rw-r--r-- | arch/powerpc/kernel/dma-swiotlb.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index 46943651da23..bd1a2aba599f 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/dma-mapping.h> | 14 | #include <linux/dma-mapping.h> |
15 | #include <linux/memblock.h> | ||
15 | #include <linux/pfn.h> | 16 | #include <linux/pfn.h> |
16 | #include <linux/of_platform.h> | 17 | #include <linux/of_platform.h> |
17 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
@@ -20,7 +21,6 @@ | |||
20 | #include <asm/machdep.h> | 21 | #include <asm/machdep.h> |
21 | #include <asm/swiotlb.h> | 22 | #include <asm/swiotlb.h> |
22 | #include <asm/dma.h> | 23 | #include <asm/dma.h> |
23 | #include <asm/abs_addr.h> | ||
24 | 24 | ||
25 | unsigned int ppc_swiotlb_enable; | 25 | unsigned int ppc_swiotlb_enable; |
26 | 26 | ||
@@ -105,3 +105,23 @@ int __init swiotlb_setup_bus_notifier(void) | |||
105 | &ppc_swiotlb_plat_bus_notifier); | 105 | &ppc_swiotlb_plat_bus_notifier); |
106 | return 0; | 106 | return 0; |
107 | } | 107 | } |
108 | |||
109 | void swiotlb_detect_4g(void) | ||
110 | { | ||
111 | if ((memblock_end_of_DRAM() - 1) > 0xffffffff) | ||
112 | ppc_swiotlb_enable = 1; | ||
113 | } | ||
114 | |||
115 | static int __init swiotlb_late_init(void) | ||
116 | { | ||
117 | if (ppc_swiotlb_enable) { | ||
118 | swiotlb_print_info(); | ||
119 | set_pci_dma_ops(&swiotlb_dma_ops); | ||
120 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; | ||
121 | } else { | ||
122 | swiotlb_free(); | ||
123 | } | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | subsys_initcall(swiotlb_late_init); | ||