dma.c 1.5 KB
Newer Older
1
/*
2
 * simple DMA Implementation for Blackfin
3
 *
4
 * Copyright 2007-2009 Analog Devices Inc.
5
 *
6
 * Licensed under the GPL-2 or later.
7
 */
8

9 10
#include <linux/module.h>

11 12 13
#include <asm/blackfin.h>
#include <asm/dma.h>

14
struct dma_register * const dma_io_base_addr[MAX_DMA_CHANNELS] = {
15 16 17 18 19 20 21 22 23 24 25 26 27
	(struct dma_register *) DMA0_NEXT_DESC_PTR,
	(struct dma_register *) DMA1_NEXT_DESC_PTR,
	(struct dma_register *) DMA2_NEXT_DESC_PTR,
	(struct dma_register *) DMA3_NEXT_DESC_PTR,
	(struct dma_register *) DMA4_NEXT_DESC_PTR,
	(struct dma_register *) DMA5_NEXT_DESC_PTR,
	(struct dma_register *) DMA6_NEXT_DESC_PTR,
	(struct dma_register *) DMA7_NEXT_DESC_PTR,
	(struct dma_register *) MDMA_D0_NEXT_DESC_PTR,
	(struct dma_register *) MDMA_S0_NEXT_DESC_PTR,
	(struct dma_register *) MDMA_D1_NEXT_DESC_PTR,
	(struct dma_register *) MDMA_S1_NEXT_DESC_PTR,
};
28
EXPORT_SYMBOL(dma_io_base_addr);
29

30
int channel2irq(unsigned int channel)
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
{
	int ret_irq = -1;

	switch (channel) {
	case CH_PPI:
		ret_irq = IRQ_PPI;
		break;

	case CH_SPORT0_RX:
		ret_irq = IRQ_SPORT0_RX;
		break;

	case CH_SPORT0_TX:
		ret_irq = IRQ_SPORT0_TX;
		break;

	case CH_SPORT1_RX:
		ret_irq = IRQ_SPORT1_RX;
		break;

	case CH_SPORT1_TX:
		ret_irq = IRQ_SPORT1_TX;
		break;

	case CH_SPI:
		ret_irq = IRQ_SPI;
		break;

59 60
	case CH_UART0_RX:
		ret_irq = IRQ_UART0_RX;
61 62
		break;

63 64
	case CH_UART0_TX:
		ret_irq = IRQ_UART0_TX;
65 66 67 68 69 70 71 72 73 74 75 76 77 78
		break;

	case CH_MEM_STREAM0_SRC:
	case CH_MEM_STREAM0_DEST:
		ret_irq = IRQ_MEM_DMA0;
		break;

	case CH_MEM_STREAM1_SRC:
	case CH_MEM_STREAM1_DEST:
		ret_irq = IRQ_MEM_DMA1;
		break;
	}
	return ret_irq;
}