Subject: Re: [net-next,PATCH v2] net: phy: realtek: Add support for PHY LEDs on RTL8211F

From: Simon Horman <[email-masked]>
Date: Fri, 28 Jun 2024 15:27:42 +0100

On Tue, Jun 25, 2024 at 10:42:17PM +0200, Marek Vasut wrote:
> Realtek RTL8211F Ethernet PHY supports 3 LED pins which are used to
> indicate link status and activity. Add minimal LED controller driver
> supporting the most common uses with the 'netdev' trigger.
> 
> Signed-off-by: Marek Vasut <[email-masked]>
> ---
> Cc: Alexandre Torgue <[email-masked]>
> Cc: Andrew Lunn <[email-masked]>
> Cc: Christophe Roullier <[email-masked]>
> Cc: David S. Miller <[email-masked]>
> Cc: Eric Dumazet <[email-masked]>
> Cc: Heiner Kallweit <[email-masked]>
> Cc: Jakub Kicinski <[email-masked]>
> Cc: Paolo Abeni <[email-masked]>
> Cc: Russell King <[email-masked]>
> Cc: [email-masked]
> Cc: [email-masked]
> Cc: [email-masked]
> ---
> V2: - RX and TX are not differentiated, either both are set or not set,
>       filter this in rtl8211f_led_hw_is_supported()
> ---
>  drivers/net/phy/realtek.c | 106 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 106 insertions(+)
> 
> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> index 2174893c974f3..bed839237fb55 100644
> --- a/drivers/net/phy/realtek.c
> +++ b/drivers/net/phy/realtek.c
> @@ -32,6 +32,15 @@
>  #define RTL8211F_PHYCR2				0x19
>  #define RTL8211F_INSR				0x1d
>  
> +#define RTL8211F_LEDCR				0x10
> +#define RTL8211F_LEDCR_MODE			BIT(15)
> +#define RTL8211F_LEDCR_ACT_TXRX			BIT(4)
> +#define RTL8211F_LEDCR_LINK_1000		BIT(3)
> +#define RTL8211F_LEDCR_LINK_100			BIT(1)
> +#define RTL8211F_LEDCR_LINK_10			BIT(0)
> +#define RTL8211F_LEDCR_MASK			GENMASK(4, 0)
> +#define RTL8211F_LEDCR_SHIFT			5
> +

Hi Marek,

FWIIW, I think that if you use FIELD_PREP and FIELD_GET then
RTL8211F_LEDCR_SHIFT can be removed.

...