Commit 5362e3d2 authored by Alexander Potashev's avatar Alexander Potashev
Browse files

RT73025. ea-lpc1788: fix `udelay()` (systick timer should use CPU clock)

Use internal clock (CPU clock) for the Cortex-M3 systick timer, because
the external clock pin (STCLK) cannot be used on this board (it is already
used for SDRAM.)
parent 990e8953
......@@ -29,8 +29,15 @@ int timer_init()
systick->load = CM3_SYSTICK_LOAD_RELOAD_MSK - 1;
systick->val = 0;
#ifdef CONFIG_ARMCORTEXM3_SYSTICK_CPU
/* Use CPU clock, no ints */
systick->ctrl = CM3_SYSTICK_CTRL_EN | CM3_SYSTICK_CTRL_SYSTICK_CPU;
#else
/* Use external clock, no ints */
systick->ctrl = CM3_SYSTICK_CTRL_EN;
#endif
timestamp = 0;
return 0;
......
......@@ -58,7 +58,10 @@ struct cm3_systick {
};
#define CM3_SYSTICK_LOAD_RELOAD_MSK (0x00FFFFFF)
#define CM3_SYSTICK_CTRL_EN 1
/* System Tick counter enable */
#define CM3_SYSTICK_CTRL_EN (1 << 0)
/* System Tick clock source selection: 1=CPU, 0=STCLK (external clock pin) */
#define CM3_SYSTICK_CTRL_SYSTICK_CPU (1 << 2)
u8 cortex_m3_irq_vec_get(void);
......
......@@ -123,6 +123,13 @@
*/
#define CONFIG_SYS_HZ 1000
/*
* Use internal clock (CPU clock) for the Cortex-M3 systick timer, because
* the external clock pin (STCLK) cannot be used on this board (it is already
* used for SDRAM.)
*/
#define CONFIG_ARMCORTEXM3_SYSTICK_CPU
/*
* Enable/disable h/w watchdog
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment