2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) 2005 infineon
17 * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
20 #ifndef _IFXMIPS_DMA_H__
21 #define _IFXMIPS_DMA_H__
24 #define TX_BUF_FULL_INT 2
25 #define TRANSMIT_CPT_INT 4
26 #define IFXMIPS_DMA_CH_ON 1
27 #define IFXMIPS_DMA_CH_OFF 0
28 #define IFXMIPS_DMA_CH_DEFAULT_WEIGHT 100
41 #define DMA_DESC_OWN_CPU 0x0
42 #define DMA_DESC_OWN_DMA 0x80000000
43 #define DMA_DESC_CPT_SET 0x40000000
44 #define DMA_DESC_SOP_SET 0x20000000
45 #define DMA_DESC_EOP_SET 0x10000000
47 #define MISCFG_MASK 0x40
48 #define RDERR_MASK 0x20
49 #define CHOFF_MASK 0x10
50 #define DESCPT_MASK 0x8
54 #define DMA_DROP_MASK (1<<31)
56 #define IFXMIPS_DMA_RX -1
57 #define IFXMIPS_DMA_TX 1
67 #ifdef CONFIG_CPU_LITTLE_ENDIAN
70 volatile u32 reserved
:7;
71 volatile u32 byte_offset
:2;
72 volatile u32 Burst_length_offset
:3;
77 volatile u32 Data_Pointer
; /* fixme: should be 28 bits here */
81 volatile u32 data_length
:16;
82 volatile u32 reserved1
:7;
83 volatile u32 byte_offset
:5;
88 volatile u32 Data_Pointer
; /* fixme: should be 28 bits here */
98 volatile u32 Burst_length_offset
:3;
99 volatile u32 byte_offset
:2;
100 volatile u32 reserve
:7;
101 volatile u32 data_length
:16;
105 volatile u32 Data_Pointer
;
115 volatile u32 byte_offset
:5;
116 volatile u32 reserved
:7;
117 volatile u32 data_length
:16;
121 volatile u32 Data_Pointer
;
125 struct dma_channel_info
{
126 /* relative channel number */
128 /* class for this channel for QoS */
130 /* specify byte_offset */
136 /* descriptor parameter */
140 int prev_desc
; /* only used if it is a tx channel*/
141 /* weight setting for WFQ algorithm*/
146 /* on or off of this channel */
148 /* optional information for the upper layer devices */
149 #if defined(CONFIG_IFXMIPS_ETHERNET_D2) || defined(CONFIG_IFXMIPS_PPA)
154 /* Pointer to the peripheral device who is using this channel */
156 /* channel operations */
157 void (*open
)(struct dma_channel_info
*pCh
);
158 void (*close
)(struct dma_channel_info
*pCh
);
159 void (*reset
)(struct dma_channel_info
*pCh
);
160 void (*enable_irq
)(struct dma_channel_info
*pCh
);
161 void (*disable_irq
)(struct dma_channel_info
*pCh
);
164 struct dma_device_info
{
165 /* device name of this peripheral */
166 char device_name
[15];
177 struct dma_channel_info
*tx_chan
[20];
178 struct dma_channel_info
*rx_chan
[20];
179 /*functions, optional*/
180 u8
*(*buffer_alloc
)(int len
, int *offset
, void **opt
);
181 void (*buffer_free
)(u8
*dataptr
, void *opt
);
182 int (*intr_handler
)(struct dma_device_info
*info
, int status
);
183 void *priv
; /* used by peripheral driver only */
186 struct dma_device_info
*dma_device_reserve(char *dev_name
);
187 void dma_device_release(struct dma_device_info
*dev
);
188 void dma_device_register(struct dma_device_info
*info
);
189 void dma_device_unregister(struct dma_device_info
*info
);
190 int dma_device_read(struct dma_device_info
*info
, u8
**dataptr
, void **opt
);
191 int dma_device_write(struct dma_device_info
*info
, u8
*dataptr
, int len
,
This page took 0.059747 seconds and 5 git commands to generate.