Skip to content

Commit

Permalink
skge: fiber link up/down fix
Browse files Browse the repository at this point in the history
The driver would not work over fibre if other end when down then
came back up (would require reloading driver). The correct way
to manage the link the same way for both TP and fibre.

Resloves problem described in: 	 http://lkml.org/lkml/2007/11/6/395

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Dec 1, 2007
1 parent 799b21d commit 21d7f67
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions drivers/net/skge.c
Original file line number Diff line number Diff line change
Expand Up @@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw *hw, int port)
{
struct net_device *dev = hw->dev[port];
struct skge_port *skge = netdev_priv(dev);
u16 cmd = xm_read16(hw, port, XM_MMU_CMD);

xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);

cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
xm_write16(hw, port, XM_MMU_CMD, cmd);

/* dummy read to ensure writing */
xm_read16(hw, port, XM_MMU_CMD);

if (netif_carrier_ok(dev))
skge_link_down(skge);
}
Expand Down Expand Up @@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_hw *hw)
static void genesis_reset(struct skge_hw *hw, int port)
{
const u8 zero[8] = { 0 };
u32 reg;

skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);

Expand All @@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw *hw, int port)
xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);

xm_outhash(hw, port, XM_HSM, zero);

/* Flush TX and RX fifo */
reg = xm_read32(hw, port, XM_MODE);
xm_write32(hw, port, XM_MODE, reg | XM_MD_FTF);
xm_write32(hw, port, XM_MODE, reg | XM_MD_FRF);
}


Expand Down Expand Up @@ -1714,6 +1713,12 @@ static void genesis_stop(struct skge_port *skge)
struct skge_hw *hw = skge->hw;
int port = skge->port;
unsigned retries = 1000;
u16 cmd;

/* Disable Tx and Rx */
cmd = xm_read16(hw, port, XM_MMU_CMD);
cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
xm_write16(hw, port, XM_MMU_CMD, cmd);

genesis_reset(hw, port);

Expand Down

0 comments on commit 21d7f67

Please sign in to comment.