All of lore.kernel.org
 help / color / mirror / Atom feed
* "sky2: set VPD size" triggers card recognition failure
@ 2009-06-11 12:29 Andy Whitcroft
  2009-06-11 17:03 ` Stephen Hemminger
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Whitcroft @ 2009-06-11 12:29 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev, linux-kernel

We have reports[1] of sky2 cards failing to be recognised with the latest
2.6.30-rc8 kernels.  We are seeing what appears to be failures to
obtains the chip id correctly:

    sky2 driver version 1.22
    sky2 0000:02:00.0: enabling device (0000 -> 0003)
    sky2 0000:02:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
    sky2 0000:02:00.0: setting latency timer to 64
    sky2 0000:02:00.0: Can't set VPD size
    sky2 0000:02:00.0: unsupported chip type 0xff
    sky2 0000:02:00.0: PCI INT A disabled
    sky2: probe of 0000:02:00.0 failed with error -95

Based on the VPD size failure message we reverted just the commit below,
which restored the card:

    commit 3834507d0c5480a0f05486c2fb57ed18fd179a83
    Author: Stephen Hemminger <shemminger@vyatta.com>
    Date:   Tue Feb 3 11:27:30 2009 +0000

	sky2: set VPD size
	
	Read configuration register during probe and use it to size the
	available VPD. Move existing code using same register slightly
	earlier in probe handling.
	
	Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
	Signed-off-by: David S. Miller <davem@davemloft.net>

Steven, any thoughts?

-apw

[1] https://www.launchpad.net/bugs/384403

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

* Re: "sky2: set VPD size" triggers card recognition failure
  2009-06-11 12:29 "sky2: set VPD size" triggers card recognition failure Andy Whitcroft
@ 2009-06-11 17:03 ` Stephen Hemminger
  2009-06-12 11:51   ` Andy Whitcroft
  0 siblings, 1 reply; 5+ messages in thread
From: Stephen Hemminger @ 2009-06-11 17:03 UTC (permalink / raw)
  To: Andy Whitcroft; +Cc: David S. Miller, netdev, linux-kernel

On Thu, 11 Jun 2009 13:29:42 +0100
Andy Whitcroft <apw@canonical.com> wrote:

> We have reports[1] of sky2 cards failing to be recognised with the latest
> 2.6.30-rc8 kernels.  We are seeing what appears to be failures to
> obtains the chip id correctly:
> 
>     sky2 driver version 1.22
>     sky2 0000:02:00.0: enabling device (0000 -> 0003)
>     sky2 0000:02:00.0: PCI INT A -> GSI 17 (level, low) -> IRQ 17
>     sky2 0000:02:00.0: setting latency timer to 64
>     sky2 0000:02:00.0: Can't set VPD size
>     sky2 0000:02:00.0: unsupported chip type 0xff
>     sky2 0000:02:00.0: PCI INT A disabled
>     sky2: probe of 0000:02:00.0 failed with error -95
> 
> Based on the VPD size failure message we reverted just the commit below,
> which restored the card:
> 
>     commit 3834507d0c5480a0f05486c2fb57ed18fd179a83
>     Author: Stephen Hemminger <shemminger@vyatta.com>
>     Date:   Tue Feb 3 11:27:30 2009 +0000
> 
> 	sky2: set VPD size
> 	
> 	Read configuration register during probe and use it to size the
> 	available VPD. Move existing code using same register slightly
> 	earlier in probe handling.
> 	
> 	Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 	Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> Steven, any thoughts?

Some of the chip version have different registers, and some hardware vendors build
boards without VPD.  Does this help:

---------
Subject: sky2: don't look for VPD size

The code to compute VPD size didn't handle some systems that use
chip without VPD. Also some of the newer chips use some additional
registers to store the actual size, and wasn't worth putting the
additional complexity in, so just remove the code.

No big loss since the code to set the VPD size was only a 
convenience so that utilities would not read the extra space past
the end of the available VPD.

Move the first PCI config read earlier to detect bad hardware
where it returns all ones and refuse loading driver before furthur
damage.

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

--- a/drivers/net/sky2.c	2009-06-11 09:26:05.420060719 -0700
+++ b/drivers/net/sky2.c	2009-06-11 09:28:27.004211122 -0700
@@ -4431,6 +4431,22 @@ static int __devinit sky2_probe(struct p
 		goto err_out;
 	}
 
+	/* Get configuration information
+	 * Note: only regular PCI config access once to test for HW issues
+	 *       other PCI access through shared memory for speed and to
+	 *	 avoid MMCONFIG problems.
+	 */
+	err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
+	if (err) {
+		dev_err(&pdev->dev, "PCI read config failed\n");
+		goto err_out;
+	}
+
+	if (~reg == 0) {
+		dev_err(&pdev->dev, "PCI configuration read error\n");
+		goto err_out;
+	}
+
 	err = pci_request_regions(pdev, DRV_NAME);
 	if (err) {
 		dev_err(&pdev->dev, "cannot obtain PCI resources\n");
@@ -4456,21 +4472,6 @@ static int __devinit sky2_probe(struct p
 		}
 	}
 
-	/* Get configuration information
-	 * Note: only regular PCI config access once to test for HW issues
-	 *       other PCI access through shared memory for speed and to
-	 *	 avoid MMCONFIG problems.
-	 */
-	err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
-	if (err) {
-		dev_err(&pdev->dev, "PCI read config failed\n");
-		goto err_out_free_regions;
-	}
-
-	/* size of available VPD, only impact sysfs */
-	err = pci_vpd_truncate(pdev, 1ul << (((reg & PCI_VPD_ROM_SZ) >> 14) + 8));
-	if (err)
-		dev_warn(&pdev->dev, "Can't set VPD size\n");
 
 #ifdef __BIG_ENDIAN
 	/* The sk98lin vendor driver uses hardware byte swapping but

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

* Re: "sky2: set VPD size" triggers card recognition failure
  2009-06-11 17:03 ` Stephen Hemminger
