Skip to content

Commit f99e6d7

Browse files
Rafał MiłeckiPaolo Abeni
authored andcommitted
bgmac: fix *initial* chip reset to support BCM5358
While bringing hardware up we should perform a full reset including the switch bit (BGMAC_BCMA_IOCTL_SW_RESET aka SICF_SWRST). It's what specification says and what reference driver does. This seems to be critical for the BCM5358. Without this hardware doesn't get initialized properly and doesn't seem to transmit or receive any packets. Originally bgmac was calling bgmac_chip_reset() before setting "has_robosw" property which resulted in expected behaviour. That has changed as a side effect of adding platform device support which regressed BCM5358 support. Fixes: f6a95a2 ("net: ethernet: bgmac: Add platform device support") Cc: Jon Mason <[email protected]> Signed-off-by: Rafał Miłecki <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 5ca26d6 commit f99e6d7

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

drivers/net/ethernet/broadcom/bgmac.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,13 +890,13 @@ static void bgmac_chip_reset_idm_config(struct bgmac *bgmac)
890890

891891
if (iost & BGMAC_BCMA_IOST_ATTACHED) {
892892
flags = BGMAC_BCMA_IOCTL_SW_CLKEN;
893-
if (!bgmac->has_robosw)
893+
if (bgmac->in_init || !bgmac->has_robosw)
894894
flags |= BGMAC_BCMA_IOCTL_SW_RESET;
895895
}
896896
bgmac_clk_enable(bgmac, flags);
897897
}
898898

899-
if (iost & BGMAC_BCMA_IOST_ATTACHED && !bgmac->has_robosw)
899+
if (iost & BGMAC_BCMA_IOST_ATTACHED && (bgmac->in_init || !bgmac->has_robosw))
900900
bgmac_idm_write(bgmac, BCMA_IOCTL,
901901
bgmac_idm_read(bgmac, BCMA_IOCTL) &
902902
~BGMAC_BCMA_IOCTL_SW_RESET);
@@ -1490,6 +1490,8 @@ int bgmac_enet_probe(struct bgmac *bgmac)
14901490
struct net_device *net_dev = bgmac->net_dev;
14911491
int err;
14921492

1493+
bgmac->in_init = true;
1494+
14931495
bgmac_chip_intrs_off(bgmac);
14941496

14951497
net_dev->irq = bgmac->irq;
@@ -1542,6 +1544,8 @@ int bgmac_enet_probe(struct bgmac *bgmac)
15421544
/* Omit FCS from max MTU size */
15431545
net_dev->max_mtu = BGMAC_RX_MAX_FRAME_SIZE - ETH_FCS_LEN;
15441546

1547+
bgmac->in_init = false;
1548+
15451549
err = register_netdev(bgmac->net_dev);
15461550
if (err) {
15471551
dev_err(bgmac->dev, "Cannot register net device\n");

drivers/net/ethernet/broadcom/bgmac.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,8 @@ struct bgmac {
472472
int irq;
473473
u32 int_mask;
474474

475+
bool in_init;
476+
475477
/* Current MAC state */
476478
int mac_speed;
477479
int mac_duplex;

0 commit comments

Comments
 (0)