2006-04-07 16:10:57 +08:00
|
|
|
/* orinoco_pci.h
|
2009-01-26 04:08:43 +08:00
|
|
|
*
|
2006-04-07 16:10:57 +08:00
|
|
|
* Common code for all Orinoco drivers for PCI devices, including
|
|
|
|
* both native PCI and PCMCIA-to-PCI bridges.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2005, Pavel Roskin.
|
2009-02-05 07:05:48 +08:00
|
|
|
* See main.c for license.
|
2006-04-07 16:10:57 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ORINOCO_PCI_H
|
|
|
|
#define _ORINOCO_PCI_H
|
|
|
|
|
|
|
|
#include <linux/netdevice.h>
|
|
|
|
|
|
|
|
/* Driver specific data */
|
|
|
|
struct orinoco_pci_card {
|
|
|
|
void __iomem *bridge_io;
|
|
|
|
void __iomem *attr_io;
|
|
|
|
};
|
|
|
|
|
2006-05-01 14:13:30 +08:00
|
|
|
#ifdef CONFIG_PM
|
2006-04-07 16:10:57 +08:00
|
|
|
static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)
|
|
|
|
{
|
2009-06-19 06:21:23 +08:00
|
|
|
struct orinoco_private *priv = pci_get_drvdata(pdev);
|
2006-04-07 16:10:57 +08:00
|
|
|
|
2009-06-19 06:21:30 +08:00
|
|
|
orinoco_down(priv);
|
2009-06-19 06:21:23 +08:00
|
|
|
free_irq(pdev->irq, priv);
|
2006-04-07 16:10:57 +08:00
|
|
|
pci_save_state(pdev);
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
pci_set_power_state(pdev, PCI_D3hot);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int orinoco_pci_resume(struct pci_dev *pdev)
|
|
|
|
{
|
2009-06-19 06:21:23 +08:00
|
|
|
struct orinoco_private *priv = pci_get_drvdata(pdev);
|
|
|
|
struct net_device *dev = priv->ndev;
|
2006-04-07 16:10:57 +08:00
|
|
|
int err;
|
|
|
|
|
2013-06-27 20:53:42 +08:00
|
|
|
pci_set_power_state(pdev, PCI_D0);
|
2006-11-08 09:53:48 +08:00
|
|
|
err = pci_enable_device(pdev);
|
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "%s: pci_enable_device failed on resume\n",
|
|
|
|
dev->name);
|
|
|
|
return err;
|
|
|
|
}
|
2006-04-07 16:10:57 +08:00
|
|
|
pci_restore_state(pdev);
|
|
|
|
|
2006-07-02 10:29:39 +08:00
|
|
|
err = request_irq(pdev->irq, orinoco_interrupt, IRQF_SHARED,
|
2009-06-19 06:21:23 +08:00
|
|
|
dev->name, priv);
|
2006-04-07 16:10:57 +08:00
|
|
|
if (err) {
|
|
|
|
printk(KERN_ERR "%s: cannot re-allocate IRQ on resume\n",
|
|
|
|
dev->name);
|
|
|
|
pci_disable_device(pdev);
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
|
2009-06-19 06:21:30 +08:00
|
|
|
err = orinoco_up(priv);
|
2006-04-07 16:10:57 +08:00
|
|
|
|
2009-06-19 06:21:30 +08:00
|
|
|
return err;
|
2006-04-07 16:10:57 +08:00
|
|
|
}
|
2006-05-01 14:13:30 +08:00
|
|
|
#else
|
|
|
|
#define orinoco_pci_suspend NULL
|
|
|
|
#define orinoco_pci_resume NULL
|
|
|
|
#endif
|
2006-04-07 16:10:57 +08:00
|
|
|
|
|
|
|
#endif /* _ORINOCO_PCI_H */
|