]> git.baikalelectronics.ru Git - kernel.git/commit
ravb: add wake-on-lan support via magic packet
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tue, 1 Aug 2017 10:14:36 +0000 (12:14 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 2 Aug 2017 00:54:38 +0000 (17:54 -0700)
commit46ae2837de6411841cf67a01715f1ec367e234d8
tree39d46d15696c2b87a3a8c4050e7bbff81ff85503
parentecbc30cfb31eed970a0067e572a4d27f0d6493f4
ravb: add wake-on-lan support via magic packet

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 ravb was not suspended to reduce resume time. To reset the
hardware the driver closes the device, sets it in reset mode 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 reset 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>
Acked-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/renesas/ravb.h
drivers/net/ethernet/renesas/ravb_main.c