Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66543
b: refs/heads/master
c: b6aec32
h: refs/heads/master
i:
  66541: 9e7a380
  66539: 7f10614
  66535: 94a9595
  66527: f7b8047
v: v3
  • Loading branch information
Rafael J. Wysocki authored and David S. Miller committed Oct 10, 2007
1 parent f993fc5 commit 0fd43d9
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 7 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: 917270c6ed7a99d4300ce57508246813ea8613b0
refs/heads/master: b6aec32a7774a398c4a194ad6b6392528b5a7a5b
108 changes: 102 additions & 6 deletions trunk/drivers/net/tulip/uli526x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,19 +1110,15 @@ static void uli526x_timer(unsigned long data)


/*
* Dynamic reset the ULI526X board
* Stop ULI526X board
* Free Tx/Rx allocated memory
* Reset ULI526X board
* Re-initialize ULI526X board
* Init system variable
*/

static void uli526x_dynamic_reset(struct net_device *dev)
static void uli526x_reset_prepare(struct net_device *dev)
{
struct uli526x_board_info *db = netdev_priv(dev);

ULI526X_DBUG(0, "uli526x_dynamic_reset()", 0);

/* Sopt MAC controller */
db->cr6_data &= ~(CR6_RXSC | CR6_TXSC); /* Disable Tx/Rx */
update_cr6(db->cr6_data, dev->base_addr);
Expand All @@ -1141,6 +1137,22 @@ static void uli526x_dynamic_reset(struct net_device *dev)
db->link_failed = 1;
db->init=1;
db->wait_reset = 0;
}


/*
* Dynamic reset the ULI526X board
* Stop ULI526X board
* Free Tx/Rx allocated memory
* Reset ULI526X board
* Re-initialize ULI526X board
*/

static void uli526x_dynamic_reset(struct net_device *dev)
{
ULI526X_DBUG(0, "uli526x_dynamic_reset()", 0);

uli526x_reset_prepare(dev);

/* Re-initialize ULI526X board */
uli526x_init(dev);
Expand All @@ -1150,6 +1162,88 @@ static void uli526x_dynamic_reset(struct net_device *dev)
}


#ifdef CONFIG_PM

/*
* Suspend the interface.
*/

static int uli526x_suspend(struct pci_dev *pdev, pm_message_t state)
{
struct net_device *dev = pci_get_drvdata(pdev);
pci_power_t power_state;
int err;

ULI526X_DBUG(0, "uli526x_suspend", 0);

if (!netdev_priv(dev))
return 0;

pci_save_state(pdev);

if (!netif_running(dev))
return 0;

netif_device_detach(dev);
uli526x_reset_prepare(dev);

power_state = pci_choose_state(pdev, state);
pci_enable_wake(pdev, power_state, 0);
err = pci_set_power_state(pdev, power_state);
if (err) {
netif_device_attach(dev);
/* Re-initialize ULI526X board */
uli526x_init(dev);
/* Restart upper layer interface */
netif_wake_queue(dev);
}

return err;
}

/*
* Resume the interface.
*/

static int uli526x_resume(struct pci_dev *pdev)
{
struct net_device *dev = pci_get_drvdata(pdev);
int err;

ULI526X_DBUG(0, "uli526x_resume", 0);

if (!netdev_priv(dev))
return 0;

pci_restore_state(pdev);

if (!netif_running(dev))
return 0;

err = pci_set_power_state(pdev, PCI_D0);
if (err) {
printk(KERN_WARNING "%s: Could not put device into D0\n",
dev->name);
return err;
}

netif_device_attach(dev);
/* Re-initialize ULI526X board */
uli526x_init(dev);
/* Restart upper layer interface */
netif_wake_queue(dev);

return 0;
}

#else /* !CONFIG_PM */

#define uli526x_suspend NULL
#define uli526x_resume NULL

#endif /* !CONFIG_PM */


/*
* free all allocated rx buffer
*/
Expand Down Expand Up @@ -1689,6 +1783,8 @@ static struct pci_driver uli526x_driver = {
.id_table = uli526x_pci_tbl,
.probe = uli526x_init_one,
.remove = __devexit_p(uli526x_remove_one),
.suspend = uli526x_suspend,
.resume = uli526x_resume,
};

MODULE_AUTHOR("Peer Chen, peer.chen@uli.com.tw");
Expand Down

0 comments on commit 0fd43d9

Please sign in to comment.