lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <adf5cdde46c829519c07cfe466923ecac1033451.camel@microchip.com>
Date: Wed, 7 Aug 2024 03:56:28 +0000
From: <Arun.Ramadoss@...rochip.com>
To: <andrew@...n.ch>, <olteanv@...il.com>, <davem@...emloft.net>,
	<linux@...linux.org.uk>, <conor+dt@...nel.org>, <Woojung.Huh@...rochip.com>,
	<robh@...nel.org>, <krzk+dt@...nel.org>, <f.fainelli@...il.com>,
	<kuba@...nel.org>, <vtpieter@...il.com>, <UNGLinuxDriver@...rochip.com>,
	<marex@...x.de>, <edumazet@...gle.com>, <pabeni@...hat.com>
CC: <pieter.van.trappen@...n.ch>, <devicetree@...r.kernel.org>,
	<netdev@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next v3 4/5] net: dsa: microchip: add WoL support for
 KSZ87xx family

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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