drivers/usb/device: stm32: use new pinctrl API

Use the new pinctrl API to configure pins.

Additionally, rename usb_pinctrl to usb_pcfg to better fit
new pinctrl API.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2021-11-08 13:49:13 +01:00 committed by Carles Cufí
commit 90b0e92540
4 changed files with 8 additions and 40 deletions

View file

@ -24,7 +24,7 @@
#include <drivers/clock_control/stm32_clock_control.h>
#include <sys/util.h>
#include <drivers/gpio.h>
#include <pinmux/pinmux_stm32.h>
#include <drivers/pinctrl.h>
#include "stm32_hsem.h"
#define LOG_LEVEL CONFIG_USB_DRIVER_LOG_LEVEL
@ -60,9 +60,10 @@ 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);
PINCTRL_DT_INST_DEFINE(0)
static const struct pinctrl_dev_config *usb_pcfg =
PINCTRL_DT_INST_DEV_CONFIG_GET(0);
#define USB_OTG_HS_EMB_PHY (DT_HAS_COMPAT_STATUS_OKAY(st_stm32_usbphyc) && \
DT_HAS_COMPAT_STATUS_OKAY(st_stm32_otghs))
@ -412,9 +413,7 @@ static int usb_dc_stm32_init(void)
#endif
LOG_DBG("Pinctrl signals configuration");
status = stm32_dt_pinctrl_configure(usb_pinctrl,
ARRAY_SIZE(usb_pinctrl),
(uint32_t)usb_dc_stm32_state.pcd.Instance);
status = pinctrl_apply_state(usb_pcfg, PINCTRL_STATE_DEFAULT);
if (status < 0) {
LOG_ERR("USB pinctrl setup failed (%d)", status);
return status;

View file

@ -5,7 +5,7 @@ description: STM32 OTGFS controller
compatible: "st,stm32-otgfs"
include: usb-ep.yaml
include: [usb-ep.yaml, pinctrl-device.yaml]
properties:
reg:
@ -28,13 +28,3 @@ properties:
clocks:
required: true
pinctrl-0:
type: phandles
required: false
description: |
Pin configuration for USB OTG FS signals (DM/DP/SOF/ID/VBUS).
We expect that the phandles will reference pinctrl nodes.
For example:
<&usb_otg_fs_dm_pa11 &usb_otg_fs_dp_pa12>;

View file

@ -5,7 +5,7 @@ description: STM32 OTGHS controller
compatible: "st,stm32-otghs"
include: usb-ep.yaml
include: [usb-ep.yaml, pinctrl-device.yaml]
properties:
reg:
@ -28,14 +28,3 @@ properties:
clocks:
required: true
pinctrl-0:
type: phandles
required: false
description: |
Pin configuration for USB OTG HS signals (DM/DP/SOF/ID/VBUS and
ULPI_DIR/ULPI_STP/ULPI_NXT/ULPI_D[0-7]).
We expect that the phandles will reference pinctrl nodes.
For example:
<&usb_otg_hs_dm_pa11 &usb_otg_hs_dp_pa12>;

View file

@ -5,7 +5,7 @@ description: STM32 USB controller
compatible: "st,stm32-usb"
include: usb-ep.yaml
include: [usb-ep.yaml, pinctrl-device.yaml]
properties:
reg:
@ -43,13 +43,3 @@ properties:
clocks:
required: true
pinctrl-0:
type: phandles
required: false
description: |
Pin configuration for USB signals (DM/DP/NOE).
We expect that the phandles will reference pinctrl nodes.
For example:
<&usb_dm_pa11 &usb_dp_pa12>;