Skip to content

Commit 08c6d8b

Browse files
Lukasz Majewskikuba-moo
authored andcommitted
net: phy: Provide Module 4 KSZ9477 errata (DS80000754C)
The KSZ9477 errata points out (in 'Module 4') the link up/down problems when EEE (Energy Efficient Ethernet) is enabled in the device to which the KSZ9477 tries to auto negotiate. The suggested workaround is to clear advertisement of EEE for PHYs in this chip driver. To avoid regressions with other switch ICs the new MICREL_NO_EEE flag has been introduced. Moreover, the in-register disablement of MMD_DEVICE_ID_EEE_ADV.MMD_EEE_ADV MMD register is removed, as this code is both; now executed too late (after previous rework of the PHY and DSA for KSZ switches) and not required as setting all members of eee_broken_modes bit field prevents the KSZ9477 from advertising EEE. Fixes: 69d3b36 ("net: dsa: microchip: enable EEE support") # for KSZ9477 Signed-off-by: Lukasz Majewski <lukma@denx.de> Tested-by: Oleksij Rempel <o.rempel@pengutronix.de> # Confirmed disabled EEE with oscilloscope. Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com> Link: https://lore.kernel.org/r/20230905093315.784052-1-lukma@denx.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent f16d411 commit 08c6d8b

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2335,13 +2335,27 @@ static u32 ksz_get_phy_flags(struct dsa_switch *ds, int port)
23352335
{
23362336
struct ksz_device *dev = ds->priv;
23372337

2338-
if (dev->chip_id == KSZ8830_CHIP_ID) {
2338+
switch (dev->chip_id) {
2339+
case KSZ8830_CHIP_ID:
23392340
/* Silicon Errata Sheet (DS80000830A):
23402341
* Port 1 does not work with LinkMD Cable-Testing.
23412342
* Port 1 does not respond to received PAUSE control frames.
23422343
*/
23432344
if (!port)
23442345
return MICREL_KSZ8_P1_ERRATA;
2346+
break;
2347+
case KSZ9477_CHIP_ID:
2348+
/* KSZ9477 Errata DS80000754C
2349+
*
2350+
* Module 4: Energy Efficient Ethernet (EEE) feature select must
2351+
* be manually disabled
2352+
* The EEE feature is enabled by default, but it is not fully
2353+
* operational. It must be manually disabled through register
2354+
* controls. If not disabled, the PHY ports can auto-negotiate
2355+
* to enable EEE, and this feature can cause link drops when
2356+
* linked to another device supporting EEE.
2357+
*/
2358+
return MICREL_NO_EEE;
23452359
}
23462360

23472361
return 0;

drivers/net/phy/micrel.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,9 +1800,6 @@ static const struct ksz9477_errata_write ksz9477_errata_writes[] = {
18001800
/* Transmit waveform amplitude can be improved (1000BASE-T, 100BASE-TX, 10BASE-Te) */
18011801
{0x1c, 0x04, 0x00d0},
18021802

1803-
/* Energy Efficient Ethernet (EEE) feature select must be manually disabled */
1804-
{0x07, 0x3c, 0x0000},
1805-
18061803
/* Register settings are required to meet data sheet supply current specifications */
18071804
{0x1c, 0x13, 0x6eff},
18081805
{0x1c, 0x14, 0xe6ff},
@@ -1847,6 +1844,12 @@ static int ksz9477_config_init(struct phy_device *phydev)
18471844
return err;
18481845
}
18491846

1847+
/* According to KSZ9477 Errata DS80000754C (Module 4) all EEE modes
1848+
* in this switch shall be regarded as broken.
1849+
*/
1850+
if (phydev->dev_flags & MICREL_NO_EEE)
1851+
phydev->eee_broken_modes = -1;
1852+
18501853
err = genphy_restart_aneg(phydev);
18511854
if (err)
18521855
return err;

include/linux/micrel_phy.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
#define MICREL_PHY_50MHZ_CLK BIT(0)
4545
#define MICREL_PHY_FXEN BIT(1)
4646
#define MICREL_KSZ8_P1_ERRATA BIT(2)
47+
#define MICREL_NO_EEE BIT(3)
4748

4849
#define MICREL_KSZ9021_EXTREG_CTRL 0xB
4950
#define MICREL_KSZ9021_EXTREG_DATA_WRITE 0xC

0 commit comments

Comments
 (0)