[net-next,0/4] Add CPSWxG SGMII support for J7200 and J721E

Message ID 20230321111958.2800005-1-s-vadapalli@ti.com
Headers
Series Add CPSWxG SGMII support for J7200 and J721E |

Message

Siddharth Vadapalli March 21, 2023, 11:19 a.m. UTC
  Hello,

This series adds support to configure the CPSW Ethernet Switch in SGMII
mode, using the am65-cpsw-nuss driver. SGMII mode is supported by the
CPSWxG instances on TI's J7200 and J721E SoCs. Thus, SGMII mode is added
in the list of extra_modes for the appropriate compatibles corresponding
to the aforementioned SoCs.

Additionally, the method of setting the supported interface via struct
"phylink_config" is simplified by converting the IF/ELSE statements to
SWITCH statements.

Regards,
Siddharth.

Siddharth Vadapalli (4):
  net: ethernet: ti: am65-cpsw: Simplify setting supported interface
  net: ethernet: ti: am65-cpsw: Add support for SGMII mode
  net: ethernet: ti: am65-cpsw: Enable SGMII mode for J7200
  net: ethernet: ti: am65-cpsw: Enable SGMII mode for J721E

 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 42 +++++++++++++++++++-----
 1 file changed, 33 insertions(+), 9 deletions(-)
  

Comments

Russell King (Oracle) March 21, 2023, 11:29 a.m. UTC | #1
On Tue, Mar 21, 2023 at 04:49:56PM +0530, Siddharth Vadapalli wrote:
> Add support for configuring the CPSW Ethernet Switch in SGMII mode.
> 
> Depending on the SoC, allow selecting SGMII mode as a supported interface,
> based on the compatible used.
> 
> Signed-off-by: Siddharth Vadapalli <s-vadapalli@ti.com>
> ---
>  drivers/net/ethernet/ti/am65-cpsw-nuss.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index cba8db14e160..d2ca1f2035f4 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -76,6 +76,7 @@
>  #define AM65_CPSW_PORTN_REG_TS_CTL_LTYPE2       0x31C
>  
>  #define AM65_CPSW_SGMII_CONTROL_REG		0x010
> +#define AM65_CPSW_SGMII_MR_ADV_ABILITY_REG	0x018
>  #define AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE	BIT(0)

Isn't this misplaced? Shouldn't AM65_CPSW_SGMII_MR_ADV_ABILITY_REG come
after AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, rather than splitting that
from its register offset definition?

If the advertisement register is at 0x18, and the lower 16 bits is the
advertisement, are the link partner advertisement found in the upper
16 bits?

>  #define AM65_CPSW_CTL_VLAN_AWARE		BIT(1)
> @@ -1496,9 +1497,14 @@ static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned in
>  	struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave);
>  	struct am65_cpsw_common *common = port->common;
>  
> -	if (common->pdata.extra_modes & BIT(state->interface))
> +	if (common->pdata.extra_modes & BIT(state->interface)) {
> +		if (state->interface == PHY_INTERFACE_MODE_SGMII)
> +			writel(ADVERTISE_SGMII,
> +			       port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG);
> +

I think we can do better with this, by implementing proper PCS support.

It seems manufacturers tend to use bought-in IP for this, so have a
look at drivers/net/pcs/ to see whether any of those (or the one in
the Mediatek patch set on netdev that has recently been applied) will
idrive your hardware.

However, given the definition of AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE,
I suspect you won't find a compatible implementation.

Thanks.
  
patchwork-bot+netdevbpf@kernel.org March 23, 2023, 5:20 a.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 21 Mar 2023 16:49:54 +0530 you wrote:
> Hello,
> 
> This series adds support to configure the CPSW Ethernet Switch in SGMII
> mode, using the am65-cpsw-nuss driver. SGMII mode is supported by the
> CPSWxG instances on TI's J7200 and J721E SoCs. Thus, SGMII mode is added
> in the list of extra_modes for the appropriate compatibles corresponding
> to the aforementioned SoCs.
> 
> [...]

Here is the summary with links:
  - [net-next,1/4] net: ethernet: ti: am65-cpsw: Simplify setting supported interface
    https://git.kernel.org/netdev/net-next/c/a2935a1cd85f
  - [net-next,2/4] net: ethernet: ti: am65-cpsw: Add support for SGMII mode
    https://git.kernel.org/netdev/net-next/c/e0f72db37547
  - [net-next,3/4] net: ethernet: ti: am65-cpsw: Enable SGMII mode for J7200
    https://git.kernel.org/netdev/net-next/c/2e20e764f24e
  - [net-next,4/4] net: ethernet: ti: am65-cpsw: Enable SGMII mode for J721E
    https://git.kernel.org/netdev/net-next/c/186016da9cca

You are awesome, thank you!