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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191112204031.GH10875@lunn.ch>
Date:   Tue, 12 Nov 2019 21:40:31 +0100
From:   Andrew Lunn <andrew@...n.ch>
To:     Bryan Whitehead <Bryan.Whitehead@...rochip.com>
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        UNGLinuxDriver@...rochip.com
Subject: Re: [PATCH v1 net-next] mscc.c: Add support for additional VSC PHYs

On Tue, Nov 12, 2019 at 10:54:08AM -0500, Bryan Whitehead wrote:
> Add support for the following VSC PHYs
> 	VSC8504, VSC8552, VSC8572,
> 	VSC8562, VSC8564, VSC8575, VSC8582
> 
> Signed-off-by: Bryan Whitehead <Bryan.Whitehead@...rochip.com>
> ---
>  drivers/net/phy/mscc.c | 182 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 182 insertions(+)
> 
> diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
> index 805cda3..8933681 100644
> --- a/drivers/net/phy/mscc.c
> +++ b/drivers/net/phy/mscc.c
> @@ -253,12 +253,18 @@ enum rgmii_rx_clock_delay {
>  #define MSCC_PHY_TR_MSB			  18
>  
>  /* Microsemi PHY ID's */
> +#define PHY_ID_VSC8504			  0x000704c0
>  #define PHY_ID_VSC8514			  0x00070670
>  #define PHY_ID_VSC8530			  0x00070560
>  #define PHY_ID_VSC8531			  0x00070570
>  #define PHY_ID_VSC8540			  0x00070760
>  #define PHY_ID_VSC8541			  0x00070770
> +#define PHY_ID_VSC8552			  0x000704e0
> +#define PHY_ID_VSC856X			  0x000707e0
> +#define PHY_ID_VSC8572			  0x000704d0
>  #define PHY_ID_VSC8574			  0x000704a0
> +#define PHY_ID_VSC8575			  0x000707d0
> +#define PHY_ID_VSC8582			  0x000707b0
>  #define PHY_ID_VSC8584			  0x000707c0
>  
>  #define MSCC_VDDMAC_1500		  1500
> @@ -1597,6 +1603,8 @@ static bool vsc8584_is_pkg_init(struct phy_device *phydev, bool reversed)
>  
>  		phy = container_of(map[addr], struct phy_device, mdio);
>  
> +		if (!phy)
> +			continue;
> +
>  		if ((phy->phy_id & phydev->drv->phy_id_mask) !=
>  		    (phydev->drv->phy_id & phydev->drv->phy_id_mask))
>  			continue;
> @@ -1648,9 +1656,27 @@ static int vsc8584_config_init(struct phy_device *phydev)
>  	 */
>  	if (!vsc8584_is_pkg_init(phydev, val & PHY_ADDR_REVERSED ? 1 : 0)) {
>  		if ((phydev->phy_id & phydev->drv->phy_id_mask) ==
> +		    (PHY_ID_VSC8504 & phydev->drv->phy_id_mask))
> +			ret = vsc8574_config_pre_init(phydev);
> +		else if ((phydev->phy_id & phydev->drv->phy_id_mask) ==
> +		    (PHY_ID_VSC8552 & phydev->drv->phy_id_mask))
> +			ret = vsc8574_config_pre_init(phydev);
> +		else if ((phydev->phy_id & phydev->drv->phy_id_mask) ==
> +		    (PHY_ID_VSC856X & phydev->drv->phy_id_mask))
> +			ret = vsc8584_config_pre_init(phydev);

Could we turn this into a switch statement? I think

      switch (phydev->phy_id & phydev->drv->phy_id_mask) {
      case PHY_ID_VSC8504:
      case PHY_ID_VSC8552:
      	   ret = vsc8574_config_pre_init(phydev);
	   break
      case PHY_ID_VSC856X:
      	   ret = vsc8584_config_pre_init(phydev);
	   break;

etc should work, since PHY_ID_VSC8<FOO> always has the lower nibble set
to 0.

   Andrew

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