Unable add RGMII PHY

Hello. I trying add RGMII, executing next step:

1 In flash log i find dts file that use for pinmux

copying inmux_config(/home/jetson/Jetson_RT/Linux_for_Tegra/bootloader/generic/BCT/tegra234-mb1-bct-pinmux-p3701-0000-a04.dtsi)... done.

in this file i add changes

                      eqos_txc_pe0 {
				nvidia,pins = "eqos_txc_pe0";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};

			eqos_td0_pe1 {
				nvidia,pins = "eqos_td0_pe1";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};

			eqos_td1_pe2 {
				nvidia,pins = "eqos_td1_pe2";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};

			eqos_td2_pe3 {
				nvidia,pins = "eqos_td2_pe3";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};

			eqos_td3_pe4 {
				nvidia,pins = "eqos_td3_pe4";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};

			eqos_tx_ctl_pe5 {
				nvidia,pins = "eqos_tx_ctl_pe5";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};

			eqos_rd0_pe6 {
				nvidia,pins = "eqos_rd0_pe6";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			eqos_rd1_pe7 {
				nvidia,pins = "eqos_rd1_pe7";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			eqos_rd2_pf0 {
				nvidia,pins = "eqos_rd2_pf0";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			eqos_rd3_pf1 {
				nvidia,pins = "eqos_rd3_pf1";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			eqos_rx_ctl_pf2 {
				nvidia,pins = "eqos_rx_ctl_pf2";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			eqos_rxc_pf3 {
				nvidia,pins = "eqos_rxc_pf3";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			eqos_sma_mdio_pf4 {
				nvidia,pins = "eqos_sma_mdio_pf4";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
			};

			eqos_sma_mdc_pf5 {
				nvidia,pins = "eqos_sma_mdc_pf5";
				nvidia,function = "eqos";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
			};



			soc_gpio17_pg4 {
				nvidia,pins = "soc_gpio17_pg4";
				nvidia,function = "rsvd0";
				nvidia,pull = <TEGRA_PIN_PULL_UP>;
				nvidia,tristate = <TEGRA_PIN_ENABLE>;
				nvidia,enable-input = <TEGRA_PIN_ENABLE>;
				nvidia,lpdr = <TEGRA_PIN_DISABLE>;
			};

			soc_gpio18_pg5 {
				nvidia,pins = "soc_gpio18_pg5";
				nvidia,function = "rsvd0";
				nvidia,pull = <TEGRA_PIN_PULL_NONE>;
				nvidia,tristate = <TEGRA_PIN_DISABLE>;
				nvidia,enable-input = <TEGRA_PIN_DISABLE>;
				nvidia,lpdr = <TEGRA_PIN_DISABLE>;
			};

2 In 2 In Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/nv-platform
i add entries to tegra234-p3737-0000+p3701-0004-nv.dts file

        /* EQOS */
	ethernet0: ethernet@2310000 {
		status = "okay";
		nvidia,mac-addr-idx = <0>;
		nvidia,phy-reset-gpio = <&gpio TEGRA234_MAIN_GPIO(G, 5) 0>;
		phy-mode = "rgmii-id";
		phy-handle = <&phy>;

		mdio {
			compatible = "nvidia,eqos-mdio";
			#address-cells = <1>;
			#size-cells = <0>;

			phy: phy@3 {        
				reg = <3>;    
				nvidia,phy-rst-pdelay-msec = <224>; /* msec */
				nvidia,phy-rst-duration-usec = <10000>; /* usec */
				interrupt-parent = <&gpio>; 
				interrupts = <TEGRA234_MAIN_GPIO(G, 4) IRQ_TYPE_LEVEL_LOW>;

			};
			
		};
	};

3 Then I create and rewrite DTB files

$ export CROSS_COMPILE=/bin/aarch64-buildroot-linux-gnu-
$ export KERNEL_HEADERS=$PWD/kernel/kernel-jammy-src
$ make dtbs
$ cp nvidia-oot/device-tree/platform/generic-dts/dtbs/* /Linux_for_Tegra/kernel/dtb/

I checked tegra234-p3737-0000+p3701-0004-nv.dtb the added entries actually appeared in it.

	ethernet@2310000 {
		status = "okay";
		nvidia,mac-addr-idx = <0x00>;
		nvidia,phy-reset-gpio = <0xe3 0x35 0x00>;
		phy-mode = "rgmii-id";
		phy-handle = <0x20a>;
		phandle = <0x361>;

		mdio {
			compatible = "nvidia,eqos-mdio";
			#address-cells = <0x01>;
			#size-cells = <0x00>;

			phy@3 {
				reg = <0x03>;
				nvidia,phy-rst-pdelay-msec = <0xe0>;
				nvidia,phy-rst-duration-usec = <0x2710>;
				interrupt-parent = <0xe3>;
				interrupts = <0x34 0x08>;
				phandle = <0x20a>;
			};
		};
	};

I attach flash_log, boot_log, dtb, pinmux files:
boot_log.txt.txt (76.5 KB)
Flash_log.txt.txt (96.5 KB)
tegra234-mb1-bct-pinmux-p3701-0000-a04.dtsi.txt (63.6 KB)
tegra234-p3737-0000+p3701-0004-nv.dts.txt (316.9 KB)

I tried debugging:

jetson@ubuntu:~$ sudo mii-tool eth0
[sudo] password for jetson:
SIOCGMIIPHY on ‘eth0’ failed: No such device

jetson@ubuntu:~$ sudo dmesg | grep 2310000

jetson@ubuntu:~$ ls /sys/bus/mdio_bus/devices/

jetson@ubuntu:~$ sudo cat /sys/kernel/debug/gpio |grep PG
gpio-347 (PGG.00 )
gpio-383 (PG.00 |Force Recovery ) in hi IRQ ACTIVE LOW
gpio-384 (PG.01 )
gpio-385 (PG.02 |Suspend ) in hi IRQ ACTIVE LOW
gpio-386 (PG.03 )
gpio-387 (PG.04 )
gpio-388 (PG.05 )
gpio-389 (PG.06 )
gpio-390 (PG.07 |cd ) in hi IRQ ACTIVE LOW
jetson@ubuntu:~$

GPIO not added
No log messages about RGMII.

Your ethernet@2310000 is totally added in wrong node in device tree.

Hello.
Could you tell me where to add ethernet@2310000?

I found the file Linux_for_Tegra/source/hardware/nvidia/t23x/nv-public/nv-platform
я добавляю записи в файл tegra234-p3737-0000+p3701-0004-nv.dts

// SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES.  All rights reserved.

/dts-v1/;

#include "staging/tegra234-p3737-0000+p3701-0004.dts"
#include "tegra234-p3737-0000+p3701-xxxx-nv-common.dtsi"
#include "tegra234-p3701-0000.dtsi"
#include <dt-bindings/gpio/tegra234-gpio.h>
/ {
        /* EQOS */
	ethernet0: ethernet@2310000 {
		status = "okay";
		nvidia,mac-addr-idx = <0>;
		nvidia,phy-reset-gpio = <&gpio TEGRA234_MAIN_GPIO(G, 5) 0>;
		phy-mode = "rgmii-id";
		phy-handle = <&phy>;

		mdio {
			compatible = "nvidia,eqos-mdio";
			#address-cells = <1>;
			#size-cells = <0>;

			phy: phy@3 {        
				reg = <3>;    
				nvidia,phy-rst-pdelay-msec = <224>; /* msec */
				nvidia,phy-rst-duration-usec = <10000>; /* usec */
				interrupt-parent = <&gpio>; 
				interrupts = <TEGRA234_MAIN_GPIO(G, 4) IRQ_TYPE_LEVEL_LOW>;

			};
			
		};
	};
};

It was essentially empty, and only included other files.

It is not about which the file to add.

Search ethernet@2310000 the device tree provided by yourself and you will notice what I am trying to say…

There are two of them
one in section
bus@0
another in the main section.
Then the whole point is that I placed the entry in the wrong file.

What about
tegra234-p3737-0000+p3701-0004.dts?
I just don’t know where to place it.

No… the point is you need to add bus@0 in your file… It really does not matter where you put it.
Again, please find someone who is really familiar with linux kernel things on your side to help you…

bus@0{	

    ethernet@2310000 {
		status = "okay";
		nvidia,mac-addr-idx = <0x00>;
		nvidia,phy-reset-gpio = <0xe3 0x35 0x00>;
		phy-mode = "rgmii-id";
		phy-handle = <0x20a>;
		phandle = <0x361>;

		mdio {
			compatible = "nvidia,eqos-mdio";
			#address-cells = <0x01>;
			#size-cells = <0x00>;

			phy@3 {
				reg = <0x03>;
				nvidia,phy-rst-pdelay-msec = <0xe0>;
				nvidia,phy-rst-duration-usec = <0x2710>;
				interrupt-parent = <0xe3>;
				interrupts = <0x34 0x08>;
				phandle = <0x20a>;
			};
		};
	};

};

It should look like this?

Check the device tree built out on your side.

Can you provide a working guide that will describe how I can add an entry?

For example, this is what the Xilinx manual looks like

/dts-v1/;
/include/ "system-conf.dtsi"
/ {
};
&gem0 {
phy-handle = <&phy0>;
ps7_ethernet_0_mdio: mdio {
      phy0: phy@7 {
                compatible = "marvell,88e1116r";
                device_type = "ethernet-phy";
                reg = <7>;
         };
      };
};

https://docs.nvidia.com/jetson/archives/r36.3/DeveloperGuide/HR/JetsonModuleAdaptationAndBringUp/JetsonAgxOrinSeries.html?highlight=rgmii#for-rgmii

Should I add these entries? Precisely?

phy-mode = "rgmii-id";
phy-handle = <$phy>;
nvidia,phy-reset-gpio = <$tegra_main_gpio TEGRA234_MAIN_GPIO(g, $) 0>

mdio {
    compatible = "nvidia,eqos-mdio";
    #address-cells = <1>;
    #size-cells = <0>;

    phy: phy@1 {
        reg = <1>;
        nvidia,phy-rst-pdelay-msec = <224>; /* msec */
        nvidia,phy-rst-duration-usec = <10000>; /* usec */
        interrupt-parent = <$tegra_main_gpio>;
        interrupts = <TEGRA234_MAIN_GPIO(G, 4) IRQ_TYPE_LEVEL_LOW>;

   };
}

Should I add this to pinmux or is this a typo?
“to connect the 1G MAC to the third-party ethernet PHY:pinmux:”

Do you see the difference between the example from Xilinx? I didn’t have any confusion, I knew exactly which file, in what sequence to do it, and where to place it.
I set up the device in a day. And I didn’t need a Linux specialist.

  1. Pinmux thing is just a typo.

  2. The GPIO and interrupt needs to match your hardware design. This is not a copy & paste thing but just an example. You could change the PHY things to match the phy you are using.

This is not a complete example. If you insert it, even after changing the configuration and parameters, the file will not compile.
Moreover, you said that -
“you need to add bus@0 to your file…”
That is, this example did not help me at all.
And I ask you to explain how I can add an entry, but you refuse me this because I don’t know Linux well?
Or what is the reason?

You just need to put your Ethernet node under bus@0 node so that it will take effect …

You put it in wrong node so that it has 2 Ethernet node in your decompiled dts.

Because this is a real obvious result that shall be found by anyone who knows how device tree syntax works and how to debug on device tree…

Currently this is really not a NVIDIA related issue yet… just you are not familiar with device tree syntax .