]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
sandbox: net: Remove fake-host-hwaddr
authorSean Anderson <sean.anderson@seco.com>
Thu, 5 May 2022 17:11:33 +0000 (13:11 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 8 Jun 2022 17:59:52 +0000 (13:59 -0400)
Instead of reading a pseudo-rom mac address from the device tree, just use
whatever we get from write_hwaddr. This has the effect of using the mac
address from the environment (or from the device tree, if it is
specified).

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Ramon Fried <rfried.dev@gmail.com>
arch/sandbox/dts/sandbox.dts
arch/sandbox/dts/sandbox64.dts
arch/sandbox/dts/test.dts
drivers/net/sandbox.c

index 18fde1c8c6f071f464c3a96543a4429117514d0b..21f00fcab5ee6ca7747e672174c616246a98a589 100644 (file)
@@ -63,7 +63,6 @@
        eth@10002000 {
                compatible = "sandbox,eth";
                reg = <0x10002000 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 00];
        };
 
        host-fs {
index ec53106af9dca8cc0d0e941e135d275248e104a7..3eb045708914ad5975080b24cbb82e76d612c0de 100644 (file)
@@ -58,7 +58,6 @@
        eth@10002000 {
                compatible = "sandbox,eth";
                reg = <0x0 0x10002000 0x0 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 00];
        };
 
        i2c_0: i2c@0 {
index 39d57f51102199f16ef8dfea712ecbddaf043b62..cf1abac5686e6a823297bb9ff28ac56de8ac8a19 100644 (file)
        eth@10002000 {
                compatible = "sandbox,eth";
                reg = <0x10002000 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 00];
        };
 
        eth_5: eth@10003000 {
                compatible = "sandbox,eth";
                reg = <0x10003000 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 11];
        };
 
        eth_3: sbe5 {
                compatible = "sandbox,eth";
                reg = <0x10005000 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 33];
        };
 
        eth@10004000 {
                compatible = "sandbox,eth";
                reg = <0x10004000 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 22];
        };
 
        phy_eth0: phy-test-eth {
                compatible = "sandbox,eth";
                reg = <0x10007000 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 77];
                phy-handle = <&ethphy1>;
                phy-mode = "2500base-x";
        };
        dsa_eth0: dsa-test-eth {
                compatible = "sandbox,eth";
                reg = <0x10006000 0x1000>;
-               fake-host-hwaddr = [00 00 66 44 22 66];
        };
 
        dsa-test {
index 37459dfa0a409bb6a66ab06fef76d687f5c27681..13022addb6a3e18720981fc9d9772f294a6ddd48 100644 (file)
@@ -395,9 +395,11 @@ static void sb_eth_stop(struct udevice *dev)
 static int sb_eth_write_hwaddr(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_plat(dev);
+       struct eth_sandbox_priv *priv = dev_get_priv(dev);
 
        debug("eth_sandbox %s: Write HW ADDR - %pM\n", dev->name,
              pdata->enetaddr);
+       memcpy(priv->fake_host_hwaddr, pdata->enetaddr, ARP_HLEN);
        return 0;
 }
 
@@ -419,16 +421,8 @@ static int sb_eth_of_to_plat(struct udevice *dev)
 {
        struct eth_pdata *pdata = dev_get_plat(dev);
        struct eth_sandbox_priv *priv = dev_get_priv(dev);
-       const u8 *mac;
 
        pdata->iobase = dev_read_addr(dev);
-
-       mac = dev_read_u8_array_ptr(dev, "fake-host-hwaddr", ARP_HLEN);
-       if (!mac) {
-               printf("'fake-host-hwaddr' is missing from the DT\n");
-               return -EINVAL;
-       }
-       memcpy(priv->fake_host_hwaddr, mac, ARP_HLEN);
        priv->disabled = false;
        priv->tx_handler = sb_default_handler;