Skip to content

Commit 5483cbf

Browse files
oleremdavem330
authored andcommitted
net: dsa: microchip: lan9371/2: update MAC capabilities for port 4
Set proper MAC capabilities for port 4 on LAN9371 and LAN9372 switches with integrated 100BaseTX PHY. And introduce the is_lan937x_tx_phy() function to reuse it where applicable. Signed-off-by: Oleksij Rempel <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Acked-by: Arun Ramadoss <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3abbd7e commit 5483cbf

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

drivers/net/dsa/microchip/ksz_common.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,12 @@ static inline int is_lan937x(struct ksz_device *dev)
638638
dev->chip_id == LAN9374_CHIP_ID;
639639
}
640640

641+
static inline bool is_lan937x_tx_phy(struct ksz_device *dev, int port)
642+
{
643+
return (dev->chip_id == LAN9371_CHIP_ID ||
644+
dev->chip_id == LAN9372_CHIP_ID) && port == KSZ_PORT_4;
645+
}
646+
641647
/* STP State Defines */
642648
#define PORT_TX_ENABLE BIT(2)
643649
#define PORT_RX_ENABLE BIT(1)

drivers/net/dsa/microchip/lan937x_main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ static int lan937x_vphy_ind_addr_wr(struct ksz_device *dev, int addr, int reg)
5555
u16 addr_base = REG_PORT_T1_PHY_CTRL_BASE;
5656
u16 temp;
5757

58-
if ((dev->info->chip_id == LAN9371_CHIP_ID ||
59-
dev->info->chip_id == LAN9372_CHIP_ID) && addr == KSZ_PORT_4)
58+
if (is_lan937x_tx_phy(dev, addr))
6059
addr_base = REG_PORT_TX_PHY_CTRL_BASE;
6160

6261
/* get register address based on the logical port */
@@ -324,6 +323,9 @@ void lan937x_phylink_get_caps(struct ksz_device *dev, int port,
324323
/* MII/RMII/RGMII ports */
325324
config->mac_capabilities |= MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
326325
MAC_100HD | MAC_10 | MAC_1000FD;
326+
} else if (is_lan937x_tx_phy(dev, port)) {
327+
config->mac_capabilities |= MAC_ASYM_PAUSE | MAC_SYM_PAUSE |
328+
MAC_100HD | MAC_10;
327329
}
328330
}
329331

0 commit comments

Comments
 (0)