]> git.karo-electronics.de Git - karo-tx-linux.git/commit
sh_eth: add generic wake-on-lan support via magic packet
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Mon, 9 Jan 2017 15:34:05 +0000 (16:34 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Jan 2017 20:54:00 +0000 (15:54 -0500)
commitd8981d029da9d230955dabe596dbb30e7971b7b9
tree26c81fccf7113c7432fbeebd0b9a6065ee052524
parent6dcf45e514974a1ff10755015b5e06746a033e5f
sh_eth: add generic wake-on-lan support via magic packet

Add generic functionality to support Wake-on-LAN using MagicPacket which
are supported by at least a few versions of sh_eth. Only add
functionality for WoL, no specific sh_eth versions are marked to support
WoL yet.

WoL is enabled in the suspend callback by setting MagicPacket detection
and disabling all interrupts expect MagicPacket. In the resume path the
driver needs to reset the hardware to rearm the WoL logic, this prevents
the driver from simply restoring the registers and to take advantage of
that sh_eth was not suspended to reduce resume time. To reset the
hardware the driver closes and reopens the device just like it would do
in a normal suspend/resume scenario without WoL enabled, but it both
closes and opens the device in the resume callback since the device
needs to be open for WoL to work.

One quirk needed for WoL is that the module clock needs to be prevented
from being switched off by Runtime PM. To keep the clock alive the
suspend callback need to call clk_enable() directly to increase the
usage count of the clock. Then when Runtime PM decreases the clock usage
count it won't reach 0 and be switched off.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/sh_eth.c
drivers/net/ethernet/renesas/sh_eth.h