Skip to content

Commit 0322ef4

Browse files
vladimirolteandavem330
authored andcommitted
net: dsa: seville: ignore mscc-miim read errors from Lynx PCS
During the refactoring in the commit below, vsc9953_mdio_read() was replaced with mscc_miim_read(), which has one extra step: it checks for the MSCC_MIIM_DATA_ERROR bits before returning the result. On T1040RDB, there are 8 QSGMII PCSes belonging to the switch, and they are organized in 2 groups. First group responds to MDIO addresses 4-7 because QSGMIIACR1[MDEV_PORT] is 1, and the second group responds to MDIO addresses 8-11 because QSGMIIBCR1[MDEV_PORT] is 2. I have double checked that these values are correctly set in the SERDES, as well as PCCR1[QSGMA_CFG] and PCCR1[QSGMB_CFG] are both 0b01. mscc_miim_read: phyad 8 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 8 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 8 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 8 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 9 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 9 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 9 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 9 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 10 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 10 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 10 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 10 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 11 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 11 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 11 reg 0x1 MIIM_DATA 0x2d mscc_miim_read: phyad 11 reg 0x5 MIIM_DATA 0x5801 mscc_miim_read: phyad 4 reg 0x1 MIIM_DATA 0x3002d, ERROR mscc_miim_read: phyad 4 reg 0x5 MIIM_DATA 0x3da01, ERROR mscc_miim_read: phyad 5 reg 0x1 MIIM_DATA 0x3002d, ERROR mscc_miim_read: phyad 5 reg 0x5 MIIM_DATA 0x35801, ERROR mscc_miim_read: phyad 5 reg 0x1 MIIM_DATA 0x3002d, ERROR mscc_miim_read: phyad 5 reg 0x5 MIIM_DATA 0x35801, ERROR mscc_miim_read: phyad 6 reg 0x1 MIIM_DATA 0x3002d, ERROR mscc_miim_read: phyad 6 reg 0x5 MIIM_DATA 0x35801, ERROR mscc_miim_read: phyad 6 reg 0x1 MIIM_DATA 0x3002d, ERROR mscc_miim_read: phyad 6 reg 0x5 MIIM_DATA 0x35801, ERROR mscc_miim_read: phyad 7 reg 0x1 MIIM_DATA 0x3002d, ERROR mscc_miim_read: phyad 7 reg 0x5 MIIM_DATA 0x35801, ERROR mscc_miim_read: phyad 7 reg 0x1 MIIM_DATA 0x3002d, ERROR mscc_miim_read: phyad 7 reg 0x5 MIIM_DATA 0x35801, ERROR As can be seen, the data in MIIM_DATA is still valid despite having the MSCC_MIIM_DATA_ERROR bits set. The driver as introduced in commit 84705fc ("net: dsa: felix: introduce support for Seville VSC9953 switch") was ignoring these bits, perhaps deliberately (although unbeknownst to me). This is an old IP and the hardware team cannot seem to be able to help me track down a plausible reason for these failures. I'll keep investigating, but in the meantime, this is a direct regression which must be restored to a working state. The only thing I can do is keep ignoring the errors as before. Fixes: b996584 ("net: dsa: ocelot: felix: utilize shared mscc-miim driver for indirect MDIO access") Signed-off-by: Vladimir Oltean <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3fa1056 commit 0322ef4

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

drivers/net/dsa/ocelot/seville_vsc9953.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,8 +893,8 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)
893893

894894
rc = mscc_miim_setup(dev, &bus, "VSC9953 internal MDIO bus",
895895
ocelot->targets[GCB],
896-
ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK]);
897-
896+
ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK],
897+
true);
898898
if (rc) {
899899
dev_err(dev, "failed to setup MDIO bus\n");
900900
return rc;

drivers/net/mdio/mdio-mscc-miim.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ struct mscc_miim_info {
5252
struct mscc_miim_dev {
5353
struct regmap *regs;
5454
int mii_status_offset;
55+
bool ignore_read_errors;
5556
struct regmap *phy_regs;
5657
const struct mscc_miim_info *info;
5758
struct clk *clk;
@@ -135,7 +136,7 @@ static int mscc_miim_read(struct mii_bus *bus, int mii_id, int regnum)
135136
goto out;
136137
}
137138

138-
if (val & MSCC_MIIM_DATA_ERROR) {
139+
if (!miim->ignore_read_errors && !!(val & MSCC_MIIM_DATA_ERROR)) {
139140
ret = -EIO;
140141
goto out;
141142
}
@@ -212,7 +213,8 @@ static const struct regmap_config mscc_miim_phy_regmap_config = {
212213
};
213214

214215
int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,
215-
struct regmap *mii_regmap, int status_offset)
216+
struct regmap *mii_regmap, int status_offset,
217+
bool ignore_read_errors)
216218
{
217219
struct mscc_miim_dev *miim;
218220
struct mii_bus *bus;
@@ -234,6 +236,7 @@ int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,
234236

235237
miim->regs = mii_regmap;
236238
miim->mii_status_offset = status_offset;
239+
miim->ignore_read_errors = ignore_read_errors;
237240

238241
*pbus = bus;
239242

@@ -285,7 +288,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
285288
return dev_err_probe(dev, PTR_ERR(phy_regmap),
286289
"Unable to create phy register regmap\n");
287290

288-
ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0);
291+
ret = mscc_miim_setup(dev, &bus, "mscc_miim", mii_regmap, 0, false);
289292
if (ret < 0) {
290293
dev_err(dev, "Unable to setup the MDIO bus\n");
291294
return ret;

include/linux/mdio/mdio-mscc-miim.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@
1414

1515
int mscc_miim_setup(struct device *device, struct mii_bus **bus,
1616
const char *name, struct regmap *mii_regmap,
17-
int status_offset);
17+
int status_offset, bool ignore_read_errors);
1818

1919
#endif

0 commit comments

Comments
 (0)