1

Merge branch 'net-phy-micrel-lan8814-erratas'

Horatiu Vultur says:

====================
net: phy: micrel: lan8814 erratas

Add two erratas for lan8814. First one fix the led which might
stay on even that there is no link. The second one improves increases
length of the cable that can be used when used in 1000Base-T.
====================

Link: https://lore.kernel.org/r/20240304091548.1386022-1-horatiu.vultur@microchip.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski 2024-03-05 11:17:56 -08:00
commit e8efd372b2

View File

@ -114,6 +114,13 @@
#define LAN8814_INTR_CTRL_REG_POLARITY BIT(1)
#define LAN8814_INTR_CTRL_REG_INTR_ENABLE BIT(0)
#define LAN8814_EEE_STATE 0x38
#define LAN8814_EEE_STATE_MASK2P5P BIT(10)
#define LAN8814_PD_CONTROLS 0x9d
#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK GENMASK(3, 0)
#define LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL 0xb
/* Represents 1ppm adjustment in 2^32 format with
* each nsec contains 4 clock cycles.
* The value is calculated as following: (1/1000000)/((2^-32)/4)
@ -3288,6 +3295,33 @@ static int lan8814_release_coma_mode(struct phy_device *phydev)
return 0;
}
static void lan8814_clear_2psp_bit(struct phy_device *phydev)
{
u16 val;
/* It was noticed that when traffic is passing through the PHY and the
* cable is removed then the LED was still one even though there is no
* link
*/
val = lanphy_read_page_reg(phydev, 2, LAN8814_EEE_STATE);
val &= ~LAN8814_EEE_STATE_MASK2P5P;
lanphy_write_page_reg(phydev, 2, LAN8814_EEE_STATE, val);
}
static void lan8814_update_meas_time(struct phy_device *phydev)
{
u16 val;
/* By setting the measure time to a value of 0xb this will allow cables
* longer than 100m to be used. This configuration can be used
* regardless of the mode of operation of the PHY
*/
val = lanphy_read_page_reg(phydev, 1, LAN8814_PD_CONTROLS);
val &= ~LAN8814_PD_CONTROLS_PD_MEAS_TIME_MASK;
val |= LAN8814_PD_CONTROLS_PD_MEAS_TIME_VAL;
lanphy_write_page_reg(phydev, 1, LAN8814_PD_CONTROLS, val);
}
static int lan8814_probe(struct phy_device *phydev)
{
const struct kszphy_type *type = phydev->drv->driver_data;
@ -3324,6 +3358,10 @@ static int lan8814_probe(struct phy_device *phydev)
lan8814_ptp_init(phydev);
/* Errata workarounds */
lan8814_clear_2psp_bit(phydev);
lan8814_update_meas_time(phydev);
return 0;
}