lkml.org 
[lkml]   [2024]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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!

\
 
 \ /
  Last update: 2024-05-27 16:22    [W:0.027 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site