drivers/usb: stm32: Add support for pinctrl configuration

Enable configuration of USB signals in stm32 driver.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2020-10-21 15:31:06 +02:00 committed by Kumar Gala
commit a1cb59398b

View file

@ -50,6 +50,7 @@
#include <drivers/clock_control/stm32_clock_control.h>
#include <sys/util.h>
#include <drivers/gpio.h>
#include <pinmux/stm32/pinmux_stm32.h>
#include "stm32_hsem.h"
#define LOG_LEVEL CONFIG_USB_DRIVER_LOG_LEVEL
@ -84,6 +85,9 @@ LOG_MODULE_REGISTER(usb_dc_stm32);
#if DT_INST_NODE_HAS_PROP(0, maximum_speed)
#define USB_MAXIMUM_SPEED DT_INST_PROP(0, maximum_speed)
#endif
static const struct soc_gpio_pinctrl usb_pinctrl[] =
ST_STM32_DT_INST_PINCTRL(0, 0);
#define USB_OTG_HS_EMB_PHY (DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usbphyc) && \
DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs))
@ -370,6 +374,15 @@ static int usb_dc_stm32_init(void)
usb_dc_stm32_state.pcd.Init.Sof_enable = 1;
#endif /* CONFIG_USB_DEVICE_SOF */
LOG_DBG("Pinctrl signals configuration");
status = stm32_dt_pinctrl_configure(usb_pinctrl,
ARRAY_SIZE(usb_pinctrl),
(uint32_t)usb_dc_stm32_state.pcd.Instance);
if (status < 0) {
LOG_ERR("USB pinctrl setup failed (%d)", status);
return status;
}
LOG_DBG("HAL_PCD_Init");
status = HAL_PCD_Init(&usb_dc_stm32_state.pcd);
if (status != HAL_OK) {