netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] sky2: update for 2.6.24-rc2
@ 2007-11-05 23:52 Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 1/7] sky2: enable PCI config writes Stephen Hemminger
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

These patch fix problems that fix some bugs/regressions in
sky2 on 2.6.24-rc1.

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/7] sky2: enable PCI config writes
  2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
@ 2007-11-05 23:52 ` Stephen Hemminger
  2007-11-06 17:41   ` Jeff Garzik
  2007-11-05 23:52 ` [PATCH 2/7] sky2: status ring race fix Stephen Hemminger
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

[-- Attachment #1: sky2-enable-pci-config.patch --]
[-- Type: text/plain, Size: 730 bytes --]

On some boards, PCI configuration space access is turned off by default.
The 2.6.24 driver doesn't turn it on, and should have.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-11-05 10:01:10.000000000 -0800
+++ b/drivers/net/sky2.c	2007-11-05 15:01:44.000000000 -0800
@@ -2791,6 +2791,9 @@ static void sky2_reset(struct sky2_hw *h
 	sky2_write8(hw, B0_CTST, CS_RST_SET);
 	sky2_write8(hw, B0_CTST, CS_RST_CLR);
 
+	/* allow writes to PCI config */
+	sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);
+
 	/* clear PCI errors, if any */
 	pci_read_config_word(pdev, PCI_STATUS, &status);
 	status |= PCI_STATUS_ERROR_BITS;

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 2/7] sky2: status ring race fix
  2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 1/7] sky2: enable PCI config writes Stephen Hemminger
@ 2007-11-05 23:52 ` Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 3/7] sky2: longer PHY delay Stephen Hemminger
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

[-- Attachment #1: sky2-status-check.patch --]
[-- Type: text/plain, Size: 1525 bytes --]

The D-Link PCI-X board (and maybe others) can lie about status
ring entries. It seems it will update the register for last status
index before completing the DMA for the ring entry. To avoid reading
stale data, zap the old entry and check.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-11-05 15:01:44.000000000 -0800
+++ b/drivers/net/sky2.c	2007-11-05 15:04:55.000000000 -0800
@@ -2247,20 +2247,26 @@ static int sky2_status_intr(struct sky2_
 	do {
 		struct sky2_port *sky2;
 		struct sky2_status_le *le  = hw->st_le + hw->st_idx;
-		unsigned port = le->css & CSS_LINK_BIT;
+		unsigned port;
 		struct net_device *dev;
 		struct sk_buff *skb;
 		u32 status;
 		u16 length;
+		u8 opcode = le->opcode;
+
+		if (!(opcode & HW_OWNER))
+			break;
 
 		hw->st_idx = RING_NEXT(hw->st_idx, STATUS_RING_SIZE);
 
+		port = le->css & CSS_LINK_BIT;
 		dev = hw->dev[port];
 		sky2 = netdev_priv(dev);
 		length = le16_to_cpu(le->length);
 		status = le32_to_cpu(le->status);
 
-		switch (le->opcode & ~HW_OWNER) {
+		le->opcode = 0;
+		switch (opcode & ~HW_OWNER) {
 		case OP_RXSTAT:
 			++rx[port];
 			skb = sky2_receive(dev, length, status);
@@ -2353,7 +2359,7 @@ static int sky2_status_intr(struct sky2_
 		default:
 			if (net_ratelimit())
 				printk(KERN_WARNING PFX
-				       "unknown status opcode 0x%x\n", le->opcode);
+				       "unknown status opcode 0x%x\n", opcode);
 		}
 	} while (hw->st_idx != idx);
 

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 3/7] sky2: longer PHY delay
  2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 1/7] sky2: enable PCI config writes Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 2/7] sky2: status ring race fix Stephen Hemminger
