kernel_samsung_a53x/drivers/clocksource
Ronald Wahl 9159713113 clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware
[ Upstream commit 6d3bc4c02d59996d1d3180d8ed409a9d7d5900e0 ]

On SAM9 hardware two cascaded 16 bit timers are used to form a 32 bit
high resolution timer that is used as scheduler clock when the kernel
has been configured that way (CONFIG_ATMEL_CLOCKSOURCE_TCB).

The driver initially triggers a reset-to-zero of the two timers but this
reset is only performed on the next rising clock. For the first timer
this is ok - it will be in the next 60ns (16MHz clock). For the chained
second timer this will only happen after the first timer overflows, i.e.
after 2^16 clocks (~4ms with a 16MHz clock). So with other words the
scheduler clock resets to 0 after the first 2^16 clock cycles.

It looks like that the scheduler does not like this and behaves wrongly
over its lifetime, e.g. some tasks are scheduled with a long delay. Why
that is and if there are additional requirements for this behaviour has
not been further analysed.

There is a simple fix for resetting the second timer as well when the
first timer is reset and this is to set the ATMEL_TC_ASWTRG_SET bit in
the Channel Mode register (CMR) of the first timer. This will also rise
the TIOA line (clock input of the second timer) when a software trigger
respective SYNC is issued.

Signed-off-by: Ronald Wahl <ronald.wahl@raritan.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20231007161803.31342-1-rwahl@gmx.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-18 11:43:12 +01:00
..
acpi_pm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arc_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arm_arch_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
arm_global_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
armv7m_systick.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
asm9260_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm2835_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
bcm_kona_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clksrc-dbx500-prcmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clksrc_st_lpc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
clps711x-timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dummy_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dw_apb_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
dw_apb_timer_of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
em_sti.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exynos_mct.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exynos_mct_v2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
exynos_mct_v2.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
h8300_timer8.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
h8300_timer16.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
h8300_tpu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
hyperv_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
i8253.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ingenic-ost.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ingenic-sysost.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ingenic-timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
jcore-pit.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mips-gic-timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mmio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mps2-timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mxs_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nomadik-mtu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
numachip.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
renesas-ostm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
samsung_pwm_timer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
scx200_hrt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sh_cmt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sh_mtu2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sh_tmu.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-armada-370-xp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-atcpit100.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-atlas7.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-atmel-pit.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-atmel-st.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-atmel-tcb.c clocksource/drivers/timer-atmel-tcb: Fix initialization on SAM9 hardware 2024-11-18 11:43:12 +01:00
timer-cadence-ttc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-clint.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-cs5535.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-davinci.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-digicolor.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-efm32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-fsl-ftm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-fttmr010.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-gx6605s.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-imx-gpt.c clocksource/drivers/timer-imx-gpt: Fix potential memory leak 2024-11-18 11:43:12 +01:00
timer-imx-sysctr.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-imx-tpm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-integrator-ap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-ixp4xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-keystone.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-lpc32xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-mediatek.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-meson6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-microchip-pit64b.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-milbeaut.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-mp-csky.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-npcm7xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-nps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-of.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-orion.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-owl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-oxnas-rps.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-pistachio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-prima2.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-probe.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-pxa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-qcom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-rda.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-riscv.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-rockchip.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-sp.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-sp804.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-sprd.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-stm32-lp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-stm32.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-sun4i.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-sun5i.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-tango-xtal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-tegra.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-ti-32k.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-ti-dm-systimer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-ti-dm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-u300.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-versatile.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-vf-pit.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-vt8500.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
timer-zevio.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00