All of lore.kernel.org
 help / color / mirror / Atom feed
From: jhovold@gmail.com (Johan Hovold)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: at91: fix rtc irq mask for sam9x5 SoCs
Date: Thu, 8 May 2014 17:54:55 +0200	[thread overview]
Message-ID: <20140508155455.GB6776@localhost> (raw)
In-Reply-To: <1399479649-3247-1-git-send-email-boris.brezillon@free-electrons.com>

[ Sorry for the resend -- forgot to add Doug as CC. ]

On Wed, May 07, 2014 at 06:20:49PM +0200, Boris BREZILLON wrote:
> The RTC IMR register is not reliable on sam9x5 SoCs, hence why me have to
> mask all interrupts no matter what IMR claims about already masked irqs.

Crap, I totally forgot about this. Doug reported the problem off-list
back in December, but it got lost somehow. Sorry.

> Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
> Reported-by: Bryan Evenson <bevenson@melinkcorp.com>
> ---
> Hello Bryan,
> 
> Yet another patch for you ;-).
> 
> As usual, could you tell me if it fixes your bug.
> 
> BTW, thanks for your tests.
> 
> Best Regards,
> 
> Boris
> 
>  arch/arm/mach-at91/sysirq_mask.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/sysirq_mask.c b/arch/arm/mach-at91/sysirq_mask.c
> index 2ba694f..eb3d2a5 100644
> --- a/arch/arm/mach-at91/sysirq_mask.c
> +++ b/arch/arm/mach-at91/sysirq_mask.c
> @@ -37,12 +37,7 @@ void __init at91_sysirq_mask_rtc(u32 rtc_base)
>  	if (!base)
>  		return;
>  
> -	mask = readl_relaxed(base + AT91_RTC_IMR);
> -	if (mask) {
> -		pr_info("AT91: Disabling rtc irq\n");
> -		writel_relaxed(mask, base + AT91_RTC_IDR);
> -		(void)readl_relaxed(base + AT91_RTC_IMR);	/* flush */
> -	}
> +	writel_relaxed(0x1f, base + AT91_RTC_IDR);

I believe this is the right way to handle this hardware bug (IMR is
always read as 0 on one particular SoC), but please document this in a
comment.

You should also keep the flush (read of IMR) regardless (to make sure
the write has reached the peripheral), and remember to remove the now
unused mask variable.

>  	iounmap(base);
>  }

Thanks,
Johan

WARNING: multiple messages have this Message-ID (diff)
From: Johan Hovold <jhovold@gmail.com>
To: Boris BREZILLON <boris.brezillon@free-electrons.com>
Cc: Bryan Evenson <bevenson@melinkcorp.com>,
	Andrew Victor <linux@maxim.org.za>,
	Nicolas Ferre <nicolas.ferre@atmel.com>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	Douglas Gilbert <dgilbert@interlog.com>,
	Johan Hovold <jhovold@gmail.com>
Subject: Re: [PATCH] ARM: at91: fix rtc irq mask for sam9x5 SoCs
Date: Thu, 8 May 2014 17:54:55 +0200	[thread overview]
Message-ID: <20140508155455.GB6776@localhost> (raw)
In-Reply-To: <1399479649-3247-1-git-send-email-boris.brezillon@free-electrons.com>

[ Sorry for the resend -- forgot to add Doug as CC. ]

On Wed, May 07, 2014 at 06:20:49PM +0200, Boris BREZILLON wrote:
> The RTC IMR register is not reliable on sam9x5 SoCs, hence why me have to
> mask all interrupts no matter what IMR claims about already masked irqs.

Crap, I totally forgot about this. Doug reported the problem off-list
back in December, but it got lost somehow. Sorry.

> Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
> Reported-by: Bryan Evenson <bevenson@melinkcorp.com>
> ---
> Hello Bryan,
> 
> Yet another patch for you ;-).
> 
> As usual, could you tell me if it fixes your bug.
> 
> BTW, thanks for your tests.
> 
> Best Regards,
> 
> Boris
> 
>  arch/arm/mach-at91/sysirq_mask.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-at91/sysirq_mask.c b/arch/arm/mach-at91/sysirq_mask.c
> index 2ba694f..eb3d2a5 100644
> --- a/arch/arm/mach-at91/sysirq_mask.c
> +++ b/arch/arm/mach-at91/sysirq_mask.c
> @@ -37,12 +37,7 @@ void __init at91_sysirq_mask_rtc(u32 rtc_base)
>  	if (!base)
>  		return;
>  
> -	mask = readl_relaxed(base + AT91_RTC_IMR);
> -	if (mask) {
> -		pr_info("AT91: Disabling rtc irq\n");
> -		writel_relaxed(mask, base + AT91_RTC_IDR);
> -		(void)readl_relaxed(base + AT91_RTC_IMR);	/* flush */
> -	}
> +	writel_relaxed(0x1f, base + AT91_RTC_IDR);

I believe this is the right way to handle this hardware bug (IMR is
always read as 0 on one particular SoC), but please document this in a
comment.

You should also keep the flush (read of IMR) regardless (to make sure
the write has reached the peripheral), and remember to remove the now
unused mask variable.

>  	iounmap(base);
>  }

Thanks,
Johan

  parent reply	other threads:[~2014-05-08 15:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07 10:28 [PATCH v2] rtc: rtc-at91rm9200: fix uninterruptible wait for ACKUPD Boris BREZILLON
2014-05-07 10:28 ` Boris BREZILLON
2014-05-07 14:51 ` Bryan Evenson
2014-05-07 14:51   ` Bryan Evenson
2014-05-07 16:20   ` [PATCH] ARM: at91: fix rtc irq mask for sam9x5 SoCs Boris BREZILLON
2014-05-07 16:20     ` Boris BREZILLON
2014-05-07 18:44     ` Bryan Evenson
2014-05-07 18:44       ` Bryan Evenson
2014-05-08  3:10       ` Mark Roszko
2014-05-08  3:10         ` Mark Roszko
2014-05-08 17:19         ` Boris BREZILLON
2014-05-08 17:19           ` Boris BREZILLON
2014-05-08 15:49     ` Johan Hovold
2014-05-08 15:49       ` Johan Hovold
2014-05-08 17:28       ` Boris BREZILLON
2014-05-08 17:28         ` Boris BREZILLON
2014-05-09 16:36         ` Johan Hovold
2014-05-09 16:36           ` Johan Hovold
2014-05-29 23:09           ` Andrew Morton
2014-05-29 23:09             ` Andrew Morton
2014-05-30 12:09             ` Johan Hovold
2014-05-30 12:09               ` Johan Hovold
2014-05-08 15:54     ` Johan Hovold [this message]
2014-05-08 15:54       ` Johan Hovold

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140508155455.GB6776@localhost \
    --to=jhovold@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.