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 = { static struct eth_stm32_hal_dev_data eth0_data = {
.heth = { .heth = {
.Instance = (ETH_TypeDef *)DT_INST_REG_ADDR(0), .Instance = (ETH_TypeDef *)DT_REG_ADDR(DT_INST_PARENT(0)),
.Init = { .Init = {
#if !defined(CONFIG_ETH_STM32_HAL_API_V2) #if !defined(CONFIG_ETH_STM32_HAL_API_V2)
#if defined(CONFIG_ETH_STM32_AUTO_NEGOTIATION_ENABLE) #if defined(CONFIG_ETH_STM32_AUTO_NEGOTIATION_ENABLE)

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -63,10 +63,6 @@ config CLOCK_CONTROL_INIT_PRIORITY
default 1 default 1
depends on CLOCK_CONTROL 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 # Get flash configuration for NS image from dts flash partition
config USE_DT_CODE_PARTITION config USE_DT_CODE_PARTITION
default y if TRUSTED_EXECUTION_NONSECURE default y if TRUSTED_EXECUTION_NONSECURE