@ 2007-11-05 23:52 ` Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 4/7] sky2: dont change LED after autoneg Stephen Hemminger
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

[-- Attachment #1: sky2-phy-delay.patch --]
[-- Type: text/plain, Size: 2310 bytes --]

Increse phy delay and handle I/O errors.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-11-05 15:04:55.000000000 -0800
+++ b/drivers/net/sky2.c	2007-11-05 15:05:00.000000000 -0800
@@ -156,7 +156,7 @@ static const char *yukon2_name[] = {
 
 static void sky2_set_multicast(struct net_device *dev);
 
-/* Access to external PHY */
+/* Access to PHY via serial interconnect */
 static int gm_phy_write(struct sky2_hw *hw, unsigned port, u16 reg, u16 val)
 {
 	int i;
@@ -166,13 +166,22 @@ static int gm_phy_write(struct sky2_hw *
 		    GM_SMI_CT_PHY_AD(PHY_ADDR_MARV) | GM_SMI_CT_REG_AD(reg));
 
 	for (i = 0; i < PHY_RETRIES; i++) {
-		if (!(gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_BUSY))
+		u16 ctrl = gma_read16(hw, port, GM_SMI_CTRL);
+		if (ctrl == 0xffff)
+			goto io_error;
+
+		if (!(ctrl & GM_SMI_CT_BUSY))
 			return 0;
-		udelay(1);
+
+		udelay(10);
 	}
 
-	printk(KERN_WARNING PFX "%s: phy write timeout\n", hw->dev[port]->name);
+	dev_warn(&hw->pdev->dev,"%s: phy write timeout\n", hw->dev[port]->name);
 	return -ETIMEDOUT;
+
+io_error:
+	dev_err(&hw->pdev->dev, "%s: phy I/O error\n", hw->dev[port]->name);
+	return -EIO;
 }
 
 static int __gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg, u16 *val)
@@ -183,23 +192,29 @@ static int __gm_phy_read(struct sky2_hw 
 		    | GM_SMI_CT_REG_AD(reg) | GM_SMI_CT_OP_RD);
 
 	for (i = 0; i < PHY_RETRIES; i++) {
-		if (gma_read16(hw, port, GM_SMI_CTRL) & GM_SMI_CT_RD_VAL) {
+		u16 ctrl = gma_read16(hw, port, GM_SMI_CTRL);
+		if (ctrl == 0xffff)
+			goto io_error;
+
+		if (ctrl & GM_SMI_CT_RD_VAL) {
 			*val = gma_read16(hw, port, GM_SMI_DATA);
 			return 0;
 		}
 
-		udelay(1);
+		udelay(10);
 	}
 
+	dev_warn(&hw->pdev->dev, "%s: phy read timeout\n", hw->dev[port]->name);
 	return -ETIMEDOUT;
+io_error:
+	dev_err(&hw->pdev->dev, "%s: phy I/O error\n", hw->dev[port]->name);
+	return -EIO;
 }
 
-static u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
+static inline u16 gm_phy_read(struct sky2_hw *hw, unsigned port, u16 reg)
 {
 	u16 v;
-
-	if (__gm_phy_read(hw, port, reg, &v) != 0)
-		printk(KERN_WARNING PFX "%s: phy read timeout\n", hw->dev[port]->name);
+	__gm_phy_read(hw, port, reg, &v);
 	return v;
 }
 

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 4/7] sky2: dont change LED after autoneg
  2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
                   ` (2 preceding siblings ...)
  2007-11-05 23:52 ` [PATCH 3/7] sky2: longer PHY delay Stephen Hemminger
@ 2007-11-05 23:52 ` Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 5/7] sky2: remove unneeded mask update Stephen Hemminger
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

