aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-05-20 18:54:23 -0400
committerBjorn Helgaas <bhelgaas@google.com>2014-05-20 18:55:39 -0400
commitace4b3fd67e771951d495aa1f1b1000984083362 (patch)
tree6af143970c659a6755795c1f4a499b4d014c030a /arch/sh
parent88a984ba0795f14a3847edbd7fabe652289ea89b (diff)
sh/PCI: Pass GAPSPCI_DMA_BASE CPU & bus address to dma_declare_coherent_memory()
dma_declare_coherent_memory() needs both the CPU physical address and the bus address of the device memory. They are the same on this platform, but in general we should use pcibios_resource_to_bus() to account for any address translation done by the PCI host bridge. This makes no difference on Dreamcast, but is safer if the usage is copied to future drivers. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Arnd Bergmann <arnd@arndb.de> CC: Magnus Damm <damm@opensource.se> CC: linux-sh@vger.kernel.org
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/drivers/pci/fixups-dreamcast.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/sh/drivers/pci/fixups-dreamcast.c b/arch/sh/drivers/pci/fixups-dreamcast.c
index d6cde700e316..1d1c5a227e50 100644
--- a/arch/sh/drivers/pci/fixups-dreamcast.c
+++ b/arch/sh/drivers/pci/fixups-dreamcast.c
@@ -31,6 +31,8 @@
31static void gapspci_fixup_resources(struct pci_dev *dev) 31static void gapspci_fixup_resources(struct pci_dev *dev)
32{ 32{
33 struct pci_channel *p = dev->sysdata; 33 struct pci_channel *p = dev->sysdata;
34 struct resource res;
35 struct pci_bus_region region;
34 36
35 printk(KERN_NOTICE "PCI: Fixing up device %s\n", pci_name(dev)); 37 printk(KERN_NOTICE "PCI: Fixing up device %s\n", pci_name(dev));
36 38
@@ -50,11 +52,21 @@ static void gapspci_fixup_resources(struct pci_dev *dev)
50 52
51 /* 53 /*
52 * Redirect dma memory allocations to special memory window. 54 * Redirect dma memory allocations to special memory window.
55 *
56 * If this GAPSPCI region were mapped by a BAR, the CPU
57 * phys_addr_t would be pci_resource_start(), and the bus
58 * address would be pci_bus_address(pci_resource_start()).
59 * But apparently there's no BAR mapping it, so we just
60 * "know" its CPU address is GAPSPCI_DMA_BASE.
53 */ 61 */
62 res.start = GAPSPCI_DMA_BASE;
63 res.end = GAPSPCI_DMA_BASE + GAPSPCI_DMA_SIZE - 1;
64 res.flags = IORESOURCE_MEM;
65 pcibios_resource_to_bus(dev->bus, &region, &res);
54 BUG_ON(!dma_declare_coherent_memory(&dev->dev, 66 BUG_ON(!dma_declare_coherent_memory(&dev->dev,
55 GAPSPCI_DMA_BASE, 67 res.start,
56 GAPSPCI_DMA_BASE, 68 region.start,
57 GAPSPCI_DMA_SIZE, 69 resource_size(&res),
58 DMA_MEMORY_MAP | 70 DMA_MEMORY_MAP |
59 DMA_MEMORY_EXCLUSIVE)); 71 DMA_MEMORY_EXCLUSIVE));
60 break; 72 break;