Re: [PATCH net-next v3 4/5] net: dsa: microchip: add WoL support for KSZ87xx family

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
> 




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux