netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] sky2: resume clocks
@ 2010-02-07 16:23 Stephen Hemminger
  2010-02-07 16:24 ` [PATCH 2/3]: sky2: disable ASF on Yukon Supreme Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stephen Hemminger @ 2010-02-07 16:23 UTC (permalink / raw)
  To: David Miller, netdev

Change the resume path to use pci write config for a couple of reasons:
1. pci_write_config_dword() allows for more error
   checking of PCI health after resume.

2. better to toggle this register on all chip types, since that
   is what vendor driver does.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/sky2.c	2010-02-03 09:17:01.602741445 -0800
+++ b/drivers/net/sky2.c	2010-02-03 09:24:17.943679463 -0800
@@ -4859,10 +4859,11 @@ static int sky2_resume(struct pci_dev *p
 	pci_enable_wake(pdev, PCI_D0, 0);
 
 	/* Re-enable all clocks */
-	if (hw->chip_id == CHIP_ID_YUKON_EX ||
-	    hw->chip_id == CHIP_ID_YUKON_EC_U ||
-	    hw->chip_id == CHIP_ID_YUKON_FE_P)
-		sky2_pci_write32(hw, PCI_DEV_REG3, 0);
+	err = pci_write_config_dword(pdev, PCI_DEV_REG3, 0);
+	if (err) {
+		dev_err(&pdev->dev, "PCI write config failed\n");
+		goto out;
+	}
 
 	sky2_reset(hw);
 	sky2_write32(hw, B0_IMSK, Y2_IS_BASE);

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

* [PATCH 2/3]: sky2: disable ASF on Yukon Supreme
  2010-02-07 16:23 [PATCH 1/3] sky2: resume clocks Stephen Hemminger
@ 2010-02-07 16:24 ` Stephen Hemminger
  2010-02-11  1:57   ` David Miller
  2010-02-07 16:28 ` [PATCH 3/3] sky2: receive checksum refactoring Stephen Hemminger
  2010-02-11  1:57 ` [PATCH 1/3] sky2: resume clocks David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2010-02-07 16:24 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Clone of vendor code to disable ASF on Extreme and Supreme chips.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--- a/drivers/net/sky2.c	2010-02-03 09:24:17.943679463 -0800
+++ b/drivers/net/sky2.c	2010-02-03 09:24:19.203992300 -0800
@@ -3035,11 +3035,20 @@ static void sky2_reset(struct sky2_hw *h
 	u32 hwe_mask = Y2_HWE_ALL_MASK;
 
 	/* disable ASF */
-	if (hw->chip_id == CHIP_ID_YUKON_EX) {
+	if (hw->chip_id == CHIP_ID_YUKON_EX
+	    || hw->chip_id == CHIP_ID_YUKON_SUPR) {
+		sky2_write32(hw, CPU_WDOG, 0);
 		status = sky2_read16(hw, HCU_CCSR);
 		status &= ~(HCU_CCSR_AHB_RST | HCU_CCSR_CPU_RST_MODE |
 			    HCU_CCSR_UC_STATE_MSK);
+		/*
+		 * CPU clock divider shouldn't be used because
+		 * - ASF firmware may malfunction
+		 * - Yukon-Supreme: Parallel FLASH doesn't support divided clocks
+		 */
+		status &= ~HCU_CCSR_CPU_CLK_DIVIDE_MSK;
 		sky2_write16(hw, HCU_CCSR, status);
+		sky2_write32(hw, CPU_WDOG, 0);
 	} else
 		sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
 	sky2_write16(hw, B0_CTST, Y2_ASF_DISABLE);

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

* [PATCH 3/3] sky2: receive checksum refactoring
  2010-02-07 16:23 [PATCH 1/3] sky2: resume clocks Stephen Hemminger
  2010-02-07 16:24 ` [PATCH 2/3]: sky2: disable ASF on Yukon Supreme Stephen Hemminger
