RT73025. ea-lpc1788: fix hang-up in `udelay()` for all Cortex-M3 targets
Hang-up scenario before this patch: At the time `udelay()` is called, the current value in the SYSTICK timer (`systick->val`) may be very close to, but greater than the number of clocks left to tick (`clc`). Since `systick->val` is greater than `clc`, we use the `while` loop from the `else` block. But this `while` loops only checks that `systick->val` is greater than `(tmp - clc)` which is a very small positive integer (because `tmp` is very close to `clc`.) The `while` loop will now terminate only if we manage to catch `systick->val` in a very thin range between 0 and `(tmp - clc)`. The comparison inside the `while` loop condition takes a considerable number of CPU clocks, that makes it hard to find `systick->val` between 0 and `(tmp - clc)`, we just step over this small range. This bug manifested when erasing NOR flash on EA-LPC1788-32: the `udelay(1)` call in `flash_status_check()` in `drivers/mtd/cfi_flash.c` was hanging.
Showing with 9 additions and 3 deletions