realtek: eth: harmonize mac (aka chip) init
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Sun, 4 Jan 2026 19:31:08 +0000 (20:31 +0100)
committerStijn Tintel <stijn@linux-ipv6.be>
Fri, 9 Jan 2026 19:03:04 +0000 (21:03 +0200)
The ethernet driver must initialize the chip for proper operation.
Currently there exist functions for RTL838x, RTL839x and RTL931x.
All of them are called differently. Combine them in a central call
location.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21391
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c

index ec3df030b9414a33b30c2dc7d8a5d1427dda77dd..69c6e95bd554bc8d2fac36e6005510f63c6dff69 100644 (file)
@@ -1704,9 +1704,6 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
        dev->hw_features = NETIF_F_RXCSUM;
        dev->netdev_ops = priv->r->netdev_ops;
 
-       if (priv->r->family_id == RTL9310_FAMILY_ID)
-               rtl931x_chip_init(priv);
-
        priv->rxringlen = rxringlen;
        priv->rxrings = rxrings;
 
@@ -1723,7 +1720,12 @@ static int __init rtl838x_eth_probe(struct platform_device *pdev)
                return err;
        }
 
-       rtl8380_init_mac(priv);
+       if (priv->r->family_id == RTL8380_FAMILY_ID)
+               rtl8380_init_mac(priv);
+       else if (priv->r->family_id == RTL8390_FAMILY_ID)
+               rtl8390_init_mac(priv);
+       else if (priv->r->family_id == RTL9310_FAMILY_ID)
+               rtl931x_chip_init(priv);
 
        /* Try to get mac address in the following order:
         * 1) from device tree data