[PATCH RFC 02/15] via-rhine: some suspend/resume cleanup.
From: Andreas Mohr <hidden>
Date: 2012-12-31 15:34:44
Subsystem:
networking drivers, the rest, via rhine network driver · Maintainers:
Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Kevin Brace
From: Andreas Mohr <redacted> Work towards unifying duplicated power setup sections, add large comment. Signed-off-by: Andreas Mohr <redacted> --- drivers/net/ethernet/via/via-rhine.c | 27 +++++++++++++++++++++++---- 1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/via/via-rhine.c b/drivers/net/ethernet/via/via-rhine.c
index 5facb0b..928d96f 100644
--- a/drivers/net/ethernet/via/via-rhine.c
+++ b/drivers/net/ethernet/via/via-rhine.c@@ -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
--
1.7.2.5