summaryrefslogtreecommitdiff
path: root/chip
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-04-09 09:03:15 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-10 23:29:21 +0000
commit8d47a1de0a97243aa4e770ad0e332a71890c1e85 (patch)
tree2f526c7f562e5843286f994dc15f9fa9b5418cd3 /chip
parentc7ad72693ed561f5b86927a9c2d1d36343957a79 (diff)
downloadchrome-ec-8d47a1de0a97243aa4e770ad0e332a71890c1e85.tar.gz
stm32f0: fix adc_read_all_channels()
We need to clear DMA status before starting another transaction. Otherwise, we get incorrect values. Same fix as the one Vic did in CL 240282 for STM32F1xx and STM32F3xx. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:38902 TEST=On the twinkie USB console (without anything connected), do "tw res rd rd" then "adc". We now always get "CC1_PD = 0 CC2_PD = 0" rather than some fancy values for CC2_PD such as "CC2_PD = 29097". Change-Id: I065b2f8f74ba39f805445bab96b45819322a7da3 Reviewed-on: https://chromium-review.googlesource.com/264981 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r--chip/stm32/adc-stm32f0.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/chip/stm32/adc-stm32f0.c b/chip/stm32/adc-stm32f0.c
index ba1b29f4d5..6fdabc0789 100644
--- a/chip/stm32/adc-stm32f0.c
+++ b/chip/stm32/adc-stm32f0.c
@@ -250,6 +250,7 @@ int adc_read_all_channels(int *data)
/* Enable DMA */
STM32_ADC_CFGR1 |= 0x1;
+ dma_clear_isr(STM32_DMAC_ADC);
dma_start_rx(&dma_adc_option, ADC_CH_COUNT, raw_data);
/* Clear flags */