STM32MP157 (stmmac) MDIO bus silent in Linux (works in U-Boot) - SJA1105 + ADIN1300

lubos123

New Member
Joined
Dec 10, 2025
Messages
3
Reaction score
0
Credits
41
Hi everyone,

I am working on a custom board based on Digi ConnectCore MP157 (STM32MP157). I am facing a persistent issue where the MDIO bus appears completely silent (no clock on MDC and only 3V3 on MDIO) during Linux boot, resulting in PHY detection failures.

Hardware Setup:

  • SoC: STM32MP157
  • Ethernet MAC: internal stmmac (ETH1), RGMII mode.
  • Switch: NXP SJA1105Q connected to the CPU port via RGMII (Fixed Link).
  • MDIO Bus:Managed by the STM32 MAC, shared by 4 PHYs:
    • Addr 0: Analog Devices ADIN1300 (Main LAN)
    • Addr 1: TI DP83TC811 (100BASE-T1)
    • Addr 2: TI DP83TD510E (10BASE-T1L)
    • Addr 3: Microchip LAN8671 (10BASE-T1S)
The Problem: In U-Boot, the MDIO bus works correctly. I can use mdio read 0 0 and I see valid traffic on the oscilloscope (MDC clocking, MDIO data moving). However, once Linux boots, the MDC pin remains static (no clock generation), and the kernel fails to detect any PHYs.

Error Logs (dmesg): The SJA1105 driver loads but fails to connect to the PHYs because the MDIO bus read returns nothing (likely reading all zeros).

Code:
sja1105 spi0.0: Probed switch chip: SJA1105Q
sja1105 spi0.0: configuring for fixed/rgmii link mode
sja1105 spi0.0 lan0 (uninitialized): failed to connect to PHY: -ENODEV
sja1105 spi0.0 lan0 (uninitialized): error -19 setting up PHY for tree 0, switch 0, port 0
sja1105 spi0.0: Link is Up - 1Gbps/Full - flow control off


Checking via sysfs shows the devices exist (instantiated by DT), but IDs not found by this cmd, but folder exists:
Code:
cat /sys/bus/mdio_bus/devices/stmmac-0:00/phy_id
What I have verified/tried:
  1. Hardware/Electrical:
    • PHY Reset: All PHY reset pins are confirmed HIGH (3.3V) during Linux boot.
    • PHY Clocks: ADIN1300 has a stable 25MHz clock input.
    • Oscilloscope: In U-Boot, MDC toggles correctly. In Linux, MDC stays low with NO clock activity and no MDIO(only 3V3 pull up) even when forcing a read via userspace.
    • Pinmux: Checked /sys/kernel/debug/pinctrl/.../pins, PC1 (MDC) and PA2 (MDIO) are correctly set to AF11.
  2. Device Tree Configuration: I suspect a conflict between the fixed-link (for the switch) and the mdio node, or an issue with snps,clk-csr.
Current Device Tree Configuration: I suspect there might be a conflict in the stmmac driver when using both a fixed-link (for the data path to the switch) and a standard mdio node (for PHY management).

