Skip to contentSkip to conversation

Add support for EN7581 to mt7530 driver

PATCH In review Lorenzo Bianconi 4 participants 8 messages Aug 1, 2024 – Aug 5, 2024

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

v2 cover Add support for EN7581 to mt7530 driver

Add EN7581 support to MT7530 DSA driver.

Changes since v1:
- get rid of mac_port_config callback for EN7581
- introduce en7581_mac_port_get_caps callback
- introduce MT753X_FORCE_MODE(id) macro
- fix compatible property in mt7530.yaml

Lorenzo Bianconi (2):
dt-bindings: net: dsa: mediatek,mt7530: Add airoha,en7581-switch
net: dsa: mt7530: Add EN7581 support

 .../bindings/net/dsa/mediatek,mt7530.yaml     |  8 ++-
 drivers/net/dsa/mt7530-mmio.c                 |  1 +
 drivers/net/dsa/mt7530.c                      | 49 ++++++++++++++++---
 drivers/net/dsa/mt7530.h                      | 20 ++++++--
 4 files changed, 66 insertions(+), 12 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH v2 1/2 dt-bindings: net: dsa: mediatek,mt7530: Add airoha,en7581-switch

Add documentation for the built-in switch which can be found in the Airoha EN7581 SoC.

---
 .../devicetree/bindings/net/dsa/mediatek,mt7530.yaml      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/net/dsa/mediatek,mt7530.yaml +7 -1
index 7e405ad96eb2..ea979bcae1d6 100644
@@ -92,6 +92,10 @@ properties:
           Built-in switch of the MT7988 SoC
         const: mediatek,mt7988-switch
 
+      - description:
+          Built-in switch of the Airoha EN7581 SoC
+        const: airoha,en7581-switch
+
   reg:
     maxItems: 1
 
@@ -284,7 +288,9 @@ allOf:
   - if:
       properties:
         compatible:
-          const: mediatek,mt7988-switch
+          enum:
+            - mediatek,mt7988-switch
+            - airoha,en7581-switch
     then:
       $ref: "#/$defs/mt7530-dsa-port"
       properties:
Signature · 1 line
2.45.2
#4 lore raw

PATCH v2 2/2 net: dsa: mt7530: Add EN7581 support

In reply to Lorenzo Bianconi

Introduce support for the DSA built-in switch available on the EN7581 development board. EN7581 support is similar to MT7988 one except it requires to set MT7530_FORCE_MODE bit in MT753X_PMCR_P register for on cpu port.

---
 drivers/net/dsa/mt7530-mmio.c |  1 +
 drivers/net/dsa/mt7530.c      | 49 ++++++++++++++++++++++++++++++-----
 drivers/net/dsa/mt7530.h      | 20 ++++++++++----
 3 files changed, 59 insertions(+), 11 deletions(-)
drivers/net/dsa/mt7530-mmio.c +1 -0
index b74a230a3f13..10dc49961f15 100644
@@ -11,6 +11,7 @@
 #include "mt7530.h"
 
 static const struct of_device_id mt7988_of_match[] = {
+	{ .compatible = "airoha,en7581-switch", .data = &mt753x_table[ID_EN7581], },
 	{ .compatible = "mediatek,mt7988-switch", .data = &mt753x_table[ID_MT7988], },
 	{ /* sentinel */ },
 };
drivers/net/dsa/mt7530.c +43 -6

85 lines not on this page · raw message

drivers/net/dsa/mt7530.h +15 -5
index 28592123070b..6ad33a9f6b1d 100644
@@ -19,6 +19,7 @@ enum mt753x_id {
 	ID_MT7621 = 1,
 	ID_MT7531 = 2,
 	ID_MT7988 = 3,
+	ID_EN7581 = 4,
 };
 
 #define	NUM_TRGMII_CTRL			5