[-- Attachment #1: sky2-noled-aneg.patch --]
[-- Type: text/plain, Size: 1163 bytes --]

Don't need to change LED's after auto negotiation, the chip
sets them correctly.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-11-05 15:05:00.000000000 -0800
+++ b/drivers/net/sky2.c	2007-11-05 15:05:01.000000000 -0800
@@ -1820,29 +1820,6 @@ static void sky2_link_up(struct sky2_por
 	sky2_write8(hw, SK_REG(port, LNK_LED_REG),
 		    LINKLED_ON | LINKLED_BLINK_OFF | LINKLED_LINKSYNC_OFF);
 
-	if (hw->flags & SKY2_HW_NEWER_PHY) {
-		u16 pg = gm_phy_read(hw, port, PHY_MARV_EXT_ADR);
-		u16 led = PHY_M_LEDC_LOS_CTRL(1);	/* link active */
-
-		switch(sky2->speed) {
-		case SPEED_10:
-			led |= PHY_M_LEDC_INIT_CTRL(7);
-			break;
-
-		case SPEED_100:
-			led |= PHY_M_LEDC_STA1_CTRL(7);
-			break;
-
-		case SPEED_1000:
-			led |= PHY_M_LEDC_STA0_CTRL(7);
-			break;
-		}
-
-		gm_phy_write(hw, port, PHY_MARV_EXT_ADR, 3);
-		gm_phy_write(hw, port, PHY_MARV_PHY_CTRL, led);
-		gm_phy_write(hw, port, PHY_MARV_EXT_ADR, pg);
-	}
-
 	if (netif_msg_link(sky2))
 		printk(KERN_INFO PFX
 		       "%s: Link is up at %d Mbps, %s duplex, flow control %s\n",

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 5/7] sky2: remove unneeded mask update
  2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
                   ` (3 preceding siblings ...)
  2007-11-05 23:52 ` [PATCH 4/7] sky2: dont change LED after autoneg Stephen Hemminger
@ 2007-11-05 23:52 ` Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 6/7] sky2: handle advanced error recovery config issues Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 7/7] sky2: version 1.20 Stephen Hemminger
  6 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

[-- Attachment #1: sky2-no-phy-irq-mask.patch --]
[-- Type: text/plain, Size: 673 bytes --]

The IRQ's is already masked on shutdown, and on startup avoid
touching PHY until after phy_init().

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

--- a/drivers/net/sky2.c	2007-11-05 15:05:01.000000000 -0800
+++ b/drivers/net/sky2.c	2007-11-05 15:05:03.000000000 -0800
@@ -288,8 +288,6 @@ static void sky2_gmac_reset(struct sky2_
 
 	/* disable all GMAC IRQ's */
 	sky2_write8(hw, SK_REG(port, GMAC_IRQ_MSK), 0);
-	/* disable PHY IRQs */
-	gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0);
 
 	gma_write16(hw, port, GM_MC_ADDR_H1, 0);	/* clear MC hash */
 	gma_write16(hw, port, GM_MC_ADDR_H2, 0);

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 6/7] sky2: handle advanced error recovery config issues
  2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
                   ` (4 preceding siblings ...)
  2007-11-05 23:52 ` [PATCH 5/7] sky2: remove unneeded mask update Stephen Hemminger
@ 2007-11-05 23:52 ` Stephen Hemminger
  2007-11-05 23:52 ` [PATCH 7/7] sky2: version 1.20 Stephen Hemminger
  6 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

[-- Attachment #1: sky2-noaer.patch --]
[-- Type: text/plain, Size: 2711 bytes --]

The PCI AER support may not work for a couple of reasons.
It may not be configured into the kernel or there may be a BIOS
bug that prevents MMCONFIG from working.  If MMCONFIG doesn't work
then the PCI registers that control AER will not be accessible via
pci_read_config functions; luckly there is another window to access
PCI space in the device, so use that.

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>


--- a/drivers/net/sky2.c	2007-11-05 15:10:56.000000000 -0800
+++ b/drivers/net/sky2.c	2007-11-05 15:21:58.000000000 -0800
@@ -2435,13 +2435,26 @@ static void sky2_hw_intr(struct sky2_hw 
 
 	if (status & Y2_IS_PCI_EXP) {
 		/* PCI-Express uncorrectable Error occurred */
-		int pos = pci_find_aer_capability(hw->pdev);
+		int aer = pci_find_aer_capability(hw->pdev);
 		u32 err;
 
-		pci_read_config_dword(pdev, pos + PCI_ERR_UNCOR_STATUS, &err);
+		if (aer) {
+			pci_read_config_dword(pdev, aer + PCI_ERR_UNCOR_STATUS,
+					      &err);
+			pci_cleanup_aer_uncorrect_error_status(pdev);
+		} else {
+			/* Either AER not configured, or not working
+			 * because of bad MMCONFIG, so just do recover
+			 * manually.
+			 */
+			err = sky2_read32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS);
+			sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
+				     0xfffffffful);
+		}
+
 		if (net_ratelimit())
 			dev_err(&pdev->dev, "PCI Express error (0x%x)\n", err);
-		pci_cleanup_aer_uncorrect_error_status(pdev);
+
 	}
 
 	if (status & Y2_HWE_L1_MASK)
@@ -2799,9 +2812,18 @@ static void sky2_reset(struct sky2_hw *h
 
 	cap = pci_find_capability(pdev, PCI_CAP_ID_EXP);
 	if (cap) {
-		/* Check for advanced error reporting */
-		pci_cleanup_aer_uncorrect_error_status(pdev);
-		pci_cleanup_aer_correct_error_status(pdev);
+		if (pci_find_aer_capability(pdev)) {
+			/* Check for advanced error reporting */
+			pci_cleanup_aer_uncorrect_error_status(pdev);
+			pci_cleanup_aer_correct_error_status(pdev);
+		} else {
+			dev_warn(&pdev->dev,
+				"PCI Express Advanced Error Reporting"
+				" not configured or MMCONFIG problem?\n");
+
+			sky2_write32(hw, Y2_CFG_AER + PCI_ERR_UNCOR_STATUS,
+				     0xfffffffful);
+		}
 
 		/* If error bit is stuck on ignore it */
 		if (sky2_read32(hw, B0_HWE_ISRC) & Y2_IS_PCI_EXP)
--- a/drivers/net/sky2.h	2007-11-05 10:01:10.000000000 -0800
+++ b/drivers/net/sky2.h	2007-11-05 15:18:58.000000000 -0800
@@ -247,7 +247,8 @@ enum csr_regs {
 	B3_PA_CTRL	= 0x01f0,
 	B3_PA_TEST	= 0x01f2,
 
-	Y2_CFG_SPC	= 0x1c00,
+	Y2_CFG_SPC	= 0x1c00,	/* PCI config space region */
+	Y2_CFG_AER      = 0x1d00,	/* PCI Advanced Error Report region */
 };
 
 /*	B0_CTST			16 bit	Control/Status register */

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 7/7] sky2: version 1.20
  2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
                   ` (5 preceding siblings ...)
  2007-11-05 23:52 ` [PATCH 6/7] sky2: handle advanced error recovery config issues Stephen Hemminger
@ 2007-11-05 23:52 ` Stephen Hemminger
  6 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2007-11-05 23:52 UTC (permalink / raw)
  To: David Miller, Jeff Garzik; +Cc: netdev

[-- Attachment #1: sky2-vers --]
[-- Type: text/plain, Size: 429 bytes --]

Version update to 1.20

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>

--- a/drivers/net/sky2.c	2007-11-05 15:06:31.000000000 -0800
+++ b/drivers/net/sky2.c	2007-11-05 15:10:56.000000000 -0800
@@ -52,7 +52,7 @@
 #include "sky2.h"
 
 #define DRV_NAME		"sky2"
-#define DRV_VERSION		"1.19"
+#define DRV_VERSION		"1.20"
 #define PFX			DRV_NAME " "
 
 /*

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/7] sky2: enable PCI config writes
  2007-11-05 23:52 ` [PATCH 1/7] sky2: enable PCI config writes Stephen Hemminger
@ 2007-11-06 17:41   ` Jeff Garzik
  0 siblings, 0 replies; 9+ messages in thread
From: Jeff Garzik @ 2007-11-06 17:41 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev

applied 1-7


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-11-06 17:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-05 23:52 [PATCH 0/7] sky2: update for 2.6.24-rc2 Stephen Hemminger
2007-11-05 23:52 ` [PATCH 1/7] sky2: enable PCI config writes Stephen Hemminger
2007-11-06 17:41   ` Jeff Garzik
2007-11-05 23:52 ` [PATCH 2/7] sky2: status ring race fix Stephen Hemminger
2007-11-05 23:52 ` [PATCH 3/7] sky2: longer PHY delay Stephen Hemminger
2007-11-05 23:52 ` [PATCH 4/7] sky2: dont change LED after autoneg Stephen Hemminger
2007-11-05 23:52 ` [PATCH 5/7] sky2: remove unneeded mask update Stephen Hemminger
2007-11-05 23:52 ` [PATCH 6/7] sky2: handle advanced error recovery config issues Stephen Hemminger
2007-11-05 23:52 ` [PATCH 7/7] sky2: version 1.20 Stephen Hemminger

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).