Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19861
b: refs/heads/master
c: 08c06d8
h: refs/heads/master
i:
  19859: 1b325d6
v: v3
  • Loading branch information
Stephen Hemminger authored and Jeff Garzik committed Feb 7, 2006
1 parent a6694ab commit 560d246
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d561514f616504c0962f22d51d165f7b6e1bae1b
refs/heads/master: 08c06d8a9063c81f6a21c9f275aa1ee49d4bf380
45 changes: 25 additions & 20 deletions trunk/drivers/net/sky2.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
/*
* TOTEST
* - speed setting
* - suspend/resume
*/

#include <linux/config.h>
Expand Down Expand Up @@ -198,7 +197,7 @@ static int sky2_set_power_state(struct sky2_hw *hw, pci_power_t state)
sky2_write8(hw, B2_TST_CTRL1, TST_CFG_WRITE_ON);

pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_PMC, &power_control);
vaux = (sky2_read8(hw, B0_CTST) & Y2_VAUX_AVAIL) &&
vaux = (sky2_read16(hw, B0_CTST) & Y2_VAUX_AVAIL) &&
(power_control & PCI_PM_CAP_PME_D3cold);

pci_read_config_word(hw->pdev, hw->pm_cap + PCI_PM_CTRL, &power_control);
Expand Down Expand Up @@ -2141,27 +2140,19 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk)

static int sky2_reset(struct sky2_hw *hw)
{
u32 ctst;
u16 status;
u8 t8, pmd_type;
int i;

ctst = sky2_read32(hw, B0_CTST);

sky2_write8(hw, B0_CTST, CS_RST_CLR);

hw->chip_id = sky2_read8(hw, B2_CHIP_ID);
if (hw->chip_id < CHIP_ID_YUKON_XL || hw->chip_id > CHIP_ID_YUKON_FE) {
printk(KERN_ERR PFX "%s: unsupported chip type 0x%x\n",
pci_name(hw->pdev), hw->chip_id);
return -EOPNOTSUPP;
}

/* ring for status responses */
hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES,
&hw->st_dma);
if (!hw->st_le)
return -ENOMEM;

/* disable ASF */
if (hw->chip_id <= CHIP_ID_YUKON_EC) {
sky2_write8(hw, B28_Y2_ASF_STAT_CMD, Y2_ASF_RESET);
Expand Down Expand Up @@ -3135,6 +3126,12 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
}
hw->pm_cap = pm_cap;

/* ring for status responses */
hw->st_le = pci_alloc_consistent(hw->pdev, STATUS_LE_BYTES,
&hw->st_dma);
if (!hw->st_le)
goto err_out_iounmap;

err = sky2_reset(hw);
if (err)
goto err_out_iounmap;
Expand Down Expand Up @@ -3263,25 +3260,33 @@ static int sky2_suspend(struct pci_dev *pdev, pm_message_t state)
static int sky2_resume(struct pci_dev *pdev)
{
struct sky2_hw *hw = pci_get_drvdata(pdev);
int i;
int i, err;

pci_restore_state(pdev);
pci_enable_wake(pdev, PCI_D0, 0);
sky2_set_power_state(hw, PCI_D0);
err = sky2_set_power_state(hw, PCI_D0);
if (err)
goto out;

sky2_reset(hw);
err = sky2_reset(hw);
if (err)
goto out;

for (i = 0; i < 2; i++) {
struct net_device *dev = hw->dev[i];
if (dev) {
if (netif_running(dev)) {
netif_device_attach(dev);
if (sky2_up(dev))
dev_close(dev);
if (dev && netif_running(dev)) {
netif_device_attach(dev);
err = sky2_up(dev);
if (err) {
printk(KERN_ERR PFX "%s: could not up: %d\n",
dev->name, err);
dev_close(dev);
break;
}
}
}
return 0;
out:
return err;
}
#endif

Expand Down

0 comments on commit 560d246

Please sign in to comment.