1 From c34d9452d4e5d98a655d7b625e85466320885416 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Thu, 4 Jan 2024 22:30:41 +0100
4 Subject: [PATCH 4/4] net: phy: at803x: make read_status more generic
6 Make read_status more generic in preparation on moving it to shared
7 library as other PHY Family Driver will have the exact same
10 The only specific part was a check for AR8031/33 if 1000basex was used.
11 The check is moved to a dedicated function specific for those PHYs.
13 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
14 Reviewed-by: Simon Horman <horms@kernel.org>
15 Signed-off-by: David S. Miller <davem@davemloft.net>
17 drivers/net/phy/at803x.c | 17 ++++++++++++-----
18 1 file changed, 12 insertions(+), 5 deletions(-)
20 --- a/drivers/net/phy/at803x.c
21 +++ b/drivers/net/phy/at803x.c
22 @@ -1020,13 +1020,9 @@ static int at803x_read_specific_status(s
24 static int at803x_read_status(struct phy_device *phydev)
26 - struct at803x_priv *priv = phydev->priv;
27 struct at803x_ss_mask ss_mask = { 0 };
28 int err, old_link = phydev->link;
30 - if (priv->is_1000basex)
31 - return genphy_c37_read_status(phydev);
33 /* Update the link, but return if there was an error */
34 err = genphy_update_link(phydev);
36 @@ -1618,6 +1614,17 @@ static int at8031_config_intr(struct phy
37 return at803x_config_intr(phydev);
40 +/* AR8031 and AR8033 share the same read status logic */
41 +static int at8031_read_status(struct phy_device *phydev)
43 + struct at803x_priv *priv = phydev->priv;
45 + if (priv->is_1000basex)
46 + return genphy_c37_read_status(phydev);
48 + return at803x_read_status(phydev);
51 /* AR8031 and AR8035 share the same cable test get status reg */
52 static int at8031_cable_test_get_status(struct phy_device *phydev,
54 @@ -2281,7 +2288,7 @@ static struct phy_driver at803x_driver[]
55 .read_page = at803x_read_page,
56 .write_page = at803x_write_page,
57 .get_features = at803x_get_features,
58 - .read_status = at803x_read_status,
59 + .read_status = at8031_read_status,
60 .config_intr = at8031_config_intr,
61 .handle_interrupt = at803x_handle_interrupt,
62 .get_tunable = at803x_get_tunable,