diff mbox series

[net-next] net: lan966x: Extend lan966x with RGMII support

Message ID 20220901122346.245786-1-horatiu.vultur@microchip.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: lan966x: Extend lan966x with RGMII support | 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 success CCed 8 of 8 maintainers
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, 23 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Horatiu Vultur Sept. 1, 2022, 12:23 p.m. UTC
Extend lan966x with RGMII support. The MAC supports all RGMII_* modes.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/ethernet/microchip/lan966x/lan966x_main.c    | 8 ++++++++
 drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c | 3 +++
 2 files changed, 11 insertions(+)

Comments

Maxime Chevallier Sept. 1, 2022, 3:38 p.m. UTC | #1
Hello Horatiu,

On Thu, 1 Sep 2022 14:23:46 +0200
Horatiu Vultur <horatiu.vultur@microchip.com> wrote:

> Extend lan966x with RGMII support. The MAC supports all RGMII_* modes.
> 
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---
>  drivers/net/ethernet/microchip/lan966x/lan966x_main.c    | 8 ++++++++
>  drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c | 3 +++
>  2 files changed, 11 insertions(+)
> 
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c index
> 1d6e3b641b2e..e2d250ed976b 100644 ---
> a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c +++
> b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c @@ -772,6
> +772,14 @@ static int lan966x_probe_port(struct lan966x *lan966x, u32
> p, __set_bit(PHY_INTERFACE_MODE_MII,
>  		  port->phylink_config.supported_interfaces);
> +	__set_bit(PHY_INTERFACE_MODE_RGMII,
> +		  port->phylink_config.supported_interfaces);
> +	__set_bit(PHY_INTERFACE_MODE_RGMII_ID,
> +		  port->phylink_config.supported_interfaces);
> +	__set_bit(PHY_INTERFACE_MODE_RGMII_RXID,
> +		  port->phylink_config.supported_interfaces);
> +	__set_bit(PHY_INTERFACE_MODE_RGMII_TXID,
> +		  port->phylink_config.supported_interfaces);

Instead of defining each individual variant, you can use :

	phy_interface_set_rgmii(port->phylink_config.supported_interfaces);

>  	__set_bit(PHY_INTERFACE_MODE_GMII,
>  		  port->phylink_config.supported_interfaces);
>  	__set_bit(PHY_INTERFACE_MODE_SGMII,
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
> b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c index
> 38a7e95d69b4..fb6aee509656 100644 ---
> a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c +++
> b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c @@ -59,6
> +59,9 @@ static void lan966x_phylink_mac_link_up(struct
> phylink_config *config, port_config->pause |= tx_pause ? MLO_PAUSE_TX
> : 0; port_config->pause |= rx_pause ? MLO_PAUSE_RX : 0; 
> +	if (phy_interface_mode_is_rgmii(interface))
> +		phy_set_speed(port->serdes, speed);
> +
>  	lan966x_port_config_up(port);
>  }
>  

Best regards,

Maxime
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 1d6e3b641b2e..e2d250ed976b 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -772,6 +772,14 @@  static int lan966x_probe_port(struct lan966x *lan966x, u32 p,
 
 	__set_bit(PHY_INTERFACE_MODE_MII,
 		  port->phylink_config.supported_interfaces);
+	__set_bit(PHY_INTERFACE_MODE_RGMII,
+		  port->phylink_config.supported_interfaces);
+	__set_bit(PHY_INTERFACE_MODE_RGMII_ID,
+		  port->phylink_config.supported_interfaces);
+	__set_bit(PHY_INTERFACE_MODE_RGMII_RXID,
+		  port->phylink_config.supported_interfaces);
+	__set_bit(PHY_INTERFACE_MODE_RGMII_TXID,
+		  port->phylink_config.supported_interfaces);
 	__set_bit(PHY_INTERFACE_MODE_GMII,
 		  port->phylink_config.supported_interfaces);
 	__set_bit(PHY_INTERFACE_MODE_SGMII,
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
index 38a7e95d69b4..fb6aee509656 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_phylink.c
@@ -59,6 +59,9 @@  static void lan966x_phylink_mac_link_up(struct phylink_config *config,
 	port_config->pause |= tx_pause ? MLO_PAUSE_TX : 0;
 	port_config->pause |= rx_pause ? MLO_PAUSE_RX : 0;
 
+	if (phy_interface_mode_is_rgmii(interface))
+		phy_set_speed(port->serdes, speed);
+
 	lan966x_port_config_up(port);
 }