Re: [PATCH net-next v4 5/6] net: phy: mediatek: add calibration logic for AN7581

From
Andrew Lunn <andrew@lunn.ch>
Date
2026-11-04 03:47:31
Also in
linux-arm-kernel, linux-mediatek, lkml
Reply to
Christian Marangi, 2026-11-03
quoted hunk ↗ jump to hunk
+static int airoha_cal_cycle(struct phy_device *phydev, int devad,
+			    u32 regnum, u16 mask, u16 cal_val)
+{
+	struct airoha_socphy_shared *shared = phy_package_get_priv(phydev);
+	struct phy_device *phydev_p0;
+	int ret;
+
+	phydev_p0 = shared->phydev_p0;
+
+	phy_modify_mmd(phydev, devad, regnum, mask, cal_val);
+
+	ret = mtk_cal_cycle_wait(phydev_p0);
+	phydev_dbg(phydev, "cal_val: 0x%x, ret: %d\n", cal_val, ret);
What is the locking scheme here?

When using PHY packages, the typical usage is:

	phy_lock_mdio_bus(phydev);

and then use

	val = __phy_package_read(phydev, X, Y);

All the read/write helpers are __ indicating they assume the bus is
locked.

Here you are doing something similar, accessing another PHY in the
same package, but without locking. Is that safe?

     Andrew
Thread (17 messages) 17 messages, 3 authors, last reply 10d ago
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help