mbox series

[v3,0/6] add qca8084 ethernet phy driver

Message ID 20231115140630.10858-1-quic_luoj@quicinc.com
Headers show
Series add qca8084 ethernet phy driver | expand

Message

Luo Jie Nov. 15, 2023, 2:06 p.m. UTC
QCA8084 is four-port PHY with maximum link capability 2.5G,
which supports the interface mode qusgmii and sgmii mode,
there are two PCSs available to connected with ethernet port.

QCA8084 can work in switch mode or PHY mode.
For switch mode, both PCS0 and PCS1 work on sgmii mode.
For PHY mode, PCS1 works on qusgmii mode, the last port
(the fourth port) works on sgmii mode.

Besides this PHY driver patches, the PCS driver is also needed
to bring up the qca8084 device, which mainly configurs PCS
and clocks.

Changes in v3:
	1. pick the two patches to introduce the interface mode
	10g-qxgmii from Vladimir Oltean(olteanv@gmail.com).

	2. add the function phydev_id_is_qca808x to identify the
	PHY qca8081 and qca8084.

	3. update the interface mode name PHY_INTERFACE_MODE_QUSGMII
	to PHY_INTERFACE_MODE_10G_QXGMII.

Luo Jie (4):
  net: phy: at803x: add QCA8084 ethernet phy support
  net: phy: at803x: add the function phydev_id_is_qca808x
  net: phy: at803x: Add qca8084_config_init function
  net: phy: qca8084: add qca8084_link_change_notify

Vladimir Oltean (2):
  net: phylink: move phylink_pcs_neg_mode() to phylink.c
  net: phy: introduce core support for phy-mode = "10g-qxgmii"

 .../bindings/net/ethernet-controller.yaml     |   1 +
 Documentation/networking/phy.rst              |   6 +
 drivers/net/phy/at803x.c                      | 130 +++++++++++++++++-
 drivers/net/phy/phy-core.c                    |   1 +
 drivers/net/phy/phylink.c                     |  77 ++++++++++-
 include/linux/phy.h                           |   4 +
 include/linux/phylink.h                       |  67 +--------
 7 files changed, 212 insertions(+), 74 deletions(-)


base-commit: bc962b35b139dd52319e6fc0f4bab00593bf38c9

Comments

Russell King (Oracle) Nov. 15, 2023, 2:14 p.m. UTC | #1
Hi,

You don't need this patch for your series, and you're bypassing my
ability to decide when this patch should be merged (which is not yet,
I want things to remain as-is for another cycle.)

In theory, looking at past history, 6.7 will probably be a LTS kernel,
but until that is known for certain, I don't want to commit to moving
this function in case LTS gets delayed by a cycle.

Please drop it from your series.

Thanks.

On Wed, Nov 15, 2023 at 10:06:25PM +0800, Luo Jie wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> Russell points out that there is no user of phylink_pcs_neg_mode()
> outside of phylink.c, nor is there planned to be any, so we can just
> move it there.
> 
> Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
> ---
>  drivers/net/phy/phylink.c | 65 ++++++++++++++++++++++++++++++++++++++
>  include/linux/phylink.h   | 66 ---------------------------------------
>  2 files changed, 65 insertions(+), 66 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 25c19496a336..162f51b0986a 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -162,6 +162,71 @@ static const char *phylink_an_mode_str(unsigned int mode)
>  	return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
>  }
>  
> +/**
> + * phylink_pcs_neg_mode() - helper to determine PCS inband mode
> + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
> + * @interface: interface mode to be used
> + * @advertising: adertisement ethtool link mode mask
> + *
> + * Determines the negotiation mode to be used by the PCS, and returns
> + * one of:
> + *
> + * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
> + * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
> + *   will be used.
> + * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
> + *   disabled
> + * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
> + *
> + * Note: this is for cases where the PCS itself is involved in negotiation
> + * (e.g. Clause 37, SGMII and similar) not Clause 73.
> + */
> +static unsigned int phylink_pcs_neg_mode(unsigned int mode, phy_interface_t interface,
> +					 const unsigned long *advertising)
> +{
> +	unsigned int neg_mode;
> +
> +	switch (interface) {
> +	case PHY_INTERFACE_MODE_SGMII:
> +	case PHY_INTERFACE_MODE_QSGMII:
> +	case PHY_INTERFACE_MODE_QUSGMII:
> +	case PHY_INTERFACE_MODE_USXGMII:
> +		/* These protocols are designed for use with a PHY which
> +		 * communicates its negotiation result back to the MAC via
> +		 * inband communication. Note: there exist PHYs that run
> +		 * with SGMII but do not send the inband data.
> +		 */
> +		if (!phylink_autoneg_inband(mode))
> +			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
> +		else
> +			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
> +		break;
> +
> +	case PHY_INTERFACE_MODE_1000BASEX:
> +	case PHY_INTERFACE_MODE_2500BASEX:
> +		/* 1000base-X is designed for use media-side for Fibre
> +		 * connections, and thus the Autoneg bit needs to be
> +		 * taken into account. We also do this for 2500base-X
> +		 * as well, but drivers may not support this, so may
> +		 * need to override this.
> +		 */
> +		if (!phylink_autoneg_inband(mode))
> +			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
> +		else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
> +					   advertising))
> +			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
> +		else
> +			neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
> +		break;
> +
> +	default:
> +		neg_mode = PHYLINK_PCS_NEG_NONE;
> +		break;
> +	}
> +
> +	return neg_mode;
> +}
> +
>  static unsigned int phylink_interface_signal_rate(phy_interface_t interface)
>  {
>  	switch (interface) {
> diff --git a/include/linux/phylink.h b/include/linux/phylink.h
> index 875439ab45de..d589f89c612c 100644
> --- a/include/linux/phylink.h
> +++ b/include/linux/phylink.h
> @@ -98,72 +98,6 @@ static inline bool phylink_autoneg_inband(unsigned int mode)
>  	return mode == MLO_AN_INBAND;
>  }
>  
> -/**
> - * phylink_pcs_neg_mode() - helper to determine PCS inband mode
> - * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
> - * @interface: interface mode to be used
> - * @advertising: adertisement ethtool link mode mask
> - *
> - * Determines the negotiation mode to be used by the PCS, and returns
> - * one of:
> - *
> - * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
> - * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
> - *   will be used.
> - * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
> - *   disabled
> - * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
> - *
> - * Note: this is for cases where the PCS itself is involved in negotiation
> - * (e.g. Clause 37, SGMII and similar) not Clause 73.
> - */
> -static inline unsigned int phylink_pcs_neg_mode(unsigned int mode,
> -						phy_interface_t interface,
> -						const unsigned long *advertising)
> -{
> -	unsigned int neg_mode;
> -
> -	switch (interface) {
> -	case PHY_INTERFACE_MODE_SGMII:
> -	case PHY_INTERFACE_MODE_QSGMII:
> -	case PHY_INTERFACE_MODE_QUSGMII:
> -	case PHY_INTERFACE_MODE_USXGMII:
> -		/* These protocols are designed for use with a PHY which
> -		 * communicates its negotiation result back to the MAC via
> -		 * inband communication. Note: there exist PHYs that run
> -		 * with SGMII but do not send the inband data.
> -		 */
> -		if (!phylink_autoneg_inband(mode))
> -			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
> -		else
> -			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
> -		break;
> -
> -	case PHY_INTERFACE_MODE_1000BASEX:
> -	case PHY_INTERFACE_MODE_2500BASEX:
> -		/* 1000base-X is designed for use media-side for Fibre
> -		 * connections, and thus the Autoneg bit needs to be
> -		 * taken into account. We also do this for 2500base-X
> -		 * as well, but drivers may not support this, so may
> -		 * need to override this.
> -		 */
> -		if (!phylink_autoneg_inband(mode))
> -			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
> -		else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
> -					   advertising))
> -			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
> -		else
> -			neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
> -		break;
> -
> -	default:
> -		neg_mode = PHYLINK_PCS_NEG_NONE;
> -		break;
> -	}
> -
> -	return neg_mode;
> -}
> -
>  /**
>   * struct phylink_link_state - link state structure
>   * @advertising: ethtool bitmask containing advertised link modes
> -- 
> 2.42.0
> 
>
Luo Jie Nov. 16, 2023, 7:32 a.m. UTC | #2
On 11/15/2023 10:14 PM, Russell King (Oracle) wrote:
> Hi,
> 
> You don't need this patch for your series, and you're bypassing my
> ability to decide when this patch should be merged (which is not yet,
> I want things to remain as-is for another cycle.)
> 
> In theory, looking at past history, 6.7 will probably be a LTS kernel,
> but until that is known for certain, I don't want to commit to moving
> this function in case LTS gets delayed by a cycle.
> 
> Please drop it from your series.
> 
> Thanks.

Got it, Russell.
I will drop this patch in the next patch set, Thanks.

> 
> On Wed, Nov 15, 2023 at 10:06:25PM +0800, Luo Jie wrote:
>> From: Vladimir Oltean <vladimir.oltean@nxp.com>
>>
>> Russell points out that there is no user of phylink_pcs_neg_mode()
>> outside of phylink.c, nor is there planned to be any, so we can just
>> move it there.
>>
>> Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
>> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
>> Signed-off-by: Luo Jie <quic_luoj@quicinc.com>
>> ---
>>   drivers/net/phy/phylink.c | 65 ++++++++++++++++++++++++++++++++++++++
>>   include/linux/phylink.h   | 66 ---------------------------------------
>>   2 files changed, 65 insertions(+), 66 deletions(-)
>>
>> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
>> index 25c19496a336..162f51b0986a 100644
>> --- a/drivers/net/phy/phylink.c
>> +++ b/drivers/net/phy/phylink.c
>> @@ -162,6 +162,71 @@ static const char *phylink_an_mode_str(unsigned int mode)
>>   	return mode < ARRAY_SIZE(modestr) ? modestr[mode] : "unknown";
>>   }
>>   
>> +/**
>> + * phylink_pcs_neg_mode() - helper to determine PCS inband mode
>> + * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
>> + * @interface: interface mode to be used
>> + * @advertising: adertisement ethtool link mode mask
>> + *
>> + * Determines the negotiation mode to be used by the PCS, and returns
>> + * one of:
>> + *
>> + * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
>> + * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
>> + *   will be used.
>> + * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
>> + *   disabled
>> + * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
>> + *
>> + * Note: this is for cases where the PCS itself is involved in negotiation
>> + * (e.g. Clause 37, SGMII and similar) not Clause 73.
>> + */
>> +static unsigned int phylink_pcs_neg_mode(unsigned int mode, phy_interface_t interface,
>> +					 const unsigned long *advertising)
>> +{
>> +	unsigned int neg_mode;
>> +
>> +	switch (interface) {
>> +	case PHY_INTERFACE_MODE_SGMII:
>> +	case PHY_INTERFACE_MODE_QSGMII:
>> +	case PHY_INTERFACE_MODE_QUSGMII:
>> +	case PHY_INTERFACE_MODE_USXGMII:
>> +		/* These protocols are designed for use with a PHY which
>> +		 * communicates its negotiation result back to the MAC via
>> +		 * inband communication. Note: there exist PHYs that run
>> +		 * with SGMII but do not send the inband data.
>> +		 */
>> +		if (!phylink_autoneg_inband(mode))
>> +			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
>> +		else
>> +			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
>> +		break;
>> +
>> +	case PHY_INTERFACE_MODE_1000BASEX:
>> +	case PHY_INTERFACE_MODE_2500BASEX:
>> +		/* 1000base-X is designed for use media-side for Fibre
>> +		 * connections, and thus the Autoneg bit needs to be
>> +		 * taken into account. We also do this for 2500base-X
>> +		 * as well, but drivers may not support this, so may
>> +		 * need to override this.
>> +		 */
>> +		if (!phylink_autoneg_inband(mode))
>> +			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
>> +		else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
>> +					   advertising))
>> +			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
>> +		else
>> +			neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
>> +		break;
>> +
>> +	default:
>> +		neg_mode = PHYLINK_PCS_NEG_NONE;
>> +		break;
>> +	}
>> +
>> +	return neg_mode;
>> +}
>> +
>>   static unsigned int phylink_interface_signal_rate(phy_interface_t interface)
>>   {
>>   	switch (interface) {
>> diff --git a/include/linux/phylink.h b/include/linux/phylink.h
>> index 875439ab45de..d589f89c612c 100644
>> --- a/include/linux/phylink.h
>> +++ b/include/linux/phylink.h
>> @@ -98,72 +98,6 @@ static inline bool phylink_autoneg_inband(unsigned int mode)
>>   	return mode == MLO_AN_INBAND;
>>   }
>>   
>> -/**
>> - * phylink_pcs_neg_mode() - helper to determine PCS inband mode
>> - * @mode: one of %MLO_AN_FIXED, %MLO_AN_PHY, %MLO_AN_INBAND.
>> - * @interface: interface mode to be used
>> - * @advertising: adertisement ethtool link mode mask
>> - *
>> - * Determines the negotiation mode to be used by the PCS, and returns
>> - * one of:
>> - *
>> - * - %PHYLINK_PCS_NEG_NONE: interface mode does not support inband
>> - * - %PHYLINK_PCS_NEG_OUTBAND: an out of band mode (e.g. reading the PHY)
>> - *   will be used.
>> - * - %PHYLINK_PCS_NEG_INBAND_DISABLED: inband mode selected but autoneg
>> - *   disabled
>> - * - %PHYLINK_PCS_NEG_INBAND_ENABLED: inband mode selected and autoneg enabled
>> - *
>> - * Note: this is for cases where the PCS itself is involved in negotiation
>> - * (e.g. Clause 37, SGMII and similar) not Clause 73.
>> - */
>> -static inline unsigned int phylink_pcs_neg_mode(unsigned int mode,
>> -						phy_interface_t interface,
>> -						const unsigned long *advertising)
>> -{
>> -	unsigned int neg_mode;
>> -
>> -	switch (interface) {
>> -	case PHY_INTERFACE_MODE_SGMII:
>> -	case PHY_INTERFACE_MODE_QSGMII:
>> -	case PHY_INTERFACE_MODE_QUSGMII:
>> -	case PHY_INTERFACE_MODE_USXGMII:
>> -		/* These protocols are designed for use with a PHY which
>> -		 * communicates its negotiation result back to the MAC via
>> -		 * inband communication. Note: there exist PHYs that run
>> -		 * with SGMII but do not send the inband data.
>> -		 */
>> -		if (!phylink_autoneg_inband(mode))
>> -			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
>> -		else
>> -			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
>> -		break;
>> -
>> -	case PHY_INTERFACE_MODE_1000BASEX:
>> -	case PHY_INTERFACE_MODE_2500BASEX:
>> -		/* 1000base-X is designed for use media-side for Fibre
>> -		 * connections, and thus the Autoneg bit needs to be
>> -		 * taken into account. We also do this for 2500base-X
>> -		 * as well, but drivers may not support this, so may
>> -		 * need to override this.
>> -		 */
>> -		if (!phylink_autoneg_inband(mode))
>> -			neg_mode = PHYLINK_PCS_NEG_OUTBAND;
>> -		else if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
>> -					   advertising))
>> -			neg_mode = PHYLINK_PCS_NEG_INBAND_ENABLED;
>> -		else
>> -			neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED;
>> -		break;
>> -
>> -	default:
>> -		neg_mode = PHYLINK_PCS_NEG_NONE;
>> -		break;
>> -	}
>> -
>> -	return neg_mode;
>> -}
>> -
>>   /**
>>    * struct phylink_link_state - link state structure
>>    * @advertising: ethtool bitmask containing advertised link modes
>> -- 
>> 2.42.0
>>
>>
>