The kernel switch driver uses the mdio bus independently by JetPack 5.0.2 JETSON ORIN

The kernel switch device driver uses the mdio bus independently.
The pin pins used by mdio are:
E7 RGMII_SMA_MDIO EQOS_SMA_MDIO
E6 RGMII_SMA_MDC EQOS_SMA_MDC

switch device ic:rtl8364nbi
USED:JetPack 5.0.2
Do you have any examples?

Mdio is working normally,
However, the

/* initialize MAC/MTL/DMA Common registers */
ret = osi_hw_core_init(pdata->osi_core,
pdata->hw_feat.tx_fifo_size,
pdata->hw_feat.rx_fifo_size);

function returns - 1;

请问,内核驱动文件:nvidia/drivers/net/ethernet/nvidia/nvethernet/ether_linux.c 中函数ether_probe过程中的:
ioctl_data.cmd = OSI_CMD_GET_HW_FEAT;
ret = osi_handle_ioctl(osi_core, &ioctl_data);
这两行是做什么的?另是否要求 phy 在工作中?

please refer to
https://docs.nvidia.com/jetson/archives/r35.1/DeveloperGuide/text/HR/JetsonModuleAdaptationAndBringUp/JetsonAgxOrinSeries.html?highlight=rgmii#for-switch

我使用 rtl8211 的 rgmii 接口是没有问题的,同样的配置使用 switch ic rtl8364nbi ,有问题

請問你的”同一配置”是什麼意思?

RGMII跟switch 在文件中就是兩個不同配置的狀況…

——

What does that mean here?

RGMII and switch are using different configuration in our document…

使用 rtl8211的 rgmii 相关配置是一样的,只是在 mido 注册后面增加了mdio 总线 对 rtl8364nbi 初始化 函数,

所以你是想表達你是在用RGMII switch嗎?

Are you saying that you are using RGMII switch?

是的,同时也是说明,rgmii 在接 网卡时是能正常工作的,

那請問你在switch狀況下的device tree 怎樣寫?

Could you share what is your device tree setup when using RGMII switch?

因为同是 rgmii 接口,所以,我没有修改 device tree

麻煩照著別人這邊的例子試試看

Please try with the example shared by other users here first.

我们需要需求跟你发的有很大区别;需要使用的是 mdio 总线对 rtl8364nbi 进行 初始化,有 reset gpio 和interrupt GPIO。

Hi,

Ok, 所以你這個還是RGMII phy.

可以請你確認一下用RGMII device tree的狀況下mdio bus下面用的phy driver是哪個嗎?


Ok, so you are still using RGMII phy,

If so, could you check what phy driver is in use under mdio bus with default RGMII device tree?

我目前的配置如下:
/ {
/* EQOS SWITCH*/
ethernet@2310000 {
status = “okay”;
nvidia,mac-addr-idx = <0>;
nvidia,phy-reset-gpio = <&tegra_main_gpio TEGRA234_MAIN_GPIO(G, 5) 0>;
phy-mode = “rgmii-id”;
phy-handle = <&phy>;
nvidia,max-platform-mtu = <16383>;
nvidia,pause_frames = <0>;

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

                    phy: phy@0 {
                            reg = <0>;
                            compatible = "ethernet-phy-id001c.c916";
                            device_type = "ethernet-phy";
                            #if TEGRA_ETHERNETPHY_DT_VERSION >= DT_VERSION_2
                            /* use phy in poll mode */
                            #else
                            interrupt-parent = <&tegra_main_gpio>;
                            interrupts = <TEGRA234_MAIN_GPIO(G, 4) IRQ_TYPE_LEVEL_LOW>;
                            #endif
                            /* Setup LED[2] as interrupt pin (active low) */
                        nvidia,phy-rst-pdelay-msec = <224>; /* msec */
                            nvidia,phy-rst-duration-usec = <10000>; /* usec */
                    };


            };

fixed-link {
speed = <1000>;
full-duplex;
};
};
};

[2022/11/24 14:55:45] [ 36.410566] nvethernet 2310000.ethernet: ether_open: failed to initialize MAC HW core with reason -1

上面是开机错误log

I mean go to /sys/bus/mdio_bus and check if the device is really using the correct PHY driver.

我没有把 switch ic 的驱动独立出去,而是放在了 ether_linux.c 文件中的 ether_open 函数下,
ioctl_data.cmd = OSI_CMD_POLL_FOR_MAC_RST;
ret = osi_handle_ioctl(osi_core, &ioctl_data);
该函数之后增加了 rtl8364_init。

Instead of separating the switch ic driver, I put it under the ether_open function in the ether_linux.c file,
ioctl_data.cmd = OSI_CMD_POLL_FOR_MAC_RST;
ret = osi_handle_ioctl(osi_core, &ioctl_data);
rtl8364_init is added after this function.

lulu@lulu:/sys/bus/mdio_bus/devices/2310000.ethernet:00/attached_dev/phydev$ sudo cat uevent
DEVTYPE=PHY
DRIVER=Generic PHY
OF_NAME=phy
OF_FULLNAME=/ethernet@2310000/mdio/phy@0
OF_TYPE=ethernet-phy
OF_COMPATIBLE_0=ethernet-phy-id001c.c45
OF_COMPATIBLE_N=1
MODALIAS=of:NphyTethernet-phyCethernet-phy-id001c.c45

开机log:
[2022/12/1 14:35:03] [ 36.878283] [eqos_flush_mtl_tx_queue][1085][type:0x2][loga-0x0] Poll FTQ bit timeout
[2022/12/1 14:35:03] [ 36.879055] nvethernet 2310000.ethernet: ether_open: failed to initialize MAC HW core with reason -1

从这个log 来看,是不是 phy 未就绪呀?