1 From 30dd62191d3dd97c08f7f9dc9ce77ffab457e4fb Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Fri, 8 Dec 2023 15:51:56 +0100
4 Subject: [PATCH 09/13] net: phy: at803x: move specific at8031 config_intr to
7 Move specific at8031 config_intr bits to dedicated function to make
8 at803x_config_initr more generic.
10 This is needed in preparation for PHY driver split as qca8081 share the
11 same function to setup interrupts.
13 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
14 Signed-off-by: David S. Miller <davem@davemloft.net>
16 drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++------
17 1 file changed, 24 insertions(+), 6 deletions(-)
19 --- a/drivers/net/phy/at803x.c
20 +++ b/drivers/net/phy/at803x.c
21 @@ -990,7 +990,6 @@ static int at803x_ack_interrupt(struct p
23 static int at803x_config_intr(struct phy_device *phydev)
25 - struct at803x_priv *priv = phydev->priv;
29 @@ -1007,10 +1006,6 @@ static int at803x_config_intr(struct phy
30 value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED;
31 value |= AT803X_INTR_ENABLE_LINK_FAIL;
32 value |= AT803X_INTR_ENABLE_LINK_SUCCESS;
33 - if (priv->is_fiber) {
34 - value |= AT803X_INTR_ENABLE_LINK_FAIL_BX;
35 - value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX;
38 err = phy_write(phydev, AT803X_INTR_ENABLE, value);
40 @@ -1617,6 +1612,29 @@ static int at8031_set_wol(struct phy_dev
44 +static int at8031_config_intr(struct phy_device *phydev)
46 + struct at803x_priv *priv = phydev->priv;
49 + if (phydev->interrupts == PHY_INTERRUPT_ENABLED &&
51 + /* Clear any pending interrupts */
52 + err = at803x_ack_interrupt(phydev);
56 + value |= AT803X_INTR_ENABLE_LINK_FAIL_BX;
57 + value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX;
59 + err = phy_set_bits(phydev, AT803X_INTR_ENABLE, value);
64 + return at803x_config_intr(phydev);
67 static int qca83xx_config_init(struct phy_device *phydev)
70 @@ -2137,7 +2155,7 @@ static struct phy_driver at803x_driver[]
71 .write_page = at803x_write_page,
72 .get_features = at803x_get_features,
73 .read_status = at803x_read_status,
74 - .config_intr = at803x_config_intr,
75 + .config_intr = at8031_config_intr,
76 .handle_interrupt = at803x_handle_interrupt,
77 .get_tunable = at803x_get_tunable,
78 .set_tunable = at803x_set_tunable,