All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: netdev@vger.kernel.org
Cc: nbd@nbd.name, john@phrozen.org, sean.wang@mediatek.com,
	Mark-MC.Lee@mediatek.com, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	matthias.bgg@gmail.com, linux-mediatek@lists.infradead.org,
	lorenzo.bianconi@redhat.com, Bo.Jiao@mediatek.com,
	sujuan.chen@mediatek.com, ryder.Lee@mediatek.com,
	evelyn.tsai@mediatek.com, devicetree@vger.kernel.org,
	robh@kernel.org, daniel@makrotopia.org
Subject: [PATCH v2 net-next 06/11] net: ethernet: mtk_eth_soc: move wdma_base definitions in mtk register map
Date: Tue, 13 Sep 2022 19:00:56 +0200	[thread overview]
Message-ID: <8e9fe9537373aa0dde270cab73590db6be53e215.1663087836.git.lorenzo@kernel.org> (raw)
In-Reply-To: <cover.1663087836.git.lorenzo@kernel.org>

This is a preliminary patch to introduce mt7986 wed support.

Tested-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 16 ++++++++++------
 drivers/net/ethernet/mediatek/mtk_eth_soc.h |  4 +---
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index bbafe5598b14..f289b994e7d5 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -75,6 +75,10 @@ static const struct mtk_reg_map mtk_reg_map = {
 	.gdm1_cnt		= 0x2400,
 	.gdma_to_ppe		= 0x4444,
 	.ppe_base		= 0x0c00,
+	.wdma_base = {
+		[0]		= 0x2800,
+		[1]		= 0x2c00,
+	},
 };
 
 static const struct mtk_reg_map mt7628_reg_map = {
@@ -130,6 +134,10 @@ static const struct mtk_reg_map mt7986_reg_map = {
 	.gdm1_cnt		= 0x1c00,
 	.gdma_to_ppe		= 0x3333,
 	.ppe_base		= 0x2000,
+	.wdma_base = {
+		[0]		= 0x4800,
+		[1]		= 0x4c00,
+	},
 };
 
 /* strings used by ethtool */
@@ -4019,16 +4027,12 @@ static int mtk_probe(struct platform_device *pdev)
 	for (i = 0;; i++) {
 		struct device_node *np = of_parse_phandle(pdev->dev.of_node,
 							  "mediatek,wed", i);
-		static const u32 wdma_regs[] = {
-			MTK_WDMA0_BASE,
-			MTK_WDMA1_BASE
-		};
 		void __iomem *wdma;
 
-		if (!np || i >= ARRAY_SIZE(wdma_regs))
+		if (!np || i >= ARRAY_SIZE(eth->soc->reg_map->wdma_base))
 			break;
 
-		wdma = eth->base + wdma_regs[i];
+		wdma = eth->base + eth->soc->reg_map->wdma_base[i];
 		mtk_wed_add_hw(np, eth, wdma, i);
 	}
 
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
index 54448795159d..39a0361ca989 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -268,9 +268,6 @@
 #define TX_DMA_FPORT_MASK_V2	0xf
 #define TX_DMA_SWC_V2		BIT(30)
 
-#define MTK_WDMA0_BASE		0x2800
-#define MTK_WDMA1_BASE		0x2c00
-
 /* QDMA descriptor txd4 */
 #define TX_DMA_CHKSUM		(0x7 << 29)
 #define TX_DMA_TSO		BIT(28)
@@ -956,6 +953,7 @@ struct mtk_reg_map {
 	u32	gdm1_cnt;
 	u32	gdma_to_ppe;
 	u32	ppe_base;
+	u32	wdma_base[2];
 };
 
 /* struct mtk_eth_data -	This is the structure holding all differences
-- 
2.37.3


  parent reply	other threads:[~2022-09-13 18:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 17:00 [PATCH v2 net-next 00/11] Add WED support for MT7986 chipset Lorenzo Bianconi
2022-09-13 17:00 ` [PATCH v2 net-next 01/11] arm64: dts: mediatek: mt7986: add support for Wireless Ethernet Dispatch Lorenzo Bianconi
2022-09-13 17:00 ` [PATCH v2 net-next 02/11] dt-bindings: net: mediatek: add WED binding for MT7986 eth driver Lorenzo Bianconi
2022-09-14 14:22   ` Rob Herring
2022-09-13 17:00 ` [PATCH v2 net-next 03/11] net: ethernet: mtk_eth_soc: move gdma_to_ppe and ppe_base definitions in mtk register map Lorenzo Bianconi
2022-09-13 17:00 ` [PATCH v2 net-next 04/11] net: ethernet: mtk_eth_soc: move ppe table hash offset to mtk_soc_data structure Lorenzo Bianconi
2022-09-13 17:00 ` [PATCH v2 net-next 05/11] net: ethernet: mtk_eth_soc: add the capability to run multiple ppe Lorenzo Bianconi
2022-09-13 17:00 ` Lorenzo Bianconi [this message]
2022-09-13 17:00 ` [PATCH v2 net-next 07/11] net: ethernet: mtk_eth_soc: add foe_entry_size to mtk_eth_soc Lorenzo Bianconi
2022-09-13 17:00 ` [PATCH v2 net-next 08/11] net: ethernet: mtk_eth_wed: add mtk_wed_configure_irq and mtk_wed_dma_{enable/disable} Lorenzo Bianconi
2022-09-13 17:00 ` [PATCH v2 net-next 09/11] net: ethernet: mtk_eth_wed: add wed support for mt7986 chipset Lorenzo Bianconi
2022-09-13 20:17   ` kernel test robot
2022-09-13 17:01 ` [PATCH v2 net-next 10/11] net: ethernet: mtk_eth_wed: add axi bus support Lorenzo Bianconi
2022-09-13 17:01 ` [PATCH v2 net-next 11/11] net: ethernet: mtk_eth_soc: introduce flow offloading support for mt7986 Lorenzo Bianconi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e9fe9537373aa0dde270cab73590db6be53e215.1663087836.git.lorenzo@kernel.org \
    --to=lorenzo@kernel.org \
    --cc=Bo.Jiao@mediatek.com \
    --cc=Mark-MC.Lee@mediatek.com \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=evelyn.tsai@mediatek.com \
    --cc=john@phrozen.org \
    --cc=kuba@kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo.bianconi@redhat.com \
    --cc=matthias.bgg@gmail.com \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=ryder.Lee@mediatek.com \
    --cc=sean.wang@mediatek.com \
    --cc=sujuan.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.