[PATCH 07/17] bus: mvebu-mbus: suspend/resume support
From: Thomas Petazzoni <hidden>
Date: 2014-11-03 21:20:40
Also in:
linux-devicetree
Dear Gregory CLEMENT, On Mon, 03 Nov 2014 19:08:21 +0100, Gregory CLEMENT wrote:
quoted
struct mvebu_mbus_state { void __iomem *mbuswins_base; void __iomem *sdramwins_base; + void __iomem *mbusbridge_base;Here you store the information about the availability of the register needed for suspend/resume ... [...]quoted
+static int mvebu_mbus_suspend(void) +{ + struct mvebu_mbus_state *s = &mbus_state; + int win; + + for (win = 0; win < s->soc->num_wins; win++) { + void __iomem *addr = s->mbuswins_base + + s->soc->win_cfg_offset(win); + + s->wins[win].base = readl(addr + WIN_BASE_OFF); + s->wins[win].ctrl = readl(addr + WIN_CTRL_OFF); + + if (win >= s->soc->num_remappable_wins) + continue; + + s->wins[win].remap_lo = readl(addr + WIN_REMAP_LO_OFF); + s->wins[win].remap_hi = readl(addr + WIN_REMAP_HI_OFF); + } + + if (s->mbusbridge_base) { + s->mbus_bridge_ctrl = readl(s->mbusbridge_base + + MBUS_BRIDGE_CTRL_OFF); + s->mbus_bridge_base = readl(s->mbusbridge_base + + MBUS_BRIDGE_BASE_OFF); + }... so here could you exit with an error if the register is not available. Then it would prevent to enter in suspend instead of crashing the system.
Hum, yeah, good point. Returning something like -ENODEV will abort the suspend procedure. I'll fix that. Thanks for the idea. Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com