From 4ac58469f13028e1eb97f8bc7b0fca5072591d8d Mon Sep 17 00:00:00 2001 From: Michael Buesch Date: Fri, 11 Apr 2008 11:59:00 +0200 Subject: ssb: Fix usage of struct device used for DMAing This fixes DMA on architectures where DMA is nontrivial, like PPC64. We must use the host-device's (PCI) struct device for any DMA operation instead of the SSB device. For this we add a new struct device pointer to the SSB device structure that will always point to the right device for DMAing. Without this patch b43 and b44 drivers won't work on complex-DMA architectures, that for example need dev->archdata for DMA operations. Signed-off-by: Michael Buesch Signed-off-by: John W. Linville --- drivers/ssb/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'drivers/ssb') diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c index 72017bf2e57..8003a9e55ac 100644 --- a/drivers/ssb/main.c +++ b/drivers/ssb/main.c @@ -436,15 +436,18 @@ static int ssb_devices_register(struct ssb_bus *bus) #ifdef CONFIG_SSB_PCIHOST sdev->irq = bus->host_pci->irq; dev->parent = &bus->host_pci->dev; + sdev->dma_dev = &bus->host_pci->dev; #endif break; case SSB_BUSTYPE_PCMCIA: #ifdef CONFIG_SSB_PCMCIAHOST sdev->irq = bus->host_pcmcia->irq.AssignedIRQ; dev->parent = &bus->host_pcmcia->dev; + sdev->dma_dev = &bus->host_pcmcia->dev; #endif break; case SSB_BUSTYPE_SSB: + sdev->dma_dev = dev; break; } @@ -1018,15 +1021,14 @@ EXPORT_SYMBOL(ssb_dma_translation); int ssb_dma_set_mask(struct ssb_device *ssb_dev, u64 mask) { - struct device *dev = ssb_dev->dev; + struct device *dma_dev = ssb_dev->dma_dev; #ifdef CONFIG_SSB_PCIHOST - if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI && - !dma_supported(dev, mask)) - return -EIO; + if (ssb_dev->bus->bustype == SSB_BUSTYPE_PCI) + return dma_set_mask(dma_dev, mask); #endif - dev->coherent_dma_mask = mask; - dev->dma_mask = &dev->coherent_dma_mask; + dma_dev->coherent_dma_mask = mask; + dma_dev->dma_mask = &dma_dev->coherent_dma_mask; return 0; } -- cgit v1.2.3