]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: eth: convert eth_probe() to regmap 23067/head
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Thu, 23 Apr 2026 18:26:49 +0000 (20:26 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 26 Apr 2026 22:38:17 +0000 (00:38 +0200)
Remove the last sw() macros from the ethernet driver.
With this drop the required include line.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23067
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.18/drivers/net/ethernet/rtl838x_eth.c

index 484f162bb3998ab73aba1ee225a1d7be4784b1a1..e50cc68fa24635c87e39a21533b1ff733eeb738c 100644 (file)
@@ -23,7 +23,6 @@
 #include <net/dsa.h>
 #include <net/switchdev.h>
 
-#include <asm/mach-rtl-otto/mach-rtl-otto.h>
 #include "rtl838x_eth.h"
 
 #define RTETH_OWN_CPU                  1
@@ -1576,12 +1575,17 @@ static int rteth_probe(struct platform_device *pdev)
        if (is_valid_ether_addr(mac_addr)) {
                rteth_set_mac_hw(dev, mac_addr);
        } else {
-               mac_addr[0] = (sw_r32(ctrl->r->mac_reg[0]) >> 8) & 0xff;
-               mac_addr[1] = sw_r32(ctrl->r->mac_reg[0]) & 0xff;
-               mac_addr[2] = (sw_r32(ctrl->r->mac_reg[0] + 4) >> 24) & 0xff;
-               mac_addr[3] = (sw_r32(ctrl->r->mac_reg[0] + 4) >> 16) & 0xff;
-               mac_addr[4] = (sw_r32(ctrl->r->mac_reg[0] + 4) >> 8) & 0xff;
-               mac_addr[5] = sw_r32(ctrl->r->mac_reg[0] + 4) & 0xff;
+               u32 mac_hi, mac_lo;
+
+               regmap_read(ctrl->map, ctrl->r->mac_reg[0], &mac_hi);
+               regmap_read(ctrl->map, ctrl->r->mac_reg[0] + 4, &mac_lo);
+
+               mac_addr[0] = (mac_hi >> 8) & 0xff;
+               mac_addr[1] = mac_hi & 0xff;
+               mac_addr[2] = (mac_lo >> 24) & 0xff;
+               mac_addr[3] = (mac_lo >> 16) & 0xff;
+               mac_addr[4] = (mac_lo >> 8) & 0xff;
+               mac_addr[5] = mac_lo & 0xff;
        }
        dev_addr_set(dev, mac_addr);
        /* if the address is invalid, use a random value */