Skip to content

Commit f7ba7db

Browse files
stroesedavem330
authored andcommitted
net: macb: Properly handle phylink on at91sam9x
I just recently noticed that ethernet does not work anymore since v5.5 on the GARDENA smart Gateway, which is based on the AT91SAM9G25. Debugging showed that the "GEM bits" in the NCFGR register are now unconditionally accessed, which is incorrect for the !macb_is_gem() case. This patch adds the macb_is_gem() checks back to the code (in macb_mac_config() & macb_mac_link_up()), so that the GEM register bits are not accessed in this case any more. Fixes: 7897b07 ("net: macb: convert to phylink") Signed-off-by: Stefan Roese <[email protected]> Cc: Reto Schneider <[email protected]> Cc: Alexandre Belloni <[email protected]> Cc: Nicolas Ferre <[email protected]> Cc: David S. Miller <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ee895a3 commit f7ba7db

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ static void macb_mac_config(struct phylink_config *config, unsigned int mode,
578578
if (bp->caps & MACB_CAPS_MACB_IS_EMAC) {
579579
if (state->interface == PHY_INTERFACE_MODE_RMII)
580580
ctrl |= MACB_BIT(RM9200_RMII);
581-
} else {
581+
} else if (macb_is_gem(bp)) {
582582
ctrl &= ~(GEM_BIT(SGMIIEN) | GEM_BIT(PCSSEL));
583583

584584
if (state->interface == PHY_INTERFACE_MODE_SGMII)
@@ -639,10 +639,13 @@ static void macb_mac_link_up(struct phylink_config *config,
639639
ctrl |= MACB_BIT(FD);
640640

641641
if (!(bp->caps & MACB_CAPS_MACB_IS_EMAC)) {
642-
ctrl &= ~(GEM_BIT(GBE) | MACB_BIT(PAE));
642+
ctrl &= ~MACB_BIT(PAE);
643+
if (macb_is_gem(bp)) {
644+
ctrl &= ~GEM_BIT(GBE);
643645

644-
if (speed == SPEED_1000)
645-
ctrl |= GEM_BIT(GBE);
646+
if (speed == SPEED_1000)
647+
ctrl |= GEM_BIT(GBE);
648+
}
646649

647650
/* We do not support MLO_PAUSE_RX yet */
648651
if (tx_pause)

0 commit comments

Comments
 (0)