Skip to contentSkip to conversation

Add support for the ethernet switch on the ESPRESSObin

PATCH In review Romain Perier 4 participants 5 messages Dec 21, 2016 – Jan 5, 2017 1 message not in the archive

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

v4 cover Add support for the ethernet switch on the ESPRESSObin

This set of patches adds support for the Marvell ethernet switch 88E6341. It also add the devicetree definition of this switch to the DT board.

Romain Perier (2):
net: dsa: mv88e6xxx: Don't forbid MDIO I/Os for PHY addr >=
num_of_ports
net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341/88E6141

 drivers/net/dsa/mv88e6xxx/chip.c      | 48 ++++++++++++++++++++++++++++++-----
 drivers/net/dsa/mv88e6xxx/mv88e6xxx.h |  4 ++-
 2 files changed, 45 insertions(+), 7 deletions(-)
Signature · 3 lines
Note: As requested by Gregory, I have removed the patch for the DT (already merged).

2.9.3
#1 lore raw

PATCH v4 1/2 net: dsa: mv88e6xxx: Don't forbid MDIO I/Os for PHY addr >= num_of_ports

Some Marvell ethernet switches have internal ethernet transceivers with hardcoded phy addresses. These addresses can be greater than the number of ports or its value might be different than the associated port number. This is for example the case for MV88E6341 that has 6 ports and internal Port 1 to Port4 PHYs mapped at SMI addresses from 0x11 to 0x14.

This commits fixes the issue by removing the condition in MDIO callbacks.

---

Changes in v4:
- Fixed typo in the commit log

Changes in v2:
- Added tag "Reviewed-by" by Andrew
- Fixed typo in the commit log

 drivers/net/dsa/mv88e6xxx/chip.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/net/dsa/mv88e6xxx/chip.c +0 -6
index b5f0e1e..76d944e 100644
@@ -2881,9 +2881,6 @@ static int mv88e6xxx_mdio_read(struct mii_bus *bus, int phy, int reg)
 	u16 val;
 	int err;
 
-	if (phy >= mv88e6xxx_num_ports(chip))
-		return 0xffff;
-
 	mutex_lock(&chip->reg_lock);
 	err = mv88e6xxx_phy_read(chip, phy, reg, &val);
 	mutex_unlock(&chip->reg_lock);
@@ -2896,9 +2893,6 @@ static int mv88e6xxx_mdio_write(struct mii_bus *bus, int phy, int reg, u16 val)
 	struct mv88e6xxx_chip *chip = bus->priv;
 	int err;
 
-	if (phy >= mv88e6xxx_num_ports(chip))
-		return 0xffff;
-
 	mutex_lock(&chip->reg_lock);
 	err = mv88e6xxx_phy_write(chip, phy, reg, val);
 	mutex_unlock(&chip->reg_lock);
Signature · 1 line
2.9.3
#2 lore raw

PATCH v4 2/2 net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341/88E6141

In reply to Romain Perier

The Marvell 88E6341 device is single-chip, 6-port ethernet switch with four integrated 10/100/1000Mbps ethernet transceivers and one high speed SerDes interfaces. It is compatible with switches of family 88E6352.

This commit adds basic support for this switch by describing its capabilities to the driver.

---

Changes in v3:
- Added tag "Reviewed-by" by Andrew

