Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: dsa: microchip: Don't embed struct phy_device to maintain the port state

The KSZ9477 maintains the SGMII port's state for speed, duplex and link
status to be able to fixup the accesses to its internal older version of
the Designware XPCS. However, it does so by embedding a full instance of
struct phy_device, only to use the 'speed', 'link' and 'duplex' fields.

This is also only used for the SGMII port, it's otherwise unused for all
other regular ports.

Replace that with simple int/bool values.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20260319181705.1576679-1-maxime.chevallier@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Maxime Chevallier and committed by
Jakub Kicinski
2e69e558 fa782d4d

+12 -11
+8 -9
drivers/net/dsa/microchip/ksz9477.c
··· 224 224 else 225 225 duplex = DUPLEX_HALF; 226 226 227 - if (!p->phydev.link || 228 - p->phydev.speed != speed || 229 - p->phydev.duplex != duplex) { 227 + if (!p->link || p->speed != speed || 228 + p->duplex != duplex) { 230 229 u16 ctrl; 231 230 232 - p->phydev.link = 1; 233 - p->phydev.speed = speed; 234 - p->phydev.duplex = duplex; 231 + p->link = true; 232 + p->speed = speed; 233 + p->duplex = duplex; 235 234 port_sgmii_r(dev, port, mmd, MII_BMCR, 236 235 &ctrl); 237 236 ctrl &= BMCR_ANENABLE; ··· 240 241 ctrl); 241 242 } 242 243 } else { 243 - p->phydev.link = 0; 244 + p->link = false; 244 245 } 245 246 } else if (reg == MII_BMSR) { 246 - p->phydev.link = !!(val & BMSR_LSTATUS); 247 + p->link = !!(val & BMSR_LSTATUS); 247 248 } 248 249 } 249 250 ··· 556 557 val = 0x0700; 557 558 break; 558 559 case MII_STAT1000: 559 - if (p->phydev.speed == SPEED_1000) 560 + if (p->speed == SPEED_1000) 560 561 val = 0x3800; 561 562 else 562 563 val = 0;
+1 -1
drivers/net/dsa/microchip/ksz_common.c
··· 3983 3983 if (dev->info->internal_phy[port]) 3984 3984 return; 3985 3985 3986 - p->phydev.speed = speed; 3986 + p->speed = speed; 3987 3987 3988 3988 ksz_port_set_xmii_speed(dev, port, speed); 3989 3989
+3 -1
drivers/net/dsa/microchip/ksz_common.h
··· 129 129 bool learning; 130 130 bool isolated; 131 131 int stp_state; 132 - struct phy_device phydev; 132 + int speed; 133 + int duplex; 134 + bool link; 133 135 134 136 u32 fiber:1; /* port is fiber */ 135 137 u32 force:1;