diff options
| -rw-r--r-- | arch/powerpc/kernel/dma-swiotlb.c | 11 | ||||
| -rw-r--r-- | arch/powerpc/sysdev/fsl_pci.c | 15 |
2 files changed, 19 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c index 735979764cd4..6e8d764ce47b 100644 --- a/arch/powerpc/kernel/dma-swiotlb.c +++ b/arch/powerpc/kernel/dma-swiotlb.c | |||
| @@ -116,16 +116,13 @@ void __init swiotlb_detect_4g(void) | |||
| 116 | } | 116 | } |
| 117 | } | 117 | } |
| 118 | 118 | ||
| 119 | static int __init swiotlb_late_init(void) | 119 | static int __init check_swiotlb_enabled(void) |
| 120 | { | 120 | { |
| 121 | if (ppc_swiotlb_enable) { | 121 | if (ppc_swiotlb_enable) |
| 122 | swiotlb_print_info(); | 122 | swiotlb_print_info(); |
| 123 | set_pci_dma_ops(&swiotlb_dma_ops); | 123 | else |
| 124 | ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb; | ||
| 125 | } else { | ||
| 126 | swiotlb_free(); | 124 | swiotlb_free(); |
| 127 | } | ||
| 128 | 125 | ||
| 129 | return 0; | 126 | return 0; |
| 130 | } | 127 | } |
| 131 | subsys_initcall(swiotlb_late_init); | 128 | subsys_initcall(check_swiotlb_enabled); |
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c index 4b74c276e427..9a8fcf0d79d7 100644 --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c | |||
| @@ -111,6 +111,18 @@ static struct pci_ops fsl_indirect_pcie_ops = | |||
| 111 | #define MAX_PHYS_ADDR_BITS 40 | 111 | #define MAX_PHYS_ADDR_BITS 40 |
| 112 | static u64 pci64_dma_offset = 1ull << MAX_PHYS_ADDR_BITS; | 112 | static u64 pci64_dma_offset = 1ull << MAX_PHYS_ADDR_BITS; |
| 113 | 113 | ||
| 114 | #ifdef CONFIG_SWIOTLB | ||
| 115 | static void setup_swiotlb_ops(struct pci_controller *hose) | ||
| 116 | { | ||
| 117 | if (ppc_swiotlb_enable) { | ||
| 118 | hose->controller_ops.dma_dev_setup = pci_dma_dev_setup_swiotlb; | ||
| 119 | set_pci_dma_ops(&swiotlb_dma_ops); | ||
| 120 | } | ||
| 121 | } | ||
| 122 | #else | ||
| 123 | static inline void setup_swiotlb_ops(struct pci_controller *hose) {} | ||
| 124 | #endif | ||
| 125 | |||
| 114 | static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask) | 126 | static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask) |
| 115 | { | 127 | { |
| 116 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | 128 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) |
| @@ -548,6 +560,9 @@ int fsl_add_bridge(struct platform_device *pdev, int is_primary) | |||
| 548 | /* Setup PEX window registers */ | 560 | /* Setup PEX window registers */ |
| 549 | setup_pci_atmu(hose); | 561 | setup_pci_atmu(hose); |
| 550 | 562 | ||
| 563 | /* Set up controller operations */ | ||
| 564 | setup_swiotlb_ops(hose); | ||
| 565 | |||
| 551 | return 0; | 566 | return 0; |
| 552 | 567 | ||
| 553 | no_bridge: | 568 | no_bridge: |
