netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v1] lan78xx: lan7801 MAC support with lan8841
@ 2024-06-11  9:42 Rengarajan S
  2024-06-13  1:33 ` Jakub Kicinski
  2024-06-13 20:46 ` Andrew Lunn
  0 siblings, 2 replies; 8+ messages in thread
From: Rengarajan S @ 2024-06-11  9:42 UTC (permalink / raw)
  To: woojung.huh, UNGLinuxDriver, davem, edumazet, kuba, pabeni,
	netdev, linux-usb, linux-kernel
  Cc: rengarajan.s

Add lan7801 MAC only support with lan8841. The PHY fixup is registered
for lan8841 and the initializations are done using lan8835_fixup since
the register configs are similar for both lann8841 and lan8835. The PHY
is unregistered at two instances, one during init and other during
disconnect.

Signed-off-by: Rengarajan S <rengarajan.s@microchip.com>
---
 drivers/net/usb/lan78xx.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 5add4145d9fc..ab6f0c42b4d9 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -479,6 +479,7 @@ struct lan78xx_net {
 
 /* define external phy id */
 #define	PHY_LAN8835			(0x0007C130)
+#define PHY_LAN8841			(0x00221650)
 #define	PHY_KSZ9031RNX			(0x00221620)
 
 /* use ethtool to change the level for any given device */
@@ -2327,6 +2328,13 @@ static struct phy_device *lan7801_phy_init(struct lan78xx_net *dev)
 			netdev_err(dev->net, "Failed to register fixup for PHY_LAN8835\n");
 			return NULL;
 		}
+		/* external PHY fixup for LAN8841 */
+		ret = phy_register_fixup_for_uid(PHY_LAN8841, 0xfffffff0,
+						 lan8835_fixup);
+		if (ret < 0) {
+			netdev_err(dev->net, "Failed to register fixup for PHY_LAN8841\n");
+			return NULL;
+		}
 		/* add more external PHY fixup here if needed */
 
 		phydev->is_internal = false;
@@ -2390,6 +2398,8 @@ static int lan78xx_phy_init(struct lan78xx_net *dev)
 							     0xfffffff0);
 				phy_unregister_fixup_for_uid(PHY_LAN8835,
 							     0xfffffff0);
+				phy_unregister_fixup_for_uid(PHY_LAN8841,
+							     0xfffffff0);
 			}
 		}
 		return -EIO;
@@ -4239,6 +4249,7 @@ static void lan78xx_disconnect(struct usb_interface *intf)
 
 	phy_unregister_fixup_for_uid(PHY_KSZ9031RNX, 0xfffffff0);
 	phy_unregister_fixup_for_uid(PHY_LAN8835, 0xfffffff0);
+	phy_unregister_fixup_for_uid(PHY_LAN8841, 0xfffffff0);
 
 	phy_disconnect(net->phydev);
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-06-28 13:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-11  9:42 [PATCH net-next v1] lan78xx: lan7801 MAC support with lan8841 Rengarajan S
2024-06-13  1:33 ` Jakub Kicinski
2024-06-20  5:33   ` Rengarajan.S
2024-06-13 20:46 ` Andrew Lunn
2024-06-20  5:48   ` Rengarajan.S
2024-06-20 13:49     ` Andrew Lunn
2024-06-28 10:59       ` Rengarajan.S
2024-06-28 13:03         ` Andrew Lunn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).