From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbdDIMNs (ORCPT ); Sun, 9 Apr 2017 08:13:48 -0400 Received: from foss.arm.com ([217.140.101.70]:40704 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752065AbdDIMNn (ORCPT ); Sun, 9 Apr 2017 08:13:43 -0400 Date: Sun, 9 Apr 2017 13:13:33 +0100 From: Marc Zyngier To: Alexandre Belloni Cc: Thomas Gleixner , Boris Brezillon , Jason Cooper , Subject: Re: [PATCH] irqchip/atmel-aic5: handle suspend to RAM Message-ID: <20170409131333.76a7e7a1@why.wild-wind.fr.eu.org> In-Reply-To: <20170406161753.4357-1-alexandre.belloni@free-electrons.com> References: <20170406161753.4357-1-alexandre.belloni@free-electrons.com> Organization: ARM Ltd X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 6 Apr 2017 18:17:53 +0200 Alexandre Belloni wrote: > On sama5d2, VDD core may be cut while suspending to RAM. This means the > AIC5 registers content is lost. Restore it at resume time. > > Signed-off-by: Alexandre Belloni > --- > drivers/irqchip/irq-atmel-aic5.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c > index 2a624d87a035..ddbf60251b0e 100644 > --- a/drivers/irqchip/irq-atmel-aic5.c > +++ b/drivers/irqchip/irq-atmel-aic5.c > @@ -150,6 +150,8 @@ static int aic5_set_type(struct irq_data *d, unsigned type) > } > > #ifdef CONFIG_PM > +u32 smr_cache[128]; Two things: - Why isn't this array static? - Why is the size hard-coded to 128, while the loops below are based on the domain revmap_size. > + > static void aic5_suspend(struct irq_data *d) > { > struct irq_domain *domain = d->domain; > @@ -159,6 +161,11 @@ static void aic5_suspend(struct irq_data *d) > int i; > u32 mask; > > + for (i = 0; i < domain->revmap_size; i++) { > + irq_reg_writel(bgc, i, AT91_AIC5_SSR); > + smr_cache[i] = irq_reg_readl(bgc, AT91_AIC5_SMR); > + } > + This seem to affect more than just the sama5d2 part. Is that expected? > irq_gc_lock(bgc); > for (i = 0; i < dgc->irqs_per_chip; i++) { > mask = 1 << i; > @@ -184,10 +191,16 @@ static void aic5_resume(struct irq_data *d) > u32 mask; > > irq_gc_lock(bgc); > + > + irq_reg_writel(bgc, 0xffffffff, AT91_AIC5_SPU); > + for (i = 0; i < domain->revmap_size; i++) { > + irq_reg_writel(bgc, i, AT91_AIC5_SSR); > + irq_reg_writel(bgc, i, AT91_AIC5_SVR); > + irq_reg_writel(bgc, smr_cache[i], AT91_AIC5_SMR); > + } > + > for (i = 0; i < dgc->irqs_per_chip; i++) { > mask = 1 << i; > - if ((mask & gc->mask_cache) == (mask & gc->wake_active)) > - continue; > > irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR); > if (mask & gc->mask_cache) Thanks, M. -- Without deviation from the norm, progress is not possible.