Re: [PATCH net-next v4 4/4] net: phy: micrel: Add support for lan8842
From: Horatiu Vultur <horatiu.vultur@microchip.com>
Date: 2025-08-14 09:59:25
Also in:
lkml
The 08/14/2025 10:20, Russell King (Oracle) wrote: Hi Russell,
On Thu, Aug 14, 2025 at 10:26:24AM +0200, Horatiu Vultur wrote:quoted
+static int lan8842_config_init(struct phy_device *phydev) +{ + int ret; + + /* Reset the PHY */ + ret = lanphy_modify_page_reg(phydev, LAN8814_PAGE_COMMON_REGS, + LAN8814_QSGMII_SOFT_RESET, + LAN8814_QSGMII_SOFT_RESET_BIT, + LAN8814_QSGMII_SOFT_RESET_BIT); + if (ret < 0) + return ret; + + /* Disable ANEG with QSGMII PCS Host side + * It has the same address as lan8814 + */ + ret = lanphy_modify_page_reg(phydev, LAN8814_PAGE_PORT_REGS, + LAN8814_QSGMII_PCS1G_ANEG_CONFIG, + LAN8814_QSGMII_PCS1G_ANEG_CONFIG_ANEG_ENA, + 0); + if (ret < 0) + return ret;Could you explain exactly what effect this has please?
The effect of this and the next write is to disable the auto-negotiation between the PHY and the MAC.
quoted
+ + /* Disable also the SGMII_AUTO_ANEG_ENA, this will determine what is the + * PHY autoneg with the other end and then will update the host side + */ + ret = lanphy_write_page_reg(phydev, LAN8814_PAGE_COMMON_REGS, + LAN8842_SGMII_AUTO_ANEG_ENA, 0); + if (ret < 0) + return ret;Also please explain this a bit more.
This write disables the PHY to update the host side advertise abilities with what it autonegotiate on the link side. I will need to double check but I think this is not needed if the autonegotiation on the host side is already disabled.
If this changes whether host-side "negotiation" is used, then please consider implementing the two phy driver inbnad operations as well.
Yes, I will implement the functions: config_inband and inband_caps.
quoted
+static u64 lan8842_get_stat(struct phy_device *phydev, int count, int *regs) +{ + int val;i> + u64 ret = 0; Please remember... reverse Christmas tree for variable declarations.
Argh.. goot catch!
Thanks. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
-- /Horatiu