forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/arch/mips/lantiq/xway/dma.c
....@@ -1,16 +1,5 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
2
- * This program is free software; you can redistribute it and/or modify it
3
- * under the terms of the GNU General Public License version 2 as published
4
- * by the Free Software Foundation.
5
- *
6
- * This program is distributed in the hope that it will be useful,
7
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
8
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
- * GNU General Public License for more details.
10
- *
11
- * You should have received a copy of the GNU General Public License
12
- * along with this program; if not, write to the Free Software
13
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
143 *
154 * Copyright (C) 2011 John Crispin <john@phrozen.org>
165 */
....@@ -51,7 +40,11 @@
5140 #define DMA_IRQ_ACK 0x7e /* IRQ status register */
5241 #define DMA_POLL BIT(31) /* turn on channel polling */
5342 #define DMA_CLK_DIV4 BIT(6) /* polling clock divider */
54
-#define DMA_2W_BURST BIT(1) /* 2 word burst length */
43
+#define DMA_PCTRL_2W_BURST 0x1 /* 2 word burst length */
44
+#define DMA_PCTRL_4W_BURST 0x2 /* 4 word burst length */
45
+#define DMA_PCTRL_8W_BURST 0x3 /* 8 word burst length */
46
+#define DMA_TX_BURST_SHIFT 4 /* tx burst shift */
47
+#define DMA_RX_BURST_SHIFT 2 /* rx burst shift */
5548 #define DMA_ETOP_ENDIANNESS (0xf << 8) /* endianness swap etop channels */
5649 #define DMA_WEIGHT (BIT(17) | BIT(16)) /* default channel wheight */
5750
....@@ -107,7 +100,6 @@
107100 spin_lock_irqsave(&ltq_dma_lock, flag);
108101 ltq_dma_w32(ch->nr, LTQ_DMA_CS);
109102 ltq_dma_w32_mask(0, DMA_CHAN_ON, LTQ_DMA_CCTRL);
110
- ltq_dma_w32_mask(0, 1 << ch->nr, LTQ_DMA_IRNEN);
111103 spin_unlock_irqrestore(&ltq_dma_lock, flag);
112104 }
113105 EXPORT_SYMBOL_GPL(ltq_dma_open);
....@@ -131,9 +123,9 @@
131123 unsigned long flags;
132124
133125 ch->desc = 0;
134
- ch->desc_base = dma_zalloc_coherent(ch->dev,
135
- LTQ_DESC_NUM * LTQ_DESC_SIZE,
136
- &ch->phys, GFP_ATOMIC);
126
+ ch->desc_base = dma_alloc_coherent(ch->dev,
127
+ LTQ_DESC_NUM * LTQ_DESC_SIZE,
128
+ &ch->phys, GFP_ATOMIC);
137129
138130 spin_lock_irqsave(&ltq_dma_lock, flags);
139131 ltq_dma_w32(ch->nr, LTQ_DMA_CS);
....@@ -203,7 +195,8 @@
203195 break;
204196
205197 case DMA_PORT_DEU:
206
- ltq_dma_w32((DMA_2W_BURST << 4) | (DMA_2W_BURST << 2),
198
+ ltq_dma_w32((DMA_PCTRL_2W_BURST << DMA_TX_BURST_SHIFT) |
199
+ (DMA_PCTRL_2W_BURST << DMA_RX_BURST_SHIFT),
207200 LTQ_DMA_PCTRL);
208201 break;
209202