stm32: fix missed event on MSB hardware timer
stm32: fix missed event on MSB hardware timer

When we set the TIM3 hardware timer match interrupt (used for 16-bit MSB
of the 32-bit microsecond counter), as the STM32 hardware block is not
triggering an interrupt on an exact match (only on the transition from
N-1 to match value N), we need to check whether the counter has been
incremented to the match value before we set the interrupt enable bit.
In that case, we simply fallback to the existing code to set the LSB
match interrupt.

Signed-off-by: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>

BUG=chrome-os-partner:12715
TEST=use Snow board and see we are no longer getting EC watchdog in the
idle task.
BRANCH=snow

Change-Id: I4ceeb46425c799e328603ae0e99b678547d88fbe
Reviewed-on: https://gerrit.chromium.org/gerrit/31228
Reviewed-by: Simon Glass <c00b0378376498bd9cd974c388df8854c0131d27@chromium.org>
Reviewed-by: David Hendricks <3b0deacc4b5357f519084f1ea34bd42bf5d34545@chromium.org>
Commit-Ready: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>
Tested-by: Vincent Palatin <70a9964ec8fd10b0b08fcc8623c2add25ddf99ac@chromium.org>

akappy7/ChromeOS_EC_LED_Diagnostics,coreboot/chrome-ec,coreboot/chrome-ec,akappy7/ChromeOS_EC_LED_Diagnostics,alterapraxisptyltd/chromium-ec,fourier49/BIZ_EC,gelraen/cros-ec,mtk09422/chromiumos-platform-ec,coreboot/chrome-ec,fourier49/BIZ_EC,alterapraxisptyltd/chromium-ec,fourier49/BZ_DEV_EC,mtk09422/chromiumos-platform-ec,md5555/ec,md5555/ec,md5555/ec,eatbyte/chromium-ec,longsleep/ec,akappy7/ChromeOS_EC_LED_Diagnostics,fourier49/BIZ_EC,gelraen/cros-ec,eatbyte/chromium-ec,thehobn/ec,akappy7/ChromeOS_EC_LED_Diagnostics,mtk09422/chromiumos-platform-ec,longsleep/ec,eatbyte/chromium-ec,gelraen/cros-ec,thehobn/ec,alterapraxisptyltd/chromium-ec,longsleep/ec,mtk09422/chromiumos-platform-ec,alterapraxisptyltd/chromium-ec,eatbyte/chromium-ec,coreboot/chrome-ec,md5555/ec,longsleep/ec,fourier49/BIZ_EC,akappy7/ChromeOS_EC_LED_Diagnostics,thehobn/ec,fourier49/BZ_DEV_EC,coreboot/chrome-ec,coreboot/chrome-ec,thehobn/ec,fourier49/BZ_DEV_EC,fourier49/BZ_DEV_EC,gelraen/cros-ec