aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/stm32h7.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2022-08-16 21:12:42 -0400
committerKevin O'Connor <kevin@koconnor.net>2022-08-16 21:21:45 -0400
commit6aec6efcc963c523d665adabc99e15a736c2dda1 (patch)
tree520feb68834243ef6d69b149caafcfcb57e6b817 /src/stm32/stm32h7.c
parenta709ba43af8edaaa307775ed73cb49fac2b5e550 (diff)
downloadkutter-6aec6efcc963c523d665adabc99e15a736c2dda1.tar.gz
kutter-6aec6efcc963c523d665adabc99e15a736c2dda1.tar.xz
kutter-6aec6efcc963c523d665adabc99e15a736c2dda1.zip
stm32: Use new CONFIG_USB to determine if USB needs to be configured
Introduce a CONFIG_USB build symbol that is set whenever CONFIG_USBSERIAL or CONFIG_USBCANBUS is set. Use that symbol during setup so that the USB controller is properly initialized for both usb serial and usb canbus bridge configurations. This fixes the clock configuration for usb canbus bridge mode on stm32f446. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/stm32h7.c')
-rw-r--r--src/stm32/stm32h7.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stm32/stm32h7.c b/src/stm32/stm32h7.c
index 565353dc..122ce64b 100644
--- a/src/stm32/stm32h7.c
+++ b/src/stm32/stm32h7.c
@@ -171,7 +171,7 @@ clock_setup(void)
;
// Configure HSI48 clock for USB
- if (CONFIG_USBSERIAL) {
+ if (CONFIG_USB) {
SET_BIT(RCC->CR, RCC_CR_HSI48ON);
while((RCC->CR & RCC_CR_HSI48RDY) == 0);
SET_BIT(RCC->APB1HENR, RCC_APB1HENR_CRSEN);
@@ -205,7 +205,7 @@ usb_reboot_for_dfu_bootloader(void)
static void
check_usb_dfu_bootloader(void)
{
- if (!CONFIG_USBSERIAL || *(uint64_t*)USB_BOOT_FLAG_ADDR != USB_BOOT_FLAG)
+ if (!CONFIG_USB || *(uint64_t*)USB_BOOT_FLAG_ADDR != USB_BOOT_FLAG)
return;
*(uint64_t*)USB_BOOT_FLAG_ADDR = 0;
uint32_t *sysbase = (uint32_t*)0x1FF09800;