diff mbox series

[v2,net-next] net: dsa: mv88e6xxx: Add .port_set_rgmii_delay to 88E6320

Message ID 20221028135148.105691-1-festevam@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [v2,net-next] net: dsa: mv88e6xxx: Add .port_set_rgmii_delay to 88E6320 | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 4 maintainers not CCed: vivien.didelot@gmail.com edumazet@google.com f.fainelli@gmail.com pabeni@redhat.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 30 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Fabio Estevam Oct. 28, 2022, 1:51 p.m. UTC
From: Steffen Bätz <steffen@innosonix.de>

Currently, the port_set_rgmii_delay hook is missing for the 88E6320
family, which causes failure to retrieve an IP address via DHCP.

Add mv88e6320_port_set_rgmii_delay() that allows applying the RGMII
delay for ports 2, 5 and 6, which are the ports only that can be used
in RGMII mode.

Tested on a i.MX8MN board connected to an 88E6320 switch.

This change also applies safely to the 88E6321 variant.

The only difference between 88E6320 versus 88E6321 is temperature grade
and pinout.

They share exactly the same MDIO register map for ports 2,5 an 6, which
are the only ports that can be used in RGMII mode. 

Signed-off-by: Steffen Bätz <steffen@innosonix.de>
Signed-off-by: Fabio Estevam <festevam@denx.de>
---
Changes since v1:
- Improve the commit log by saying that change is also
valid for the 88E631 chip. (Andrew).

 drivers/net/dsa/mv88e6xxx/chip.c | 1 +
 drivers/net/dsa/mv88e6xxx/port.c | 9 +++++++++
 drivers/net/dsa/mv88e6xxx/port.h | 2 ++
 3 files changed, 12 insertions(+)

Comments

Andrew Lunn Oct. 28, 2022, 3:58 p.m. UTC | #1
On Fri, Oct 28, 2022 at 10:51:48AM -0300, Fabio Estevam wrote:
> From: Steffen Bätz <steffen@innosonix.de>
> 
> Currently, the port_set_rgmii_delay hook is missing for the 88E6320
> family, which causes failure to retrieve an IP address via DHCP.
> 
> Add mv88e6320_port_set_rgmii_delay() that allows applying the RGMII
> delay for ports 2, 5 and 6, which are the ports only that can be used
> in RGMII mode.
> 
> Tested on a i.MX8MN board connected to an 88E6320 switch.
> 
> This change also applies safely to the 88E6321 variant.

> @@ -5029,6 +5029,7 @@ static const struct mv88e6xxx_ops mv88e6320_ops = {
>  	.phy_write = mv88e6xxx_g2_smi_phy_write,
>  	.port_set_link = mv88e6xxx_port_set_link,
>  	.port_sync_link = mv88e6xxx_port_sync_link,
> +	.port_set_rgmii_delay = mv88e6320_port_set_rgmii_delay,
>  	.port_set_speed_duplex = mv88e6185_port_set_speed_duplex,
>  	.port_tag_remap = mv88e6095_port_tag_remap,
>  	.port_set_frame_mode = mv88e6351_port_set_frame_mode,

You say it is safe, but then don't actually add it to mv88e6321_ops ?

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 2479be3a1e35..dc7cbf48bda5 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -5029,6 +5029,7 @@  static const struct mv88e6xxx_ops mv88e6320_ops = {
 	.phy_write = mv88e6xxx_g2_smi_phy_write,
 	.port_set_link = mv88e6xxx_port_set_link,
 	.port_sync_link = mv88e6xxx_port_sync_link,
+	.port_set_rgmii_delay = mv88e6320_port_set_rgmii_delay,
 	.port_set_speed_duplex = mv88e6185_port_set_speed_duplex,
 	.port_tag_remap = mv88e6095_port_tag_remap,
 	.port_set_frame_mode = mv88e6351_port_set_frame_mode,
diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c
index 5c4195c635b0..f79cf716c541 100644
--- a/drivers/net/dsa/mv88e6xxx/port.c
+++ b/drivers/net/dsa/mv88e6xxx/port.c
@@ -133,6 +133,15 @@  int mv88e6390_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port,
 	return mv88e6xxx_port_set_rgmii_delay(chip, port, mode);
 }
 
+int mv88e6320_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port,
+				   phy_interface_t mode)
+{
+	if (port != 2 && port != 5 && port != 6)
+		return -EOPNOTSUPP;
+
+	return mv88e6xxx_port_set_rgmii_delay(chip, port, mode);
+}
+
 int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link)
 {
 	u16 reg;
diff --git a/drivers/net/dsa/mv88e6xxx/port.h b/drivers/net/dsa/mv88e6xxx/port.h
index cb04243f37c1..fe8f2085bb0b 100644
--- a/drivers/net/dsa/mv88e6xxx/port.h
+++ b/drivers/net/dsa/mv88e6xxx/port.h
@@ -336,6 +336,8 @@  int mv88e6352_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port,
 				   phy_interface_t mode);
 int mv88e6390_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port,
 				   phy_interface_t mode);
+int mv88e6320_port_set_rgmii_delay(struct mv88e6xxx_chip *chip, int port,
+				   phy_interface_t mode);
 
 int mv88e6xxx_port_set_link(struct mv88e6xxx_chip *chip, int port, int link);