From: Alexander Stein <alexander.stein@systec-electronic.com>
To: linux-kernel@vger.kernel.org
Cc: Meng Yi <meng.yi@nxp.com>, daniel.lezcano@linaro.org, tglx@linutronix.de
Subject: Re: [PATCH] clocksource/fsl: Fix errata A-007728 for flextimer
Date: Thu, 08 Sep 2016 08:22:39 +0200 [thread overview]
Message-ID: <1977031.jHqNsaRUgG@ws-stein> (raw)
In-Reply-To: <1473300295-32574-1-git-send-email-meng.yi@nxp.com>
On Thursday 08 September 2016 10:04:55, Meng Yi wrote:
> If the FTM counter reaches the FTM_MOD value between the reading of the
> TOF bit and the writing of 0 to the TOF bit, the process of clearing the
> TOF bit does not work as expected when FTMx_CONF[NUMTOF] != 0 and the
> current TOF count is less than FTMx_CONF[NUMTOF]. If the above condition
> is met, the TOF bit remains set. If the TOF interrupt is enabled
> (FTMx_SC[TOIE] = 1), the TOF interrupt also remains asserted.
>
> Above is the errata discription
>
> The workaround is clearing TOF bit until it is cleaned(FTM counter doesn't
> always reache the FTM_MOD anyway),which may cost some cycles.
>
> Signed-off-by: Meng Yi <meng.yi@nxp.com>
> ---
> drivers/clocksource/fsl_ftm_timer.c | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clocksource/fsl_ftm_timer.c
> b/drivers/clocksource/fsl_ftm_timer.c index 738515b..ade26e5 100644
> --- a/drivers/clocksource/fsl_ftm_timer.c
> +++ b/drivers/clocksource/fsl_ftm_timer.c
> @@ -83,11 +83,10 @@ static inline void ftm_counter_disable(void __iomem
> *base)
>
> static inline void ftm_irq_acknowledge(void __iomem *base)
> {
> - u32 val;
> -
> - val = ftm_readl(base + FTM_SC);
> - val &= ~FTM_SC_TOF;
> - ftm_writel(val, base + FTM_SC);
> + /*read and clean the FTM_SC_TOF bit until its cleared*/
> + while (FTM_SC_TOF & ftm_readl(base + FTM_SC))
> + ftm_writel(ftm_readl(base + FTM_SC) & (~FTM_SC_TOF),
> + base + FTM_SC);
> }
So you are essentially polling hardware in interrupt context. Please add a
sensible timeout to abort this loop in case of defective hardware, and maybe
disable the interrupt in that case.
Best regards,
Alexander
next prev parent reply other threads:[~2016-09-08 6:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 2:04 Meng Yi
2016-09-08 6:22 ` Alexander Stein [this message]
2016-09-08 6:28 ` Meng Yi
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=1977031.jHqNsaRUgG@ws-stein \
--to=alexander.stein@systec-electronic.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=meng.yi@nxp.com \
--cc=tglx@linutronix.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®