15 #ifndef __ASM_XTENSA_S6000_DMAC_H
16 #define __ASM_XTENSA_S6000_DMAC_H
22 #define S6_DMA_INTSTAT0 0x000
23 #define S6_DMA_INTSTAT1 0x004
24 #define S6_DMA_INTENABLE0 0x008
25 #define S6_DMA_INTENABLE1 0x00C
26 #define S6_DMA_INTRAW0 0x010
27 #define S6_DMA_INTRAW1 0x014
28 #define S6_DMA_INTCLEAR0 0x018
29 #define S6_DMA_INTCLEAR1 0x01C
30 #define S6_DMA_INTSET0 0x020
31 #define S6_DMA_INTSET1 0x024
32 #define S6_DMA_INT0_UNDER 0
33 #define S6_DMA_INT0_OVER 16
34 #define S6_DMA_INT1_CHANNEL 0
35 #define S6_DMA_INT1_MASTER 16
36 #define S6_DMA_INT1_MASTER_MASK 7
37 #define S6_DMA_TERMCNTIRQSTAT 0x028
38 #define S6_DMA_TERMCNTIRQCLR 0x02C
39 #define S6_DMA_TERMCNTIRQSET 0x030
40 #define S6_DMA_PENDCNTIRQSTAT 0x034
41 #define S6_DMA_PENDCNTIRQCLR 0x038
42 #define S6_DMA_PENDCNTIRQSET 0x03C
43 #define S6_DMA_LOWWMRKIRQSTAT 0x040
44 #define S6_DMA_LOWWMRKIRQCLR 0x044
45 #define S6_DMA_LOWWMRKIRQSET 0x048
46 #define S6_DMA_MASTERERRINFO 0x04C
47 #define S6_DMA_MASTERERR_CHAN(n) (4*(n))
48 #define S6_DMA_MASTERERR_CHAN_MASK 0xF
49 #define S6_DMA_DESCRFIFO0 0x050
50 #define S6_DMA_DESCRFIFO1 0x054
51 #define S6_DMA_DESCRFIFO2 0x058
52 #define S6_DMA_DESCRFIFO2_AUTODISABLE 24
53 #define S6_DMA_DESCRFIFO3 0x05C
54 #define S6_DMA_MASTER0START 0x060
55 #define S6_DMA_MASTER0END 0x064
56 #define S6_DMA_MASTER1START 0x068
57 #define S6_DMA_MASTER1END 0x06C
58 #define S6_DMA_NEXTFREE 0x070
59 #define S6_DMA_NEXTFREE_CHAN 0
60 #define S6_DMA_NEXTFREE_CHAN_MASK 0x1F
61 #define S6_DMA_NEXTFREE_ENA 16
62 #define S6_DMA_NEXTFREE_ENA_MASK ((1 << 16) - 1)
63 #define S6_DMA_DPORTCTRLGRP(p) ((p) * 4 + 0x074)
64 #define S6_DMA_DPORTCTRLGRP_FRAMEREP 0
65 #define S6_DMA_DPORTCTRLGRP_NRCHANS 1
66 #define S6_DMA_DPORTCTRLGRP_NRCHANS_1 0
67 #define S6_DMA_DPORTCTRLGRP_NRCHANS_3 1
68 #define S6_DMA_DPORTCTRLGRP_NRCHANS_4 2
69 #define S6_DMA_DPORTCTRLGRP_NRCHANS_2 3
70 #define S6_DMA_DPORTCTRLGRP_ENA 31
75 #define DMA_CHNL(dmac, n) ((dmac) + 0x1000 + (n) * 0x100)
76 #define DMA_INDEX_CHNL(addr) (((addr) >> 8) & 0xF)
77 #define DMA_MASK_DMAC(addr) ((addr) & 0xFFFF0000)
78 #define S6_DMA_CHNCTRL 0x000
79 #define S6_DMA_CHNCTRL_ENABLE 0
80 #define S6_DMA_CHNCTRL_PAUSE 1
81 #define S6_DMA_CHNCTRL_PRIO 2
82 #define S6_DMA_CHNCTRL_PRIO_MASK 3
83 #define S6_DMA_CHNCTRL_PERIPHXFER 4
84 #define S6_DMA_CHNCTRL_PERIPHENA 5
85 #define S6_DMA_CHNCTRL_SRCINC 6
86 #define S6_DMA_CHNCTRL_DSTINC 7
87 #define S6_DMA_CHNCTRL_BURSTLOG 8
88 #define S6_DMA_CHNCTRL_BURSTLOG_MASK 7
89 #define S6_DMA_CHNCTRL_DESCFIFODEPTH 12
90 #define S6_DMA_CHNCTRL_DESCFIFODEPTH_MASK 0x1F
91 #define S6_DMA_CHNCTRL_DESCFIFOFULL 17
92 #define S6_DMA_CHNCTRL_BWCONSEL 18
93 #define S6_DMA_CHNCTRL_BWCONENA 19
94 #define S6_DMA_CHNCTRL_PENDGCNTSTAT 20
95 #define S6_DMA_CHNCTRL_PENDGCNTSTAT_MASK 0x3F
96 #define S6_DMA_CHNCTRL_LOWWMARK 26
97 #define S6_DMA_CHNCTRL_LOWWMARK_MASK 0xF
98 #define S6_DMA_CHNCTRL_TSTAMP 30
99 #define S6_DMA_TERMCNTNB 0x004
100 #define S6_DMA_TERMCNTNB_MASK 0xFFFF
101 #define S6_DMA_TERMCNTTMO 0x008
102 #define S6_DMA_TERMCNTSTAT 0x00C
103 #define S6_DMA_TERMCNTSTAT_MASK 0xFF
104 #define S6_DMA_CMONCHUNK 0x010
105 #define S6_DMA_SRCSKIP 0x014
106 #define S6_DMA_DSTSKIP 0x018
107 #define S6_DMA_CUR_SRC 0x024
108 #define S6_DMA_CUR_DST 0x028
109 #define S6_DMA_TIMESTAMP 0x030
113 #define S6_DPDMA_CHAN(stream, channel) (4 * (stream) + (channel))
114 #define S6_DPDMA_NB 16
116 #define S6_HIFDMA_GMACTX 0
117 #define S6_HIFDMA_GMACRX 1
118 #define S6_HIFDMA_I2S0 2
119 #define S6_HIFDMA_I2S1 3
120 #define S6_HIFDMA_EGIB 4
121 #define S6_HIFDMA_PCITX 5
122 #define S6_HIFDMA_PCIRX 6
123 #define S6_HIFDMA_NB 7
125 #define S6_NIDMA_NB 4
127 #define S6_LMSDMA_NB 12
132 #define S6_DMAC_INDEX(dmac) (((unsigned)(dmac) >> 18) % S6_DMAC_NB)
145 static inline int s6dmac_fifo_full(
u32 dmac,
int chan)
151 static inline int s6dmac_termcnt_irq(
u32 dmac,
int chan)
160 static inline int s6dmac_pendcnt_irq(
u32 dmac,
int chan)
169 static inline int s6dmac_lowwmark_irq(
u32 dmac,
int chan)
177 static inline u32 s6dmac_pending_count(
u32 dmac,
int chan)
184 static inline void s6dmac_set_terminal_count(
u32 dmac,
int chan,
u32 n)
192 static inline u32 s6dmac_get_terminal_count(
u32 dmac,
int chan)
198 static inline u32 s6dmac_timestamp(
u32 dmac,
int chan)
203 static inline u32 s6dmac_cur_src(
u32 dmac,
int chan)
208 static inline u32 s6dmac_cur_dst(
u32 dmac,
int chan)
213 static inline void s6dmac_disable_chan(
u32 dmac,
int chan)
224 static inline void s6dmac_set_stride_skip(
u32 dmac,
int chan,
226 int srcskip,
int dstskip)
233 static inline void s6dmac_enable_chan(
u32 dmac,
int chan,
236 int srcinc,
int dstinc,
238 int srcskip,
int dstskip,
240 int bandwidthconserve,
249 s6dmac_set_stride_skip(dmac, chan, comchunk, srcskip, dstskip);
267 static inline unsigned _dmac_addr_index(
u32 dmac)
275 static inline void _s6dmac_disable_error_irqs(
u32 dmac,
u32 mask)
296 static inline int s6dmac_request_chan(
u32 dmac,
int chan,
299 int srcinc,
int dstinc,
301 int srcskip,
int dstskip,
303 int bandwidthconserve,
325 s6dmac_enable_chan(dmac, r, prio, periphxfer,
326 srcinc, dstinc, comchunk, srcskip, dstskip, burstsize,
327 bandwidthconserve, lowwmark, timestamp, enable);
329 spin_unlock_irqrestore(spinl, flags);
333 static inline void s6dmac_put_fifo(
u32 dmac,
int chan,
343 spin_unlock_irqrestore(spinl, flags);
346 static inline u32 s6dmac_channel_enabled(
u32 dmac,
int chan)
357 static inline void s6dmac_dp_setup_group(
u32 dmac,
int port,
360 static const u8 mask[4] = {0, 3, 1, 2};
362 if ((port < 0) || (port > 3) || (nrch < 1) || (nrch > 4))
369 static inline void s6dmac_dp_switch_group(
u32 dmac,
int port,
int enable)