Root/arch/mips/include/asm/mach-jz4740/dma.h

Source at commit 4bbb1eea9c3c814b96eb9987571274d3c9e1f686 created 8 years 7 months ago.
By Maarten ter Huurne, MIPS: JZ4740: Use round robin DMA channel priority mode.
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ7420/JZ4740 DMA definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_DMA_H__
17#define __ASM_MACH_JZ4740_DMA_H__
18
19struct jz4740_dma_chan;
20
21enum jz4740_dma_request_type {
22    JZ4740_DMA_TYPE_AUTO_REQUEST = 8,
23    JZ4740_DMA_TYPE_UART_TRANSMIT = 20,
24    JZ4740_DMA_TYPE_UART_RECEIVE = 21,
25    JZ4740_DMA_TYPE_SPI_TRANSMIT = 22,
26    JZ4740_DMA_TYPE_SPI_RECEIVE = 23,
27    JZ4740_DMA_TYPE_AIC_TRANSMIT = 24,
28    JZ4740_DMA_TYPE_AIC_RECEIVE = 25,
29    JZ4740_DMA_TYPE_MMC_TRANSMIT = 26,
30    JZ4740_DMA_TYPE_MMC_RECEIVE = 27,
31    JZ4740_DMA_TYPE_TCU = 28,
32    JZ4740_DMA_TYPE_SADC = 29,
33    JZ4740_DMA_TYPE_SLCD = 30,
34};
35
36enum jz4740_dma_width {
37    JZ4740_DMA_WIDTH_32BIT = 0,
38    JZ4740_DMA_WIDTH_8BIT = 1,
39    JZ4740_DMA_WIDTH_16BIT = 2,
40};
41
42enum jz4740_dma_transfer_size {
43    JZ4740_DMA_TRANSFER_SIZE_4BYTE = 0,
44    JZ4740_DMA_TRANSFER_SIZE_1BYTE = 1,
45    JZ4740_DMA_TRANSFER_SIZE_2BYTE = 2,
46    JZ4740_DMA_TRANSFER_SIZE_16BYTE = 3,
47    JZ4740_DMA_TRANSFER_SIZE_32BYTE = 4,
48};
49
50enum jz4740_dma_flags {
51    JZ4740_DMA_SRC_AUTOINC = 0x2,
52    JZ4740_DMA_DST_AUTOINC = 0x1,
53};
54
55enum jz4740_dma_mode {
56    JZ4740_DMA_MODE_SINGLE = 0,
57    JZ4740_DMA_MODE_BLOCK = 1,
58};
59
60struct jz4740_dma_config {
61    enum jz4740_dma_width src_width;
62    enum jz4740_dma_width dst_width;
63    enum jz4740_dma_transfer_size transfer_size;
64    enum jz4740_dma_request_type request_type;
65    enum jz4740_dma_flags flags;
66    enum jz4740_dma_mode mode;
67};
68
69typedef void (*jz4740_dma_complete_callback_t)(struct jz4740_dma_chan *, int, void *);
70
71/*
72 * The 'prio' argument selects priority group: 0 (high) or 1 (low).
73 * There are 3 DMA channels available per group.
74 */
75struct jz4740_dma_chan *jz4740_dma_request(void *dev, const char *name, int prio);
76void jz4740_dma_free(struct jz4740_dma_chan *dma);
77
78void jz4740_dma_configure(struct jz4740_dma_chan *dma,
79    const struct jz4740_dma_config *config);
80
81
82void jz4740_dma_enable(struct jz4740_dma_chan *dma);
83void jz4740_dma_disable(struct jz4740_dma_chan *dma);
84
85void jz4740_dma_set_src_addr(struct jz4740_dma_chan *dma, dma_addr_t src);
86void jz4740_dma_set_dst_addr(struct jz4740_dma_chan *dma, dma_addr_t dst);
87void jz4740_dma_set_transfer_count(struct jz4740_dma_chan *dma, uint32_t count);
88
89uint32_t jz4740_dma_get_residue(const struct jz4740_dma_chan *dma);
90
91void jz4740_dma_set_complete_cb(struct jz4740_dma_chan *dma,
92    jz4740_dma_complete_callback_t cb);
93
94#endif /* __ASM_JZ4740_DMA_H__ */
95

Archive Download this file



interactive