Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 188355
b: refs/heads/master
c: 2549edd
h: refs/heads/master
i:
  188353: 8c5317a
  188351: b265c99
v: v3
  • Loading branch information
Michal Simek committed Mar 11, 2010
1 parent 8499f69 commit 4532bae
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ccfe27d7000668b02d10fc3e06aa49e3e3603162
refs/heads/master: 2549edd353196d7de9c18e08146d7a8836f97235
1 change: 0 additions & 1 deletion trunk/arch/microblaze/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#define __dma_alloc_coherent(dev, gfp, size, handle) NULL
#define __dma_free_coherent(size, addr) ((void)0)
#define __dma_sync(addr, size, rw) ((void)0)
#define __dma_sync_page(pg, off, sz, rw) ((void)0)

static inline unsigned long device_to_mask(struct device *dev)
{
Expand Down
26 changes: 23 additions & 3 deletions trunk/arch/microblaze/kernel/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/dma-mapping.h>
#include <linux/dma-debug.h>
#include <asm/bug.h>
#include <asm/cacheflush.h>

/*
* Generic direct DMA implementation
Expand All @@ -20,6 +21,23 @@
* default the offset is PCI_DRAM_OFFSET.
*/

static inline void __dma_sync_page(void *vaddr, unsigned long offset,
size_t size, enum dma_data_direction direction)
{
unsigned long start = virt_to_phys(vaddr);

switch (direction) {
case DMA_TO_DEVICE:
flush_dcache_range(start + offset, start + offset + size);
break;
case DMA_FROM_DEVICE:
invalidate_dcache_range(start + offset, start + offset + size);
break;
default:
BUG();
}
}

static unsigned long get_dma_direct_offset(struct device *dev)
{
if (dev)
Expand Down Expand Up @@ -85,11 +103,11 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
struct page *page,
unsigned long offset,
size_t size,
enum dma_data_direction dir,
enum dma_data_direction direction,
struct dma_attrs *attrs)
{
BUG_ON(dir == DMA_NONE);
__dma_sync_page(page, offset, size, dir);
BUG_ON(direction == DMA_NONE);
__dma_sync_page(page, offset, size, direction);
return page_to_phys(page) + offset + get_dma_direct_offset(dev);
}

Expand All @@ -99,6 +117,8 @@ static inline void dma_direct_unmap_page(struct device *dev,
enum dma_data_direction direction,
struct dma_attrs *attrs)
{
/* There is not necessary to do cache cleanup */
/* __dma_sync_page(dma_address, 0 , size, direction); */
}

struct dma_map_ops dma_direct_ops = {
Expand Down

0 comments on commit 4532bae

Please sign in to comment.