summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorMeng Yi <meng.yi@nxp.com>2017-04-20 07:10:12 (GMT)
committerXie Xiaobo <xiaobo.xie@nxp.com>2017-07-14 10:29:50 (GMT)
commit7323e43b12cf145418c1b27b190ec3edfa7984b6 (patch)
tree2639746adb6b2cc345ae377cae858d0781149e77 /drivers/soc
parentbc153d0e78186cfc06d16d228777625277882ea0 (diff)
downloadlinux-7323e43b12cf145418c1b27b190ec3edfa7984b6.tar.xz
Fix errata A-007728 for flextimer
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 In one word: software clearing TOF bit not works when FTMx_CONF[NUMTOF] was seted as nonzero and FTM counter reaches the FTM_MOD value. The workaround is clearing TOF bit until it works(FTM counter doesn't always reache the FTM_MOD anyway),which may cost some cycles. Signed-off-by: Meng Yi <meng.yi@nxp.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/fsl/layerscape/ftm_alarm.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/soc/fsl/layerscape/ftm_alarm.c b/drivers/soc/fsl/layerscape/ftm_alarm.c
index f5d6de6..6f9882f 100644
--- a/drivers/soc/fsl/layerscape/ftm_alarm.c
+++ b/drivers/soc/fsl/layerscape/ftm_alarm.c
@@ -79,11 +79,11 @@ static inline void ftm_counter_disable(void __iomem *base)
static inline void ftm_irq_acknowledge(void __iomem *base)
{
- u32 val;
+ unsigned int timeout = 100;
- val = ftm_readl(base + FTM_SC);
- val &= ~FTM_SC_TOF;
- ftm_writel(val, base + FTM_SC);
+ while ((FTM_SC_TOF & ftm_readl(base + FTM_SC)) && timeout--)
+ ftm_writel(ftm_readl(base + FTM_SC) & (~FTM_SC_TOF),
+ base + FTM_SC);
}
static inline void ftm_irq_enable(void __iomem *base)