Skip to content

Commit 0b394f5

Browse files
oleremNipaLocal
authored andcommitted
net: dsa: microchip: lan937x: Fix RGMII delay tuning
Correct RGMII delay application logic in lan937x_set_tune_adj(). The function was missing `data16 &= ~PORT_TUNE_ADJ` before setting the new delay value. This caused the new value to be bitwise-OR'd with the existing PORT_TUNE_ADJ field instead of replacing it. For example, when setting the RGMII 2 TX delay on port 4, the intended TUNE_ADJUST value of 0 (RGMII_2_TX_DELAY_2NS) was incorrectly OR'd with the default 0x1B (from register value 0xDA3), leaving the delay at the wrong setting. This patch adds the missing mask to clear the field, ensuring the correct delay value is written. Physical measurements on the RGMII TX lines confirm the fix, showing the delay changing from ~1ns (before change) to ~2ns. While testing on i.MX 8MP showed this was within the platform's timing tolerance, it did not match the intended hardware-characterized value. Fixes: b19ac41 ("net: dsa: microchip: apply rgmii tx and rx delay in phylink mac config") Signed-off-by: Oleksij Rempel <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 30edf8b commit 0b394f5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/dsa/microchip/lan937x_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ static void lan937x_set_tune_adj(struct ksz_device *dev, int port,
540540
ksz_pread16(dev, port, reg, &data16);
541541

542542
/* Update tune Adjust */
543+
data16 &= ~PORT_TUNE_ADJ;
543544
data16 |= FIELD_PREP(PORT_TUNE_ADJ, val);
544545
ksz_pwrite16(dev, port, reg, data16);
545546

0 commit comments

Comments
 (0)