Hi,
I'm trying to bring the Netgear WAX220 to openWRT. There is a small issue though: The link status of the single ethernet port is not properly shown in openWRT. That is also the case for the stock firmware though, when I unplug the cable on the stock firmware I see
SSK_processApupLinkChange():109:36.947:apmode uplinkPort=-1 port=6[eth1] down.
though, so it seems like something in userspace is fetching the status somehow?
The part of the DTS looks like this:
ð {
status = "okay";
gmac0: mac@1 {
compatible = "mediatek,eth-mac";
reg = <1>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
mdio: mdio-bus {
#address-cells = <1>;
#size-cells = <0>;
};
};
If I remove the fixed-link there I see
mtk_soc_eth 15100000.ethernet eth0: mtk_open: could not attach PHY: -19
during boot. Even if I copy this part from the manufacturers GPL file it doesnt properly show the link status:
&mdio {
#address-cells = <1>;
#size-cells = <0>;
switch@0 {
compatible = "mediatek,mt7531";
reg = <31>;
reset-gpios = <&pio 5 0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
label = "lan0";
};
port@1 {
reg = <1>;
label = "lan1";
};
port@2 {
reg = <2>;
label = "lan2";
};
port@3 {
reg = <3>;
label = "lan3";
};
port@6 {
reg = <6>;
label = "cpu";
ethernet = <&gmac0>;
phy-mode = "2500base-x";
fixed-link {
speed = <2500>;
full-duplex;
pause;
};
};
};
};
phy@5 {
reset-gpios = <&pio 0x6 0x1>;
phy-mode = "2500base-x";
reset-deassert-us = <0x4e20>;
reg = <0x5>;
compatible = "ethernet-phy-id67c9.de0a";
};
phy@6 {
phy-mode = "2500base-x";
reg = <0x6>;
compatible = "ethernet-phy-id67c9.de0a";
};
};
Oddly enough, openWRT says 2.5 Gbit/s even though I connected the device to a 1 Gbit/s port, so either the information in openWRT is not correct or there is something else performing the "conversion" between 2.5 Gbit/s and whatever I connect to the Ethernet port.
Does anybody have a clue how I could get the status shown properly? When I throw the ssk binary that emits the message in the vendor openWRT I see something like this:
Gpio = dai_sysGetGpio("ETH_INTERRUPT");
dai_sysGetEthLinkChange(Gpio, &v2);
if ( !v2 )
{
dai_readEthInterrupt();
sub_31B0(6LL);
}
so there is an interrupt and apparently it is processed in userspace. Gpio is 457 in this case and that is then simply read out from /sys/class/gpio457/value and if I kill the ssk process I can indeed watch the change there when (un)plugging the cable. I can also get the current state by running this command
mii_mgr_cl45 -g -p 6 -d 0x1f -r 0xa434
they even provide help for that command
mii_mgr -g -i [ifname] -p [phy number] -r [register number]
Get: mii_mgr -g -p 3 -r 4
mii_mgr -s -p [phy number] -r [register number] -v [0xvalue]
Set: mii_mgr -s -p 4 -r 1 -v 0xff11
#NOTE: Without -i , eth0 is default ifname!
----------------------------------------------------------------------------------------
Get: mii_mgr_cl45 -g -p [port number] -d [dev number] -r [register number]
Example: mii_mgr_cl45 -g -p 3 -d 0x5 -r 0x4
Set: mii_mgr_cl45 -s -p [port number] -d [dev number] -r [register number] -v [value]
Example: mii_mgr_cl45 -s -p 4 -d 0x6 -r 0x1 -v 0xff11
so I assume that I need to somehow add those parameters to my FDT?
As a side question: Is gmac0 for mac@1 correct or should I name it gmac1 in this case?