aboutsummaryrefslogtreecommitdiffstats
path: root/src/stm32/usbotg.c
diff options
context:
space:
mode:
authorbigtreetech <tech@biqu3d.com>2022-11-23 11:29:44 +0800
committerKevin O'Connor <kevin@koconnor.net>2022-12-02 13:55:23 -0500
commita42f615881a31c487067153aa7ce385146a5807c (patch)
tree2f1920cacbd21ff45d46a13e1f7d8f05ab60ede6 /src/stm32/usbotg.c
parent50b2e2e67e299d71749508d2aeb45abde4b761ca (diff)
downloadkutter-a42f615881a31c487067153aa7ce385146a5807c.tar.gz
kutter-a42f615881a31c487067153aa7ce385146a5807c.tar.xz
kutter-a42f615881a31c487067153aa7ce385146a5807c.zip
stm32: add STM32H723 support
Signed-off-by: Chen.BJ from BigTreeTech chenbj@biqu3d.com Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'src/stm32/usbotg.c')
-rw-r--r--src/stm32/usbotg.c38
1 files changed, 24 insertions, 14 deletions
diff --git a/src/stm32/usbotg.c b/src/stm32/usbotg.c
index d6551106..b61c99ca 100644
--- a/src/stm32/usbotg.c
+++ b/src/stm32/usbotg.c
@@ -15,21 +15,31 @@
#include "sched.h" // DECL_INIT
#if CONFIG_STM32_USB_PB14_PB15
-#define USB_PERIPH_BASE USB_OTG_HS_PERIPH_BASE
-#define OTG_IRQn OTG_HS_IRQn
-#define USBOTGEN RCC_AHB1ENR_USB1OTGHSEN
-#define GPIO_D_NEG GPIO('B', 14)
-#define GPIO_D_POS GPIO('B', 15)
-#define GPIO_FUNC GPIO_FUNCTION(12)
-DECL_CONSTANT_STR("RESERVE_PINS_USB1", "PB14,PB15");
+ #define IS_OTG_HS 1
+ #define GPIO_D_NEG GPIO('B', 14)
+ #define GPIO_D_POS GPIO('B', 15)
+ #define GPIO_FUNC GPIO_FUNCTION(12)
+ DECL_CONSTANT_STR("RESERVE_PINS_USB1", "PB14,PB15");
#else
-#define USB_PERIPH_BASE USB_OTG_FS_PERIPH_BASE
-#define OTG_IRQn OTG_FS_IRQn
-#define USBOTGEN RCC_AHB1ENR_USB2OTGHSEN
-#define GPIO_D_NEG GPIO('A', 11)
-#define GPIO_D_POS GPIO('A', 12)
-#define GPIO_FUNC GPIO_FUNCTION(10)
-DECL_CONSTANT_STR("RESERVE_PINS_USB", "PA11,PA12");
+ #if CONFIG_MACH_STM32H723
+ #define IS_OTG_HS 1
+ #else
+ #define IS_OTG_HS 0
+ #endif
+ #define GPIO_D_NEG GPIO('A', 11)
+ #define GPIO_D_POS GPIO('A', 12)
+ #define GPIO_FUNC GPIO_FUNCTION(10)
+ DECL_CONSTANT_STR("RESERVE_PINS_USB", "PA11,PA12");
+#endif
+
+#if IS_OTG_HS
+ #define USB_PERIPH_BASE USB_OTG_HS_PERIPH_BASE
+ #define OTG_IRQn OTG_HS_IRQn
+ #define USBOTGEN RCC_AHB1ENR_USB1OTGHSEN
+#else
+ #define USB_PERIPH_BASE USB_OTG_FS_PERIPH_BASE
+ #define OTG_IRQn OTG_FS_IRQn
+ #define USBOTGEN RCC_AHB1ENR_USB2OTGHSEN
#endif
static void