706-v6.6-06-net-phy-at803x-add-qca8081-fifo-reset-on-the-link-ch.patch 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 723970affdd8766fa0d91cd34bf2ffc861538b5f Mon Sep 17 00:00:00 2001
  2. From: Luo Jie <[email protected]>
  3. Date: Sun, 16 Jul 2023 16:49:24 +0800
  4. Subject: [PATCH 6/6] net: phy: at803x: add qca8081 fifo reset on the link
  5. changed
  6. The qca8081 sgmii fifo needs to be reset on link down and
  7. released on the link up in case of any abnormal issue
  8. such as the packet blocked on the PHY.
  9. Signed-off-by: Luo Jie <[email protected]>
  10. Reviewed-by: Andrew Lunn <[email protected]>
  11. Reviewed-by: Russell King (Oracle) <[email protected]>
  12. Signed-off-by: David S. Miller <[email protected]>
  13. ---
  14. drivers/net/phy/at803x.c | 14 ++++++++++++++
  15. 1 file changed, 14 insertions(+)
  16. --- a/drivers/net/phy/at803x.c
  17. +++ b/drivers/net/phy/at803x.c
  18. @@ -276,6 +276,9 @@
  19. #define QCA808X_PHY_MMD7_CHIP_TYPE 0x901d
  20. #define QCA808X_PHY_CHIP_TYPE_1G BIT(0)
  21. +#define QCA8081_PHY_SERDES_MMD1_FIFO_CTRL 0x9072
  22. +#define QCA8081_PHY_FIFO_RSTN BIT(11)
  23. +
  24. MODULE_DESCRIPTION("Qualcomm Atheros AR803x and QCA808X PHY driver");
  25. MODULE_AUTHOR("Matus Ujhelyi");
  26. MODULE_LICENSE("GPL");
  27. @@ -2037,6 +2040,16 @@ static int qca808x_get_features(struct p
  28. return 0;
  29. }
  30. +static void qca808x_link_change_notify(struct phy_device *phydev)
  31. +{
  32. + /* Assert interface sgmii fifo on link down, deassert it on link up,
  33. + * the interface device address is always phy address added by 1.
  34. + */
  35. + mdiobus_c45_modify_changed(phydev->mdio.bus, phydev->mdio.addr + 1,
  36. + MDIO_MMD_PMAPMD, QCA8081_PHY_SERDES_MMD1_FIFO_CTRL,
  37. + QCA8081_PHY_FIFO_RSTN, phydev->link ? QCA8081_PHY_FIFO_RSTN : 0);
  38. +}
  39. +
  40. static struct phy_driver at803x_driver[] = {
  41. {
  42. /* Qualcomm Atheros AR8035 */
  43. @@ -2213,6 +2226,7 @@ static struct phy_driver at803x_driver[]
  44. .soft_reset = qca808x_soft_reset,
  45. .cable_test_start = qca808x_cable_test_start,
  46. .cable_test_get_status = qca808x_cable_test_get_status,
  47. + .link_change_notify = qca808x_link_change_notify,
  48. }, };
  49. module_phy_driver(at803x_driver);