From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, netdev@vger.kernel.org,
devicetree@vger.kernel.org
Subject: [PATCH net-next 10/12] net: airoha: Select default ppe cpu port in airoha_dev_init()
Date: Wed, 15 Oct 2025 09:15:10 +0200 [thread overview]
Message-ID: <20251015-an7583-eth-support-v1-10-064855f05923@kernel.org> (raw)
In-Reply-To: <20251015-an7583-eth-support-v1-0-064855f05923@kernel.org>
Select PPE default cpu port in airoha_dev_init routine.
For PPE2 always use secondary cpu port. For PPE1 select cpu port
according to the running QDMA.
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
drivers/net/ethernet/airoha/airoha_eth.c | 38 ++++++++++++++------------------
1 file changed, 16 insertions(+), 22 deletions(-)
diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index 99e7fea52c6db9c4686fcef368f21e25f21ced58..5f6b5ab52e0265f7bb56b008ca653d64e04ff2d2 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -531,25 +531,6 @@ static int airoha_fe_init(struct airoha_eth *eth)
/* disable IFC by default */
airoha_fe_clear(eth, REG_FE_CSR_IFC_CFG, FE_IFC_EN_MASK);
- airoha_fe_wr(eth, REG_PPE_DFT_CPORT0(0),
- FIELD_PREP(DFT_CPORT_MASK(7), FE_PSE_PORT_CDM1) |
- FIELD_PREP(DFT_CPORT_MASK(6), FE_PSE_PORT_CDM1) |
- FIELD_PREP(DFT_CPORT_MASK(5), FE_PSE_PORT_CDM1) |
- FIELD_PREP(DFT_CPORT_MASK(4), FE_PSE_PORT_CDM1) |
- FIELD_PREP(DFT_CPORT_MASK(3), FE_PSE_PORT_CDM1) |
- FIELD_PREP(DFT_CPORT_MASK(2), FE_PSE_PORT_CDM1) |
- FIELD_PREP(DFT_CPORT_MASK(1), FE_PSE_PORT_CDM1) |
- FIELD_PREP(DFT_CPORT_MASK(0), FE_PSE_PORT_CDM1));
- airoha_fe_wr(eth, REG_PPE_DFT_CPORT0(1),
- FIELD_PREP(DFT_CPORT_MASK(7), FE_PSE_PORT_CDM2) |
- FIELD_PREP(DFT_CPORT_MASK(6), FE_PSE_PORT_CDM2) |
- FIELD_PREP(DFT_CPORT_MASK(5), FE_PSE_PORT_CDM2) |
- FIELD_PREP(DFT_CPORT_MASK(4), FE_PSE_PORT_CDM2) |
- FIELD_PREP(DFT_CPORT_MASK(3), FE_PSE_PORT_CDM2) |
- FIELD_PREP(DFT_CPORT_MASK(2), FE_PSE_PORT_CDM2) |
- FIELD_PREP(DFT_CPORT_MASK(1), FE_PSE_PORT_CDM2) |
- FIELD_PREP(DFT_CPORT_MASK(0), FE_PSE_PORT_CDM2));
-
/* enable 1:N vlan action, init vlan table */
airoha_fe_set(eth, REG_MC_VLAN_EN, MC_VLAN_EN_MASK);
@@ -1756,8 +1737,10 @@ static void airhoha_set_gdm2_loopback(struct airoha_gdm_port *port)
static int airoha_dev_init(struct net_device *dev)
{
struct airoha_gdm_port *port = netdev_priv(dev);
- struct airoha_eth *eth = port->qdma->eth;
- u32 pse_port;
+ struct airoha_qdma *qdma = port->qdma;
+ struct airoha_eth *eth = qdma->eth;
+ u32 pse_port, fe_cpu_port;
+ u8 ppe_id;
airoha_set_macaddr(port, dev->dev_addr);
@@ -1770,16 +1753,27 @@ static int airoha_dev_init(struct net_device *dev)
fallthrough;
case 2:
if (airoha_ppe_is_enabled(eth, 1)) {
+ /* For PPE2 always use secondary cpu port. */
+ fe_cpu_port = FE_PSE_PORT_CDM2;
pse_port = FE_PSE_PORT_PPE2;
break;
}
fallthrough;
- default:
+ default: {
+ u8 qdma_id = qdma - ð->qdma[0];
+
+ /* For PPE1 select cpu port according to the running QDMA. */
+ fe_cpu_port = qdma_id ? FE_PSE_PORT_CDM2 : FE_PSE_PORT_CDM1;
pse_port = FE_PSE_PORT_PPE1;
break;
}
+ }
airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(port->id), pse_port);
+ ppe_id = pse_port == FE_PSE_PORT_PPE2 ? 1 : 0;
+ airoha_fe_rmw(eth, REG_PPE_DFT_CPORT0(ppe_id),
+ DFT_CPORT_MASK(port->id),
+ fe_cpu_port << __ffs(DFT_CPORT_MASK(port->id)));
return 0;
}
--
2.51.0
next prev parent reply other threads:[~2025-10-15 7:15 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-15 7:15 [PATCH net-next 00/12] net: airoha: Add AN7583 ethernet controller support Lorenzo Bianconi
2025-10-15 7:15 ` [PATCH net-next 01/12] dt-bindings: net: airoha: Add AN7583 support Lorenzo Bianconi
2025-10-15 7:15 ` [PATCH net-next 02/12] net: airoha: ppe: Dynamically allocate foe_check_time array in airoha_ppe struct Lorenzo Bianconi
2025-10-15 16:06 ` Simon Horman
2025-10-15 7:15 ` [PATCH net-next 03/12] net: airoha: Add airoha_ppe_get_num_stats_entries() and airoha_ppe_get_num_total_stats_entries() Lorenzo Bianconi
2025-10-15 12:52 ` Simon Horman
2025-10-16 8:10 ` Lorenzo Bianconi
2025-10-15 7:15 ` [PATCH net-next 04/12] net: airoha: Add airoha_eth_soc_data struct Lorenzo Bianconi
2025-10-15 16:06 ` Simon Horman
2025-10-15 7:15 ` [PATCH net-next 05/12] net: airoha: Generalize airoha_ppe2_is_enabled routine Lorenzo Bianconi
2025-10-15 16:07 ` Simon Horman
2025-10-15 7:15 ` [PATCH net-next 06/12] net: airoha: ppe: Move PPE memory info in airoha_eth_soc_data struct Lorenzo Bianconi
2025-10-15 16:07 ` Simon Horman
2025-10-15 7:15 ` [PATCH net-next 07/12] net: airoha: ppe: Remove airoha_ppe_is_enabled() where not necessary Lorenzo Bianconi
2025-10-15 16:07 ` Simon Horman
2025-10-15 7:15 ` [PATCH net-next 08/12] net: airoha: ppe: Configure SRAM PPE entries via the cpu Lorenzo Bianconi
2025-10-15 15:47 ` Simon Horman
2025-10-16 8:13 ` Lorenzo Bianconi
2025-10-15 7:15 ` [PATCH net-next 09/12] net: airoha: ppe: Flush PPE SRAM table during PPE setup Lorenzo Bianconi
2025-10-15 16:08 ` Simon Horman
2025-10-15 7:15 ` Lorenzo Bianconi [this message]
2025-10-15 15:54 ` [PATCH net-next 10/12] net: airoha: Select default ppe cpu port in airoha_dev_init() Simon Horman
2025-10-16 8:51 ` Lorenzo Bianconi
2025-10-15 7:15 ` [PATCH net-next 11/12] net: airoha: Refactor src port configuration in airhoha_set_gdm2_loopback Lorenzo Bianconi
2025-10-15 16:05 ` Simon Horman
2025-10-16 8:36 ` Lorenzo Bianconi
2025-10-15 7:15 ` [PATCH net-next 12/12] net: airoha: Add AN7583 SoC support 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=20251015-an7583-eth-support-v1-10-064855f05923@kernel.org \
--to=lorenzo@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).