netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH] sh_eth: add wake-on-lan support via magic packet
Date: Thu, 8 Dec 2016 14:22:44 +0100	[thread overview]
Message-ID: <20161208132241.GA7150@verge.net.au> (raw)
In-Reply-To: <20161208071620.GG21834@bigcity.dyn.berto.se>

On do, dec 08, 2016 at 08:16:20 +0100, Niklas Söderlund wrote:
> Hi Geert,
> 
> Thanks for testing and your feedback.
> 
> On 2016-12-07 19:14:40 +0100, Geert Uytterhoeven wrote:
> > Hi Niklas,
> > 
> > On Wed, Dec 7, 2016 at 5:28 PM, Niklas Söderlund
> > <niklas.soderlund+renesas@ragnatech.se> wrote:
> > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
> > 
> > Thanks, works fine on r8a7791/koelsch!
> > 
> > Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > 
> > > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > > +++ b/drivers/net/ethernet/renesas/sh_eth.c
> > > @@ -624,7 +624,7 @@ static struct sh_eth_cpu_data r8a779x_data = {
> > >
> > >         .register_type  = SH_ETH_REG_FAST_RCAR,
> > >
> > > -       .ecsr_value     = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD,
> > > +       .ecsr_value     = ECSR_PSRTO | ECSR_LCHNG | ECSR_ICD | ECSR_MPD,
> > 
> > Interestingly, the ECSR_MPD bit is already set for several SoCs.
> 
> Yes, I noticed that and my assumption was that it was set 'just in case' 
> to clear any MagicPacket interrupts at probe time.
> 
> > 
> > Hence adding ".magic = 1" to the entry for r8a7740 instantly gave me working
> > WoL support on r8a7740/armadillo. Cool!
> 
> Cool, I will set ".magic = 1" for r8a7740 in v2.
> 
> > 
> > > --- a/drivers/net/ethernet/renesas/sh_eth.h
> > > +++ b/drivers/net/ethernet/renesas/sh_eth.h
> > > @@ -493,6 +493,7 @@ struct sh_eth_cpu_data {
> > >         unsigned shift_rd0:1;   /* shift Rx descriptor word 0 right by 16 */
> > >         unsigned rmiimode:1;    /* EtherC has RMIIMODE register */
> > >         unsigned rtrate:1;      /* EtherC has RTRATE register */
> > > +       unsigned magic:1;       /* EtherC have PMDE in ECMR and MPDIP in ECSIPR */
> > 
> > Instead of adding a new flag, perhaps you can just check for the ECSR_MPD flag
> > in ecsr_value?
> 
> I briefly considered this but decided against it since I do not have 
> documentation for all versions of the device and no way to test it. You 
> tested and confirmed functionality on r8a7740, which leaves:
> 
> - sh7734-gether
> - sh7763-gether
> - sh7757-gether
> 
> To figure out if they support MagicPacket in the same fashion as r8a7740 
> and r8a779x. If anyone have access to documentation or hardware to 
> confirm this I be more then happy to get rid of the magic flag in favor 
> och checking for ECSR_MPD in ecsr_value.

Perhaps documentation can be found but if not I wonder if we can use some
other mechanism to blacklist SoC which we are unsure about.

>From my POV it would be very nice if things just worked™ on SoCs where
the feature has been verified.

> > > @@ -529,6 +530,9 @@ struct sh_eth_private {
> > >         unsigned no_ether_link:1;
> > >         unsigned ether_link_active_low:1;
> > >         unsigned is_opened:1;
> > > +
> > > +       bool wol_enabled;
> > 
> > "unsigned wol_enabled:1", to merge with the bitfield above?
> 
> Thanks, looking it it now I don't know what I was thinking. I will 
> changes it for v2.
> 
> > 
> > > +       struct clk *clk;
> > 
> > It's a good practice to keep all pointers at the top of the struct, to avoid
> > gaps due to alignment restrictions, especially on 64-bit (I know that's not
> > the case here).
> 
> Thanks, you learn new things everyday. I will move it for v2.
> 
> > 
> > Gr{oetje,eeting}s,
> > 
> >                         Geert
> > 
> > --
> > Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> > 
> > In personal conversations with technical people, I call myself a hacker. But
> > when I'm talking to journalists I just say "programmer" or something like that.
> >                                 -- Linus Torvalds
> 
> -- 
> Regards,
> Niklas Söderlund
> 

  reply	other threads:[~2016-12-08 13:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-07 16:28 [PATCH] sh_eth: add wake-on-lan support via magic packet Niklas Söderlund
2016-12-07 18:14 ` Geert Uytterhoeven
2016-12-08  7:16   ` Niklas Söderlund
2016-12-08 13:22     ` Simon Horman [this message]
2016-12-08 15:01       ` Niklas Söderlund
2016-12-08 15:31         ` Simon Horman
2016-12-08 12:28 ` Sergei Shtylyov
2016-12-08 14:56   ` Niklas Söderlund
2016-12-08 15:13     ` Geert Uytterhoeven
2016-12-10 21:25     ` Sergei Shtylyov
2016-12-12 15:49       ` Niklas Söderlund
2016-12-12 17:35         ` Sergei Shtylyov
2016-12-08 16:29   ` Sergei Shtylyov

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=20161208132241.GA7150@verge.net.au \
    --to=horms@verge.net.au \
    --cc=geert@linux-m68k.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --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).