a3p
Posts: 19
Joined: Tue Nov 17, 2020 5:53 pm

[SOLVED] ethernet phandle in overlay

Tue Apr 13, 2021 8:54 am

Hi,

the ethernet interface does not have a name in the dts, so i'm struggling to reference it in an overlay.
in order to instantiate a ksz9477, i need to reference an ethernet device like this;

Code: Select all

port@0 {
  reg = <0>;
  label = "cpu";
  ethernet = <&eth1>;
};
the driver uses that here:

Code: Select all

dsa2.c:760  of_find_net_device_by_node(ethernet);
however on the rpi4, the ethernet device does not have an alias. it's just spec'd like this:

Code: Select all

scb {
   ethernet@7d580000 {
i tried referencing it like this:

Code: Select all

ethernet = <ethernet@7d580000>;
but that's a syntax error.

i also tried just giving it the path as a string

Code: Select all

ethernet = "/scb/ethernet@7d580000";
but that will just make it ignore the entire property, probably because this fails:

Code: Select all

 struct device_node *ethernet = of_parse_phandle(dn, "ethernet", 0);
there also appears this syntax

Code: Select all

ethernet = <&{/scb/ethernet@7d580000}>;
but that gives me:

Code: Select all

[  909.158298] OF: resolver: node label '/scb/ethernet@7d580000' not found in live devicetree symbols table
so presumably that means it has to be in

Code: Select all

/sys/firmware/devicetree/base/__symbols__/
which it is not, so i guess overlays just wont work at all?

or is there any way give of_find_net_device_by_node the right thing so it finds the device?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 3819
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: ethernet phandle in overlay

Tue Apr 13, 2021 12:01 pm

There is a label on the Pi 4 Ethernet interface - "genet" - so use that ("&genet").

a3p
Posts: 19
Joined: Tue Nov 17, 2020 5:53 pm

Re: ethernet phandle in overlay

Tue Apr 13, 2021 4:15 pm

thanks! this worked

Return to “Device Tree”