From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: "Geert Uytterhoeven" <geert@linux-m68k.org>,
netdev@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH v3 0/2] ravb: add wake-on-lan support via magic packet
Date: Tue, 1 Aug 2017 12:14:35 +0200 [thread overview]
Message-ID: <20170801101437.9020-1-niklas.soderlund+renesas@ragnatech.se> (raw)
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.
Changes since v2
- Only do the clock dance to workaround PSCI sleep when resuming if WoL
is enabled. This was a bug in v2 which resulted in a WARN if resuming
from PSCI sleep with WoL disabled, thanks Sergei for pointing this
out!
- Break out clock dance workaround in separate patch to make it easier
to revert once a fix is upstream for the clock driver as suggested by
Sergei.
Changes since v1
- Fix issue where device would fail to resume from PSCI suspend if WoL
was enabled, reported by Geert. The fault was that the clock driver
thinks the clock is on, but PSCI have disabled it, added workaround
for this in ravb driver which can be removed once the clock driver is
aware of the PSCI behavior.
- Only try to restore from wol wake up if netif is running, since this
is a condition to enable wol in the first place this was a bug in v1.
Niklas Söderlund (2):
ravb: add wake-on-lan support via magic packet
ravb: add workaround for clock when resuming with WoL enabled
drivers/net/ethernet/renesas/ravb.h | 2 +
drivers/net/ethernet/renesas/ravb_main.c | 131 ++++++++++++++++++++++++++++++-
2 files changed, 129 insertions(+), 4 deletions(-)
--
2.13.3
next reply other threads:[~2017-08-01 10:14 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-01 10:14 Niklas Söderlund [this message]
2017-08-01 10:14 ` [PATCH v3 1/2] ravb: add wake-on-lan support via magic packet Niklas Söderlund
2017-08-01 13:25 ` Sergei Shtylyov
2017-08-01 10:14 ` [PATCH v3 2/2] ravb: add workaround for clock when resuming with WoL enabled Niklas Söderlund
2017-08-01 13:27 ` Sergei Shtylyov
2017-08-02 0:54 ` [PATCH v3 0/2] ravb: add wake-on-lan support via magic packet David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170801101437.9020-1-niklas.soderlund+renesas@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=geert@linux-m68k.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).