A set of clocksource/clockevents updates:
- Reset the TI/DM timer before enabling it instead of doing it the other way round. - Initialize the reload value for the GX6605s timer correctly so the hardware counter starts at 0 again after overrun. - Make error return value negative in the h8300 timer init function -----BEGIN PGP SIGNATURE----- iQJHBAABCgAxFiEEQp8+kY+LLUocC4bMphj1TA10mKEFAl9wqQ0THHRnbHhAbGlu dXRyb25peC5kZQAKCRCmGPVMDXSYoZx0EACJUIlCC54kw4CnZdxhoWu0f6tXEuip +Iyb8OJw56FdyHigvkPBMoF1o4a0Ax32TbYYOKntpDy67vnqkO6DV1M/Mwt8IhfO ey7h1t7e4y2vrXAfYN0oX1ZQAk9hkPGW5+wugEf6dbZZva7mm+jV0PfNP/yn7KWS n9lUrLNlPJdndSIYwj9Cto5mMQBsM7/qM8MkBR84i8GxFP2rofh4C5bD8WTnXzHd B8898riwkaaQmfq/Ch9Y79oMzpZXysAEYpZ3YExkQsEmi5YqZ8k6R8RD18mKQdFH 7Kqh/025j7oKk9fopOvPjZ9sIX22gGP8C+tdy3sipYDCY0wRVNu+SPXppwl0T9ML JLX/D2pC20f/VUQ21yc8KgVt76g8QID4t+NV5/VdIHuxhei/4WN3hJxuI4w4Ivfn YK8mB5TK+R4K8Ln+GFE0zh/wfpjJe84K7r4NmDJnClD8chTVhVZHOlv5qJBZzob8 Yd4fMFS0WufAj15ZMN55iLFEI30iubY5X1xaDD1sFrFJyO1VCj8ITH7mBtW9zW1a a/8LQlB5yIjLNTGVZGTCcYfyQ7+MA1EmkutD7AnFN87Zwx6FtDYGEPZq/KI3dwrw 2qA7HTVBYoWQvSOQWt8inuXsbnqUQ2Hq2y8cIuieg333OGc1WQS6BZOeLdJWNGas W0JztaeFr1S3ew== =Htin -----END PGP SIGNATURE----- Merge tag 'timers-urgent-2020-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull timer updates from Thomas Gleixner: "A set of clocksource/clockevents updates: - Reset the TI/DM timer before enabling it instead of doing it the other way round. - Initialize the reload value for the GX6605s timer correctly so the hardware counter starts at 0 again after overrun. - Make error return value negative in the h8300 timer init function" * tag 'timers-urgent-2020-09-27' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/timer-gx6605s: Fixup counter reload clocksource/drivers/timer-ti-dm: Do reset before enable clocksource/drivers/h8300_timer8: Fix wrong return value in h8300_8timer_init()
This commit is contained in:
commit
ba25f0570b
|
@ -169,7 +169,7 @@ static int __init h8300_8timer_init(struct device_node *node)
|
||||||
return PTR_ERR(clk);
|
return PTR_ERR(clk);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ENXIO;
|
ret = -ENXIO;
|
||||||
base = of_iomap(node, 0);
|
base = of_iomap(node, 0);
|
||||||
if (!base) {
|
if (!base) {
|
||||||
pr_err("failed to map registers for clockevent\n");
|
pr_err("failed to map registers for clockevent\n");
|
||||||
|
|
|
@ -28,6 +28,7 @@ static irqreturn_t gx6605s_timer_interrupt(int irq, void *dev)
|
||||||
void __iomem *base = timer_of_base(to_timer_of(ce));
|
void __iomem *base = timer_of_base(to_timer_of(ce));
|
||||||
|
|
||||||
writel_relaxed(GX6605S_STATUS_CLR, base + TIMER_STATUS);
|
writel_relaxed(GX6605S_STATUS_CLR, base + TIMER_STATUS);
|
||||||
|
writel_relaxed(0, base + TIMER_INI);
|
||||||
|
|
||||||
ce->event_handler(ce);
|
ce->event_handler(ce);
|
||||||
|
|
||||||
|
|
|
@ -69,12 +69,33 @@ static bool dmtimer_systimer_revision1(struct dmtimer_systimer *t)
|
||||||
return !(tidr >> 16);
|
return !(tidr >> 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void dmtimer_systimer_enable(struct dmtimer_systimer *t)
|
||||||
|
{
|
||||||
|
u32 val;
|
||||||
|
|
||||||
|
if (dmtimer_systimer_revision1(t))
|
||||||
|
val = DMTIMER_TYPE1_ENABLE;
|
||||||
|
else
|
||||||
|
val = DMTIMER_TYPE2_ENABLE;
|
||||||
|
|
||||||
|
writel_relaxed(val, t->base + t->sysc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void dmtimer_systimer_disable(struct dmtimer_systimer *t)
|
||||||
|
{
|
||||||
|
if (!dmtimer_systimer_revision1(t))
|
||||||
|
return;
|
||||||
|
|
||||||
|
writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc);
|
||||||
|
}
|
||||||
|
|
||||||
static int __init dmtimer_systimer_type1_reset(struct dmtimer_systimer *t)
|
static int __init dmtimer_systimer_type1_reset(struct dmtimer_systimer *t)
|
||||||
{
|
{
|
||||||
void __iomem *syss = t->base + OMAP_TIMER_V1_SYS_STAT_OFFSET;
|
void __iomem *syss = t->base + OMAP_TIMER_V1_SYS_STAT_OFFSET;
|
||||||
int ret;
|
int ret;
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
|
dmtimer_systimer_enable(t);
|
||||||
writel_relaxed(BIT(1) | BIT(2), t->base + t->ifctrl);
|
writel_relaxed(BIT(1) | BIT(2), t->base + t->ifctrl);
|
||||||
ret = readl_poll_timeout_atomic(syss, l, l & BIT(0), 100,
|
ret = readl_poll_timeout_atomic(syss, l, l & BIT(0), 100,
|
||||||
DMTIMER_RESET_WAIT);
|
DMTIMER_RESET_WAIT);
|
||||||
|
@ -88,6 +109,7 @@ static int __init dmtimer_systimer_type2_reset(struct dmtimer_systimer *t)
|
||||||
void __iomem *sysc = t->base + t->sysc;
|
void __iomem *sysc = t->base + t->sysc;
|
||||||
u32 l;
|
u32 l;
|
||||||
|
|
||||||
|
dmtimer_systimer_enable(t);
|
||||||
l = readl_relaxed(sysc);
|
l = readl_relaxed(sysc);
|
||||||
l |= BIT(0);
|
l |= BIT(0);
|
||||||
writel_relaxed(l, sysc);
|
writel_relaxed(l, sysc);
|
||||||
|
@ -336,26 +358,6 @@ static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dmtimer_systimer_enable(struct dmtimer_systimer *t)
|
|
||||||
{
|
|
||||||
u32 val;
|
|
||||||
|
|
||||||
if (dmtimer_systimer_revision1(t))
|
|
||||||
val = DMTIMER_TYPE1_ENABLE;
|
|
||||||
else
|
|
||||||
val = DMTIMER_TYPE2_ENABLE;
|
|
||||||
|
|
||||||
writel_relaxed(val, t->base + t->sysc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dmtimer_systimer_disable(struct dmtimer_systimer *t)
|
|
||||||
{
|
|
||||||
if (!dmtimer_systimer_revision1(t))
|
|
||||||
return;
|
|
||||||
|
|
||||||
writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int __init dmtimer_systimer_setup(struct device_node *np,
|
static int __init dmtimer_systimer_setup(struct device_node *np,
|
||||||
struct dmtimer_systimer *t)
|
struct dmtimer_systimer *t)
|
||||||
{
|
{
|
||||||
|
@ -409,8 +411,8 @@ static int __init dmtimer_systimer_setup(struct device_node *np,
|
||||||
t->wakeup = regbase + _OMAP_TIMER_WAKEUP_EN_OFFSET;
|
t->wakeup = regbase + _OMAP_TIMER_WAKEUP_EN_OFFSET;
|
||||||
t->ifctrl = regbase + _OMAP_TIMER_IF_CTRL_OFFSET;
|
t->ifctrl = regbase + _OMAP_TIMER_IF_CTRL_OFFSET;
|
||||||
|
|
||||||
dmtimer_systimer_enable(t);
|
|
||||||
dmtimer_systimer_reset(t);
|
dmtimer_systimer_reset(t);
|
||||||
|
dmtimer_systimer_enable(t);
|
||||||
pr_debug("dmtimer rev %08x sysc %08x\n", readl_relaxed(t->base),
|
pr_debug("dmtimer rev %08x sysc %08x\n", readl_relaxed(t->base),
|
||||||
readl_relaxed(t->base + t->sysc));
|
readl_relaxed(t->base + t->sysc));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue