Release 4.9 arch/c6x/kernel/dma.c
/*
* Copyright (C) 2011 Texas Instruments Incorporated
* Author: Mark Salter <msalter@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <linux/mm.h>
#include <linux/mm_types.h>
#include <linux/scatterlist.h>
#include <asm/cacheflush.h>
static void c6x_dma_sync(dma_addr_t handle, size_t size,
enum dma_data_direction dir)
{
unsigned long paddr = handle;
BUG_ON(!valid_dma_direction(dir));
switch (dir) {
case DMA_FROM_DEVICE:
L2_cache_block_invalidate(paddr, paddr + size);
break;
case DMA_TO_DEVICE:
L2_cache_block_writeback(paddr, paddr + size);
break;
case DMA_BIDIRECTIONAL:
L2_cache_block_writeback_invalidate(paddr, paddr + size);
break;
default:
break;
}
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 78 | 100.00% | 1 | 100.00% |
| Total | 78 | 100.00% | 1 | 100.00% |
static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size, enum dma_data_direction dir,
unsigned long attrs)
{
dma_addr_t handle = virt_to_phys(page_address(page) + offset);
c6x_dma_sync(handle, size, dir);
return handle;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 34 | 60.71% | 1 | 33.33% |
christoph hellwig | christoph hellwig | 20 | 35.71% | 1 | 33.33% |
krzysztof kozlowski | krzysztof kozlowski | 2 | 3.57% | 1 | 33.33% |
| Total | 56 | 100.00% | 3 | 100.00% |
static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
size_t size, enum dma_data_direction dir, unsigned long attrs)
{
c6x_dma_sync(handle, size, dir);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 28 | 82.35% | 1 | 33.33% |
christoph hellwig | christoph hellwig | 4 | 11.76% | 1 | 33.33% |
krzysztof kozlowski | krzysztof kozlowski | 2 | 5.88% | 1 | 33.33% |
| Total | 34 | 100.00% | 3 | 100.00% |
static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
int nents, enum dma_data_direction dir, unsigned long attrs)
{
struct scatterlist *sg;
int i;
for_each_sg(sglist, sg, nents, i) {
sg->dma_address = sg_phys(sg);
c6x_dma_sync(sg->dma_address, sg->length, dir);
}
return nents;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 57 | 79.17% | 1 | 33.33% |
christoph hellwig | christoph hellwig | 13 | 18.06% | 1 | 33.33% |
krzysztof kozlowski | krzysztof kozlowski | 2 | 2.78% | 1 | 33.33% |
| Total | 72 | 100.00% | 3 | 100.00% |
static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
int nents, enum dma_data_direction dir, unsigned long attrs)
{
struct scatterlist *sg;
int i;
for_each_sg(sglist, sg, nents, i)
c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 52 | 88.14% | 1 | 33.33% |
christoph hellwig | christoph hellwig | 5 | 8.47% | 1 | 33.33% |
krzysztof kozlowski | krzysztof kozlowski | 2 | 3.39% | 1 | 33.33% |
| Total | 59 | 100.00% | 3 | 100.00% |
static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
size_t size, enum dma_data_direction dir)
{
c6x_dma_sync(handle, size, dir);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 28 | 93.33% | 1 | 50.00% |
christoph hellwig | christoph hellwig | 2 | 6.67% | 1 | 50.00% |
| Total | 30 | 100.00% | 2 | 100.00% |
static void c6x_dma_sync_single_for_device(struct device *dev,
dma_addr_t handle, size_t size, enum dma_data_direction dir)
{
c6x_dma_sync(handle, size, dir);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 28 | 93.33% | 1 | 50.00% |
christoph hellwig | christoph hellwig | 2 | 6.67% | 1 | 50.00% |
| Total | 30 | 100.00% | 2 | 100.00% |
static void c6x_dma_sync_sg_for_cpu(struct device *dev,
struct scatterlist *sglist, int nents,
enum dma_data_direction dir)
{
struct scatterlist *sg;
int i;
for_each_sg(sglist, sg, nents, i)
c6x_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
sg->length, dir);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 54 | 94.74% | 1 | 50.00% |
christoph hellwig | christoph hellwig | 3 | 5.26% | 1 | 50.00% |
| Total | 57 | 100.00% | 2 | 100.00% |
static void c6x_dma_sync_sg_for_device(struct device *dev,
struct scatterlist *sglist, int nents,
enum dma_data_direction dir)
{
struct scatterlist *sg;
int i;
for_each_sg(sglist, sg, nents, i)
c6x_dma_sync_single_for_device(dev, sg_dma_address(sg),
sg->length, dir);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 54 | 94.74% | 1 | 50.00% |
christoph hellwig | christoph hellwig | 3 | 5.26% | 1 | 50.00% |
| Total | 57 | 100.00% | 2 | 100.00% |
struct dma_map_ops c6x_dma_ops = {
.alloc = c6x_dma_alloc,
.free = c6x_dma_free,
.map_page = c6x_dma_map_page,
.unmap_page = c6x_dma_unmap_page,
.map_sg = c6x_dma_map_sg,
.unmap_sg = c6x_dma_unmap_sg,
.sync_single_for_device = c6x_dma_sync_single_for_device,
.sync_single_for_cpu = c6x_dma_sync_single_for_cpu,
.sync_sg_for_device = c6x_dma_sync_sg_for_device,
.sync_sg_for_cpu = c6x_dma_sync_sg_for_cpu,
};
EXPORT_SYMBOL(c6x_dma_ops);
/* Number of entries preallocated for DMA-API debugging */
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
static int __init dma_init(void)
{
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 17 | 100.00% | 1 | 100.00% |
| Total | 17 | 100.00% | 1 | 100.00% |
fs_initcall(dma_init);
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
aurelien jacquiot | aurelien jacquiot | 463 | 79.83% | 1 | 33.33% |
christoph hellwig | christoph hellwig | 109 | 18.79% | 1 | 33.33% |
krzysztof kozlowski | krzysztof kozlowski | 8 | 1.38% | 1 | 33.33% |
| Total | 580 | 100.00% | 3 | 100.00% |