Changes in v2:
- Add a dedicated data structure for the operations of the 88E6341
- Re-ordered PORT_SWITCH_ID_PROD_NUM_6341 in alphabetic order with other macros

 drivers/net/dsa/mv88e6xxx/chip.c      | 42 +++++++++++++++++++++++++++++++++++
 drivers/net/dsa/mv88e6xxx/mv88e6xxx.h |  4 +++-
 2 files changed, 45 insertions(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx/chip.c +42 -0
index 76d944e..5e97dc4 100644
@@ -3625,6 +3625,34 @@ static const struct mv88e6xxx_ops mv88e6321_ops = {
 	.reset = mv88e6352_g1_reset,
 };
 
+static const struct mv88e6xxx_ops mv88e6341_ops = {
+	/* MV88E6XXX_FAMILY_6352 */
+	.get_eeprom = mv88e6xxx_g2_get_eeprom16,
+	.set_eeprom = mv88e6xxx_g2_set_eeprom16,
+	.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
+	.phy_read = mv88e6xxx_g2_smi_phy_read,
+	.phy_write = mv88e6xxx_g2_smi_phy_write,
+	.port_set_link = mv88e6xxx_port_set_link,
+	.port_set_duplex = mv88e6xxx_port_set_duplex,
+	.port_set_rgmii_delay = mv88e6352_port_set_rgmii_delay,
+	.port_set_speed = mv88e6352_port_set_speed,
+	.port_tag_remap = mv88e6095_port_tag_remap,
+	.port_set_frame_mode = mv88e6351_port_set_frame_mode,
+	.port_set_egress_unknowns = mv88e6351_port_set_egress_unknowns,
+	.port_set_ether_type = mv88e6351_port_set_ether_type,
+	.port_jumbo_config = mv88e6165_port_jumbo_config,
+	.port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting,
+	.port_pause_config = mv88e6097_port_pause_config,
+	.stats_snapshot = mv88e6320_g1_stats_snapshot,
+	.stats_get_sset_count = mv88e6095_stats_get_sset_count,
+	.stats_get_strings = mv88e6095_stats_get_strings,
+	.stats_get_stats = mv88e6095_stats_get_stats,
+	.g1_set_cpu_port = mv88e6095_g1_set_cpu_port,
+	.g1_set_egress_port = mv88e6095_g1_set_egress_port,
+	.mgmt_rsvd2cpu = mv88e6095_g2_mgmt_rsvd2cpu,
+	.reset = mv88e6352_g1_reset,
+};
+
 static const struct mv88e6xxx_ops mv88e6350_ops = {
 	/* MV88E6XXX_FAMILY_6351 */
 	.set_switch_mac = mv88e6xxx_g2_set_switch_mac,
@@ -4086,6 +4114,20 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.ops = &mv88e6321_ops,
 	},
 
+	[MV88E6341] = {
+		.prod_num = PORT_SWITCH_ID_PROD_NUM_6341,
+		.family = MV88E6XXX_FAMILY_6352,
+		.name = "Marvell 88E6341",
+		.num_databases = 4096,
+		.num_ports = 6,
+		.port_base_addr = 0x10,
+		.global1_addr = 0x1b,
+		.age_time_coeff = 15000,
+		.tag_protocol = DSA_TAG_PROTO_EDSA,
+		.flags = MV88E6XXX_FLAGS_FAMILY_6352,
+		.ops = &mv88e6341_ops,
+	},
+
 	[MV88E6350] = {
 		.prod_num = PORT_SWITCH_ID_PROD_NUM_6350,
 		.family = MV88E6XXX_FAMILY_6351,
drivers/net/dsa/mv88e6xxx/mv88e6xxx.h +3 -1
index af54bae..cb55fdb 100644
@@ -100,6 +100,7 @@
 #define PORT_SWITCH_ID_PROD_NUM_6240	0x240
 #define PORT_SWITCH_ID_PROD_NUM_6290	0x290
 #define PORT_SWITCH_ID_PROD_NUM_6321	0x310
+#define PORT_SWITCH_ID_PROD_NUM_6341	0x340
 #define PORT_SWITCH_ID_PROD_NUM_6352	0x352
 #define PORT_SWITCH_ID_PROD_NUM_6350	0x371
 #define PORT_SWITCH_ID_PROD_NUM_6351	0x375
@@ -432,6 +433,7 @@ enum mv88e6xxx_model {
 	MV88E6290,
 	MV88E6320,
 	MV88E6321,
+	MV88E6341,
 	MV88E6350,
 	MV88E6351,
 	MV88E6352,
@@ -448,7 +450,7 @@ enum mv88e6xxx_family {
 	MV88E6XXX_FAMILY_6185,	/* 6108 6121 6122 6131 6152 6155 6182 6185 */
 	MV88E6XXX_FAMILY_6320,	/* 6320 6321 */
 	MV88E6XXX_FAMILY_6351,	/* 6171 6175 6350 6351 */
-	MV88E6XXX_FAMILY_6352,	/* 6172 6176 6240 6352 */
+	MV88E6XXX_FAMILY_6352,	/* 6172 6176 6240 6341 6352 */
 	MV88E6XXX_FAMILY_6390,  /* 6190 6190X 6191 6290 6390 6390X */
 };
 
Signature · 1 line
2.9.3

A message that is not in the archive (sent off-list or not yet received): 20161221125734.1034-1-romain.perier-wi1+55ScJUtKEb57/[email protected]

#4 lore raw

Hi David,

Quoted 2 lines · Romain Perier

This set of patches adds support for the Marvell ethernet switch 88E6341. It also add the devicetree definition of this switch to the DT board.

The forth version of this series had been sent while the net-next merge window was closed so I think it was missed.

Do you want that we send it again on the netdev mainling list?

Thanks,

Gregory

Quoted 16 lines

Romain Perier (2):
net: dsa: mv88e6xxx: Don't forbid MDIO I/Os for PHY addr >=
num_of_ports
net: dsa: mv88e6xxx: Add support for ethernet switch 88E6341/88E6141

 drivers/net/dsa/mv88e6xxx/chip.c      | 48 ++++++++++++++++++++++++++++++-----
 drivers/net/dsa/mv88e6xxx/mv88e6xxx.h |  4 ++-
 2 files changed, 45 insertions(+), 7 deletions(-)
Signature · 3 lines
Note: As requested by Gregory, I have removed the patch for the DT (already merged).

2.9.3
Signature · 4 lines
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
maintainer
#5 lore raw
Quoted 9 lines · Gregory CLEMENT

Hi David,

Quoted 2 lines · Romain Perier

This set of patches adds support for the Marvell ethernet switch 88E6341. It also add the devicetree definition of this switch to the DT board.

The forth version of this series had been sent while the net-next merge window was closed so I think it was missed.

Having done a bit more research, i'm pretty sure the second patch is wrong. The 88E6341 is not compatible with the 6352, it is a different family. It might be more like the 6390. So supporting it will need a side-by-side comparison of the datasheet against the 6352 and the 6390, and the correct selection of the ops.

Andrew