drivers: ethernet: stm32: make mac a child like the mdio node

mac and mdio are now on the same level, this way
phy-handle can be used.

Signed-off-by: Fin Maaß <f.maass@vogl-electronic.com>
This commit is contained in:
Fin Maaß 2025-03-26 07:40:06 +01:00 committed by Benjamin Cabé
commit d139d84338
11 changed files with 99 additions and 82 deletions

View file

@ -1585,7 +1585,7 @@ BUILD_ASSERT(DT_ENUM_HAS_VALUE(MAC_NODE, phy_connection_type, mii) ||
static struct eth_stm32_hal_dev_data eth0_data = {
.heth = {
.Instance = (ETH_TypeDef *)DT_INST_REG_ADDR(0),
.Instance = (ETH_TypeDef *)DT_REG_ADDR(DT_INST_PARENT(0)),
.Init = {
#if !defined(CONFIG_ETH_STM32_HAL_API_V2)
#if defined(CONFIG_ETH_STM32_AUTO_NEGOTIATION_ENABLE)

View file

@ -19,16 +19,18 @@
status = "disabled";
};
mac: ethernet@40028000 {
compatible = "st,stm32-ethernet";
ethernet@40028000 {
reg = <0x40028000 0x2000>;
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB1, 14U)>,
<&rcc STM32_CLOCK(AHB1, 15U)>,
<&rcc STM32_CLOCK(AHB1, 16U)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32-ethernet";
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB1, 14)>,
<&rcc STM32_CLOCK(AHB1, 15)>,
<&rcc STM32_CLOCK(AHB1, 16)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";

View file

@ -10,17 +10,19 @@
soc {
compatible = "st,stm32f207", "st,stm32f2", "simple-bus";
mac: ethernet@40028000 {
compatible = "st,stm32-ethernet";
ethernet@40028000 {
reg = <0x40028000 0x8000>;
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25U)>,
<&rcc STM32_CLOCK(AHB1, 26U)>,
<&rcc STM32_CLOCK(AHB1, 27U)>,
<&rcc STM32_CLOCK(AHB1, 28U)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32-ethernet";
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25)>,
<&rcc STM32_CLOCK(AHB1, 26)>,
<&rcc STM32_CLOCK(AHB1, 27)>,
<&rcc STM32_CLOCK(AHB1, 28)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";

View file

@ -10,17 +10,19 @@
soc {
compatible = "st,stm32f407", "st,stm32f4", "simple-bus";
mac: ethernet@40028000 {
compatible = "st,stm32-ethernet";
ethernet@40028000 {
reg = <0x40028000 0x8000>;
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25U)>,
<&rcc STM32_CLOCK(AHB1, 26U)>,
<&rcc STM32_CLOCK(AHB1, 27U)>,
<&rcc STM32_CLOCK(AHB1, 28U)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32-ethernet";
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25)>,
<&rcc STM32_CLOCK(AHB1, 26)>,
<&rcc STM32_CLOCK(AHB1, 27)>,
<&rcc STM32_CLOCK(AHB1, 28)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";

View file

@ -75,17 +75,19 @@
status = "disabled";
};
mac: ethernet@40028000 {
compatible = "st,stm32-ethernet";
ethernet@40028000 {
reg = <0x40028000 0x8000>;
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25U)>,
<&rcc STM32_CLOCK(AHB1, 26U)>,
<&rcc STM32_CLOCK(AHB1, 27U)>,
<&rcc STM32_CLOCK(AHB1, 28U)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32-ethernet";
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25)>,
<&rcc STM32_CLOCK(AHB1, 26)>,
<&rcc STM32_CLOCK(AHB1, 27)>,
<&rcc STM32_CLOCK(AHB1, 28)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";

View file

@ -68,17 +68,26 @@
status = "disabled";
};
mac: ethernet@40028000 {
compatible = "st,stm32-ethernet";
ethernet@40028000 {
reg = <0x40028000 0x8000>;
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25U)>,
<&rcc STM32_CLOCK(AHB1, 26U)>,
<&rcc STM32_CLOCK(AHB1, 27U)>,
<&rcc STM32_CLOCK(AHB1, 28U)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32-ethernet";
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx", "mac-clk-ptp";
clocks = <&rcc STM32_CLOCK(AHB1, 25)>,
<&rcc STM32_CLOCK(AHB1, 26)>,
<&rcc STM32_CLOCK(AHB1, 27)>,
<&rcc STM32_CLOCK(AHB1, 28)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";
#address-cells = <1>;
#size-cells = <0>;
status = "disabled";
};
};
sdmmc2: sdmmc@40011c00 {

View file

@ -538,15 +538,17 @@
status = "disabled";
};
mac: ethernet@40028000 {
compatible = "st,stm32h7-ethernet", "st,stm32-ethernet";
ethernet@40028000 {
reg = <0x40028000 0x8000>;
interrupts = <106 0>;
clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB1, 19U)>,
<&rcc STM32_CLOCK(AHB1, 20U)>,
<&rcc STM32_CLOCK(AHB1, 21U)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32h7-ethernet", "st,stm32-ethernet";
interrupts = <106 0>;
clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB1, 19)>,
<&rcc STM32_CLOCK(AHB1, 20)>,
<&rcc STM32_CLOCK(AHB1, 21)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";

View file

@ -1025,15 +1025,17 @@
status = "disabled";
};
mac: ethernet@40028000 {
compatible = "st,stm32h7-ethernet", "st,stm32-ethernet";
ethernet@40028000 {
reg = <0x40028000 0x8000>;
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB1, 15U)>,
<&rcc STM32_CLOCK(AHB1, 16U)>,
<&rcc STM32_CLOCK(AHB1, 17U)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32h7-ethernet", "st,stm32-ethernet";
interrupts = <61 0>;
clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB1, 15)>,
<&rcc STM32_CLOCK(AHB1, 16)>,
<&rcc STM32_CLOCK(AHB1, 17)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";

View file

@ -643,17 +643,19 @@
status = "disabled";
};
mac: ethernet@58036000 {
compatible = "st,stm32n6-ethernet", "st,stm32h7-ethernet",
"st,stm32-ethernet";
ethernet@58036000 {
reg = <0x58036000 0x8000>;
interrupts = <179 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB5, 22)>,
<&rcc STM32_CLOCK(AHB5, 23)>,
<&rcc STM32_CLOCK(AHB5, 24)>;
status = "disabled";
mac: ethernet {
compatible = "st,stm32n6-ethernet", "st,stm32h7-ethernet",
"st,stm32-ethernet";
interrupts = <179 0>;
clock-names = "stmmaceth", "mac-clk-tx",
"mac-clk-rx";
clocks = <&rcc STM32_CLOCK(AHB5, 22)>,
<&rcc STM32_CLOCK(AHB5, 23)>,
<&rcc STM32_CLOCK(AHB5, 24)>;
status = "disabled";
};
mdio: mdio {
compatible = "st,stm32-mdio";

View file

@ -6,8 +6,6 @@
include: [ethernet-controller.yaml, pinctrl-device.yaml]
properties:
reg:
required: true
interrupts:
required: true
clocks:

View file

@ -63,10 +63,6 @@ config CLOCK_CONTROL_INIT_PRIORITY
default 1
depends on CLOCK_CONTROL
config PHY_INIT_PRIORITY
default 81
depends on NET_L2_ETHERNET && ETH_DRIVER
# Get flash configuration for NS image from dts flash partition
config USE_DT_CODE_PARTITION
default y if TRUSTED_EXECUTION_NONSECURE