@ 2010-02-07 16:28 ` Stephen Hemminger
  2010-02-11  1:57   ` David Miller
  2010-02-11  1:57 ` [PATCH 1/3] sky2: resume clocks David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2010-02-07 16:28 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

Break the largish case for handling receive checksum into a separate
function, and if there is a problem use dev_XXX routines to
show which hardware is the problem.

Turn one corner case into a BUG().  This only happens if the driver
is expecting one behavior but the chip does the old behavior;
only ever saw this when bringing up a new chip type and driver
was buggy.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/drivers/net/sky2.c	2010-02-03 09:24:19.203992300 -0800
+++ b/drivers/net/sky2.c	2010-02-03 09:24:19.933679365 -0800
@@ -2484,6 +2484,32 @@ static inline void sky2_rx_done(struct s
 	}
 }
 
+static void sky2_rx_checksum(struct sky2_port *sky2, u32 status)
+{
+	/* If this happens then driver assuming wrong format for chip type */
+	BUG_ON(sky2->hw->flags & SKY2_HW_NEW_LE);
+
+	/* Both checksum counters are programmed to start at
+	 * the same offset, so unless there is a problem they
+	 * should match. This failure is an early indication that
+	 * hardware receive checksumming won't work.
+	 */
+	if (likely((u16)(status >> 16) == (u16)status)) {
+		struct sk_buff *skb = sky2->rx_ring[sky2->rx_next].skb;
+		skb->ip_summed = CHECKSUM_COMPLETE;
+		skb->csum = le16_to_cpu(status);
+	} else {
+		dev_notice(&sky2->hw->pdev->dev,
+			   "%s: receive checksum problem (status = %#x)\n",
+			   sky2->netdev->name, status);
+
+		/* Disable checksum offload */
+		sky2->flags &= ~SKY2_FLAG_RX_CHECKSUM;
+		sky2_write32(sky2->hw, Q_ADDR(rxqaddr[sky2->port], Q_CSR),
+			     BMU_DIS_RX_CHKSUM);
+	}
+}
+
 /* Process status response ring */
 static int sky2_status_intr(struct sky2_hw *hw, int to_do, u16 idx)
 {
@@ -2552,37 +2578,8 @@ static int sky2_status_intr(struct sky2_
 			/* fall through */
 #endif
 		case OP_RXCHKS:
-			if (!(sky2->flags & SKY2_FLAG_RX_CHECKSUM))
-				break;
-
-			/* If this happens then driver assuming wrong format */
-			if (unlikely(hw->flags & SKY2_HW_NEW_LE)) {
-				if (net_ratelimit())
-					printk(KERN_NOTICE "%s: unexpected"
-					       " checksum status\n",
-					       dev->name);
-				break;
-			}
-
-			/* Both checksum counters are programmed to start at
-			 * the same offset, so unless there is a problem they
-			 * should match. This failure is an early indication that
-			 * hardware receive checksumming won't work.
-			 */
-			if (likely(status >> 16 == (status & 0xffff))) {
-				skb = sky2->rx_ring[sky2->rx_next].skb;
-				skb->ip_summed = CHECKSUM_COMPLETE;
-				skb->csum = le16_to_cpu(status);
-			} else {
-				printk(KERN_NOTICE PFX "%s: hardware receive "
-				       "checksum problem (status = %#x)\n",
-				       dev->name, status);
-				sky2->flags &= ~SKY2_FLAG_RX_CHECKSUM;
-
-				sky2_write32(sky2->hw,
-					     Q_ADDR(rxqaddr[port], Q_CSR),
-					     BMU_DIS_RX_CHKSUM);
-			}
+			if (likely(sky2->flags & SKY2_FLAG_RX_CHECKSUM))
+				sky2_rx_checksum(sky2, status);
 			break;
 
 		case OP_TXINDEXLE:

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

* Re: [PATCH 1/3] sky2: resume clocks
  2010-02-07 16:23 [PATCH 1/3] sky2: resume clocks Stephen Hemminger
  2010-02-07 16:24 ` [PATCH 2/3]: sky2: disable ASF on Yukon Supreme Stephen Hemminger
  2010-02-07 16:28 ` [PATCH 3/3] sky2: receive checksum refactoring Stephen Hemminger
@ 2010-02-11  1:57 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-02-11  1:57 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sun, 7 Feb 2010 08:23:53 -0800

> Change the resume path to use pci write config for a couple of reasons:
> 1. pci_write_config_dword() allows for more error
>    checking of PCI health after resume.
> 
> 2. better to toggle this register on all chip types, since that
>    is what vendor driver does.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied to net-next-2.6

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

* Re: [PATCH 2/3]: sky2: disable ASF on Yukon Supreme
  2010-02-07 16:24 ` [PATCH 2/3]: sky2: disable ASF on Yukon Supreme Stephen Hemminger
@ 2010-02-11  1:57   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-02-11  1:57 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sun, 7 Feb 2010 08:24:50 -0800

> Clone of vendor code to disable ASF on Extreme and Supreme chips.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied to net-next-2.6

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

* Re: [PATCH 3/3] sky2: receive checksum refactoring
  2010-02-07 16:28 ` [PATCH 3/3] sky2: receive checksum refactoring Stephen Hemminger
@ 2010-02-11  1:57   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2010-02-11  1:57 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sun, 7 Feb 2010 08:28:36 -0800

> Break the largish case for handling receive checksum into a separate
> function, and if there is a problem use dev_XXX routines to
> show which hardware is the problem.
> 
> Turn one corner case into a BUG().  This only happens if the driver
> is expecting one behavior but the chip does the old behavior;
> only ever saw this when bringing up a new chip type and driver
> was buggy.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied to net-next-2.6

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

end of thread, other threads:[~2010-02-11  1:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-07 16:23 [PATCH 1/3] sky2: resume clocks Stephen Hemminger
2010-02-07 16:24 ` [PATCH 2/3]: sky2: disable ASF on Yukon Supreme Stephen Hemminger
2010-02-11  1:57   ` David Miller
2010-02-07 16:28 ` [PATCH 3/3] sky2: receive checksum refactoring Stephen Hemminger
2010-02-11  1:57   ` David Miller
2010-02-11  1:57 ` [PATCH 1/3] sky2: resume clocks David Miller

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