Article 6GHQJ How to describe PHY Wake on LAN in the device tree

How to describe PHY Wake on LAN in the device tree

by
Javiku
from LinuxQuestions.org on (#6GHQJ)
I have a Rockchip-based embedded system that supports the suspend-to-RAM power mode. I want the system to wake up when the PHY receives a Wake on LAN magic packet because the MAC is not powered in suspend. So I would expect the PHY to generate an interrupt that acts as a wakeup source.
The PHY in question (TI DP83826E) can generate interrupts when a magic packet is received and Wake on LAN works fine in freeze mode, where all voltages are still available. That is simply because the MAC is still powered and it reacts to the magic packet.
I configured the PHY registers manually via mdio to get the right configuration and it generates interrupts as expected. On the other hand the driver does not configure it that way automatically and maybe that is so because I blundered in the device tree description. Defining the PHY output as an interrupt source does not seem to be the right approach because then it is used as an interrupt source for a number of events the MAC might find relevant, not just WoL. A second attempt was adding the wakeup-source property, which did not help.

These are the nodes that describe the MAC and the PHY:

Code:&gmac0 {
assigned-clocks = <&cru SCLK_GMAC0_RX_TX>,
<&cru SCLK_GMAC0>;
assigned-clock-parents = <&cru SCLK_GMAC0_RMII_SPEED>,
<&gmac0_clkin>;
clock_in_out = "input";
phy-handle = <&dp83826>;
phy-mode = "rmii";
phy-supply = <&vcc3v3_eth>;
pinctrl-names = "default";
pinctrl-0 = <&gmac0_miim
&gmac0_clkinout
&gmac0_rx_er
&gmac0_rx_bus2
&gmac0_tx_bus2>;
status = "okay";
};

&mdio0 {
#address-cells = <1>;
#size-cells = <0>;

dp83826: ethernet-phy@0 {
compatible = "ethernet-phy-ieee802.3-c22";
reg = <0x0>;
interrupt-parent = <&gpio0>;
interrupts = <RK_PD3 IRQ_TYPE_EDGE_FALLING>;
pinctrl-names = "default";
pinctrl-0 = <&eth_wake_intn &eth_phy_rstn>;
reset-assert-us = <1000>;
reset-deassert-us = <2000>;
reset-gpios = <&gpio0 RK_PD4 GPIO_ACTIVE_LOW>;
wakeup-source;
};
};where eth_wake_intn is a gpio.

Does anyone know how to configure this properly? Maybe I am aiming for an unsupported functionality and the MAC must be always available, but then I wonder why the PHY supports interrupts upon magic packet reception. I would expect the MAC to poll the PHY for any information it requires and leave the PHY interrupt available for WoL.

Thanks and best regards
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments