RE: [PATCH net-next 2/2] net: phy: microchip_t1: Autonegotiaion support for LAN887x T1 phy
From: Tarun.Alle
Date: Tue Dec 10 2024 - 01:43:08 EST
Hi Andrew,
Thanks for your review comments.
> -----Original Message-----
> From: Andrew Lunn <andrew@xxxxxxx>
> Sent: Monday, December 9, 2024 10:33 PM
> To: Tarun Alle - I68638 <Tarun.Alle@xxxxxxxxxxxxx>
> Cc: Arun Ramadoss - I17769 <Arun.Ramadoss@xxxxxxxxxxxxx>;
> UNGLinuxDriver <UNGLinuxDriver@xxxxxxxxxxxxx>;
> hkallweit1@xxxxxxxxx; linux@xxxxxxxxxxxxxxx; davem@xxxxxxxxxxxxx;
> edumazet@xxxxxxxxxx; kuba@xxxxxxxxxx; pabeni@xxxxxxxxxx;
> netdev@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH net-next 2/2] net: phy: microchip_t1: Autonegotiaion
> support for LAN887x T1 phy
>
> EXTERNAL EMAIL: Do not click links or open attachments unless you know
> the content is safe
>
> > - if (phydev->master_slave_set == MASTER_SLAVE_CFG_MASTER_FORCE
> ||
> > - phydev->master_slave_set ==
> MASTER_SLAVE_CFG_MASTER_PREFERRED){
> > - static const struct lan887x_regwr_map phy_cfg[] = {
> > - {MDIO_MMD_PMAPMD,
> LAN887X_AFE_PORT_TESTBUS_CTRL4, 0x00b8},
> > - {MDIO_MMD_PMAPMD, LAN887X_TX_AMPLT_1000T1_REG,
> 0x0038},
> > - {MDIO_MMD_VEND1, LAN887X_INIT_COEFF_DFE1_100,
> 0x000f},
> > - };
> > -
> > - ret = lan887x_phy_config(phydev, phy_cfg, ARRAY_SIZE(phy_cfg));
> > + if (phydev->autoneg == AUTONEG_DISABLE) {
> > + if (phydev->master_slave_set ==
> MASTER_SLAVE_CFG_MASTER_FORCE ||
> > + phydev->master_slave_set ==
> > + MASTER_SLAVE_CFG_MASTER_PREFERRED) {
> > + ret = lan887x_phy_config(phydev, phy_comm_cfg,
> > + ARRAY_SIZE(phy_comm_cfg));
> > + } else {
> > + static const struct lan887x_regwr_map phy_cfg[] = {
> > + {MDIO_MMD_PMAPMD,
> LAN887X_AFE_PORT_TESTBUS_CTRL4,
> > + 0x0038},
> > + {MDIO_MMD_VEND1, LAN887X_INIT_COEFF_DFE1_100,
> > + 0x0014},
> > + };
> > +
> > + ret = lan887x_phy_config(phydev, phy_cfg,
> > + ARRAY_SIZE(phy_cfg));
> > + }
>
> It might be better to pull this apart into two helper functions? That would
> avoid most of the not so nice wrapping.
>
I will implement helper functions for each case.
> Andrew
Thanks,
Tarun Alle.