Skip to contentSkip to conversation

bcm63xx_enet: do not overwrite ENET_CTL_REG value

PATCH Applied Florian Fainelli 2 participants 2 messages Apr 9, 2010 – Apr 13, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 bcm63xx_enet: do not overwrite ENET_CTL_REG value

bcm_enet_hw_preinit will correctly set values in ENET_CTL_REG for internal or external MII operations, however, bcm_enet_open will blindly overwrite the ENET_CTL_REG register value and thus we will loose any changes to it that were made in bcm_enet_hw_preinit, rendering external MII operations non-working.

This would lead to the driver not being able to check for link availability on external PHY setups, and thus we would never get to sending packets because link was down from the driver side.

This was completely un-noticed because all boards out there but BCM6338-based ones use internal phy on their enet0 interface.

---

drivers/net/bcm63xx_enet.c +3 -1
index 5173340..14ab4dc 100644
@@ -958,7 +958,9 @@ static int bcm_enet_open(struct net_device *dev)
 	/* all set, enable mac and interrupts, start dma engine and
 	 * kick rx dma channel */
 	wmb();
-	enet_writel(priv, ENET_CTL_ENABLE_MASK, ENET_CTL_REG);
+	val = enet_readl(priv, ENET_CTL_REG);
+	val |= ENET_CTL_ENABLE_MASK;
+	enet_writel(priv, val, ENET_CTL_REG);
 	enet_dma_writel(priv, ENETDMA_CFG_EN_MASK, ENETDMA_CFG_REG);
 	enet_dma_writel(priv, ENETDMA_CHANCFG_EN_MASK,
 			ENETDMA_CHANCFG_REG(priv->rx_chan));
maintainer Applied
#1 lore raw

From: Florian Fainelli <[email protected]>
Date: Fri, 9 Apr 2010 13:04:52 +0200

Quoted 5 lines

bcm_enet_hw_preinit will correctly set values in ENET_CTL_REG for internal or external MII operations, however, bcm_enet_open will blindly overwrite the ENET_CTL_REG register value and thus we will loose any changes to it that were made in bcm_enet_hw_preinit, rendering external MII operations non-working.

Quoted 8 lines

This would lead to the driver not being able to check for link availability on external PHY setups, and thus we would never get to sending packets because link was down from the driver side.

This was completely un-noticed because all boards out there but BCM6338-based ones use internal phy on their enet0 interface.

Applied.