Current Device Tree Snippet:
Code:
&spi6 {
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&ccmp15_spi6_z_pins>;
    pinctrl-1 = <&ccmp15_spi6_z_sleep_pins>;
  
    clocks = <&scmi_clk CK_SCMI_SPI6>;
    resets = <&scmi_reset RST_SCMI_SPI6>;
  
    cs-gpios = <&gpiod 13 GPIO_ACTIVE_LOW>;
    status = "okay";


    switch@0 {
        compatible = "nxp,sja1105q";
        reg = <0>;
        spi-max-frequency = <1000000>;
        spi-cpha;
      
        reset-gpios = <&gpiob 10 GPIO_ACTIVE_LOW>;

        ports {
            #address-cells = <1>;
            #size-cells = <0>;
          
            port@0 {
                reg = <0>;
                label = "lan0";
                phy-handle = <&phy0>;
                phy-mode = "rgmii";
                sja1105,role-mac;
            };
            port@1 { reg = <1>; label = "lan1"; status = "disabled";};
            port@2 { reg = <2>; label = "lan2"; status = "disabled";};
            port@3 { reg = <3>; label = "lan3"; status = "disabled";};
          
            port@4 {
                reg = <4>;
                label = "cpu";
                ethernet = <&ethernet0>;
                phy-mode = "rgmii";
                rx-internal-delay-ps = <2000>;
                tx-internal-delay-ps = <2000>;
                fixed-link {
                    speed = <1000>;
                    full-duplex;
                };
            };
        };
    };
};
&ethernet0 {
    status = "okay";
    pinctrl-names = "default", "sleep";
    pinctrl-0 = <&ccmp15_ethernet0_pins &mdc_pins &mdio_pins>;
    pinctrl-1 = <&ccmp15_ethernet0_sleep_pins>;

    phy-mode = "rgmii";
    st,ext-phyclk;
    snps,clk-csr = <0>;
  
    clocks = <&rcc ETHMAC>,
             <&rcc ETHTX>,
             <&rcc ETHRX>,
             <&si5351 0>,
             <&rcc ETHSTP>;
    clock-names = "stmmaceth", "mac-clk-tx", "mac-clk-rx", "eth-ck", "ethstp";

    fixed-link {
        speed = <1000>;
        full-duplex;
    };
  
    mdio0: mdio {
        compatible = "snps,dwmac-mdio";
        #address-cells = <1>;
        #size-cells = <0>;

        /* === ADIN1300 PHY @ MDIO 0 === */
        phy0: ethernet-phy@0 {
            compatible = "adi,adin1300";
            reg = <0>;

            /* RESET pin = PA3 */
            reset-gpios = <&gpioa 3 GPIO_ACTIVE_LOW>;
            reset-assert-us = <10000>;
            reset-deassert-us = <10000>;
            /* IRQ pin = PF8 */
            interrupt-parent = <&gpiof>;
            interrupts = <8 IRQ_TYPE_LEVEL_LOW>;
        };   
    };
};
....
....
    mdc_pins: mdc-pins {
        pins {
            pinmux = <STM32_PINMUX('C', 1, AF11)>; /* MDC */
            drive-push-pull;
            bias-disable;
            slew-rate = <2>;
        };
    };
    mdio_pins: mdio-pins {
        pins {
            pinmux = <STM32_PINMUX('A', 2, AF11)>; /* MDIO */
            drive-open-drain;
            bias-pull-up;
            slew-rate = <0>;
        };
    };
 
 ccmp15_ethernet0_sleep_pins: ethernet0-rgmii-sleep-0 {
        pins1 {
            pinmux = ...another ethernet pins...
                     <STM32_PINMUX('G', 4, ANALOG)>,  /* GTX_CLK */
                     <STM32_PINMUX('C', 1, ANALOG)>,  /* MDC */
                     <STM32_PINMUX('A', 2, ANALOG)>,  /* MDIO */
                     <STM32_PINMUX('C', 4, ANALOG)>,  /* RXD0 */
                     ...another ethernet pins...
        };
    };
 


Is this a Single Board system you are talking about and which Linux distribution are you using?
 
Yes, this is my own custom carrier board with a Digi ConnectCore MP15 (STM32MP157) SoM without WI-FI mounted on it.
I am using Digi Embedded Yocto (DEY) 5.0, based on Linux kernel 6.6.
The issue appears only in Linux – MDIO works correctly in U-Boot, but Linux does not generate any MDIO/MDC activity at all.
 
not my particular area, development boards are not my thing. But I do know this bare-bones board has ARM CPU, so you will need to make sure you have an arm compatible OS
 
Yes, this is my own custom carrier board with a Digi ConnectCore MP15 (STM32MP157) SoM without WI-FI mounted on it.
Moved to Single Board Computers.

I am using Digi Embedded Yocto (DEY) 5.0, based on Linux kernel 6.6.
Never heard of it, not a every high chance you will get an answer here since most users here run mainstream Linux distributions on normal desktop or laptop computers.
 
not my particular area, development boards are not my thing. But I do know this bare-bones board has ARM CPU, so you will need to make sure you have an arm compatible OS
Yes, I have ARM compatible linux.
Linux itself boots perfectly fine; the only issue is that the MDIO bus is inactive after the kernel starts, even though MDIO works normally in U-Boot. So I’m trying to understand why the Linux DWMAC MDIO driver doesn’t send any transactions on MDC/MDIO.
 
Now my colleague has moved this to single boards, hopefully one of our few members who may help pass through
 
@f33dm3bits :-

I am using Digi Embedded Yocto (DEY) 5.0, based on Linux kernel 6.6.
Never heard of it, not a every high chance you will get an answer here since most users here run mainstream Linux distributions on normal desktop or laptop computers.
Heh.

Were it not for the fact that Barry K's current, quite long-running experimental "project" (EasyOS) is based around Yocto - essentially designed for embedded systems - I, too, would never have heard of it.

I began looking into it a year or so back for one simple reason; because the core Yocto dev team had named several consecutive releases after well-known mountain peaks, passes and moorland fells from the English Lake District National Park.....an area which, although I haven't been up there for many years, I am quite familiar with.

I started this thread in the Puppy Forum's EasyOS section to let BK and his 'regulars' know about it:-



Mike. ;)
 


Follow Linux.org

Members online


Top