Skip to content

Commit 745d7e3

Browse files
Ante Knezicdavem330
authored andcommitted
net: dsa: mv88e6xxx: Add erratum 3.14 for 88E6390X and 88E6190X
Fixes XAUI/RXAUI lane alignment errors. Issue causes dropped packets when trying to communicate over fiber via SERDES lanes of port 9 and 10. Errata document applies only to 88E6190X and 88E6390X devices. Requires poking in undocumented registers. Signed-off-by: Ante Knezic <[email protected]> Reviewed-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 996dcff commit 745d7e3

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

drivers/net/dsa/mv88e6xxx/pcs-639x.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct mv88e639x_pcs {
2020
struct mdio_device mdio;
2121
struct phylink_pcs sgmii_pcs;
2222
struct phylink_pcs xg_pcs;
23+
bool erratum_3_14;
2324
bool supports_5g;
2425
phy_interface_t interface;
2526
unsigned int irq;
@@ -205,13 +206,53 @@ static void mv88e639x_sgmii_pcs_pre_config(struct phylink_pcs *pcs,
205206
mv88e639x_sgmii_pcs_control_pwr(mpcs, false);
206207
}
207208

209+
static int mv88e6390_erratum_3_14(struct mv88e639x_pcs *mpcs)
210+
{
211+
const int lanes[] = { MV88E6390_PORT9_LANE0, MV88E6390_PORT9_LANE1,
212+
MV88E6390_PORT9_LANE2, MV88E6390_PORT9_LANE3,
213+
MV88E6390_PORT10_LANE0, MV88E6390_PORT10_LANE1,
214+
MV88E6390_PORT10_LANE2, MV88E6390_PORT10_LANE3 };
215+
int err, i;
216+
217+
/* 88e6190x and 88e6390x errata 3.14:
218+
* After chip reset, SERDES reconfiguration or SERDES core
219+
* Software Reset, the SERDES lanes may not be properly aligned
220+
* resulting in CRC errors
221+
*/
222+
223+
for (i = 0; i < ARRAY_SIZE(lanes); i++) {
224+
err = mdiobus_c45_write(mpcs->mdio.bus, lanes[i],
225+
MDIO_MMD_PHYXS,
226+
0xf054, 0x400C);
227+
if (err)
228+
return err;
229+
230+
err = mdiobus_c45_write(mpcs->mdio.bus, lanes[i],
231+
MDIO_MMD_PHYXS,
232+
0xf054, 0x4000);
233+
if (err)
234+
return err;
235+
}
236+
237+
return 0;
238+
}
239+
208240
static int mv88e639x_sgmii_pcs_post_config(struct phylink_pcs *pcs,
209241
phy_interface_t interface)
210242
{
211243
struct mv88e639x_pcs *mpcs = sgmii_pcs_to_mv88e639x_pcs(pcs);
244+
int err;
212245

213246
mv88e639x_sgmii_pcs_control_pwr(mpcs, true);
214247

248+
if (mpcs->erratum_3_14) {
249+
err = mv88e6390_erratum_3_14(mpcs);
250+
if (err)
251+
dev_err(mpcs->mdio.dev.parent,
252+
"failed to apply erratum 3.14: %pe\n",
253+
ERR_PTR(err));
254+
}
255+
215256
return 0;
216257
}
217258

@@ -524,6 +565,10 @@ static int mv88e6390_pcs_init(struct mv88e6xxx_chip *chip, int port)
524565
mpcs->xg_pcs.ops = &mv88e6390_xg_pcs_ops;
525566
mpcs->xg_pcs.neg_mode = true;
526567

568+
if (chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6190X ||
569+
chip->info->prod_num == MV88E6XXX_PORT_SWITCH_ID_PROD_6390X)
570+
mpcs->erratum_3_14 = true;
571+
527572
err = mv88e639x_pcs_setup_irq(mpcs, chip, port);
528573
if (err)
529574
goto err_free;

0 commit comments

Comments
 (0)