@@ -64,25 +65,30 @@ enum mt753x_id {
 #define  MT7531_CPU_PMAP(x)		FIELD_PREP(MT7531_CPU_PMAP_MASK, x)
 
 #define MT753X_MIRROR_REG(id)		((id == ID_MT7531 || \
-					  id == ID_MT7988) ? \
+					  id == ID_MT7988 || \
+					  id == ID_EN7581) ? \
 					 MT7531_CFC : MT753X_MFC)
 
 #define MT753X_MIRROR_EN(id)		((id == ID_MT7531 || \
-					  id == ID_MT7988) ? \
+					  id == ID_MT7988 || \
+					  id == ID_EN7581) ? \
 					 MT7531_MIRROR_EN : MT7530_MIRROR_EN)
 
 #define MT753X_MIRROR_PORT_MASK(id)	((id == ID_MT7531 || \
-					  id == ID_MT7988) ? \
+					  id == ID_MT7988 || \
+					  id == ID_EN7581) ? \
 					 MT7531_MIRROR_PORT_MASK : \
 					 MT7530_MIRROR_PORT_MASK)
 
 #define MT753X_MIRROR_PORT_GET(id, val)	((id == ID_MT7531 || \
-					  id == ID_MT7988) ? \
+					  id == ID_MT7988 || \
+					  id == ID_EN7581) ? \
 					 MT7531_MIRROR_PORT_GET(val) : \
 					 MT7530_MIRROR_PORT_GET(val))
 
 #define MT753X_MIRROR_PORT_SET(id, val)	((id == ID_MT7531 || \
-					  id == ID_MT7988) ? \
+					  id == ID_MT7988 || \
+					  id == ID_EN7581) ? \
 					 MT7531_MIRROR_PORT_SET(val) : \
 					 MT7530_MIRROR_PORT_SET(val))
 
@@ -355,6 +361,10 @@ enum mt7530_vlan_port_acc_frm {
 					 MT7531_FORCE_MODE_TX_FC | \
 					 MT7531_FORCE_MODE_EEE100 | \
 					 MT7531_FORCE_MODE_EEE1G)
+#define  MT753X_FORCE_MODE(id)		((id == ID_MT7531 || \
+					  id == ID_MT7988) ? \
+					 MT7531_FORCE_MODE_MASK : \
+					 MT7530_FORCE_MODE)
 #define  PMCR_LINK_SETTINGS_MASK	(PMCR_MAC_TX_EN | PMCR_MAC_RX_EN | \
 					 PMCR_FORCE_EEE1G | \
 					 PMCR_FORCE_EEE100 | \
Signature · 1 line
2.45.2
Reviewed-by on v2 2/2
#5 lore raw

Re: [PATCH v2 net-next 2/2] net: dsa: mt7530: Add EN7581 support

Quoted 7 lines · Lorenzo Bianconi

Introduce support for the DSA built-in switch available on the EN7581 development board. EN7581 support is similar to MT7988 one except it requires to set MT7530_FORCE_MODE bit in MT753X_PMCR_P register for on cpu port.

I'm interested in getting my hands on this development board.

Arınç

Reviewed-by on v2 2/2
#6 lore raw

Re: [PATCH v2 net-next 2/2] net: dsa: mt7530: Add EN7581 support

In reply to Lorenzo Bianconi
Quoted 7 lines · Lorenzo Bianconi

Introduce support for the DSA built-in switch available on the EN7581 development board. EN7581 support is similar to MT7988 one except it requires to set MT7530_FORCE_MODE bit in MT753X_PMCR_P register for on cpu port.

Signature · 1 line
Florian
maintainer
#7 lore raw
In reply to Lorenzo Bianconi
Quoted 7 lines · On Thu, 1 Aug 2024 09:35:10 +0200 Lorenzo Bianconi wrote:

Add EN7581 support to MT7530 DSA driver.

Changes since v1:
- get rid of mac_port_config callback for EN7581
- introduce en7581_mac_port_get_caps callback
- introduce MT753X_FORCE_MODE(id) macro
- fix compatible property in mt7530.yaml

Looks like this got applied as 3608d6aca5e7 ("Merge branch 'dsa-en7581' into main"). I think due to some script misbehavior it has the wrong cover letter on the merge, but the code matches this series.

Thanks!