From e5d7addcf76109990992d242a1cae45f3aa5a837 Mon Sep 17 00:00:00 2001 From: Chen Zheng Wei Date: Mon, 28 Oct 2019 14:21:59 +0800 Subject: [PATCH] bugfix(i2s_bootloader_random_disable): fix bug about i2s bootloader_random_disable for release/v3.2 bootloader_random_disable disables the ADC incorrectly, causing the ADC to sometimes fail to work. Fix this bug --- components/bootloader_support/src/bootloader_random.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/bootloader_support/src/bootloader_random.c b/components/bootloader_support/src/bootloader_random.c index eb34d6add2..1b9c504ca2 100644 --- a/components/bootloader_support/src/bootloader_random.c +++ b/components/bootloader_support/src/bootloader_random.c @@ -114,17 +114,18 @@ void bootloader_random_enable(void) void bootloader_random_disable(void) { - /* Disable i2s clock */ - DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN); - - /* Reset some i2s configuration (possibly redundant as we reset entire I2S peripheral further down). */ + CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); + SET_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET); + CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_RESET); CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_CAMERA_EN); CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_LCD_EN); CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE_TEST_EN); CLEAR_PERI_REG_MASK(I2S_CONF2_REG(0), I2S_DATA_ENABLE); - CLEAR_PERI_REG_MASK(I2S_CONF_REG(0), I2S_RX_START); + + /* Disable i2s clock */ + DPORT_CLEAR_PERI_REG_MASK(DPORT_PERIP_CLK_EN_REG, DPORT_I2S0_CLK_EN); /* Restore SYSCON mode registers */ CLEAR_PERI_REG_MASK(SENS_SAR_READ_CTRL_REG, SENS_SAR1_DIG_FORCE);