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 <atx@atx.name>
This commit is contained in:
Josef Gajdusek 2018-08-11 14:33:29 +02:00 committed by Kumar Gala
parent 6bf369f306
commit 29ffcae80c
3 changed files with 12 additions and 1 deletions

View file

@ -427,7 +427,7 @@ int usb_dc_attach(void)
* For STM32F0 series SoCs on QFN28 and TSSOP20 packages enable PIN
* pair PA11/12 mapped instead of PA9/10 (e.g. stm32f070x6)
*/
#if defined(CONFIG_SOC_SERIES_STM32F0X) && defined(SYSCFG_CFGR1_PA11_PA12_RMP)
#if defined(DT_USB_ENABLE_PIN_REMAP)
if (LL_APB1_GRP2_IsEnabledClock(LL_APB1_GRP2_PERIPH_SYSCFG)) {
LL_SYSCFG_EnablePinRemap();
} else {

View file

@ -53,4 +53,11 @@ properties:
category: optional
generation: define
description: PHY provider specifier
enable-pin-remap:
type: boolean
category: optional
description: For STM32F0 series SoCs on QFN28 and TSSOP20 packages
enable PIN pair PA11/12 mapped instead of PA9/10 (e.g. stm32f070x6)
generation: define, use-prop-name
...

View file

@ -125,6 +125,10 @@
#define DT_USB_NUM_BIDIR_ENDPOINTS DT_ST_STM32_USB_40005C00_NUM_BIDIR_ENDPOINTS
#define DT_USB_RAM_SIZE DT_ST_STM32_USB_40005C00_RAM_SIZE
#ifdef DT_ST_STM32_USB_40005C00_ENABLE_PIN_REMAP
#define DT_USB_ENABLE_PIN_REMAP DT_ST_STM32_USB_40005C00_ENABLE_PIN_REMAP
#endif /* ST_STM32_USB_40005C00_ENABLE_PIN_REMAP */
#define DT_PWM_STM32_1_DEV_NAME DT_ST_STM32_PWM_40012C00_PWM_LABEL
#define DT_PWM_STM32_1_PRESCALER DT_ST_STM32_PWM_40012C00_PWM_ST_PRESCALER
#define DT_TIM_STM32_1_BASE_ADDRESS DT_ST_STM32_TIMERS_40012C00_BASE_ADDRESS