From mboxrd@z Thu Jan 1 00:00:00 1970 From: thomas.petazzoni@free-electrons.com (Thomas Petazzoni) Date: Mon, 3 Nov 2014 22:20:40 +0100 Subject: [PATCH 07/17] bus: mvebu-mbus: suspend/resume support In-Reply-To: <5457C495.7080403@free-electrons.com> References: <1414151970-6626-1-git-send-email-thomas.petazzoni@free-electrons.com> <1414151970-6626-8-git-send-email-thomas.petazzoni@free-electrons.com> <5457C495.7080403@free-electrons.com> Message-ID: <20141103222040.045231ae@free-electrons.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Dear Gregory CLEMENT, On Mon, 03 Nov 2014 19:08:21 +0100, Gregory CLEMENT wrote: > > 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 ... > > [...] > > > > +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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Petazzoni Subject: Re: [PATCH 07/17] bus: mvebu-mbus: suspend/resume support Date: Mon, 3 Nov 2014 22:20:40 +0100 Message-ID: <20141103222040.045231ae@free-electrons.com> References: <1414151970-6626-1-git-send-email-thomas.petazzoni@free-electrons.com> <1414151970-6626-8-git-send-email-thomas.petazzoni@free-electrons.com> <5457C495.7080403@free-electrons.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <5457C495.7080403-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Gregory CLEMENT Cc: Jason Cooper , Andrew Lunn , Sebastian Hesselbarth , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Tawfik Bayouk , Nadav Haklai , Lior Amsalem , Ezequiel Garcia , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org Dear Gregory CLEMENT, On Mon, 03 Nov 2014 19:08:21 +0100, Gregory CLEMENT wrote: > > 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 ... > > [...] > > > > +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 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html