mxs: timrot: Add support to i.MX23
Subsystems (2)
PATCH v4 1/1 mxs: timrot: Add support to i.MX23
From: Fadil Berisha <[email protected]>
This patch add timer support to i.MX23 and complete bit fields and values on regs-timrot.h.
Testet on imx23-olinuxino board.
Signed-off-by Fadil Berisha <[email protected]>
Acked-by Marek Vasut <[email protected]>
Cc Marek Vasut <[email protected]>
Cc Otavio Salvador <[email protected]>
Cc Fabio Estevam <[email protected]>
Cc Stefano Babic <[email protected]>
---
v2 - Updated the struct mxs_timrot_regs so the mapping works for all registers v3 - Revert macro MX28_INCREMENTER_HZ, MX28_HW_DIGCTL_MICROSECONDS and fix whitespaces v4 - Fixed comment and style corrections
arch/arm/cpu/arm926ejs/mxs/timer.c | 23 +++++- arch/arm/include/asm/arch-mxs/regs-timrot.h | 101 +++++++++++++++++++++++++++ 2 files changed, 122 insertions(+), 2 deletions(-)
arch/arm/cpu/arm926ejs/mxs/timer.c +21 -2
@@ -32,7 +32,11 @@#include <asm/arch/sys_proto.h> /* Maximum fixed count */ -#define TIMER_LOAD_VAL 0xffffffff +#if defined(CONFIG_MX23 ) +#define TIMER_LOAD_VAL 0xffff +#elif defined(CONFIG_MX28 ) +#define TIMER_LOAD_VAL 0xffffffff +#endif DECLARE_GLOBAL_DATA_PTR ;
@@ -69,7 +73,11 @@ int timer_init(void)mxs_reset_block (&timrot_regs->hw_timrot_rotctrl_reg);/* Set fixed_count to 0 */ +#if defined(CONFIG_MX23 ) +writel (0 , &timrot_regs->hw_timrot_timcount0); +#elif defined(CONFIG_MX28 )writel (0 , &timrot_regs->hw_timrot_fixed_count0); +#endif /* Set UPDATE bit and 1Khz frequency */ writel(TIMROT_TIMCTRLn_UPDATE | TIMROT_TIMCTRLn_RELOAD |
@@ -77,7 +85,11 @@ int timer_init(void) &timrot_regs->hw_timrot_timctrl0);/* Set fixed_count to maximal value */ +#if defined(CONFIG_MX23 ) +writel (TIMER_LOAD_VAL -1 , &timrot_regs->hw_timrot_timcount0); +#elif defined(CONFIG_MX28 )writel (TIMER_LOAD_VAL , &timrot_regs->hw_timrot_fixed_count0); +#endif return 0 ; }
@@ -86,9 +98,16 @@ unsigned long long get_ticks(void) {struct mxs_timrot_regs *timrot_regs = (struct mxs_timrot_regs *)MXS_TIMROT_BASE ; +uint32_t now;/* Current tick value */ -uint32_t now =readl (&timrot_regs->hw_timrot_running_count0); +#if defined(CONFIG_MX23 ) +/* Upper bits are the valid ones. */ + now =readl (&timrot_regs->hw_timrot_timcount0) >> + TIMROT_RUNNING_COUNTn_RUNNING_COUNT_OFFSET; +#elif defined(CONFIG_MX28 ) + now =readl (&timrot_regs->hw_timrot_running_count0); +#endif if (lastdec >= now) {/*
arch/arm/include/asm/arch-mxs/regs-timrot.h +101 -0
184 lines not on this page · raw message
Signature · 1 line
1.7.10
PATCH v4 1/1 mxs: timrot: Add support to i.MX23
Quoted 8 lines · Fadil Berisha
From: Fadil Berisha <[email protected]>
This patch add timer support to i.MX23 and complete bit fields and values on
regs-timrot.h.
Testet on imx23-olinuxino board.Signed-off-by Fadil Berisha <[email protected]>Acked-by Marek Vasut <[email protected]>
Acked-by Otavio Salvador <[email protected]>
Signature · 3 lines
Otavio Salvador O.S. Systems E-mail: otavio at ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br