diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2021-10-13 11:25:41 -0400 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2021-10-13 11:25:41 -0400 |
commit | 1e226a8893dea25c1c390243ec7176485715fe0c (patch) | |
tree | f9abeee24c4020b9faf288289146854104ad76a9 /src | |
parent | 50f51d8aa2412d861fbd0cc9f877514a7f11b8e2 (diff) | |
download | kutter-1e226a8893dea25c1c390243ec7176485715fe0c.tar.gz kutter-1e226a8893dea25c1c390243ec7176485715fe0c.tar.xz kutter-1e226a8893dea25c1c390243ec7176485715fe0c.zip |
stm32: Add a MACH_STM32F0x2 alias for F042 and F072 chips
The F042 and F072 chips are in the same series and the code should be
nearly identical for these chips. Implement the alias and enable USB
for the F072 chips.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/stm32/Kconfig | 12 | ||||
-rw-r--r-- | src/stm32/stm32f0.c | 6 |
2 files changed, 11 insertions, 7 deletions
diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 0dd1cf64..3fef9a16 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -55,12 +55,14 @@ choice config MACH_STM32F042 bool "STM32F042" select MACH_STM32F0 + select MACH_STM32F0x2 config MACH_STM32F070 bool "STM32F070" select MACH_STM32F0 config MACH_STM32F072 bool "STM32F072" select MACH_STM32F0 + select MACH_STM32F0x2 config MACH_STM32H750 bool "STM32H750" select MACH_STM32H7 @@ -74,19 +76,21 @@ config MACH_STM32F2 bool config MACH_STM32F4 bool -config MACH_STM32F4x5 # F405, F407, F429 series - bool config MACH_STM32H7 bool +config MACH_STM32F0x2 # F042, F072 series + bool +config MACH_STM32F4x5 # F405, F407, F429 series + bool config HAVE_STM32_USBFS bool - default y if MACH_STM32F103 || MACH_STM32F042 || MACH_STM32F070 + default y if MACH_STM32F103 || MACH_STM32F0x2 || MACH_STM32F070 config HAVE_STM32_USBOTG bool default y if MACH_STM32F2 || MACH_STM32F4 config HAVE_STM32_CANBUS bool - default y if MACH_STM32F1 || MACH_STM32F2 || MACH_STM32F4 || MACH_STM32F042 || MACH_STM32F072 + default y if MACH_STM32F1 || MACH_STM32F2 || MACH_STM32F4 || MACH_STM32F0x2 config MCU string diff --git a/src/stm32/stm32f0.c b/src/stm32/stm32f0.c index 701346c5..54338b14 100644 --- a/src/stm32/stm32f0.c +++ b/src/stm32/stm32f0.c @@ -162,7 +162,7 @@ pll_setup(void) static void hsi48_setup(void) { -#if CONFIG_MACH_STM32F042 +#if CONFIG_MACH_STM32F0x2 // Enable HSI48 RCC->CR2 |= RCC_CR2_HSI48ON; while (!(RCC->CR2 & RCC_CR2_HSI48RDY)) @@ -198,7 +198,7 @@ hsi14_setup(void) void armcm_main(void) { - if (CONFIG_USBSERIAL && CONFIG_MACH_STM32F042 + if (CONFIG_USBSERIAL && CONFIG_MACH_STM32F0x2 && *(uint64_t*)USB_BOOT_FLAG_ADDR == USB_BOOT_FLAG) { *(uint64_t*)USB_BOOT_FLAG_ADDR = 0; uint32_t *sysbase = (uint32_t*)0x1fffc400; @@ -215,7 +215,7 @@ armcm_main(void) FLASH->ACR = (1 << FLASH_ACR_LATENCY_Pos) | FLASH_ACR_PRFTBE; // Configure main clock - if (CONFIG_MACH_STM32F042 && CONFIG_STM32_CLOCK_REF_INTERNAL + if (CONFIG_MACH_STM32F0x2 && CONFIG_STM32_CLOCK_REF_INTERNAL && CONFIG_USBSERIAL) hsi48_setup(); else |