boards: arm: Update STM32 UCPD nodes with pin control

Assign the pins for the STM32G071b and STM32G081b STM32
UCPD peripherals so the UCPD driver can properly
configure the device.

Signed-off-by: Sam Hurst <sbh1187@gmail.com>
This commit is contained in:
Sam Hurst 2022-05-14 11:54:31 -07:00 committed by Anas Nashif
commit 99e07709ff
4 changed files with 17 additions and 1 deletions

View file

@ -15,7 +15,7 @@ LOG_MODULE_REGISTER(ucpd_stm32, CONFIG_USBC_LOG_LEVEL);
#include <soc.h>
#include <stddef.h>
#include <zephyr/math/ilog2.h>
#include <stm32g0xx_ll_system.h>
#include <stm32_ll_system.h>
#include <zephyr/irq.h>
#include "ucpd_stm32_priv.h"
@ -1375,6 +1375,13 @@ static int ucpd_init(const struct device *dev)
uint32_t cfg1;
int ret;
LOG_DBG("Pinctrl signals configuration");
ret = pinctrl_apply_state(config->ucpd_pcfg, PINCTRL_STATE_DEFAULT);
if (ret < 0) {
LOG_ERR("USB pinctrl setup failed (%d)", ret);
return ret;
}
/*
* The UCPD port is disabled in the LL_UCPD_Init function
*
@ -1459,8 +1466,10 @@ BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) > 0,
"No compatible STM32 TCPC instance found");
#define TCPC_DRIVER_INIT(inst) \
PINCTRL_DT_INST_DEFINE(inst); \
static struct tcpc_data drv_data_##inst; \
static const struct tcpc_config drv_config_##inst = { \
.ucpd_pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
.ucpd_port = (UCPD_TypeDef *)DT_INST_REG_ADDR(inst), \
.ucpd_params.psc_ucpdclk = ilog2(DT_INST_PROP(inst, psc_ucpdclk)), \
.ucpd_params.transwin = DT_INST_PROP(inst, transwin) - 1, \

View file

@ -9,6 +9,7 @@
#include <zephyr/sys/util.h>
#include <zephyr/drivers/usb_c/usbc_tcpc.h>
#include <zephyr/drivers/pinctrl.h>
#include <stm32_ll_ucpd.h>
/**
@ -251,6 +252,8 @@ struct alert_info {
* @brief Driver config
*/
struct tcpc_config {
/* STM32 UCPC CC pin control */
const struct pinctrl_dev_config *ucpd_pcfg;
/* STM32 UCPD port */
UCPD_TypeDef *ucpd_port;
/* STM32 UCPD parameters */