mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed for mv88e6250
@ 2022-03-21 13:16 Steffen Trumtrar
  2022-03-21 13:16 ` [PATCH 2/2] net: phy: mv88e6xxx: add support " Steffen Trumtrar
  2022-03-28  8:29 ` [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed " Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Steffen Trumtrar @ 2022-03-21 13:16 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

From: Steffen Trumtrar <s.trumtrar@pengutronix.de>

barebox port of the linux patch:

  commit a528e5be6b5f8026eda029b03340dcfa23c70824
  Author: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
  Date:   Tue Jun 4 07:34:29 2019 +0000

      net: dsa: mv88e6xxx: implement port_set_speed for mv88e6250

      The data sheet also mentions the possibility of selecting 200 Mbps for
      the MII ports (ports 5 and 6) by setting the ForceSpd field to
      0x2 (aka MV88E6065_PORT_MAC_CTL_SPEED_200). However, there's a note
      that "actual speed is determined by bit 8 above", and flipping back a
      page, one finds that bits 13:8 are reserved...

      So without further information on what bit 8 means, let's stick to
      supporting just 10 and 100 Mbps on all ports.

      Reviewed-by: Andrew Lunn <andrew@lunn.ch>
      Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/net/phy/mv88e6xxx/port.c | 12 ++++++++++++
 drivers/net/phy/mv88e6xxx/port.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/net/phy/mv88e6xxx/port.c b/drivers/net/phy/mv88e6xxx/port.c
index ba2b03e18d..95542d4eec 100644
--- a/drivers/net/phy/mv88e6xxx/port.c
+++ b/drivers/net/phy/mv88e6xxx/port.c
@@ -277,6 +277,18 @@ int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
 	return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
 }
 
+/* Support 10, 100 (e.g. 88E6250 family) */
+int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
+{
+	if (speed == SPEED_MAX)
+		speed = 100;
+
+	if (speed > 100)
+		return -EOPNOTSUPP;
+
+	return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
+}
+
 /* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */
 int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
 {
diff --git a/drivers/net/phy/mv88e6xxx/port.h b/drivers/net/phy/mv88e6xxx/port.h
index f47f392b87..f5cf72932a 100644
--- a/drivers/net/phy/mv88e6xxx/port.h
+++ b/drivers/net/phy/mv88e6xxx/port.h
@@ -121,6 +121,7 @@ int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link);
 int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup);
 int mv88e6065_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
