Skip to content

Commit 9c0770e

Browse files
Phil Elwellpopcornmix
Phil Elwell
authored andcommitted
net: bcmgenet: Workaround for Pi 4B network issue
Some combinations of Pi 4Bs and Ethernet switches don't reliably get a DCHP-assigned IP address, leaving the unit with a self=assigned 169.254 address. Forcing renegotiation has been found to be an effective workaround, so add an automatic renegotiation after the link comes up for the first time; enable it with genet.force_reneg=y - by default it is disabled. See: #3108 Signed-off-by: Phil Elwell <[email protected]>
1 parent a08305b commit 9c0770e

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

+22
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@
7272
#define GENET_RDMA_REG_OFF (priv->hw_params->rdma_offset + \
7373
TOTAL_DESC * DMA_DESC_SIZE)
7474

75+
static bool force_reneg = false;
76+
module_param(force_reneg, bool, 0444);
77+
MODULE_PARM_DESC(force_reneg, "Force a renegotiation after the initial link-up");
78+
7579
static inline void bcmgenet_writel(u32 value, void __iomem *offset)
7680
{
7781
/* MIPS chips strapped for BE will automagically configure the
@@ -2610,6 +2614,7 @@ static void bcmgenet_irq_task(struct work_struct *work)
26102614
unsigned int status;
26112615
struct bcmgenet_priv *priv = container_of(
26122616
work, struct bcmgenet_priv, bcmgenet_irq_work);
2617+
static int first_link = 1;
26132618

26142619
netif_dbg(priv, intr, priv->dev, "%s\n", __func__);
26152620

@@ -2622,6 +2627,23 @@ static void bcmgenet_irq_task(struct work_struct *work)
26222627
if (status & UMAC_IRQ_LINK_EVENT) {
26232628
priv->dev->phydev->link = !!(status & UMAC_IRQ_LINK_UP);
26242629
phy_mac_interrupt(priv->dev->phydev);
2630+
2631+
if (priv->dev->phydev->link && first_link) {
2632+
first_link = 0;
2633+
/*
2634+
* HACK: Some Pi4Bs, when paired with some switches,
2635+
* come up in a strange state where they are unable to
2636+
* transmit, causing them to fail to get an IP address.
2637+
* Although the failure mechanism is not yet understood,
2638+
* forcing renegotiation at this point has been shown
2639+
* to be effective in avoiding the problem.
2640+
*/
2641+
if (force_reneg) {
2642+
dev_info(&priv->pdev->dev,
2643+
"Forcing renegotiation\n");
2644+
genphy_restart_aneg(priv->dev->phydev);
2645+
}
2646+
}
26252647
}
26262648
}
26272649

0 commit comments

Comments
 (0)