]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: Load mac address using misc device
authorSean Anderson <sean.anderson@seco.com>
Thu, 5 May 2022 17:11:44 +0000 (13:11 -0400)
committerTom Rini <trini@konsulko.com>
Wed, 8 Jun 2022 18:00:22 +0000 (14:00 -0400)
This loads a mac address using a misc device using the nvmem interface.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
arch/sandbox/dts/test.dts
drivers/misc/misc_sandbox.c

index afcdda944d40d4720c6831af0c2b79e2508164d3..e068d0c8c562ed00ae584aa0fbf1c7aee0ad01a5 100644 (file)
        eth_5: eth@10003000 {
                compatible = "sandbox,eth";
                reg = <0x10003000 0x1000>;
-               mac-address = [ 02 00 11 22 33 46 ];
+               nvmem-cells = <&eth5_addr>;
+               nvmem-cell-names = "mac-address";
        };
 
        eth_3: sbe5 {
        };
 
        misc-test {
+               #address-cells = <1>;
+               #size-cells = <1>;
                compatible = "sandbox,misc_sandbox";
+
+               eth5_addr: mac-address@10 {
+                       reg = <0x10 6>;
+               };
        };
 
        mmc2 {
index 0e4292fd0aa97e097852d6bf3e0bd8420c770b5e..31cde2dbac07eb0c55a400ca12e303712edc3dec 100644 (file)
@@ -112,8 +112,11 @@ static const struct misc_ops misc_sandbox_ops = {
 int misc_sandbox_probe(struct udevice *dev)
 {
        struct misc_sandbox_priv *priv = dev_get_priv(dev);
+       /* For eth5 */
+       const u8 mac[] = { 0x02, 0x00, 0x11, 0x22, 0x33, 0x46 };
 
        priv->enabled = true;
+       memcpy(&priv->mem[16], mac, sizeof(mac));
 
        return 0;
 }