Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: phy: broadcom: Convert to phy_id_compare_model()

Convert driver to phy_id_compare_model() helper instead of the custom
BRCM_PHY_MODEL macro.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Link: https://patch.msgid.link/20250911130840.23569-2-ansuelsmth@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Christian Marangi and committed by
Jakub Kicinski
64d1726b ae1c658b

+20 -22
+20 -22
drivers/net/phy/broadcom.c
··· 23 23 #include <linux/irq.h> 24 24 #include <linux/gpio/consumer.h> 25 25 26 - #define BRCM_PHY_MODEL(phydev) \ 27 - ((phydev)->drv->phy_id & (phydev)->drv->phy_id_mask) 28 - 29 26 #define BRCM_PHY_REV(phydev) \ 30 27 ((phydev)->drv->phy_id & ~((phydev)->drv->phy_id_mask)) 31 28 ··· 246 249 if (err < 0) 247 250 return err; 248 251 249 - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 || 250 - BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) { 252 + if (phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610) || 253 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610M)) { 251 254 /* Clear bit 9 to fix a phy interop issue. */ 252 255 err = bcm_phy_write_exp(phydev, MII_BCM54XX_EXP_EXP08, 253 256 MII_BCM54XX_EXP_EXP08_RJCT_2MHZ); ··· 261 264 } 262 265 } 263 266 264 - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM57780) { 267 + if (phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM57780)) { 265 268 int val; 266 269 267 270 val = bcm_phy_read_exp(phydev, MII_BCM54XX_EXP_EXP75); ··· 289 292 bool clk125en = true; 290 293 291 294 /* Abort if we are using an untested phy. */ 292 - if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM57780 && 293 - BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610 && 294 - BRCM_PHY_MODEL(phydev) != PHY_ID_BCM50610M && 295 - BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54210E && 296 - BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54810 && 297 - BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811) 295 + if (!(phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM57780) || 296 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610) || 297 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610M) || 298 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM54210E) || 299 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM54810) || 300 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM54811))) 298 301 return; 299 302 300 303 val = bcm_phy_read_shadow(phydev, BCM54XX_SHD_SCR3); ··· 303 306 304 307 orig = val; 305 308 306 - if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 || 307 - BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) && 309 + if ((phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610) || 310 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610M)) && 308 311 BRCM_PHY_REV(phydev) >= 0x3) { 309 312 /* 310 313 * Here, bit 0 _disables_ CLK125 when set. ··· 313 316 clk125en = false; 314 317 } else { 315 318 if (phydev->dev_flags & PHY_BRCM_RX_REFCLK_UNUSED) { 316 - if (BRCM_PHY_MODEL(phydev) != PHY_ID_BCM54811) { 319 + if (!phy_id_compare_model(phydev->drv->phy_id, 320 + PHY_ID_BCM54811)) { 317 321 /* Here, bit 0 _enables_ CLK125 when set */ 318 322 val &= ~BCM54XX_SHD_SCR3_DEF_CLK125; 319 323 } ··· 328 330 val |= BCM54XX_SHD_SCR3_DLLAPD_DIS; 329 331 330 332 if (phydev->dev_flags & PHY_BRCM_DIS_TXCRXC_NOENRGY) { 331 - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54210E || 332 - BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54810 || 333 - BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811) 333 + if (phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM54210E) || 334 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM54810) || 335 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM54811)) 334 336 val |= BCM54XX_SHD_SCR3_RXCTXC_DIS; 335 337 else 336 338 val |= BCM54XX_SHD_SCR3_TRDDAPD; ··· 459 461 if (err < 0) 460 462 return err; 461 463 462 - if ((BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610 || 463 - BRCM_PHY_MODEL(phydev) == PHY_ID_BCM50610M) && 464 + if ((phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610) || 465 + phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM50610M)) && 464 466 (phydev->dev_flags & PHY_BRCM_CLEAR_RGMII_MODE)) 465 467 bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, 0); 466 468 467 469 bcm54xx_adjust_rxrefclk(phydev); 468 470 469 - switch (BRCM_PHY_MODEL(phydev)) { 471 + switch (phydev->drv->phy_id & PHY_ID_MATCH_MODEL_MASK) { 470 472 case PHY_ID_BCM50610: 471 473 case PHY_ID_BCM50610M: 472 474 err = bcm54xx_config_clock_delay(phydev); ··· 691 693 * So we must read the bcm54811 as unable to auto-negotiate 692 694 * in BroadR-Reach mode. 693 695 */ 694 - if (BRCM_PHY_MODEL(phydev) == PHY_ID_BCM54811) 696 + if (phy_id_compare_model(phydev->drv->phy_id, PHY_ID_BCM54811)) 695 697 aneg = 0; 696 698 else 697 699 aneg = val & LRESR_LDSABILITY;