mirror of
https://github.com/Dasharo/zephyr.git
synced 2026-03-06 14:57:20 -08:00
drivers: ethernet: stm32: add support for DT pinctrl
Add support for configuring Ethernet pins using DT pinctrl entries. Note that F1 series pinctrl support is not handled as the driver does not support F1. Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
This commit is contained in:
committed by
Carles Cufí
parent
e7886c6634
commit
c8687bc2e4
@@ -26,6 +26,7 @@ LOG_MODULE_REGISTER(LOG_MODULE_NAME);
|
||||
#include <sys/printk.h>
|
||||
#include <drivers/clock_control.h>
|
||||
#include <drivers/clock_control/stm32_clock_control.h>
|
||||
#include <pinmux/stm32/pinmux_stm32.h>
|
||||
|
||||
#include "eth.h"
|
||||
#include "eth_stm32_hal_priv.h"
|
||||
@@ -654,6 +655,14 @@ static int eth_initialize(const struct device *dev)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* configure pinmux */
|
||||
ret = stm32_dt_pinctrl_configure(cfg->pinctrl, cfg->pinctrl_len,
|
||||
(uint32_t)dev_data->heth.Instance);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Could not configure ethernet pins");
|
||||
return ret;
|
||||
}
|
||||
|
||||
heth = &dev_data->heth;
|
||||
|
||||
#if defined(CONFIG_ETH_STM32_HAL_RANDOM_MAC)
|
||||
@@ -852,6 +861,8 @@ static void eth0_irq_config(void)
|
||||
irq_enable(DT_INST_IRQN(0));
|
||||
}
|
||||
|
||||
static const struct soc_gpio_pinctrl eth0_pins[] = ST_STM32_DT_INST_PINCTRL(0, 0);
|
||||
|
||||
static const struct eth_stm32_hal_dev_cfg eth0_config = {
|
||||
.config_func = eth0_irq_config,
|
||||
.pclken = {.bus = DT_INST_CLOCKS_CELL_BY_NAME(0, stmmaceth, bus),
|
||||
@@ -864,6 +875,8 @@ static const struct eth_stm32_hal_dev_cfg eth0_config = {
|
||||
.pclken_ptp = {.bus = DT_INST_CLOCKS_CELL_BY_NAME(0, mac_clk_ptp, bus),
|
||||
.enr = DT_INST_CLOCKS_CELL_BY_NAME(0, mac_clk_ptp, bits)},
|
||||
#endif /* !CONFIG_SOC_SERIES_STM32H7X */
|
||||
.pinctrl = eth0_pins,
|
||||
.pinctrl_len = ARRAY_SIZE(eth0_pins),
|
||||
};
|
||||
|
||||
static struct eth_stm32_hal_dev_data eth0_data = {
|
||||
|
||||
@@ -29,6 +29,8 @@ struct eth_stm32_hal_dev_cfg {
|
||||
#if !defined(CONFIG_SOC_SERIES_STM32H7X)
|
||||
struct stm32_pclken pclken_ptp;
|
||||
#endif /* !defined(CONFIG_SOC_SERIES_STM32H7X) */
|
||||
const struct soc_gpio_pinctrl *pinctrl;
|
||||
size_t pinctrl_len;
|
||||
};
|
||||
|
||||
/* Device run time data */
|
||||
|
||||
@@ -16,3 +16,12 @@ properties:
|
||||
required: true
|
||||
clock-names:
|
||||
required: true
|
||||
|
||||
pinctrl-0:
|
||||
type: phandles
|
||||
required: false
|
||||
description: |
|
||||
GPIO pin configuration for Ethernet signals. We expect that the phandles
|
||||
will reference pinctrl nodes, e.g.
|
||||
|
||||
pinctrl-0 = <ð_ref_clk_pa1 ð_mdio_pa2 ...>;
|
||||
|
||||
Reference in New Issue
Block a user