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:
parent
5a9eff1e1a
commit
a1cb59398b
1 changed files with 14 additions and 1 deletions
|
@ -50,6 +50,7 @@
|
||||||
#include <drivers/clock_control/stm32_clock_control.h>
|
#include <drivers/clock_control/stm32_clock_control.h>
|
||||||
#include <sys/util.h>
|
#include <sys/util.h>
|
||||||
#include <drivers/gpio.h>
|
#include <drivers/gpio.h>
|
||||||
|
#include <pinmux/stm32/pinmux_stm32.h>
|
||||||
#include "stm32_hsem.h"
|
#include "stm32_hsem.h"
|
||||||
|
|
||||||
#define LOG_LEVEL CONFIG_USB_DRIVER_LOG_LEVEL
|
#define LOG_LEVEL CONFIG_USB_DRIVER_LOG_LEVEL
|
||||||
|
@ -84,9 +85,12 @@ LOG_MODULE_REGISTER(usb_dc_stm32);
|
||||||
#if DT_INST_NODE_HAS_PROP(0, maximum_speed)
|
#if DT_INST_NODE_HAS_PROP(0, maximum_speed)
|
||||||
#define USB_MAXIMUM_SPEED DT_INST_PROP(0, maximum_speed)
|
#define USB_MAXIMUM_SPEED DT_INST_PROP(0, maximum_speed)
|
||||||
#endif
|
#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) && \
|
#define USB_OTG_HS_EMB_PHY (DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usbphyc) && \
|
||||||
DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs))
|
DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs))
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* USB and USB_OTG_FS are defined in STM32Cube HAL and allows to distinguish
|
* USB and USB_OTG_FS are defined in STM32Cube HAL and allows to distinguish
|
||||||
|
@ -370,6 +374,15 @@ static int usb_dc_stm32_init(void)
|
||||||
usb_dc_stm32_state.pcd.Init.Sof_enable = 1;
|
usb_dc_stm32_state.pcd.Init.Sof_enable = 1;
|
||||||
#endif /* CONFIG_USB_DEVICE_SOF */
|
#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");
|
LOG_DBG("HAL_PCD_Init");
|
||||||
status = HAL_PCD_Init(&usb_dc_stm32_state.pcd);
|
status = HAL_PCD_Init(&usb_dc_stm32_state.pcd);
|
||||||
if (status != HAL_OK) {
|
if (status != HAL_OK) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue