]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: macb: use SA1 for MAC filtering on GEM
authorChristian DREHER <christian.dreher@nanoxplore.com>
Tue, 28 Apr 2026 18:04:06 +0000 (20:04 +0200)
committerJerome Forissier <jerome.forissier@arm.com>
Wed, 6 May 2026 09:07:22 +0000 (11:07 +0200)
The MACB uses specific address registers (SA Top and Bottom) to
filter source or destination MAC addresses.
On the Gigabit Ethernet version, SA1B is @0x88.
On the non-GEM version, SA1B is @0x98.

Before this commit, the code was always writing 0x98. By chance,
on GEM, this is the address of SA3B, allowing the driver to work
anyway.

The motivation for this change is to be able to use the driver on
an instance of the GEM with less than 4 SA registers.

Signed-off-by: Christian DREHER <christian.dreher@nanoxplore.com>
drivers/net/macb.c

index 719aef39a3f475cd12aa6772ce289c6df0421b6a..807a038e07115c6d82037ada5a6024f49a367bc7 100644 (file)
@@ -1007,9 +1007,14 @@ static int _macb_write_hwaddr(struct macb_device *macb, unsigned char *enetaddr)
        /* set hardware address */
        hwaddr_bottom = enetaddr[0] | enetaddr[1] << 8 |
                        enetaddr[2] << 16 | enetaddr[3] << 24;
-       macb_writel(macb, SA1B, hwaddr_bottom);
        hwaddr_top = enetaddr[4] | enetaddr[5] << 8;
-       macb_writel(macb, SA1T, hwaddr_top);
+       if (macb_is_gem(macb)) {
+               gem_writel(macb, SA1B, hwaddr_bottom);
+               gem_writel(macb, SA1T, hwaddr_top);
+       } else {
+               macb_writel(macb, SA1B, hwaddr_bottom);
+               macb_writel(macb, SA1T, hwaddr_top);
+       }
        return 0;
 }