diff options
author | Vic Yang <victoryang@google.com> | 2015-02-04 11:28:53 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-02-10 10:47:07 +0000 |
commit | 049463f8ad985f9cb996caa7dbc5438383bd3084 (patch) | |
tree | 93ff78695657a998919c6d6e28101cd158489368 /chip/stm32/clock-stm32l.c | |
parent | a9ae00b10129feca28713a7b88978ff6cfe7c2a6 (diff) | |
download | chrome-ec-049463f8ad985f9cb996caa7dbc5438383bd3084.tar.gz |
stm32: Add delay after enabling peripheral clock
We need a dummy read after enabling AHB peripheral clock before we can
access the peripheral. For APB, we also need a dummy read for STM32F3.
BRANCH=All affected
BUG=chrome-os-partner:33007
TEST=make buildall
Change-Id: I47f4a024dca294f555428c3f2053c1d32835ebe0
Signed-off-by: Vic Yang <victoryang@google.com>
Reviewed-on: https://chromium-review.googlesource.com/246181
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vic Yang <victoryang@chromium.org>
Diffstat (limited to 'chip/stm32/clock-stm32l.c')
-rw-r--r-- | chip/stm32/clock-stm32l.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chip/stm32/clock-stm32l.c b/chip/stm32/clock-stm32l.c index e0c7ebc747..c8b8bc0683 100644 --- a/chip/stm32/clock-stm32l.c +++ b/chip/stm32/clock-stm32l.c @@ -50,6 +50,19 @@ int clock_get_freq(void) return freq; } +void clock_wait_bus_cycles(enum bus_type bus, uint32_t cycles) +{ + volatile uint32_t dummy __attribute__((unused)); + + if (bus == BUS_AHB) { + while (cycles--) + dummy = STM32_DMA1_REGS->isr; + } else { /* APB */ + while (cycles--) + dummy = STM32_USART_BRR(STM32_USART1_BASE); + } +} + /** * Set which oscillator is used for the clock * |