Lines Matching +full:cortex +full:- +full:m4
1 // SPDX-License-Identifier: GPL-2.0+
3 * ARM Cortex M3/M4/M7 SysTick timer driver
6 * Based on arch/arm/mach-stm32/stm32f1/timer.c
13 * The SysTick timer is a 24-bit count down timer. The clock can be either the
29 /* SysTick Base Address - fixed for all Cortex M3, M4 and M7 devices */
47 /* read the 24-bit timer */
53 return TIMER_MAX_VAL - readl(&systick->current_val); in read_timer()
61 writel(TIMER_MAX_VAL, &systick->reload_val); in timer_init()
63 writel(0, &systick->current_val); in timer_init()
65 cal = readl(&systick->calibration); in timer_init()
68 writel(SYSTICK_CTRL_EN | SYSTICK_CTRL_CPU_CLK, &systick->ctrl); in timer_init()
71 writel(SYSTICK_CTRL_EN, &systick->ctrl); in timer_init()
78 gd->arch.timer_rate_hz = CONFIG_SYS_HZ_CLOCK; in timer_init()
80 gd->arch.timer_rate_hz = (cal & SYSTICK_CAL_TENMS_MASK) * 100; in timer_init()
83 gd->arch.tbl = 0; in timer_init()
84 gd->arch.tbu = 0; in timer_init()
85 gd->arch.lastinc = read_timer(); in timer_init()
90 /* return milli-seconds timer value */
95 return (ulong)((t / gd->arch.timer_rate_hz)) - base; in get_timer()
102 if (now >= gd->arch.lastinc) in get_ticks()
103 gd->arch.tbl += (now - gd->arch.lastinc); in get_ticks()
105 gd->arch.tbl += (TIMER_MAX_VAL - gd->arch.lastinc) + now; in get_ticks()
107 gd->arch.lastinc = now; in get_ticks()
109 return gd->arch.tbl; in get_ticks()
114 return gd->arch.timer_rate_hz; in get_tbclk()