blob: c2f2c108ec76498557da4c7b948c491574c10c92 [file] [log] [blame]
developeredbe69e2023-06-08 11:08:46 +08001From 3fc10755d5f6a5618519f2b5b3a68febfc5984b0 Mon Sep 17 00:00:00 2001
2From: Sam Shih <sam.shih@mediatek.com>
3Date: Fri, 2 Jun 2023 13:06:27 +0800
4Subject: [PATCH]
5 [networking][999-2702-v5.9-net-phy-add-support-for-a-common-probe-between-shared-PHYs.patch]
6
7---
8 include/linux/phy.h | 18 +++++++++++++++---
9 1 file changed, 15 insertions(+), 3 deletions(-)
10
11diff --git a/include/linux/phy.h b/include/linux/phy.h
12index d26dba255..4f2c105f5 100644
13--- a/include/linux/phy.h
14+++ b/include/linux/phy.h
15@@ -232,7 +232,8 @@ struct phy_package_shared {
16 };
17
18 /* used as bit number in atomic bitops */
19-#define PHY_SHARED_F_INIT_DONE 0
20+#define PHY_SHARED_F_INIT_DONE 0
21+#define PHY_SHARED_F_PROBE_DONE 1
22
23 /*
24 * The Bus class for PHYs. Devices which provide access to
25@@ -1373,14 +1374,25 @@ static inline int __phy_package_write(struct phy_device *phydev,
26 return __mdiobus_write(phydev->mdio.bus, shared->addr, regnum, val);
27 }
28
29-static inline bool phy_package_init_once(struct phy_device *phydev)
30+static inline bool __phy_package_set_once(struct phy_device *phydev,
31+ unsigned int b)
32 {
33 struct phy_package_shared *shared = phydev->shared;
34
35 if (!shared)
36 return false;
37
38- return !test_and_set_bit(PHY_SHARED_F_INIT_DONE, &shared->flags);
39+ return !test_and_set_bit(b, &shared->flags);
40+}
41+
42+static inline bool phy_package_init_once(struct phy_device *phydev)
43+{
44+ return __phy_package_set_once(phydev, PHY_SHARED_F_INIT_DONE);
45+}
46+
47+static inline bool phy_package_probe_once(struct phy_device *phydev)
48+{
49+ return __phy_package_set_once(phydev, PHY_SHARED_F_PROBE_DONE);
50 }
51
52 extern struct bus_type mdio_bus_type;
53--
542.34.1
55