aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev
diff options
context:
space:
mode:
authorDaniel Axtens <dja@axtens.net>2015-04-09 23:15:47 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-04-11 06:49:17 -0400
commit97884e00e29ad6654b8b6939bb805b9d6303427c (patch)
treec9c154d1927be0cc17353d51c2e7ba47c81b3375 /arch/powerpc/sysdev
parent19124d6deed32c5c7096f1892dd9f3882cef4605 (diff)
powerpc: fsl_pci, swiotlb: Move controller ops from ppc_md to controller_ops
Move the installation of DMA operations out of swiotlb's subsys initcall, and into the generic PCI controller operations struct. These ops are installed conditionally, based on the ppc_swiotlb_enable global. The global can be set in two places: - swiotlb_detect_4g, which is always called at the arch initcall level - setup_pci_atmu, which is called as part of the fsl_add_bridge and fsl_pci_syscore_do_resume. fsl_pci_syscore_do_resume is called late enough that any changes as a result of that call will have no effect. As such, if we test the global and set the operations as part of fsl_add_bridge, after the call to setup_pci_atmu, we can be confident that it will cover all the PCI implementations affected by the changes to dma-swiotlb.c. Signed-off-by: Daniel Axtens <dja@axtens.net> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/sysdev')
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c15
1 files changed, 15 insertions, 0 deletions
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
112static u64 pci64_dma_offset = 1ull << MAX_PHYS_ADDR_BITS; 112static u64 pci64_dma_offset = 1ull << MAX_PHYS_ADDR_BITS;
113 113
114#ifdef CONFIG_SWIOTLB
115static 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
123static inline void setup_swiotlb_ops(struct pci_controller *hose) {}
124#endif
125
114static int fsl_pci_dma_set_mask(struct device *dev, u64 dma_mask) 126static 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
553no_bridge: 568no_bridge: