aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mn10300
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2010-01-08 17:43:21 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-01-11 12:34:10 -0500
commit012c79bad50469d964fda126102080d4b93a5946 (patch)
treeb67c2c3787b1d4aebf79a2cdb08d89c0f159be4e /arch/mn10300
parent112b4a0bf1080b3d40a2d3b3982361229b25e72d (diff)
mn10300: make the ASB2305's PCnet32 NIC work by using the PCI bridge's SRAM
Access to the ASB2305's PCnet32 NIC doesn't work correctly because when the NIC attempts to update the ring buffer flags by DMA, the change to RAM crops up about 17uS after the interrupt line is asserted. This is almost certainly due to a bug in the PCI bridge FPGA on that board. We can get around this by making dma_alloc_coherent() put the ring buffer in the SRAM attached to the PCI bridge rather than in the SDRAM. Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/mn10300')
-rw-r--r--arch/mn10300/mm/dma-alloc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/mn10300/mm/dma-alloc.c b/arch/mn10300/mm/dma-alloc.c
index f3649d8f50e3..ee82d624b3c6 100644
--- a/arch/mn10300/mm/dma-alloc.c
+++ b/arch/mn10300/mm/dma-alloc.c
@@ -16,12 +16,24 @@
16#include <linux/pci.h> 16#include <linux/pci.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19static unsigned long pci_sram_allocated = 0xbc000000;
20
19void *dma_alloc_coherent(struct device *dev, size_t size, 21void *dma_alloc_coherent(struct device *dev, size_t size,
20 dma_addr_t *dma_handle, int gfp) 22 dma_addr_t *dma_handle, int gfp)
21{ 23{
22 unsigned long addr; 24 unsigned long addr;
23 void *ret; 25 void *ret;
24 26
27 printk("dma_alloc_coherent(%s,%zu,,%x)\n", dev_name(dev), size, gfp);
28
29 if (0xbe000000 - pci_sram_allocated >= size) {
30 size = (size + 255) & ~255;
31 addr = pci_sram_allocated;
32 pci_sram_allocated += size;
33 ret = (void *) addr;
34 goto done;
35 }
36
25 /* ignore region specifiers */ 37 /* ignore region specifiers */
26 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM); 38 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
27 39
@@ -41,7 +53,9 @@ void *dma_alloc_coherent(struct device *dev, size_t size,
41 /* write back and evict all cache lines covering this region */ 53 /* write back and evict all cache lines covering this region */
42 mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE); 54 mn10300_dcache_flush_inv_range2(virt_to_phys((void *) addr), PAGE_SIZE);
43 55
56done:
44 *dma_handle = virt_to_bus((void *) addr); 57 *dma_handle = virt_to_bus((void *) addr);
58 printk("dma_alloc_coherent() = %p [%x]\n", ret, *dma_handle);
45 return ret; 59 return ret;
46} 60}
47EXPORT_SYMBOL(dma_alloc_coherent); 61EXPORT_SYMBOL(dma_alloc_coherent);
@@ -51,6 +65,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr,
51{ 65{
52 unsigned long addr = (unsigned long) vaddr & ~0x20000000; 66 unsigned long addr = (unsigned long) vaddr & ~0x20000000;
53 67
68 if (addr >= 0x9c000000)
69 return;
70
54 free_pages(addr, get_order(size)); 71 free_pages(addr, get_order(size));
55} 72}
56EXPORT_SYMBOL(dma_free_coherent); 73EXPORT_SYMBOL(dma_free_coherent);