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] [day] [month] [year] [list]
Message-ID:
 <SA1PR18MB47090943351773233B16C0C9A0962@SA1PR18MB4709.namprd18.prod.outlook.com>
Date: Thu, 29 Aug 2024 06:28:17 +0000
From: Sai Krishna Gajula <saikrishnag@...vell.com>
To: Frank Sae <Frank.Sae@...or-comm.com>, "andrew@...n.ch" <andrew@...n.ch>,
        "hkallweit1@...il.com" <hkallweit1@...il.com>,
        "davem@...emloft.net"
	<davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "kuba@...nel.org" <kuba@...nel.org>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "linux@...linux.org.uk" <linux@...linux.org.uk>
CC: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "yuanlai.cui@...or-comm.com" <yuanlai.cui@...or-comm.com>,
        "hua.sun@...or-comm.com" <hua.sun@...or-comm.com>,
        "xiaoyong.li@...or-comm.com" <xiaoyong.li@...or-comm.com>,
        "suting.hu@...or-comm.com" <suting.hu@...or-comm.com>,
        "jie.han@...or-comm.com" <jie.han@...or-comm.com>
Subject: RE: [PATCH net-next v4 2/2] net: phy: Add driver for Motorcomm yt8821
 2.5G ethernet phy


> -----Original Message-----
> From: Frank Sae <Frank.Sae@...or-comm.com>
> Sent: Wednesday, August 28, 2024 2:41 PM
> To: Frank.Sae@...or-comm.com; andrew@...n.ch; hkallweit1@...il.com;
> davem@...emloft.net; edumazet@...gle.com; kuba@...nel.org;
> pabeni@...hat.com; linux@...linux.org.uk
> Cc: netdev@...r.kernel.org; linux-kernel@...r.kernel.org;
> yuanlai.cui@...or-comm.com; hua.sun@...or-comm.com;
> xiaoyong.li@...or-comm.com; suting.hu@...or-comm.com;
> jie.han@...or-comm.com
> Subject: [PATCH net-next v4 2/2] net: phy: Add driver for
> Motorcomm yt8821 2.5G ethernet phy
> 
> Add a driver for the motorcomm yt8821 2. 5G ethernet phy. Verified the
> driver on BPI-R3(with MediaTek MT7986(Filogic 830) SoC) development
> board, which is developed by Guangdong Bipai Technology Co. , Ltd. . yt8821
> 2. 5G ethernet phy works in AUTO_BX2500_SGMII
> Add a driver for the motorcomm yt8821 2.5G ethernet phy. Verified the driver
> on BPI-R3(with MediaTek MT7986(Filogic 830) SoC) development board,
> which is developed by Guangdong Bipai Technology Co., Ltd..
> 
> yt8821 2.5G ethernet phy works in AUTO_BX2500_SGMII or FORCE_BX2500
> interface, supports 2.5G/1000M/100M/10M speeds, and wol(magic package).
> 
> Signed-off-by: Frank Sae <Frank.Sae@...or-comm.com>
> ---
> v4:
>   - removed all these pointless goto err_restore_page;
> v3:
>   - used existing API genphy_c45_pma_read_ext_abilities() to make source
>     code more concise in yt8821_get_features().
>   - used existing API genphy_c45_read_lpa() to make source code more
>     concise in yt8821_read_status().
>   - updated to return yt8521_aneg_done_paged() in yt8821_aneg_done();
>   - moved __set_bit(PHY_INTERFACE_MODE_2500BASEX,
>     phydev->possible_interfaces); out of these if() statements.
> v2:
>   - removed motorcomm,chip-mode property in DT.
>   - modified the magic numbers of _SETTING macro.
>   - added ":" after returns in function's DOC.
>   - updated YTPHY_SSR_SPEED_2500M val from 0x4 ((0x0 << 14) | BIT(9)).
>   - yt8821gen_init_paged(phydev, YT8521_RSSR_FIBER_SPACE) and
>     yt8821gen_init_paged(phydev, YT8521_RSSR_UTP_SPACE) updated to
>     yt8821_serdes_init() and yt8821_utp_init().
>   - removed phydev->irq = PHY_POLL; in yt8821_config_init().
>   - instead of phydev_info(), phydev_dbg() used in yt8821_read_status().
>   - instead of __assign_bit(), __set_bit() used.
> v1:
>   - https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_netdev_20240727091906.1108588-2D1-2DFrank.Sae-
> 40motor-
> 2Dcomm.com_&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=c3MsgrR-U-
> HFhmFd6R4MWRZG-
> 8QeikJn5PkjqMTpBSg&m=VckHuujnmDd4GF3H1QDn2ODGX3JQFGecOaxg_KFL
> mqojgTcv9-
> Sj4t01SGe93wdC&s=esTln_IHM7h4im8TXdCU3Gc49A3kpbUA_9KTS9UB_MM
> &e=
>   - https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_netdev_20240727092009.1108640-2D1-2DFrank.Sae-
> 40motor-
> 2Dcomm.com_&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=c3MsgrR-U-
> HFhmFd6R4MWRZG-
> 8QeikJn5PkjqMTpBSg&m=VckHuujnmDd4GF3H1QDn2ODGX3JQFGecOaxg_KFL
> mqojgTcv9-Sj4t01SGe93wdC&s=2G8-kMLfmOIyynLWZplwoTeQw-
> luFwFmCESN5zy_9hs&e=
>   - https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__lore.kernel.org_netdev_20240727092031.1108690-2D1-2DFrank.Sae-
> 40motor-
> 2Dcomm.com_&d=DwIDAg&c=nKjWec2b6R0mOyPaz7xtfQ&r=c3MsgrR-U-
> HFhmFd6R4MWRZG-
> 8QeikJn5PkjqMTpBSg&m=VckHuujnmDd4GF3H1QDn2ODGX3JQFGecOaxg_KFL
> mqojgTcv9-
> Sj4t01SGe93wdC&s=4ewK3NYOYrlZcAJGCrzRRuALyWaOqDu0lENKWjsoCQY&e
> =
> ---
>  drivers/net/phy/motorcomm.c | 662
> +++++++++++++++++++++++++++++++++++-
>  1 file changed, 658 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/phy/motorcomm.c b/drivers/net/phy/motorcomm.c
> index fe0aabe12622..a9074f98cd88 100644
> --- a/drivers/net/phy/motorcomm.c
> +++ b/drivers/net/phy/motorcomm.c
> @@ -1,6 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0+
>  /*
> - * Motorcomm 8511/8521/8531/8531S PHY driver.
> + * Motorcomm 8511/8521/8531/8531S/8821 PHY driver.
>   *
>   * Author: Peter Geis <pgwipeout@...il.com>
>   * Author: Frank <Frank.Sae@...or-comm.com> @@ -16,8 +16,8 @@
>  #define PHY_ID_YT8521		0x0000011a
>  #define PHY_ID_YT8531		0x4f51e91b
>  #define PHY_ID_YT8531S		0x4f51e91a
> -
> -/* YT8521/YT8531S Register Overview
> +#define PHY_ID_YT8821		0x4f51ea19
> +/* YT8521/YT8531S/YT8821 Register Overview
>   *	UTP Register space	|	FIBER Register space
>   *  ------------------------------------------------------------
>   * |	UTP MII			|	FIBER MII		|
> @@ -50,6 +50,8 @@
>  #define YTPHY_SSR_SPEED_10M			((0x0 << 14))
>  #define YTPHY_SSR_SPEED_100M			((0x1 << 14))
>  #define YTPHY_SSR_SPEED_1000M			((0x2 << 14))
> +#define YTPHY_SSR_SPEED_10G			((0x3 << 14))
> +#define YTPHY_SSR_SPEED_2500M			((0x0 << 14) | BIT(9))
>  #define YTPHY_SSR_DUPLEX_OFFSET			13
>  #define YTPHY_SSR_DUPLEX			BIT(13)
>  #define YTPHY_SSR_PAGE_RECEIVED			BIT(12)
> @@ -268,12 +270,89 @@
>  #define YT8531_SCR_CLK_SRC_REF_25M		4
>  #define YT8531_SCR_CLK_SRC_SSC_25M		5
> 
> +#define YT8821_SDS_EXT_CSR_CTRL_REG			0x23
> +#define YT8821_SDS_EXT_CSR_VCO_LDO_EN			BIT(15)

...

> + *
> + * Returns: 0 or negative errno code
> + */
> +static int yt8821_utp_init(struct phy_device *phydev) {
> +	int old_page;
> +	int ret = 0;
> +	u16 mask;
> +	u16 save;
> +	u16 set;
> +
> +	old_page = phy_select_page(phydev, YT8521_RSSR_UTP_SPACE);
> +	if (old_page < 0)
> +		goto err_restore_page;

If phy_select_page returns an error, you’re directly jumping to the cleanup without any logging. It is advisable to add debug log before the goto statement, until unless you have other constraints w.r.t
Memory etc..
If (old_page < 0) {
	phydev_err(phydev, "Failed to select page: %d\n", old_page);
	goto err_restore_page;
}

> +
> +	mask = YT8821_UTP_EXT_RPDN_BP_FFE_LNG_2500 |
> +		YT8821_UTP_EXT_RPDN_BP_FFE_SHT_2500 |
> +		YT8821_UTP_EXT_RPDN_IPR_SHT_2500;
> +	set = YT8821_UTP_EXT_RPDN_BP_FFE_LNG_2500 |
> +		YT8821_UTP_EXT_RPDN_BP_FFE_SHT_2500;
> +	ret = ytphy_modify_ext(phydev, YT8821_UTP_EXT_RPDN_CTRL_REG,
> +			       mask, set);
> +	if (ret < 0)
> +		goto err_restore_page;
> +
> +	mask = YT8821_UTP_EXT_VGA_LPF1_CAP_OTHER |
> +		YT8821_UTP_EXT_VGA_LPF1_CAP_2500;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