Skip to content

Commit

Permalink
arm: fix "arm: fix pci_set_consistent_dma_mask for dmabounce devices"
Browse files Browse the repository at this point in the history
This fixes the regression caused by the commit 6fee48c
("dma-mapping: arm: use generic pci_set_dma_mask and
pci_set_consistent_dma_mask").

ARM needs to clip the dma coherent mask for dmabounce devices. This
restores the old trick.

Note that strictly speaking, the DMA API doesn't allow architectures to do
such but I'm not sure it's worth adding the new API to set the dma mask
that allows architectures to clip it.

Reported-by: Krzysztof Halasa <khc@pm.waw.pl>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
fujita authored and torvalds committed Sep 23, 2010
1 parent c227e69 commit 710224f
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 1 deletion.
8 changes: 8 additions & 0 deletions arch/arm/common/it8152.c
Expand Up @@ -271,6 +271,14 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
((dma_addr + size - PHYS_OFFSET) >= SZ_64M);
}

int dma_set_coherent_mask(struct device *dev, u64 mask)
{
if (mask >= PHYS_OFFSET + SZ_64M - 1)
return 0;

return -EIO;
}

int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
{
it8152_io.start = IT8152_IO_BASE + 0x12000;
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/mach-ixp4xx/common-pci.c
Expand Up @@ -503,6 +503,14 @@ struct pci_bus * __devinit ixp4xx_scan_bus(int nr, struct pci_sys_data *sys)
return pci_scan_bus(sys->busnr, &ixp4xx_ops, sys);
}

int dma_set_coherent_mask(struct device *dev, u64 mask)
{
if (mask >= SZ_64M - 1)
return 0;

return -EIO;
}

EXPORT_SYMBOL(ixp4xx_pci_read);
EXPORT_SYMBOL(ixp4xx_pci_write);

2 changes: 2 additions & 0 deletions arch/arm/mach-ixp4xx/include/mach/hardware.h
Expand Up @@ -26,6 +26,8 @@
#define PCIBIOS_MAX_MEM 0x4BFFFFFF
#endif

#define ARCH_HAS_DMA_SET_COHERENT_MASK

#define pcibios_assign_all_busses() 1

/* Register locations and bits */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-pxa/include/mach/hardware.h
Expand Up @@ -309,7 +309,7 @@ extern unsigned long get_clock_tick_rate(void);
#define PCIBIOS_MIN_IO 0
#define PCIBIOS_MIN_MEM 0
#define pcibios_assign_all_busses() 1
#define ARCH_HAS_DMA_SET_COHERENT_MASK
#endif


#endif /* _ASM_ARCH_HARDWARE_H */
2 changes: 2 additions & 0 deletions arch/arm/mach-pxa/include/mach/io.h
Expand Up @@ -6,6 +6,8 @@
#ifndef __ASM_ARM_ARCH_IO_H
#define __ASM_ARM_ARCH_IO_H

#include <mach/hardware.h>

#define IO_SPACE_LIMIT 0xffffffff

/*
Expand Down
4 changes: 4 additions & 0 deletions include/linux/dma-mapping.h
Expand Up @@ -102,13 +102,17 @@ static inline u64 dma_get_mask(struct device *dev)
return DMA_BIT_MASK(32);
}

#ifdef ARCH_HAS_DMA_SET_COHERENT_MASK
int dma_set_coherent_mask(struct device *dev, u64 mask);
#else
static inline int dma_set_coherent_mask(struct device *dev, u64 mask)
{
if (!dma_supported(dev, mask))
return -EIO;
dev->coherent_dma_mask = mask;
return 0;
}
#endif

extern u64 dma_get_required_mask(struct device *dev);

Expand Down

0 comments on commit 710224f

Please sign in to comment.