netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@linux-foundation.org>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev@vger.kernel.org
Subject: [PATCH 4/6] skge: fiber link up/down fix
Date: Mon, 26 Nov 2007 11:54:51 -0800	[thread overview]
Message-ID: <20071126195557.709511931@linux-foundation.org> (raw)
In-Reply-To: 20071126195447.846382144@linux-foundation.org

[-- Attachment #1: skge-link-down.patch --]
[-- Type: text/plain, Size: 1865 bytes --]

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>

--- a/drivers/net/skge.c	2007-11-21 14:44:02.000000000 -0800
+++ b/drivers/net/skge.c	2007-11-21 14:46:34.000000000 -0800
@@ -1095,16 +1095,9 @@ static void xm_link_down(struct skge_hw 
 {
 	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);
 }
@@ -1194,6 +1187,7 @@ static void genesis_init(struct skge_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);
 
@@ -1209,6 +1203,11 @@ static void genesis_reset(struct skge_hw
 		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);
 }
 
 
@@ -1714,6 +1713,12 @@ static void genesis_stop(struct skge_por
 	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);
 

-- 
Stephen Hemminger <shemminger@linux-foundation.org>


  parent reply	other threads:[~2007-11-26 19:59 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-26 19:54 [PATCH 0/6] skge update (for 2.6.24) Stephen Hemminger
2007-11-26 19:54 ` [PATCH 1/6] skge: FIFO Ram calculation error Stephen Hemminger
2007-12-01 21:33   ` Jeff Garzik
2007-11-26 19:54 ` [PATCH 2/6] skge: receive flush logic Stephen Hemminger
2007-11-26 19:54 ` [PATCH 3/6] skge: retry on MAC shutdown Stephen Hemminger
2007-11-26 19:54 ` Stephen Hemminger [this message]
2007-11-26 19:54 ` [PATCH 5/6] skge: increase TX threshold for Jumbo Stephen Hemminger
2007-11-26 19:54 ` [PATCH 6/6] skge version 1.13 Stephen Hemminger
2007-11-28 22:23   ` [PATCH 1/2] skge: serial mode register values Stephen Hemminger
2007-11-28 22:25     ` [PATCH 2/2] skge: MTU changing fix Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071126195557.709511931@linux-foundation.org \
    --to=shemminger@linux-foundation.org \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).