@ 2009-06-12 11:51   ` Andy Whitcroft
  2009-06-15 10:17     ` Andy Whitcroft
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Whitcroft @ 2009-06-12 11:51 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev, linux-kernel

On Thu, Jun 11, 2009 at 10:03:47AM -0700, Stephen Hemminger wrote:

> Some of the chip version have different registers, and some hardware vendors build
> boards without VPD.  Does this help:

Thanks for the patch.  I have built some kernels and pushed them out
for testing.  Will let you know what comes of it!

Thanks.

-apw

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

* Re: "sky2: set VPD size" triggers card recognition failure
  2009-06-12 11:51   ` Andy Whitcroft
@ 2009-06-15 10:17     ` Andy Whitcroft
  2009-06-16  9:26       ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Whitcroft @ 2009-06-15 10:17 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, netdev, linux-kernel

On Fri, Jun 12, 2009 at 12:51:20PM +0100, Andy Whitcroft wrote:
> On Thu, Jun 11, 2009 at 10:03:47AM -0700, Stephen Hemminger wrote:
> 
> > Some of the chip version have different registers, and some hardware vendors build
> > boards without VPD.  Does this help:
> 
> Thanks for the patch.  I have built some kernels and pushed them out
> for testing.  Will let you know what comes of it!

Ok, that tests out good as well.

Tested-by: Andy Whitcroft <apw@canonical.com>

-apw

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

* Re: "sky2: set VPD size" triggers card recognition failure
  2009-06-15 10:17     ` Andy Whitcroft
@ 2009-06-16  9:26       ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2009-06-16  9:26 UTC (permalink / raw)
  To: apw; +Cc: shemminger, netdev, linux-kernel

From: Andy Whitcroft <apw@canonical.com>
Date: Mon, 15 Jun 2009 11:17:53 +0100

> On Fri, Jun 12, 2009 at 12:51:20PM +0100, Andy Whitcroft wrote:
>> On Thu, Jun 11, 2009 at 10:03:47AM -0700, Stephen Hemminger wrote:
>> 
>> > Some of the chip version have different registers, and some hardware vendors build
>> > boards without VPD.  Does this help:
>> 
>> Thanks for the patch.  I have built some kernels and pushed them out
>> for testing.  Will let you know what comes of it!
> 
> Ok, that tests out good as well.
> 
> Tested-by: Andy Whitcroft <apw@canonical.com>

Applied, thanks everyone.

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

end of thread, other threads:[~2009-06-16  9:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-11 12:29 "sky2: set VPD size" triggers card recognition failure Andy Whitcroft
2009-06-11 17:03 ` Stephen Hemminger
2009-06-12 11:51   ` Andy Whitcroft
2009-06-15 10:17     ` Andy Whitcroft
2009-06-16  9:26       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.