diff options
Diffstat (limited to 'drivers/net/sk98lin/skge.c')
-rw-r--r-- | drivers/net/sk98lin/skge.c | 85 |
1 files changed, 83 insertions, 2 deletions
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 1ccb2989001c..6ee4771addf1 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -112,6 +112,7 @@ | |||
112 | #include <linux/moduleparam.h> | 112 | #include <linux/moduleparam.h> |
113 | #include <linux/init.h> | 113 | #include <linux/init.h> |
114 | #include <linux/proc_fs.h> | 114 | #include <linux/proc_fs.h> |
115 | #include <linux/dma-mapping.h> | ||
115 | 116 | ||
116 | #include "h/skdrv1st.h" | 117 | #include "h/skdrv1st.h" |
117 | #include "h/skdrv2nd.h" | 118 | #include "h/skdrv2nd.h" |
@@ -4912,8 +4913,8 @@ static int __devinit skge_probe_one(struct pci_dev *pdev, | |||
4912 | goto out; | 4913 | goto out; |
4913 | 4914 | ||
4914 | /* Configure DMA attributes. */ | 4915 | /* Configure DMA attributes. */ |
4915 | if (pci_set_dma_mask(pdev, (u64) 0xffffffffffffffffULL) && | 4916 | if (pci_set_dma_mask(pdev, DMA_64BIT_MASK) && |
4916 | pci_set_dma_mask(pdev, (u64) 0xffffffff)) | 4917 | pci_set_dma_mask(pdev, DMA_32BIT_MASK)) |
4917 | goto out_disable_device; | 4918 | goto out_disable_device; |
4918 | 4919 | ||
4919 | 4920 | ||
@@ -5132,6 +5133,84 @@ static void __devexit skge_remove_one(struct pci_dev *pdev) | |||
5132 | kfree(pAC); | 5133 | kfree(pAC); |
5133 | } | 5134 | } |
5134 | 5135 | ||
5136 | #ifdef CONFIG_PM | ||
5137 | static int skge_suspend(struct pci_dev *pdev, pm_message_t state) | ||
5138 | { | ||
5139 | struct net_device *dev = pci_get_drvdata(pdev); | ||
5140 | DEV_NET *pNet = netdev_priv(dev); | ||
5141 | SK_AC *pAC = pNet->pAC; | ||
5142 | struct net_device *otherdev = pAC->dev[1]; | ||
5143 | |||
5144 | if (netif_running(dev)) { | ||
5145 | netif_carrier_off(dev); | ||
5146 | DoPrintInterfaceChange = SK_FALSE; | ||
5147 | SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */ | ||
5148 | netif_device_detach(dev); | ||
5149 | } | ||
5150 | if (otherdev != dev) { | ||
5151 | if (netif_running(otherdev)) { | ||
5152 | netif_carrier_off(otherdev); | ||
5153 | DoPrintInterfaceChange = SK_FALSE; | ||
5154 | SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */ | ||
5155 | netif_device_detach(otherdev); | ||
5156 | } | ||
5157 | } | ||
5158 | |||
5159 | pci_save_state(pdev); | ||
5160 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | ||
5161 | if (pAC->AllocFlag & SK_ALLOC_IRQ) { | ||
5162 | free_irq(dev->irq, dev); | ||
5163 | } | ||
5164 | pci_disable_device(pdev); | ||
5165 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
5166 | |||
5167 | return 0; | ||
5168 | } | ||
5169 | |||
5170 | static int skge_resume(struct pci_dev *pdev) | ||
5171 | { | ||
5172 | struct net_device *dev = pci_get_drvdata(pdev); | ||
5173 | DEV_NET *pNet = netdev_priv(dev); | ||
5174 | SK_AC *pAC = pNet->pAC; | ||
5175 | struct net_device *otherdev = pAC->dev[1]; | ||
5176 | int ret; | ||
5177 | |||
5178 | pci_set_power_state(pdev, PCI_D0); | ||
5179 | pci_restore_state(pdev); | ||
5180 | pci_enable_device(pdev); | ||
5181 | pci_set_master(pdev); | ||
5182 | if (pAC->GIni.GIMacsFound == 2) | ||
5183 | ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); | ||
5184 | else | ||
5185 | ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); | ||
5186 | if (ret) { | ||
5187 | printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); | ||
5188 | pAC->AllocFlag &= ~SK_ALLOC_IRQ; | ||
5189 | dev->irq = 0; | ||
5190 | pci_disable_device(pdev); | ||
5191 | return -EBUSY; | ||
5192 | } | ||
5193 | |||
5194 | netif_device_attach(dev); | ||
5195 | if (netif_running(dev)) { | ||
5196 | DoPrintInterfaceChange = SK_FALSE; | ||
5197 | SkDrvInitAdapter(pAC, 0); /* first device */ | ||
5198 | } | ||
5199 | if (otherdev != dev) { | ||
5200 | netif_device_attach(otherdev); | ||
5201 | if (netif_running(otherdev)) { | ||
5202 | DoPrintInterfaceChange = SK_FALSE; | ||
5203 | SkDrvInitAdapter(pAC, 1); /* second device */ | ||
5204 | } | ||
5205 | } | ||
5206 | |||
5207 | return 0; | ||
5208 | } | ||
5209 | #else | ||
5210 | #define skge_suspend NULL | ||
5211 | #define skge_resume NULL | ||
5212 | #endif | ||
5213 | |||
5135 | static struct pci_device_id skge_pci_tbl[] = { | 5214 | static struct pci_device_id skge_pci_tbl[] = { |
5136 | { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 5215 | { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5137 | { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 5216 | { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
@@ -5157,6 +5236,8 @@ static struct pci_driver skge_driver = { | |||
5157 | .id_table = skge_pci_tbl, | 5236 | .id_table = skge_pci_tbl, |
5158 | .probe = skge_probe_one, | 5237 | .probe = skge_probe_one, |
5159 | .remove = __devexit_p(skge_remove_one), | 5238 | .remove = __devexit_p(skge_remove_one), |
5239 | .suspend = skge_suspend, | ||
5240 | .resume = skge_resume, | ||
5160 | }; | 5241 | }; |
5161 | 5242 | ||
5162 | static int __init skge_init(void) | 5243 | static int __init skge_init(void) |