27 #include <linux/pci.h>
29 #include "../comedidev.h"
35 #define MDPRINTK(format, args...) pr_debug(format , ## args)
37 #define MDPRINTK(format, args...) do { } while (0)
40 #define MAX_MITE_DMA_CHANNELS 8
79 static inline void mite_free(
struct mite_struct *mite)
84 static inline unsigned int mite_irq(
struct mite_struct *mite)
89 static inline unsigned int mite_device_id(
struct mite_struct *mite)
91 return mite->
pcidev->device;
102 *
ring,
unsigned min_channel,
103 unsigned max_channel);
132 unsigned int num_device_bits,
unsigned int num_memory_bits);
137 void mite_print_chsr(
unsigned int chsr);
141 static inline int CHAN_OFFSET(
int channel)
143 return 0x500 + 0x100 *
channel;
157 static inline int MITE_CHOR(
int channel)
159 return CHAN_OFFSET(channel) + 0x0;
162 static inline int MITE_CHCR(
int channel)
164 return CHAN_OFFSET(channel) + 0x4;
167 static inline int MITE_TCR(
int channel)
169 return CHAN_OFFSET(channel) + 0x8;
172 static inline int MITE_MCR(
int channel)
174 return CHAN_OFFSET(channel) + 0xc;
177 static inline int MITE_MAR(
int channel)
179 return CHAN_OFFSET(channel) + 0x10;
182 static inline int MITE_DCR(
int channel)
184 return CHAN_OFFSET(channel) + 0x14;
187 static inline int MITE_DAR(
int channel)
189 return CHAN_OFFSET(channel) + 0x18;
192 static inline int MITE_LKCR(
int channel)
194 return CHAN_OFFSET(channel) + 0x1c;
197 static inline int MITE_LKAR(
int channel)
199 return CHAN_OFFSET(channel) + 0x20;
202 static inline int MITE_LLKAR(
int channel)
204 return CHAN_OFFSET(channel) + 0x24;
207 static inline int MITE_BAR(
int channel)
209 return CHAN_OFFSET(channel) + 0x28;
212 static inline int MITE_BCR(
int channel)
214 return CHAN_OFFSET(channel) + 0x2c;
217 static inline int MITE_SAR(
int channel)
219 return CHAN_OFFSET(channel) + 0x30;
222 static inline int MITE_WSCR(
int channel)
224 return CHAN_OFFSET(channel) + 0x34;
227 static inline int MITE_WSER(
int channel)
229 return CHAN_OFFSET(channel) + 0x38;
232 static inline int MITE_CHSR(
int channel)
234 return CHAN_OFFSET(channel) + 0x3c;
237 static inline int MITE_FCR(
int channel)
239 return CHAN_OFFSET(channel) + 0x40;
246 static inline unsigned MITE_IODWBSR_1_WSIZE_bits(
unsigned size)
253 return (order - 1) & 0x1f;
260 static inline int mite_csigr_version(
u32 csigr_bits)
262 return csigr_bits & 0xf;
265 static inline int mite_csigr_type(
u32 csigr_bits)
267 return (csigr_bits >> 4) & 0xf;
270 static inline int mite_csigr_mmode(
u32 csigr_bits)
272 return (csigr_bits >> 8) & 0x3;
275 static inline int mite_csigr_imode(
u32 csigr_bits)
277 return (csigr_bits >> 12) & 0x3;
280 static inline int mite_csigr_dmac(
u32 csigr_bits)
282 return (csigr_bits >> 16) & 0xf;
285 static inline int mite_csigr_wpdep(
u32 csigr_bits)
287 unsigned int wpdep_bits = (csigr_bits >> 20) & 0x7;
291 return 1 << (wpdep_bits - 1);
294 static inline int mite_csigr_wins(
u32 csigr_bits)
296 return (csigr_bits >> 24) & 0x1f;
299 static inline int mite_csigr_iowins(
u32 csigr_bits)
301 return (csigr_bits >> 29) & 0x7;
382 static inline int CR_REQS(
int source)
384 return (source & 0x7) << 16;
387 static inline int CR_REQSDRQ(
unsigned drq_line)
391 return CR_REQS((drq_line & 0x3) | 0x4);
394 static inline int CR_RL(
unsigned int retry_limit)
399 value = 1 +
ilog2(retry_limit);
402 return (value & 0x7) << 21;
440 static inline void mite_dma_reset(
struct mite_channel *mite_chan)
443 mite_chan->
mite->mite_io_addr + MITE_CHOR(mite_chan->
channel));