aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/dma/mv_xor.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 2d033790ea2d..a95878cd36d9 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -139,45 +139,10 @@ static void mv_chan_clear_err_status(struct mv_xor_chan *chan)
139} 139}
140 140
141static void mv_chan_set_mode(struct mv_xor_chan *chan, 141static void mv_chan_set_mode(struct mv_xor_chan *chan,
142 enum dma_transaction_type type) 142 u32 op_mode)
143{ 143{
144 u32 op_mode;
145 u32 config = readl_relaxed(XOR_CONFIG(chan)); 144 u32 config = readl_relaxed(XOR_CONFIG(chan));
146 145
147 switch (type) {
148 case DMA_XOR:
149 op_mode = XOR_OPERATION_MODE_XOR;
150 break;
151 case DMA_MEMCPY:
152 op_mode = XOR_OPERATION_MODE_MEMCPY;
153 break;
154 default:
155 dev_err(mv_chan_to_devp(chan),
156 "error: unsupported operation %d\n",
157 type);
158 BUG();
159 return;
160 }
161
162 config &= ~0x7;
163 config |= op_mode;
164
165#if defined(__BIG_ENDIAN)
166 config |= XOR_DESCRIPTOR_SWAP;
167#else
168 config &= ~XOR_DESCRIPTOR_SWAP;
169#endif
170
171 writel_relaxed(config, XOR_CONFIG(chan));
172}
173
174static void mv_chan_set_mode_to_desc(struct mv_xor_chan *chan)
175{
176 u32 op_mode;
177 u32 config = readl_relaxed(XOR_CONFIG(chan));
178
179 op_mode = XOR_OPERATION_MODE_IN_DESC;
180
181 config &= ~0x7; 146 config &= ~0x7;
182 config |= op_mode; 147 config |= op_mode;
183 148
@@ -1042,9 +1007,9 @@ mv_xor_channel_add(struct mv_xor_device *xordev,
1042 mv_chan_unmask_interrupts(mv_chan); 1007 mv_chan_unmask_interrupts(mv_chan);
1043 1008
1044 if (mv_chan->op_in_desc == XOR_MODE_IN_DESC) 1009 if (mv_chan->op_in_desc == XOR_MODE_IN_DESC)
1045 mv_chan_set_mode_to_desc(mv_chan); 1010 mv_chan_set_mode(mv_chan, XOR_OPERATION_MODE_IN_DESC);
1046 else 1011 else
1047 mv_chan_set_mode(mv_chan, DMA_XOR); 1012 mv_chan_set_mode(mv_chan, XOR_OPERATION_MODE_XOR);
1048 1013
1049 spin_lock_init(&mv_chan->lock); 1014 spin_lock_init(&mv_chan->lock);
1050 INIT_LIST_HEAD(&mv_chan->chain); 1015 INIT_LIST_HEAD(&mv_chan->chain);