+int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
 int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] net: phy: mv88e6xxx: add support for mv88e6250
  2022-03-21 13:16 [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed for mv88e6250 Steffen Trumtrar
@ 2022-03-21 13:16 ` Steffen Trumtrar
  2022-03-28  8:29 ` [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed " Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Steffen Trumtrar @ 2022-03-21 13:16 UTC (permalink / raw)
  To: barebox; +Cc: Steffen Trumtrar

From: Steffen Trumtrar <s.trumtrar@pengutronix.de>

barebox port of the linux patch:

  commit 1f71836f5d96e4c87fad16db86d324bee47e1d30
  Author: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
  Date:   Tue Jun 4 07:34:32 2019 +0000

      net: dsa: mv88e6xxx: add support for mv88e6250

      This adds support for the Marvell 88E6250. I've checked that each
      member in the ops-structure makes sense, and basic switchdev
      functionality works fine.

      It uses the new dual_chip option, and since its port registers start
      at SMI address 0x08 or 0x18 (i.e., always sw_addr + 0x08), we need to
      introduce a new compatible string in order for the auto-identification
      in mv88e6xxx_detect() to work.

      The chip has four per port 16-bits statistics registers, two of which
      correspond to the existing "sw_in_filtered" and "sw_out_filtered" (but
      at offsets 0x13 and 0x10 rather than 0x12 and 0x13, because why should
      this be easy...). Wiring up those four statistics seems to require
      introducing a STATS_TYPE_PORT_6250 bit or similar, which seems a tad
      ugly, so for now this just allows access to the STATS_TYPE_BANK0 ones.

      The chip does have ptp support, and the existing
      mv88e6352_{gpio,avb,ptp}_ops at first glance seem like they would work
      out-of-the-box, but for simplicity (and lack of testing) I'm eliding
      this.

      Reviewed-by: Andrew Lunn <andrew@lunn.ch>
      Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
      Signed-off-by: David S. Miller <davem@davemloft.net>

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 drivers/net/phy/mv88e6xxx/chip.c | 28 ++++++++++++++++++++++++++++
 drivers/net/phy/mv88e6xxx/chip.h |  1 +
 drivers/net/phy/mv88e6xxx/port.h |  1 +
 3 files changed, 30 insertions(+)

diff --git a/drivers/net/phy/mv88e6xxx/chip.c b/drivers/net/phy/mv88e6xxx/chip.c
index ae59d134e7..a7d707095b 100644
--- a/drivers/net/phy/mv88e6xxx/chip.c
+++ b/drivers/net/phy/mv88e6xxx/chip.c
@@ -36,6 +36,7 @@ enum mv88e6xxx_model {
 	MV88E6190X,
 	MV88E6191,
 	MV88E6240,
+	MV88E6250,
 	MV88E6290,
 	MV88E6320,
 	MV88E6321,
@@ -224,6 +225,18 @@ static const struct mv88e6xxx_ops mv88e6240_ops = {
 	.port_link_state = mv88e6352_port_link_state,
 };
 
+static const struct mv88e6xxx_ops mv88e6250_ops = {
+	/* MV88E6XXX_FAMILY_6250 */
+	.get_eeprom = mv88e6xxx_g2_get_eeprom16,
+	.set_eeprom = mv88e6xxx_g2_set_eeprom16,
+	.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 = mv88e6250_port_set_speed,
+};
+
 static const struct mv88e6xxx_ops mv88e6290_ops = {
 	/* MV88E6XXX_FAMILY_6390 */
 	.get_eeprom = mv88e6xxx_g2_get_eeprom8,
@@ -525,6 +538,17 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = {
 		.ops = &mv88e6240_ops,
 	},
 
+	[MV88E6250] = {
+		.prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6250,
+		.family = MV88E6XXX_FAMILY_6250,
+		.name = "Marvell 88E6250",
+		.num_ports = 7,
+		.port_base_addr = 0x08,
+		.global1_addr = 0xf,
+		.global2_addr = 0x7,
+		.ops = &mv88e6250_ops,
+	},
+
 	[MV88E6290] = {
 		.prod_num = MV88E6XXX_PORT_SWITCH_ID_PROD_6290,
 		.family = MV88E6XXX_FAMILY_6390,
@@ -931,6 +955,10 @@ static const struct of_device_id mv88e6xxx_of_match[] = {
 		.compatible = "marvell,mv88e6085",
 		.data = &mv88e6xxx_table[MV88E6085],
 	},
+	{
+		.compatible = "marvell,mv88e6250",
+		.data = &mv88e6xxx_table[MV88E6250],
+	},
 	{
 		.compatible = "marvell,mv88e6190",
 		.data = &mv88e6xxx_table[MV88E6190],
diff --git a/drivers/net/phy/mv88e6xxx/chip.h b/drivers/net/phy/mv88e6xxx/chip.h
index 12037ca95c..30fdac9a9f 100644
--- a/drivers/net/phy/mv88e6xxx/chip.h
+++ b/drivers/net/phy/mv88e6xxx/chip.h
@@ -19,6 +19,7 @@ enum mv88e6xxx_family {
 	MV88E6XXX_FAMILY_6165,	/* 6123 6161 6165 */
 	MV88E6XXX_FAMILY_6185,	/* 6108 6121 6122 6131 6152 6155 6182 6185 */
 	MV88E6XXX_FAMILY_6320,	/* 6320 6321 */
+	MV88E6XXX_FAMILY_6250,	/* 6250 */
 	MV88E6XXX_FAMILY_6341,	/* 6141 6341 */
 	MV88E6XXX_FAMILY_6351,	/* 6171 6175 6350 6351 */
 	MV88E6XXX_FAMILY_6352,	/* 6172 6176 6240 6352 */
diff --git a/drivers/net/phy/mv88e6xxx/port.h b/drivers/net/phy/mv88e6xxx/port.h
index f5cf72932a..4bc5072948 100644
--- a/drivers/net/phy/mv88e6xxx/port.h
+++ b/drivers/net/phy/mv88e6xxx/port.h
@@ -90,6 +90,7 @@
 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6191	0x1910
 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6185	0x1a70
 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6240	0x2400
+#define MV88E6XXX_PORT_SWITCH_ID_PROD_6250	0x2500
 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6290	0x2900
 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6321	0x3100
 #define MV88E6XXX_PORT_SWITCH_ID_PROD_6141	0x3400
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed for mv88e6250
  2022-03-21 13:16 [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed for mv88e6250 Steffen Trumtrar
  2022-03-21 13:16 ` [PATCH 2/2] net: phy: mv88e6xxx: add support " Steffen Trumtrar
@ 2022-03-28  8:29 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2022-03-28  8:29 UTC (permalink / raw)
  To: Steffen Trumtrar; +Cc: barebox, Steffen Trumtrar

On Mon, Mar 21, 2022 at 02:16:31PM +0100, Steffen Trumtrar wrote:
> From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> 
> barebox port of the linux patch:
> 
>   commit a528e5be6b5f8026eda029b03340dcfa23c70824
>   Author: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
>   Date:   Tue Jun 4 07:34:29 2019 +0000
> 
>       net: dsa: mv88e6xxx: implement port_set_speed for mv88e6250
> 
>       The data sheet also mentions the possibility of selecting 200 Mbps for
>       the MII ports (ports 5 and 6) by setting the ForceSpd field to
>       0x2 (aka MV88E6065_PORT_MAC_CTL_SPEED_200). However, there's a note
>       that "actual speed is determined by bit 8 above", and flipping back a
>       page, one finds that bits 13:8 are reserved...
> 
>       So without further information on what bit 8 means, let's stick to
>       supporting just 10 and 100 Mbps on all ports.
> 
>       Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>       Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
>       Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
>  drivers/net/phy/mv88e6xxx/port.c | 12 ++++++++++++
>  drivers/net/phy/mv88e6xxx/port.h |  1 +
>  2 files changed, 13 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/net/phy/mv88e6xxx/port.c b/drivers/net/phy/mv88e6xxx/port.c
> index ba2b03e18d..95542d4eec 100644
> --- a/drivers/net/phy/mv88e6xxx/port.c
> +++ b/drivers/net/phy/mv88e6xxx/port.c
> @@ -277,6 +277,18 @@ int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
>  	return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
>  }
>  
> +/* Support 10, 100 (e.g. 88E6250 family) */
> +int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
> +{
> +	if (speed == SPEED_MAX)
> +		speed = 100;
> +
> +	if (speed > 100)
> +		return -EOPNOTSUPP;
> +
> +	return mv88e6xxx_port_set_speed(chip, port, speed, false, false);
> +}
> +
>  /* Support 10, 100, 200, 1000 Mbps (e.g. 88E6352 family) */
>  int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed)
>  {
> diff --git a/drivers/net/phy/mv88e6xxx/port.h b/drivers/net/phy/mv88e6xxx/port.h
> index f47f392b87..f5cf72932a 100644
> --- a/drivers/net/phy/mv88e6xxx/port.h
> +++ b/drivers/net/phy/mv88e6xxx/port.h
> @@ -121,6 +121,7 @@ int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link);
>  int mv88e6xxx_port_set_duplex(struct mv88e6xxx_chip *chip, int port, int dup);
>  int mv88e6065_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
>  int mv88e6185_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
> +int mv88e6250_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
>  int mv88e6352_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
>  int mv88e6390_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
>  int mv88e6390x_port_set_speed(struct mv88e6xxx_chip *chip, int port, int speed);
> -- 
> 2.30.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-28  8:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 13:16 [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed for mv88e6250 Steffen Trumtrar
2022-03-21 13:16 ` [PATCH 2/2] net: phy: mv88e6xxx: add support " Steffen Trumtrar
2022-03-28  8:29 ` [PATCH 1/2] net: phy: mv88e6xxx: implement port_set_speed " Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox