Subject: Re: [PATCH net-next v4 2/7] net: phylink: add rxc_always_on flag to phylink_pcs

From: Simon Horman <[email-masked]>
Date: Wed, 21 Feb 2024 19:07:40 +0000

On Wed, Feb 21, 2024 at 02:04:19PM +0100, Romain Gantois wrote:
> Some MAC drivers (e.g. stmmac) require a continuous receive clock signal to
> be generated by a PCS that is handled by a standalone PCS driver.
> 
> Such a PCS driver does not have access to a PHY device, thus cannot check
> the PHY_F_RXC_ALWAYS_ON flag. They cannot check max_requires_rxc in the
> phylink config either, since it is a private member. Therefore, a new flag
> is needed to signal to the PCS that it should keep the RX clock signal up
> at all times.
> 
> Suggested-by: Russell King <[email-masked]>
> Signed-off-by: Romain Gantois <[email-masked]>

...

> @@ -549,6 +557,34 @@ void pcs_an_restart(struct phylink_pcs *pcs);
>   */
>  void pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
>  		 phy_interface_t interface, int speed, int duplex);
> +
> +/**
> + * pcs_pre_init() - Configure PCS components necessary for MAC initialization
> + * @pcs: a pointer to a &struct phylink_pcs.
> + *
> + * This function can be called by MAC drivers through the
> + * phylink_pcs_pre_init() wrapper, before their hardware is initialized. It
> + * should not be called after the link is brought up, as reconfiguring the PCS
> + * at this point could break the link.
> + *
> + * Some MAC devices require specific hardware initialization to be performed by
> + * their associated PCS device before they can properly initialize their own
> + * hardware. An example of this is the initialization of stmmac controllers,
> + * which requires an active REF_CLK signal to be provided by the PHY/PCS.
> + *
> + * By calling phylink_pcs_pre_init(), MAC drivers can ensure that the PCS is
> + * setup in a way that allows for successful hardware initialization.
> + *
> + * The specific configuration performed by pcs_pre_init() is dependent on the
> + * model of PCS and the requirements of the MAC device attached to it. PCS
> + * driver authors should consider whether their target device is to be used in
> + * conjunction with a MAC device whose driver calls phylink_pcs_pre_init(). MAC
> + * driver authors should document their requirements for the PCS
> + * pre-initialization.
> + *
> + */
> +int pcs_config(struct phylink_pcs *pcs);

Hi Romain,

Should this be pcs_pre_init instead of pcs_config?

> +
>  #endif
>  
>  struct phylink *phylink_create(struct phylink_config *,

...