Skip to content

Commit 72e6955

Browse files
mathieuchopstmdkalowsk
authored andcommitted
boards: stm32: stm32n6570_dk: fix DTS errors for Ethernet
The DTS for this board contained a few mistakes: * The PHY address was incorrect * This did not impair functionality because the RTL8211F treats address 0 as "broadcast" and accepts commands sent to it by default * An incorrect PHY driver was used * The generic "phy_mii" driver is not the most appropriate for this PHY - use the HW-specific RTL8211F driver instead * Also remove the PHY IRQ pin configuration from Ethernet pinctrl to allow RTL8211F driver to receive IRQ via GPIO instead * The RGMII GTX CLK pinctrl must be configured at "medium-speed" * This is a temporary solution. The proper solution would use very-high-speed combined with a GPIO delay, but delays are not supported yet in Zephyr. Signed-off-by: Mathieu CHOPLAIN <[email protected]>
1 parent d621dbd commit 72e6955

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

boards/st/stm32n6570_dk/stm32n6570_dk_common.dtsi

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,15 @@ zephyr_udc0: &usbotg_hs1 {
344344
};
345345
};
346346

347+
/**
348+
* Board-specific configuration, required to ensure that
349+
* the Tx CLK and DAT signals arrive in sync at the PHY.
350+
* Without this, the Tx will be unreliable
351+
*/
352+
&eth1_rgmii_gtx_clk_pf0 {
353+
slew-rate = "medium-speed";
354+
};
355+
347356
&mac {
348357
status = "okay";
349358
pinctrl-0 = <&eth1_rgmii_gtx_clk_pf0
@@ -358,8 +367,7 @@ zephyr_udc0: &usbotg_hs1 {
358367
&eth1_rgmii_rxd0_pf14
359368
&eth1_rgmii_rxd1_pf15
360369
&eth1_rgmii_txd2_pg3
361-
&eth1_rgmii_txd3_pg4
362-
&eth1_phy_intn_pd3>;
370+
&eth1_rgmii_txd3_pg4>;
363371
pinctrl-names = "default";
364372
phy-connection-type = "rgmii";
365373
phy-handle = <&eth_phy>;
@@ -370,9 +378,20 @@ zephyr_udc0: &usbotg_hs1 {
370378
pinctrl-0 = <&eth1_mdio_pd12 &eth1_mdc_pd1>;
371379
pinctrl-names = "default";
372380

373-
eth_phy: ethernet-phy@0 {
374-
compatible = "ethernet-phy";
375-
reg = <0x0>;
381+
eth_phy: ethernet-phy@1 {
382+
compatible = "realtek,rtl8211f";
383+
reg = <0x1>;
384+
/**
385+
* PD3 can be used as alternate function ETH1_PHY_INTN,
386+
* which allows the Ethernet MAC to sense interrupts from
387+
* the PHY in order to signal them to the CPU via its own
388+
* interrupt lines. However, the Zephyr RTL8211F driver
389+
* is unaware of this mechanism. Skip configuring PD3 as
390+
* alternate function (in pinctrl of &mac) and provide the
391+
* pin to the RTL8211F driver for interrupt sensing using
392+
* the regular GPIO interrupt APIs.
393+
*/
394+
int-gpios = <&gpiod 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
376395
};
377396
};
378397

0 commit comments

Comments
 (0)