[PATCH 1/3] net: give a different name to rtl8169 interfaces

Quentin Schulz quentin.schulz at cherry.de
Mon Jun 24 15:08:54 CEST 2024


Hi Etienne,

On 6/24/24 2:40 PM, ETIENNE DUBLE wrote:
> This commit implements the .bind member function,
> and gives a different name to interfaces:
> "RTL8169#0", "RTL8169#1", etc.
> 
> This was tested on a FriendlyElec Nanopi R5C board,
> which has two RTL-8125B interfaces managed by this
> driver. Since they were given the same name, it
> was previously not possible to select the 2nd one
> using ethact or ethprime environment variables.
> 
> Signed-off-by: Etienne Dublé <etienne.duble at imag.fr>
> ---
> 
>   drivers/net/rtl8169.c | 11 +++++++++++
>   1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
> index 93e83661ce..b30d51731f 100644
> --- a/drivers/net/rtl8169.c
> +++ b/drivers/net/rtl8169.c
> @@ -1091,6 +1091,16 @@ static int rtl8169_eth_probe(struct udevice *dev)
>   	return 0;
>   }
>   
> +static int rtl8169_eth_bind(struct udevice *dev)
> +{
> +	static int card_number;
> +	char name[16];
> +
> +	sprintf(name, "RTL8169#%u", card_number++);
> +
> +	return device_set_name(dev, name);
> +}
> +

I don't think we can guarantee bind order so this may not be stable over 
time.

I'm wondering if there isn't a way to use the "ethernet" (ethernet0, 
ethernet1) alias in DT instead?

Cheers,
Quentin


More information about the U-Boot mailing list