forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.h
....@@ -1,12 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * DWMAC4 DMA Header file.
34 *
4
- *
55 * Copyright (C) 2007-2015 STMicroelectronics Ltd
6
- *
7
- * This program is free software; you can redistribute it and/or modify it
8
- * under the terms and conditions of the GNU General Public License,
9
- * version 2, as published by the Free Software Foundation.
106 *
117 * Author: Alexandre Torgue <alexandre.torgue@st.com>
128 */
....@@ -26,6 +22,7 @@
2622 #define DMA_DEBUG_STATUS_1 0x00001010
2723 #define DMA_DEBUG_STATUS_2 0x00001014
2824 #define DMA_AXI_BUS_MODE 0x00001028
25
+#define DMA_TBS_CTRL 0x00001050
2926
3027 /* DMA Bus Mode bitmap */
3128 #define DMA_BUS_MODE_SFT_RESET BIT(0)
....@@ -69,6 +66,7 @@
6966 #define DMA_SYS_BUS_MB BIT(14)
7067 #define DMA_AXI_1KBBE BIT(13)
7168 #define DMA_SYS_BUS_AAL BIT(12)
69
+#define DMA_SYS_BUS_EAME BIT(11)
7270 #define DMA_AXI_BLEN256 BIT(7)
7371 #define DMA_AXI_BLEN128 BIT(6)
7472 #define DMA_AXI_BLEN64 BIT(5)
....@@ -85,6 +83,11 @@
8583
8684 #define DMA_AXI_BURST_LEN_MASK 0x000000FE
8785
86
+/* DMA TBS Control */
87
+#define DMA_TBS_FTOS GENMASK(31, 8)
88
+#define DMA_TBS_FTOV BIT(0)
89
+#define DMA_TBS_DEF_FTOS (DMA_TBS_FTOS | DMA_TBS_FTOV)
90
+
8891 /* Following DMA defines are chanels oriented */
8992 #define DMA_CHAN_BASE_ADDR 0x00001100
9093 #define DMA_CHAN_BASE_OFFSET 0x80
....@@ -95,7 +98,9 @@
9598 #define DMA_CHAN_CONTROL(x) DMA_CHANX_BASE_ADDR(x)
9699 #define DMA_CHAN_TX_CONTROL(x) (DMA_CHANX_BASE_ADDR(x) + 0x4)
97100 #define DMA_CHAN_RX_CONTROL(x) (DMA_CHANX_BASE_ADDR(x) + 0x8)
101
+#define DMA_CHAN_TX_BASE_ADDR_HI(x) (DMA_CHANX_BASE_ADDR(x) + 0x10)
98102 #define DMA_CHAN_TX_BASE_ADDR(x) (DMA_CHANX_BASE_ADDR(x) + 0x14)
103
+#define DMA_CHAN_RX_BASE_ADDR_HI(x) (DMA_CHANX_BASE_ADDR(x) + 0x18)
99104 #define DMA_CHAN_RX_BASE_ADDR(x) (DMA_CHANX_BASE_ADDR(x) + 0x1c)
100105 #define DMA_CHAN_TX_END_ADDR(x) (DMA_CHANX_BASE_ADDR(x) + 0x20)
101106 #define DMA_CHAN_RX_END_ADDR(x) (DMA_CHANX_BASE_ADDR(x) + 0x28)
....@@ -111,9 +116,11 @@
111116 #define DMA_CHAN_STATUS(x) (DMA_CHANX_BASE_ADDR(x) + 0x60)
112117
113118 /* DMA Control X */
119
+#define DMA_CONTROL_SPH BIT(24)
114120 #define DMA_CONTROL_MSS_MASK GENMASK(13, 0)
115121
116122 /* DMA Tx Channel X Control register defines */
123
+#define DMA_CONTROL_EDSE BIT(28)
117124 #define DMA_CONTROL_TSE BIT(12)
118125 #define DMA_CONTROL_OSP BIT(4)
119126 #define DMA_CONTROL_ST BIT(0)
....@@ -168,6 +175,8 @@
168175 /* DMA default interrupt mask for 4.00 */
169176 #define DMA_CHAN_INTR_DEFAULT_MASK (DMA_CHAN_INTR_NORMAL | \
170177 DMA_CHAN_INTR_ABNORMAL)
178
+#define DMA_CHAN_INTR_DEFAULT_RX (DMA_CHAN_INTR_ENA_RIE)
179
+#define DMA_CHAN_INTR_DEFAULT_TX (DMA_CHAN_INTR_ENA_TIE)
171180
172181 #define DMA_CHAN_INTR_NORMAL_4_10 (DMA_CHAN_INTR_ENA_NIE_4_10 | \
173182 DMA_CHAN_INTR_ENA_RIE | \
....@@ -178,6 +187,8 @@
178187 /* DMA default interrupt mask for 4.10a */
179188 #define DMA_CHAN_INTR_DEFAULT_MASK_4_10 (DMA_CHAN_INTR_NORMAL_4_10 | \
180189 DMA_CHAN_INTR_ABNORMAL_4_10)
190
+#define DMA_CHAN_INTR_DEFAULT_RX_4_10 (DMA_CHAN_INTR_ENA_RIE)
191
+#define DMA_CHAN_INTR_DEFAULT_TX_4_10 (DMA_CHAN_INTR_ENA_TIE)
181192
182193 /* channel 0 specific fields */
183194 #define DMA_CHAN0_DBG_STAT_TPS GENMASK(15, 12)
....@@ -186,9 +197,10 @@
186197 #define DMA_CHAN0_DBG_STAT_RPS_SHIFT 8
187198
188199 int dwmac4_dma_reset(void __iomem *ioaddr);
189
-void dwmac4_enable_dma_irq(void __iomem *ioaddr, u32 chan);
190
-void dwmac410_enable_dma_irq(void __iomem *ioaddr, u32 chan);
191
-void dwmac4_disable_dma_irq(void __iomem *ioaddr, u32 chan);
200
+void dwmac4_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
201
+void dwmac410_enable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
202
+void dwmac4_disable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
203
+void dwmac410_disable_dma_irq(void __iomem *ioaddr, u32 chan, bool rx, bool tx);
192204 void dwmac4_dma_start_tx(void __iomem *ioaddr, u32 chan);
193205 void dwmac4_dma_stop_tx(void __iomem *ioaddr, u32 chan);
194206 void dwmac4_dma_start_rx(void __iomem *ioaddr, u32 chan);