diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2009-02-03 06:27:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-02-03 18:08:36 -0500 |
commit | 3834507d0c5480a0f05486c2fb57ed18fd179a83 (patch) | |
tree | 2fe6502ac93a291ca698490f41a5504609e084f8 /drivers/net/sky2.c | |
parent | e4c2abe29e1ec5d68908848ffa77b39f61a83f7c (diff) |
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>
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index d3c090dae879..d01c56eb9627 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -4356,6 +4356,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4356 | struct net_device *dev; | 4356 | struct net_device *dev; |
4357 | struct sky2_hw *hw; | 4357 | struct sky2_hw *hw; |
4358 | int err, using_dac = 0, wol_default; | 4358 | int err, using_dac = 0, wol_default; |
4359 | u32 reg; | ||
4359 | char buf1[16]; | 4360 | char buf1[16]; |
4360 | 4361 | ||
4361 | err = pci_enable_device(pdev); | 4362 | err = pci_enable_device(pdev); |
@@ -4389,6 +4390,34 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4389 | } | 4390 | } |
4390 | } | 4391 | } |
4391 | 4392 | ||
4393 | /* Get configuration information | ||
4394 | * Note: only regular PCI config access once to test for HW issues | ||
4395 | * other PCI access through shared memory for speed and to | ||
4396 | * avoid MMCONFIG problems. | ||
4397 | */ | ||
4398 | err = pci_read_config_dword(pdev, PCI_DEV_REG2, ®); | ||
4399 | if (err) { | ||
4400 | dev_err(&pdev->dev, "PCI read config failed\n"); | ||
4401 | goto err_out_free_regions; | ||
4402 | } | ||
4403 | |||
4404 | /* size of available VPD, only impact sysfs */ | ||
4405 | err = pci_vpd_truncate(pdev, 1ul << (((reg & PCI_VPD_ROM_SZ) >> 14) + 8)); | ||
4406 | if (err) | ||
4407 | dev_warn(&pdev->dev, "Can't set VPD size\n"); | ||
4408 | |||
4409 | #ifdef __BIG_ENDIAN | ||
4410 | /* The sk98lin vendor driver uses hardware byte swapping but | ||
4411 | * this driver uses software swapping. | ||
4412 | */ | ||
4413 | reg &= ~PCI_REV_DESC; | ||
4414 | err = pci_write_config_dword(pdev,PCI_DEV_REG2, reg); | ||
4415 | if (err) { | ||
4416 | dev_err(&pdev->dev, "PCI write config failed\n"); | ||
4417 | goto err_out_free_regions; | ||
4418 | } | ||
4419 | #endif | ||
4420 | |||
4392 | wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0; | 4421 | wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0; |
4393 | 4422 | ||
4394 | err = -ENOMEM; | 4423 | err = -ENOMEM; |
@@ -4406,18 +4435,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4406 | goto err_out_free_hw; | 4435 | goto err_out_free_hw; |
4407 | } | 4436 | } |
4408 | 4437 | ||
4409 | #ifdef __BIG_ENDIAN | ||
4410 | /* The sk98lin vendor driver uses hardware byte swapping but | ||
4411 | * this driver uses software swapping. | ||
4412 | */ | ||
4413 | { | ||
4414 | u32 reg; | ||
4415 | reg = sky2_pci_read32(hw, PCI_DEV_REG2); | ||
4416 | reg &= ~PCI_REV_DESC; | ||
4417 | sky2_pci_write32(hw, PCI_DEV_REG2, reg); | ||
4418 | } | ||
4419 | #endif | ||
4420 | |||
4421 | /* ring for status responses */ | 4438 | /* ring for status responses */ |
4422 | hw->st_le = pci_alloc_consistent(pdev, STATUS_LE_BYTES, &hw->st_dma); | 4439 | hw->st_le = pci_alloc_consistent(pdev, STATUS_LE_BYTES, &hw->st_dma); |
4423 | if (!hw->st_le) | 4440 | if (!hw->st_le) |