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: <Zg1gycEDL4llYrjI@shell.armlinux.org.uk>
Date: Wed, 3 Apr 2024 14:59:37 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Gregor Herburger <gregor.herburger@...tq-group.com>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Dimitri Fedrau <dima.fedrau@...il.com>,
	Stefan Eichenberger <eichest@...il.com>, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org, linux@...tq-group.com,
	alexander.stein@...tq-group.com
Subject: Re: [PATCH] net: phy: marvell-88q2xxx: add support for Rev B1 and B2

On Wed, Apr 03, 2024 at 03:45:22PM +0200, Gregor Herburger wrote:
> +static int mv88q222x_revb1_revb2_config_init(struct phy_device *phydev)
> +{
> +	bool is_rev_b2 = phydev->c45_ids.device_ids[MDIO_MMD_PMAPMD] == PHY_ID_88Q2220_REVB2;
> +	int ret, i;
> +
> +	for (i = 0; i < ARRAY_SIZE(mv88q222x_revb1_init_seq0); i++) {
> +		/* Rev B2 init sequence differs compared to Rev B1. As noted in Marvell API:
> +		 * Remove the instruction to enable TXDAC setting overwrite bit for Rev B2.
> +		 */
> +		if (is_rev_b2 && mv88q222x_revb1_init_seq1[i].regnum == 0xffe3)
> +			continue;
> +
> +		ret = phy_write_mmd(phydev, mv88q222x_revb1_init_seq0[i].devad,
> +				    mv88q222x_revb1_init_seq0[i].regnum,
> +				    mv88q222x_revb1_init_seq0[i].val);
> +		if (ret < 0)
> +			return ret;
> +	}
> +
> +	usleep_range(3000, 5000);
> +
> +	for (i = 0; i < ARRAY_SIZE(mv88q222x_revb1_init_seq1); i++) {
> +		ret = phy_write_mmd(phydev, mv88q222x_revb1_init_seq1[i].devad,
> +				    mv88q222x_revb1_init_seq1[i].regnum,
> +				    mv88q222x_revb1_init_seq1[i].val);
> +		if (ret < 0)
> +			return ret;
> +	}

I think a helper would be useful to write these sequences, rather than
writing the same code several times:

static int mv88q2xxx_write_mmd_vals(struct phy_device *phydev,
				    const struct mmd_val *vals, size_t len)
{
	int ret;

	for (; len; vals++, len--) {
		ret = phy_write_mmd(phydev, vals->devad, vals->regnum,
				    vals->val);
		if (ret < 0)
			return ret;
	}

	return 0;
}

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