aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-11-26 14:54:51 -0500
committerJeff Garzik <jeff@garzik.org>2007-12-01 16:32:29 -0500
commit21d7f67700ad7a4523d35d43ce95755e40eae5b7 (patch)
tree96b8f96de4183c6c1870ac17fec621cd167fd948
parent799b21d2bddd43145130e509efb92339eabafef9 (diff)
skge: fiber link up/down fix
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>
-rw-r--r--drivers/net/skge.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index b680cb08e9ce..73a424694ac5 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw *hw, int port)
1095{ 1095{
1096 struct net_device *dev = hw->dev[port]; 1096 struct net_device *dev = hw->dev[port];
1097 struct skge_port *skge = netdev_priv(dev); 1097 struct skge_port *skge = netdev_priv(dev);
1098 u16 cmd = xm_read16(hw, port, XM_MMU_CMD);
1099 1098
1100 xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE); 1099 xm_write16(hw, port, XM_IMSK, XM_IMSK_DISABLE);
1101 1100
1102 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1103 xm_write16(hw, port, XM_MMU_CMD, cmd);
1104
1105 /* dummy read to ensure writing */
1106 xm_read16(hw, port, XM_MMU_CMD);
1107
1108 if (netif_carrier_ok(dev)) 1101 if (netif_carrier_ok(dev))
1109 skge_link_down(skge); 1102 skge_link_down(skge);
1110} 1103}
@@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_hw *hw)
1194static void genesis_reset(struct skge_hw *hw, int port) 1187static void genesis_reset(struct skge_hw *hw, int port)
1195{ 1188{
1196 const u8 zero[8] = { 0 }; 1189 const u8 zero[8] = { 0 };
1190 u32 reg;
1197 1191
1198 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0); 1192 skge_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
1199 1193
@@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw *hw, int port)
1209 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff); 1203 xm_write16(hw, port, PHY_BCOM_INT_MASK, 0xffff);
1210 1204
1211 xm_outhash(hw, port, XM_HSM, zero); 1205 xm_outhash(hw, port, XM_HSM, zero);
1206
1207 /* Flush TX and RX fifo */
1208 reg = xm_read32(hw, port, XM_MODE);
1209 xm_write32(hw, port, XM_MODE, reg | XM_MD_FTF);
1210 xm_write32(hw, port, XM_MODE, reg | XM_MD_FRF);
1212} 1211}
1213 1212
1214 1213
@@ -1714,6 +1713,12 @@ static void genesis_stop(struct skge_port *skge)
1714 struct skge_hw *hw = skge->hw; 1713 struct skge_hw *hw = skge->hw;
1715 int port = skge->port; 1714 int port = skge->port;
1716 unsigned retries = 1000; 1715 unsigned retries = 1000;
1716 u16 cmd;
1717
1718 /* Disable Tx and Rx */
1719 cmd = xm_read16(hw, port, XM_MMU_CMD);
1720 cmd &= ~(XM_MMU_ENA_RX | XM_MMU_ENA_TX);
1721 xm_write16(hw, port, XM_MMU_CMD, cmd);
1717 1722
1718 genesis_reset(hw, port); 1723 genesis_reset(hw, port);
1719 1724