Skip to content

Commit 29ffcae

Browse files
atxgalak
authored andcommitted
drivers: usb_dc_stm32: Make pin remapping part of the device tree
The SYSCFG_CFGR1_PA11_PA12_RMP define is present even on packages where the remap isn't strictly required. This commit makes the remap optional based on a DT property. Also fixes syntax error caused by a missing );. Signed-off-by: Josef Gajdusek <[email protected]>
1 parent 6bf369f commit 29ffcae

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

drivers/usb/device/usb_dc_stm32.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ int usb_dc_attach(void)
427427
* For STM32F0 series SoCs on QFN28 and TSSOP20 packages enable PIN
428428
* pair PA11/12 mapped instead of PA9/10 (e.g. stm32f070x6)
429429
*/
430-
#if defined(CONFIG_SOC_SERIES_STM32F0X) && defined(SYSCFG_CFGR1_PA11_PA12_RMP)
430+
#if defined(DT_USB_ENABLE_PIN_REMAP)
431431
if (LL_APB1_GRP2_IsEnabledClock(LL_APB1_GRP2_PERIPH_SYSCFG)) {
432432
LL_SYSCFG_EnablePinRemap();
433433
} else {

dts/bindings/usb/st,stm32-usb.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,11 @@ properties:
5353
category: optional
5454
generation: define
5555
description: PHY provider specifier
56+
57+
enable-pin-remap:
58+
type: boolean
59+
category: optional
60+
description: For STM32F0 series SoCs on QFN28 and TSSOP20 packages
61+
enable PIN pair PA11/12 mapped instead of PA9/10 (e.g. stm32f070x6)
62+
generation: define, use-prop-name
5663
...

soc/arm/st_stm32/stm32f0/dts_fixup.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@
125125
#define DT_USB_NUM_BIDIR_ENDPOINTS DT_ST_STM32_USB_40005C00_NUM_BIDIR_ENDPOINTS
126126
#define DT_USB_RAM_SIZE DT_ST_STM32_USB_40005C00_RAM_SIZE
127127

128+
#ifdef DT_ST_STM32_USB_40005C00_ENABLE_PIN_REMAP
129+
#define DT_USB_ENABLE_PIN_REMAP DT_ST_STM32_USB_40005C00_ENABLE_PIN_REMAP
130+
#endif /* ST_STM32_USB_40005C00_ENABLE_PIN_REMAP */
131+
128132
#define DT_PWM_STM32_1_DEV_NAME DT_ST_STM32_PWM_40012C00_PWM_LABEL
129133
#define DT_PWM_STM32_1_PRESCALER DT_ST_STM32_PWM_40012C00_PWM_ST_PRESCALER
130134
#define DT_TIM_STM32_1_BASE_ADDRESS DT_ST_STM32_TIMERS_40012C00_BASE_ADDRESS

0 commit comments

Comments
 (0)