aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/dw_dmac_regs.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/dma/dw_dmac_regs.h')
-rw-r--r--drivers/dma/dw_dmac_regs.h64
1 files changed, 58 insertions, 6 deletions
diff --git a/drivers/dma/dw_dmac_regs.h b/drivers/dma/dw_dmac_regs.h
index 50830bee087a..88965597b7d0 100644
--- a/drivers/dma/dw_dmac_regs.h
+++ b/drivers/dma/dw_dmac_regs.h
@@ -82,9 +82,47 @@ struct dw_dma_regs {
82 DW_REG(ID); 82 DW_REG(ID);
83 DW_REG(TEST); 83 DW_REG(TEST);
84 84
85 /* reserved */
86 DW_REG(__reserved0);
87 DW_REG(__reserved1);
88
85 /* optional encoded params, 0x3c8..0x3f7 */ 89 /* optional encoded params, 0x3c8..0x3f7 */
90 u32 __reserved;
91
92 /* per-channel configuration registers */
93 u32 DWC_PARAMS[DW_DMA_MAX_NR_CHANNELS];
94 u32 MULTI_BLK_TYPE;
95 u32 MAX_BLK_SIZE;
96
97 /* top-level parameters */
98 u32 DW_PARAMS;
86}; 99};
87 100
101#ifdef CONFIG_DW_DMAC_BIG_ENDIAN_IO
102#define dma_readl_native ioread32be
103#define dma_writel_native iowrite32be
104#else
105#define dma_readl_native readl
106#define dma_writel_native writel
107#endif
108
109/* To access the registers in early stage of probe */
110#define dma_read_byaddr(addr, name) \
111 dma_readl_native((addr) + offsetof(struct dw_dma_regs, name))
112
113/* Bitfields in DW_PARAMS */
114#define DW_PARAMS_NR_CHAN 8 /* number of channels */
115#define DW_PARAMS_NR_MASTER 11 /* number of AHB masters */
116#define DW_PARAMS_DATA_WIDTH(n) (15 + 2 * (n))
117#define DW_PARAMS_DATA_WIDTH1 15 /* master 1 data width */
118#define DW_PARAMS_DATA_WIDTH2 17 /* master 2 data width */
119#define DW_PARAMS_DATA_WIDTH3 19 /* master 3 data width */
120#define DW_PARAMS_DATA_WIDTH4 21 /* master 4 data width */
121#define DW_PARAMS_EN 28 /* encoded parameters */
122
123/* Bitfields in DWC_PARAMS */
124#define DWC_PARAMS_MBLK_EN 11 /* multi block transfer */
125
88/* Bitfields in CTL_LO */ 126/* Bitfields in CTL_LO */
89#define DWC_CTLL_INT_EN (1 << 0) /* irqs enabled? */ 127#define DWC_CTLL_INT_EN (1 << 0) /* irqs enabled? */
90#define DWC_CTLL_DST_WIDTH(n) ((n)<<1) /* bytes per element */ 128#define DWC_CTLL_DST_WIDTH(n) ((n)<<1) /* bytes per element */
@@ -140,10 +178,9 @@ struct dw_dma_regs {
140/* Bitfields in CFG */ 178/* Bitfields in CFG */
141#define DW_CFG_DMA_EN (1 << 0) 179#define DW_CFG_DMA_EN (1 << 0)
142 180
143#define DW_REGLEN 0x400
144
145enum dw_dmac_flags { 181enum dw_dmac_flags {
146 DW_DMA_IS_CYCLIC = 0, 182 DW_DMA_IS_CYCLIC = 0,
183 DW_DMA_IS_SOFT_LLP = 1,
147}; 184};
148 185
149struct dw_dma_chan { 186struct dw_dma_chan {
@@ -154,6 +191,10 @@ struct dw_dma_chan {
154 bool paused; 191 bool paused;
155 bool initialized; 192 bool initialized;
156 193
194 /* software emulation of the LLP transfers */
195 struct list_head *tx_list;
196 struct list_head *tx_node_active;
197
157 spinlock_t lock; 198 spinlock_t lock;
158 199
159 /* these other elements are all protected by lock */ 200 /* these other elements are all protected by lock */
@@ -165,8 +206,15 @@ struct dw_dma_chan {
165 206
166 unsigned int descs_allocated; 207 unsigned int descs_allocated;
167 208
209 /* hardware configuration */
210 unsigned int block_size;
211 bool nollp;
212
168 /* configuration passed via DMA_SLAVE_CONFIG */ 213 /* configuration passed via DMA_SLAVE_CONFIG */
169 struct dma_slave_config dma_sconfig; 214 struct dma_slave_config dma_sconfig;
215
216 /* backlink to dw_dma */
217 struct dw_dma *dw;
170}; 218};
171 219
172static inline struct dw_dma_chan_regs __iomem * 220static inline struct dw_dma_chan_regs __iomem *
@@ -176,9 +224,9 @@ __dwc_regs(struct dw_dma_chan *dwc)
176} 224}
177 225
178#define channel_readl(dwc, name) \ 226#define channel_readl(dwc, name) \
179 readl(&(__dwc_regs(dwc)->name)) 227 dma_readl_native(&(__dwc_regs(dwc)->name))
180#define channel_writel(dwc, name, val) \ 228#define channel_writel(dwc, name, val) \
181 writel((val), &(__dwc_regs(dwc)->name)) 229 dma_writel_native((val), &(__dwc_regs(dwc)->name))
182 230
183static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan) 231static inline struct dw_dma_chan *to_dw_dma_chan(struct dma_chan *chan)
184{ 232{
@@ -193,6 +241,10 @@ struct dw_dma {
193 241
194 u8 all_chan_mask; 242 u8 all_chan_mask;
195 243
244 /* hardware configuration */
245 unsigned char nr_masters;
246 unsigned char data_width[4];
247
196 struct dw_dma_chan chan[0]; 248 struct dw_dma_chan chan[0];
197}; 249};
198 250
@@ -202,9 +254,9 @@ static inline struct dw_dma_regs __iomem *__dw_regs(struct dw_dma *dw)
202} 254}
203 255
204#define dma_readl(dw, name) \ 256#define dma_readl(dw, name) \
205 readl(&(__dw_regs(dw)->name)) 257 dma_readl_native(&(__dw_regs(dw)->name))
206#define dma_writel(dw, name, val) \ 258#define dma_writel(dw, name, val) \
207 writel((val), &(__dw_regs(dw)->name)) 259 dma_writel_native((val), &(__dw_regs(dw)->name))
208 260
209#define channel_set_bit(dw, reg, mask) \ 261#define channel_set_bit(dw, reg, mask) \
210 dma_writel(dw, reg, ((mask) << 8) | (mask)) 262 dma_writel(dw, reg, ((mask) << 8) | (mask))