diff options
author | Charlie Mooney <charliemooney@chromium.org> | 2012-08-16 11:05:35 -0700 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-08-17 08:50:58 -0700 |
commit | 91a6726b56d119445808a86997137d2a62fed898 (patch) | |
tree | f609040b770ca4caef3205947872293ea9182401 | |
parent | 8fdf7d5564261cf1f24e375162c5984348ce0595 (diff) | |
download | chrome-ec-91a6726b56d119445808a86997137d2a62fed898.tar.gz |
Replacing usleep with interrupt friendly udelay
There was a usleep put into a function that can be called from in an
interrupt context, which doesn't work. This just switches it over to
udelay which will work in an interrupt.
Also flips the condition on the i2c if/else that might send it there.
It was backwards before
BUG=chrome-os-partner:12688
TEST=Run "battery" "pmu" boot the machine and use the keyboard. Then
replace the in_interrupt_context() function with "1" to force it to use
polling and repeat the test. Everything should work in both cases.
BOARD=snow
Change-Id: Ib2a8c7f9e5e2eb3f6b00678d6307afc9dd5f0518
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/30575
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | chip/stm32/dma.c | 2 | ||||
-rw-r--r-- | chip/stm32/i2c.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/chip/stm32/dma.c b/chip/stm32/dma.c index c37063a894..935ffed038 100644 --- a/chip/stm32/dma.c +++ b/chip/stm32/dma.c @@ -217,7 +217,7 @@ int dma_wait(int channel) if (deadline.val <= get_time().val) return -1; else - usleep(DMA_POLLING_INTERVAL_US); + udelay(DMA_POLLING_INTERVAL_US); } return 0; } diff --git a/chip/stm32/i2c.c b/chip/stm32/i2c.c index 8ac6823cea..5205abbda6 100644 --- a/chip/stm32/i2c.c +++ b/chip/stm32/i2c.c @@ -131,7 +131,7 @@ static int i2c_write_raw_slave(int port, void *buf, int len) /* Configuring i2c2 to use DMA */ STM32_I2C_CR2(port) |= (1 << 11); - if (!in_interrupt_context()) { + if (in_interrupt_context()) { /* Poll for the transmission complete flag */ dma_wait(DMAC_I2C_TX); dma_clear_isr(DMAC_I2C_TX); |