Skip to contentSkip to conversation

dt-bindings: net: mediatek: Add support for MediaTek MT7628/88 SoC

PATCH Applied Stefan Roese 2 participants 8 messages Aug 16, 2019 – Aug 18, 2019

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/4 dt-bindings: net: mediatek: Add support for MediaTek MT7628/88 SoC

Add compatible for the ethernet IP core on MT7628/88 SoCs. Its compatible with the older Ralink Rt5350F SoC. And OpenWrt already uses this compatible string for the MT76x8.

Cc René van Dorst <[email protected]>
Cc Daniel Golle <[email protected]>
Cc Sean Wang <[email protected]>
Cc John Crispin <[email protected]>
Cc Rob Herring <[email protected]>

---
v3:
- No change

v2:
- New patch - bindings description moved to separate patch

 Documentation/devicetree/bindings/net/mediatek-net.txt | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/net/mediatek-net.txt +1 -0
index 770ff98d4524..72d03e07cf7c 100644
@@ -12,6 +12,7 @@ Required properties:
 		"mediatek,mt7623-eth", "mediatek,mt2701-eth": for MT7623 SoC
 		"mediatek,mt7622-eth": for MT7622 SoC
 		"mediatek,mt7629-eth": for MT7629 SoC
+		"ralink,rt5350-eth": for Ralink Rt5350F and MT7628/88 SoC
 - reg: Address and length of the register set for the device
 - interrupts: Should contain the three frame engines interrupts in numeric
 	order. These are fe_int0, fe_int1 and fe_int2.
Signature · 1 line
2.22.1
#1 lore raw

PATCH v3 2/4 net: ethernet: mediatek: Rename MTK_QMTK_INT_STATUS to MTK_QDMA_INT_STATUS

Currently all QDMA registers are named "MTK_QDMA_foo" in this driver with one exception: MTK_QMTK_INT_STATUS. This patch renames MTK_QMTK_INT_STATUS to MTK_QDMA_INT_STATUS so that all macros follow this rule.

Cc René van Dorst <[email protected]>
Cc Daniel Golle <[email protected]>
Cc Sean Wang <[email protected]>
Cc John Crispin <[email protected]>

---
v3:
- No change

v2:
- New patch

 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 ++++----
 drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +4 -4
index ddbffeb5701b..bee2cdca66e7 100644
@@ -1122,11 +1122,11 @@ static int mtk_napi_tx(struct napi_struct *napi, int budget)
 	int tx_done = 0;
 
 	mtk_handle_status_irq(eth);
