aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2009-06-11 03:03:47 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-16 05:25:42 -0400
commit6cc90a5a6061428358d0f726a53fb44af5254111 (patch)
tree963a86a2f6adf2398938813d45ca8ba83831c6bc /drivers/net
parent9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (diff)
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> Tested-by: Andy Whitcroft <apw@canonical.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/sky2.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
index 6b5946fe8ae2..c6ceba95ace7 100644
--- a/drivers/net/sky2.c
+++ b/drivers/net/sky2.c
@@ -4364,6 +4364,22 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4364 goto err_out; 4364 goto err_out;
4365 } 4365 }
4366 4366
4367 /* Get configuration information
4368 * Note: only regular PCI config access once to test for HW issues
4369 * other PCI access through shared memory for speed and to
4370 * avoid MMCONFIG problems.
4371 */
4372 err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
4373 if (err) {
4374 dev_err(&pdev->dev, "PCI read config failed\n");
4375 goto err_out;
4376 }
4377
4378 if (~reg == 0) {
4379 dev_err(&pdev->dev, "PCI configuration read error\n");
4380 goto err_out;
4381 }
4382
4367 err = pci_request_regions(pdev, DRV_NAME); 4383 err = pci_request_regions(pdev, DRV_NAME);
4368 if (err) { 4384 if (err) {
4369 dev_err(&pdev->dev, "cannot obtain PCI resources\n"); 4385 dev_err(&pdev->dev, "cannot obtain PCI resources\n");
@@ -4389,21 +4405,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
4389 } 4405 }
4390 } 4406 }
4391 4407
4392 /* Get configuration information
4393 * Note: only regular PCI config access once to test for HW issues
4394 * other PCI access through shared memory for speed and to
4395 * avoid MMCONFIG problems.
4396 */
4397 err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
4398 if (err) {
4399 dev_err(&pdev->dev, "PCI read config failed\n");
4400 goto err_out_free_regions;
4401 }
4402
4403 /* size of available VPD, only impact sysfs */
4404 err = pci_vpd_truncate(pdev, 1ul << (((reg & PCI_VPD_ROM_SZ) >> 14) + 8));
4405 if (err)
4406 dev_warn(&pdev->dev, "Can't set VPD size\n");
4407 4408
4408#ifdef __BIG_ENDIAN 4409#ifdef __BIG_ENDIAN
4409 /* The sk98lin vendor driver uses hardware byte swapping but 4410 /* The sk98lin vendor driver uses hardware byte swapping but