From: Keith Packard Date: Wed, 24 Jan 2024 23:36:34 +0000 (-0800) Subject: src/stm32f1: Disable extra JTAG pins in ao_clock_init X-Git-Tag: 1.9.18~2^2~46 X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=commitdiff_plain;h=9a5cd9e64a66829fb0cd3713c5cbd41085641db3 src/stm32f1: Disable extra JTAG pins in ao_clock_init Need to enable AFIO before trying to adjust bits there. Signed-off-by: Keith Packard --- diff --git a/src/stm32f1/ao_clock.c b/src/stm32f1/ao_clock.c index 52830117..899923dc 100644 --- a/src/stm32f1/ao_clock.c +++ b/src/stm32f1/ao_clock.c @@ -181,6 +181,8 @@ ao_clock_init(void) /* Clear reset flags */ stm_rcc.csr |= (1 << STM_RCC_CSR_RMVF); + /* Enable AFIO */ + stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_AFIOEN); /* Release PB3, PA15 and PB4 from JTAG use */ stm_afio.mapr = (stm_afio.mapr & diff --git a/src/stm32f1/stm32f1.h b/src/stm32f1/stm32f1.h index 532cd052..bf96fbbc 100644 --- a/src/stm32f1/stm32f1.h +++ b/src/stm32f1/stm32f1.h @@ -1187,9 +1187,6 @@ stm_exticr_set(struct stm_gpio *gpio, int pin) { uint8_t shift = (pin & 3) << 2; uint8_t val = 0; - /* Enable AFIO */ - stm_rcc.apb2enr |= (1 << STM_RCC_APB2ENR_AFIOEN); - if (gpio == &stm_gpioa) val = STM_AFIO_EXTICR_PA; else if (gpio == &stm_gpiob)