-	mtk_w32(eth, MTK_TX_DONE_INT, MTK_QMTK_INT_STATUS);
+	mtk_w32(eth, MTK_TX_DONE_INT, MTK_QDMA_INT_STATUS);
 	tx_done = mtk_poll_tx(eth, budget);
 
 	if (unlikely(netif_msg_intr(eth))) {
-		status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
+		status = mtk_r32(eth, MTK_QDMA_INT_STATUS);
 		mask = mtk_r32(eth, MTK_QDMA_INT_MASK);
 		dev_info(eth->dev,
 			 "done tx %d, intr 0x%08x/0x%x\n",
@@ -1136,7 +1136,7 @@ static int mtk_napi_tx(struct napi_struct *napi, int budget)
 	if (tx_done == budget)
 		return budget;
 
-	status = mtk_r32(eth, MTK_QMTK_INT_STATUS);
+	status = mtk_r32(eth, MTK_QDMA_INT_STATUS);
 	if (status & MTK_TX_DONE_INT)
 		return budget;
 
@@ -1747,7 +1747,7 @@ static irqreturn_t mtk_handle_irq(int irq, void *_eth)
 			mtk_handle_irq_rx(irq, _eth);
 	}
 	if (mtk_r32(eth, MTK_QDMA_INT_MASK) & MTK_TX_DONE_INT) {
-		if (mtk_r32(eth, MTK_QMTK_INT_STATUS) & MTK_TX_DONE_INT)
+		if (mtk_r32(eth, MTK_QDMA_INT_STATUS) & MTK_TX_DONE_INT)
 			mtk_handle_irq_tx(irq, _eth);
 	}
 
drivers/net/ethernet/mediatek/mtk_eth_soc.h +1 -1
index bab94f763e2c..088e2bc621f7 100644
@@ -212,7 +212,7 @@
 #define FC_THRES_MIN		0x4444
 
 /* QDMA Interrupt Status Register */
-#define MTK_QMTK_INT_STATUS	0x1A18
+#define MTK_QDMA_INT_STATUS	0x1A18
 #define MTK_RX_DONE_DLY		BIT(30)
 #define MTK_RX_DONE_INT3	BIT(19)
 #define MTK_RX_DONE_INT2	BIT(18)
Signature · 1 line
2.22.1
maintainer Applied
#2 lore raw

Re: [PATCH net-next 2/4 v3] net: ethernet: mediatek: Rename MTK_QMTK_INT_STATUS to MTK_QDMA_INT_STATUS

From: Stefan Roese <[email protected]>
Date: Fri, 16 Aug 2019 15:23:23 +0200

Quoted 6 lines

Currently all QDMA registers are named "MTK_QDMA_foo" in this driver with one exception: MTK_QMTK_INT_STATUS. This patch renames MTK_QMTK_INT_STATUS to MTK_QDMA_INT_STATUS so that all macros follow this rule.

Applied.

#3 lore raw

PATCH v3 3/4 net: ethernet: mediatek: Rename NEXT_RX_DESP_IDX to NEXT_DESP_IDX

In reply to Stefan Roese

Rename the NEXT_RX_DESP_IDX macro to NEXT_DESP_IDX, so that it better can be used for TX ops as well. This will be used in the upcoming MT7628/88 support (same functionality for RX and TX in this macro).

Cc René van Dorst <[email protected]>
Cc Daniel Golle <[email protected]>
Cc Sean Wang <[email protected]>
Cc John Crispin <[email protected]>

---
v3:
- No change

v2:
- New patch

 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++--
 drivers/net/ethernet/mediatek/mtk_eth_soc.h | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +2 -2
index bee2cdca66e7..d9978174b96a 100644
@@ -903,7 +903,7 @@ static struct mtk_rx_ring *mtk_get_rx_ring(struct mtk_eth *eth)
 
 	for (i = 0; i < MTK_MAX_RX_RING_NUM; i++) {
 		ring = &eth->rx_ring[i];
-		idx = NEXT_RX_DESP_IDX(ring->calc_idx, ring->dma_size);
+		idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
 		if (ring->dma[idx].rxd2 & RX_DMA_DONE) {
 			ring->calc_idx_update = true;
 			return ring;
@@ -952,7 +952,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,
 		if (unlikely(!ring))
 			goto rx_done;
 
-		idx = NEXT_RX_DESP_IDX(ring->calc_idx, ring->dma_size);
+		idx = NEXT_DESP_IDX(ring->calc_idx, ring->dma_size);
 		rxd = &ring->dma[idx];
 		data = ring->data[idx];
 
drivers/net/ethernet/mediatek/mtk_eth_soc.h +1 -1
index 088e2bc621f7..556644f28eae 100644
@@ -39,7 +39,7 @@
 				 NETIF_F_SG | NETIF_F_TSO | \
 				 NETIF_F_TSO6 | \
 				 NETIF_F_IPV6_CSUM)
-#define NEXT_RX_DESP_IDX(X, Y)	(((X) + 1) & ((Y) - 1))
+#define NEXT_DESP_IDX(X, Y)	(((X) + 1) & ((Y) - 1))
 
 #define MTK_MAX_RX_RING_NUM	4
 #define MTK_HW_LRO_DMA_SIZE	8
Signature · 1 line
2.22.1
maintainer Applied
#4 lore raw

Re: [PATCH net-next 3/4 v3] net: ethernet: mediatek: Rename NEXT_RX_DESP_IDX to NEXT_DESP_IDX

From: Stefan Roese <[email protected]>
Date: Fri, 16 Aug 2019 15:23:24 +0200

Quoted 5 lines

Rename the NEXT_RX_DESP_IDX macro to NEXT_DESP_IDX, so that it better can be used for TX ops as well. This will be used in the upcoming MT7628/88 support (same functionality for RX and TX in this macro).

Applied.

#5 lore raw

PATCH v3 4/4 net: ethernet: mediatek: Add MT7628/88 SoC support

In reply to Stefan Roese

This patch adds support for the MediaTek MT7628/88 SoCs to the common MediaTek ethernet driver. Some minor changes are needed for this and a bigger change, as the MT7628 does not support QDMA (only PDMA).

Cc René van Dorst <[email protected]>
Cc Daniel Golle <[email protected]>
Cc Sean Wang <[email protected]>
Cc John Crispin <[email protected]>

---
v3:
- Corrected pointer arthmetic - use proper (void *) cast (David)

v2:
- Rebased on net-next (David)
- Used "ralink,rt5350-eth" compatible (Daniel)
- Fixed capability bit usage (Rene)
- Extracted DT bindings description to separate patch
- Introduced MTK_QDMA capability, which is used on all currently supported SoCs. Only the newly introcuded MT7628 uses PDMA and does not have this capability bit set
- Added tx_int_mask_reg/tx_int_status_reg variables to better abstract the QDMA vs PDMA usage

 drivers/net/ethernet/mediatek/Kconfig        |   2 +-
 drivers/net/ethernet/mediatek/mtk_eth_path.c |   4 +
 drivers/net/ethernet/mediatek/mtk_eth_soc.c  | 480 ++++++++++++++-----
 drivers/net/ethernet/mediatek/mtk_eth_soc.h  |  51 +-
 4 files changed, 425 insertions(+), 112 deletions(-)
drivers/net/ethernet/mediatek/Kconfig +1 -1
index 1f7fff81f24d..b76cf2e1c9dc 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 config NET_VENDOR_MEDIATEK
 	bool "MediaTek ethernet driver"
-	depends on ARCH_MEDIATEK || SOC_MT7621
+	depends on ARCH_MEDIATEK || SOC_MT7621 || SOC_MT7620
 	---help---
 	  If you have a Mediatek SoC with ethernet, say Y.
 
drivers/net/ethernet/mediatek/mtk_eth_path.c +4 -0
index 7f05880cf9ef..28960e4c4e43 100644
@@ -315,6 +315,10 @@ int mtk_setup_hw_path(struct mtk_eth *eth, int mac_id, int phymode)
 {
 	int err;
 
+	/* No mux'ing for MT7628/88 */
+	if (MTK_HAS_CAPS(eth->soc->caps, MTK_SOC_MT7628))
+		return 0;
+
 	switch (phymode) {
 	case PHY_INTERFACE_MODE_TRGMII:
 	case PHY_INTERFACE_MODE_RGMII_TXID:
drivers/net/ethernet/mediatek/mtk_eth_soc.c +373 -107

804 lines not on this page · raw message

drivers/net/ethernet/mediatek/mtk_eth_soc.h +47 -4

144 lines not on this page · raw message

Signature · 1 line
2.22.1
maintainer Applied
#6 lore raw

Re: [PATCH net-next 4/4 v3] net: ethernet: mediatek: Add MT7628/88 SoC support

From: Stefan Roese <[email protected]>
Date: Fri, 16 Aug 2019 15:23:25 +0200

Quoted 5 lines

This patch adds support for the MediaTek MT7628/88 SoCs to the common MediaTek ethernet driver. Some minor changes are needed for this and a bigger change, as the MT7628 does not support QDMA (only PDMA).

Applied.

Please submit your patch series properly next time, which means including a "[PATCH 0/N]" introductory posting which explains what the patch series is doing, how it is doing it, and why it is doing it that way.

It not only provides a proper organizational object for your patch series, it also makes less work for me because I can just reply to that single email when I apply your series instead of having to reply to every single one in the set.

Thanks.