2
0

707-v6.8-09-net-phy-at803x-move-specific-at8031-config_intr-to-d.patch 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. From 30dd62191d3dd97c08f7f9dc9ce77ffab457e4fb Mon Sep 17 00:00:00 2001
  2. From: Christian Marangi <[email protected]>
  3. Date: Fri, 8 Dec 2023 15:51:56 +0100
  4. Subject: [PATCH 09/13] net: phy: at803x: move specific at8031 config_intr to
  5. dedicated function
  6. Move specific at8031 config_intr bits to dedicated function to make
  7. at803x_config_initr more generic.
  8. This is needed in preparation for PHY driver split as qca8081 share the
  9. same function to setup interrupts.
  10. Signed-off-by: Christian Marangi <[email protected]>
  11. Signed-off-by: David S. Miller <[email protected]>
  12. ---
  13. drivers/net/phy/at803x.c | 30 ++++++++++++++++++++++++------
  14. 1 file changed, 24 insertions(+), 6 deletions(-)
  15. --- a/drivers/net/phy/at803x.c
  16. +++ b/drivers/net/phy/at803x.c
  17. @@ -990,7 +990,6 @@ static int at803x_ack_interrupt(struct p
  18. static int at803x_config_intr(struct phy_device *phydev)
  19. {
  20. - struct at803x_priv *priv = phydev->priv;
  21. int err;
  22. int value;
  23. @@ -1007,10 +1006,6 @@ static int at803x_config_intr(struct phy
  24. value |= AT803X_INTR_ENABLE_DUPLEX_CHANGED;
  25. value |= AT803X_INTR_ENABLE_LINK_FAIL;
  26. value |= AT803X_INTR_ENABLE_LINK_SUCCESS;
  27. - if (priv->is_fiber) {
  28. - value |= AT803X_INTR_ENABLE_LINK_FAIL_BX;
  29. - value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX;
  30. - }
  31. err = phy_write(phydev, AT803X_INTR_ENABLE, value);
  32. } else {
  33. @@ -1617,6 +1612,29 @@ static int at8031_set_wol(struct phy_dev
  34. return ret;
  35. }
  36. +static int at8031_config_intr(struct phy_device *phydev)
  37. +{
  38. + struct at803x_priv *priv = phydev->priv;
  39. + int err, value = 0;
  40. +
  41. + if (phydev->interrupts == PHY_INTERRUPT_ENABLED &&
  42. + priv->is_fiber) {
  43. + /* Clear any pending interrupts */
  44. + err = at803x_ack_interrupt(phydev);
  45. + if (err)
  46. + return err;
  47. +
  48. + value |= AT803X_INTR_ENABLE_LINK_FAIL_BX;
  49. + value |= AT803X_INTR_ENABLE_LINK_SUCCESS_BX;
  50. +
  51. + err = phy_set_bits(phydev, AT803X_INTR_ENABLE, value);
  52. + if (err)
  53. + return err;
  54. + }
  55. +
  56. + return at803x_config_intr(phydev);
  57. +}
  58. +
  59. static int qca83xx_config_init(struct phy_device *phydev)
  60. {
  61. u8 switch_revision;
  62. @@ -2137,7 +2155,7 @@ static struct phy_driver at803x_driver[]
  63. .write_page = at803x_write_page,
  64. .get_features = at803x_get_features,
  65. .read_status = at803x_read_status,
  66. - .config_intr = at803x_config_intr,
  67. + .config_intr = at8031_config_intr,
  68. .handle_interrupt = at803x_handle_interrupt,
  69. .get_tunable = at803x_get_tunable,
  70. .set_tunable = at803x_set_tunable,