> +config NXP_C45_TJA11XX_PHY > + tristate "NXP C45 TJA11XX PHYs" > + help > + Enable support for NXP C45 TJA11XX PHYs. > + Currently supports only the TJA1103 PHY.
> +#define PHY_ID_BASE_T1 0x001BB010 It would be better to use PHY_ID_TJA_1103 here. > + > +#define PMAPMD_B100T1_PMAPMD_CTL 0x0834 > +#define B100T1_PMAPMD_CONFIG_EN BIT(15) > +#define B100T1_PMAPMD_MASTER BIT(14) > +#define MASTER_MODE (B100T1_PMAPMD_CONFIG_EN | \ > + B100T1_PMAPMD_MASTER) You would normally align this with the B100T1_PMAPMD_CONFIG_EN > +static int nxp_c45_reset_done(struct phy_device *phydev) > +{ > + return !(phy_read_mmd(phydev, MDIO_MMD_VEND1, VEND1_DEVICE_CONTROL) & > + DEVICE_CONTROL_RESET); > +} > + > +static int nxp_c45_reset_done_or_timeout(struct phy_device *phydev, > + ktime_t timeout) > +{ > + ktime_t cur = ktime_get(); > + > + return nxp_c45_reset_done(phydev) || ktime_after(cur, timeout); > +} > + > +static int nxp_c45_soft_reset(struct phy_device *phydev) > +{ > + ktime_t timeout; > + int ret; > + > + ret = phy_write_mmd(phydev, MDIO_MMD_VEND1, VEND1_DEVICE_CONTROL, > + DEVICE_CONTROL_RESET); > + if (ret) > + return ret; > + > + timeout = ktime_add_ns(ktime_get(), RESET_POLL_NS); > + spin_until_cond(nxp_c45_reset_done_or_timeout(phydev, timeout)); phy_read_mmd_poll_timeout() i think does what you need. > + if (!nxp_c45_reset_done(phydev)) { > + phydev_err(phydev, "reset fail\n"); > + return -EIO; > + } > + return 0; > +} > +static struct phy_driver nxp_c45_driver[] = { > + { > + PHY_ID_MATCH_MODEL(PHY_ID_BASE_T1), > + .name = "NXP C45 BASE-T1", "NXP C45 TJA1103" Andrew