Re: [PATCH 2/3] net: microchip_t1s: add support for LAN867x Rev.C1

From: Andrew Lunn
Date: Mon Nov 27 2023 - 08:37:53 EST


> #define PHY_ID_LAN867X_REVB1 0x0007C162
> +#define PHY_ID_LAN867X_REVC1 0x0007C164

So there is a gap in the revisions. Maybe a B2 exists?

> +static int lan867x_revc1_read_fixup_value(struct phy_device *phydev, u16 addr)
> +{
> + int regval;
> + /* The AN pretty much just states 'trust us' regarding these magic vals */
> + const u16 magic_or = 0xE0;
> + const u16 magic_reg_mask = 0x1F;
> + const u16 magic_check_mask = 0x10;

Reverse christmass tree please. Longest first, shorted last.

> + regval = lan865x_revb0_indirect_read(phydev, addr);
> + if (regval < 0)
> + return regval;
> +
> + regval &= magic_reg_mask;
> +
> + return (regval & magic_check_mask) ? regval | magic_or : regval;
> +}
> +
> +static int lan867x_revc1_config_init(struct phy_device *phydev)
> +{
> + int err;
> + int regval;
> + u16 override0;
> + u16 override1;
> + const u16 override_addr0 = 0x4;
> + const u16 override_addr1 = 0x8;
> + const u8 index_to_override0 = 2;
> + const u8 index_to_override1 = 3;

Same here.

> +
> + err = lan867x_wait_for_reset_complete(phydev);
> + if (err)
> + return err;
> +
> + /* The application note specifies a super convenient process
> + * where 2 of the fixup regs needs a write with a value that is
> + * a modified result of another reg read.
> + * Enjoy the magic show.
> + */

I really do hope that by revision D1 they get the firmware sorted out
so none of this undocumented magic is needed.

Andrew