@@ -955,8 +955,10 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
goto err_out_free_res;
}
+ rp->base = ioaddr;
+
#ifdef USE_MMIO
- enable_mmio(pioaddr, quirks);
+ enable_mmio(rp->pioaddr, rp->quirks);
/* Check that selected MMIO registers match the PIO ones */
i = 0;
@@ -974,11 +976,9 @@ static int rhine_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
}
#endif /* USE_MMIO */
- rp->base = ioaddr;
-
/* Get chip registers into a sane state */
rhine_power_init(dev);
- rhine_hw_init(dev, pioaddr);
+ rhine_hw_init(dev, rp->pioaddr);
for (i = 0; i < 6; i++)
dev->dev_addr[i] = ioread8(ioaddr + StationAddr + i);
@@ -2324,6 +2324,25 @@ static int rhine_resume(struct device *device)
struct net_device *dev = pci_get_drvdata(pdev);
struct rhine_private *rp = netdev_priv(dev);
+ /*
+ * Resume theory of operation ("state machine" description):
+ * Card state post resume() needs to be sufficiently restored
+ * to be at least as "good" as post-probe()
+ * (plus certain user-side card attribute modifications
+ * ideally being preserved, too!).
+ * In the case of an ifdown iface prior to suspend,
+ * this means equal state.
+ * open()/close() then do a state elevation (working iface)
+ * and reversal (back down to post-probe() card state).
+ * NetworkManager likes to close() ifaces prior to suspend(),
+ * thus they end up "closed" on resume() yet the card
+ * needs to be sufficiently restored to have its basics working...
+ * (open() does NOT and should not carry out such things!!).
+ * FIXME: the card setup parts here are duplicated
+ * with corresponding parts in probe() - they should be moved
+ * into a helper to be commonly called by both places.
+ */
+
#ifdef USE_MMIO
enable_mmio(rp->pioaddr, rp->quirks);
#endif