diff options
-rw-r--r-- | chip/mec1322/hwtimer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chip/mec1322/hwtimer.c b/chip/mec1322/hwtimer.c index be9ffac1ea..221633d3f4 100644 --- a/chip/mec1322/hwtimer.c +++ b/chip/mec1322/hwtimer.c @@ -107,3 +107,14 @@ int __hw_clock_source_init(uint32_t start_t) return MEC1322_IRQ_TIMER32_1; } + +/* + * Unrolled udelay. It preserves LR, which points to the root cause of WD crash. + */ +__override void udelay(unsigned us) +{ + unsigned t0 = 0xffffffff - MEC1322_TMR32_CNT(0); + + while (0xffffffff - MEC1322_TMR32_CNT(0) - t0 <= us) + ; +} |