mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <Arun.Ramadoss@microchip.com>
To: <andrew@lunn.ch>, <olteanv@gmail.com>, <davem@davemloft.net>,
	<linux@armlinux.org.uk>, <conor+dt@kernel.org>,
	<Woojung.Huh@microchip.com>, <robh@kernel.org>,
	<krzk+dt@kernel.org>, <f.fainelli@gmail.com>, <kuba@kernel.org>,
	<vtpieter@gmail.com>, <UNGLinuxDriver@microchip.com>,
	<marex@denx.de>, <edumazet@google.com>, <pabeni@redhat.com>
Cc: <pieter.van.trappen@cern.ch>, <devicetree@vger.kernel.org>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next v3 4/5] net: dsa: microchip: add WoL support for KSZ87xx family
Date: Wed, 7 Aug 2024 03:56:28 +0000	[thread overview]
Message-ID: <adf5cdde46c829519c07cfe466923ecac1033451.camel@microchip.com> (raw)
In-Reply-To: <20240806132606.1438953-5-vtpieter@gmail.com>

Hi Pieter,


> 
>  static const u32 ksz8795_masks[] = {
> @@ -3789,7 +3795,7 @@ static void ksz_get_wol(struct dsa_switch *ds,
> int port,
>         u8 pme_ctrl;
>         int ret;
> 
> -       if (!is_ksz9477(dev))
> +       if (!is_ksz9477(dev) && !ksz_is_ksz87xx(dev))
>                 return;
> 
>         if (!dev->wakeup_source)
> @@ -3842,7 +3848,7 @@ static int ksz_set_wol(struct dsa_switch *ds,
> int port,
>         if (wol->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
>                 return -EINVAL;
> 
> -       if (!is_ksz9477(dev))
> +       if (!is_ksz9477(dev) && !ksz_is_ksz87xx(dev))
>                 return -EOPNOTSUPP;
> 
>         if (!dev->wakeup_source)
> @@ -3908,12 +3914,13 @@ static void ksz_wol_pre_shutdown(struct
> ksz_device *dev, bool *wol_enabled)
>  {
>         const struct ksz_dev_ops *ops = dev->dev_ops;
>         const u16 *regs = dev->info->regs;
> +       u8 pme_pin_en = PME_ENABLE;
>         struct dsa_port *dp;
>         int ret;
> 
>         *wol_enabled = false;
> 
> -       if (!is_ksz9477(dev))
> +       if (!is_ksz9477(dev) && !ksz_is_ksz87xx(dev))
>                 return;
> 
>         if (!dev->wakeup_source)
> @@ -3934,8 +3941,13 @@ static void ksz_wol_pre_shutdown(struct
> ksz_device *dev, bool *wol_enabled)
>         }
> 
>         /* Now we are save to enable PME pin. */
> -       if (*wol_enabled)
> -               ops->pme_write8(dev, regs[REG_SW_PME_CTRL],
> PME_ENABLE);
> +       if (*wol_enabled) {
> +               if (dev->pme_active_high)
> +                       pme_pin_en |= PME_POLARITY;
> +               ops->pme_write8(dev, regs[REG_SW_PME_CTRL],
> pme_pin_en);
> +               if (ksz_is_ksz87xx(dev))
> +                       ksz_write8(dev, KSZ8795_REG_INT_EN,
> KSZ8795_INT_PME_MASK);

nitpick: 
Do we need to rename register like KSZ87xx_REG_INT_EN since it is
common to other switches as well?


> diff --git a/drivers/net/dsa/microchip/ksz_common.h
> b/drivers/net/dsa/microchip/ksz_common.h
> index c60c218afa64..c0b93825726d 100644
> --- a/drivers/net/dsa/microchip/ksz_common.h
> +++ b/drivers/net/dsa/microchip/ksz_common.h
> @@ -174,6 +174,7 @@ struct ksz_device {
>         bool synclko_125;
>         bool synclko_disable;
>         bool wakeup_source;
> +       bool pme_active_high;
> 
>         struct vlan_table *vlan_cache;
> 
> @@ -712,6 +713,9 @@ static inline bool is_lan937x_tx_phy(struct
> ksz_device *dev, int port)
>  #define PME_ENABLE                     BIT(1)
>  #define PME_POLARITY                   BIT(0)
> 
> +#define KSZ8795_REG_INT_EN             0x7D
> +#define KSZ8795_INT_PME_MASK           BIT(4)
> +
> 
> --
> 2.43.0
> 

  reply	other threads:[~2024-08-07  3:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-06 13:25 [PATCH net-next v3 0/5] net: dsa: microchip: ksz8795: add Wake on LAN support vtpieter
2024-08-06 13:25 ` [PATCH net-next v3 1/5] dt-bindings: net: dsa: microchip: add microchip,pme-active-high flag vtpieter
2024-08-06 13:25 ` [PATCH net-next v3 2/5] net: dsa: microchip: move KSZ9477 WoL functions to ksz_common vtpieter
2024-08-07  3:50   ` Arun.Ramadoss
2024-08-06 13:25 ` [PATCH net-next v3 3/5] net: dsa: microchip: generalize KSZ9477 WoL functions at ksz_common vtpieter
2024-08-07  3:47   ` Arun.Ramadoss
2024-08-06 13:25 ` [PATCH net-next v3 4/5] net: dsa: microchip: add WoL support for KSZ87xx family vtpieter
2024-08-07  3:56   ` Arun.Ramadoss [this message]
2024-08-08  9:37     ` Pieter
2024-08-06 13:25 ` [PATCH net-next v3 5/5] net: dsa: microchip: apply KSZ87xx family fixes wrt datasheet vtpieter
2024-08-07  3:41   ` Arun.Ramadoss
2024-08-08  9:28     ` Pieter

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=adf5cdde46c829519c07cfe466923ecac1033451.camel@microchip.com \
    --to=arun.ramadoss@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=Woojung.Huh@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=conor+dt@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=marex@denx.de \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=pieter.van.trappen@cern.ch \
    --cc=robh@kernel.org \
    --cc=vtpieter@gmail.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

all inboxes | Powered by JetHome®