Re: [PATCH net-next 2/2] net: phy: microchip_t1: Autonegotiaion support for LAN887x T1 phy
From: Andrew Lunn
Date: Mon Dec 09 2024 - 12:04:17 EST
> - 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.
Andrew