Skip to content

Commit 1ced1b8

Browse files
nikita-youshkuba-moo
authored andcommitted
net: renesas: rswitch: align mdio C45 operations with datasheet
Per rswitch datasheet, software can know that mdio operation completed either by polling MPSM.PSME bit, or via interrupt. Instead, the driver currently polls for interrupt status bit. Although this still provides correct result, it requires additional register operations to clean the interrupt status bits, and generally looks wrong. Fix it to poll MPSM.PSME bit, as the datasheet suggests. Signed-off-by: Nikita Yushchenko <[email protected]> Reviewed-by: Yoshihiro Shimoda <[email protected]> Tested-by: Yoshihiro Shimoda <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent da75ba9 commit 1ced1b8

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

drivers/net/ethernet/renesas/rswitch.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,32 +1205,26 @@ static int rswitch_etha_set_access(struct rswitch_etha *etha, bool read,
12051205
if (devad == 0xffffffff)
12061206
return -ENODEV;
12071207

1208-
writel(MMIS1_CLEAR_FLAGS, etha->addr + MMIS1);
1209-
12101208
val = MPSM_PSME | MPSM_MFF_C45;
12111209
iowrite32((regad << 16) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM);
12121210

1213-
ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PAACS, MMIS1_PAACS);
1211+
ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0);
12141212
if (ret)
12151213
return ret;
12161214

1217-
rswitch_modify(etha->addr, MMIS1, MMIS1_PAACS, MMIS1_PAACS);
1218-
12191215
if (read) {
12201216
writel((pop << 13) | (devad << 8) | (phyad << 3) | val, etha->addr + MPSM);
12211217

1222-
ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PRACS, MMIS1_PRACS);
1218+
ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0);
12231219
if (ret)
12241220
return ret;
12251221

12261222
ret = (ioread32(etha->addr + MPSM) & MPSM_PRD_MASK) >> 16;
1227-
1228-
rswitch_modify(etha->addr, MMIS1, MMIS1_PRACS, MMIS1_PRACS);
12291223
} else {
12301224
iowrite32((data << 16) | (pop << 13) | (devad << 8) | (phyad << 3) | val,
12311225
etha->addr + MPSM);
12321226

1233-
ret = rswitch_reg_wait(etha->addr, MMIS1, MMIS1_PWACS, MMIS1_PWACS);
1227+
ret = rswitch_reg_wait(etha->addr, MPSM, MPSM_PSME, 0);
12341228
}
12351229

12361230
return ret;

drivers/net/ethernet/renesas/rswitch.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -743,12 +743,6 @@ enum rswitch_etha_mode {
743743
#define MPSM_PRD_SHIFT 16
744744
#define MPSM_PRD_MASK GENMASK(31, MPSM_PRD_SHIFT)
745745

746-
/* Completion flags */
747-
#define MMIS1_PAACS BIT(2) /* Address */
748-
#define MMIS1_PWACS BIT(1) /* Write */
749-
#define MMIS1_PRACS BIT(0) /* Read */
750-
#define MMIS1_CLEAR_FLAGS 0xf
751-
752746
#define MLVC_PLV BIT(16)
753747

754748
/* GWCA */

0 commit comments

Comments
 (0)