自学内容网 自学内容网

20241114给荣品PRO-RK3566开发板刷Rockchip原厂的Android13下适配RJ45以太网卡

20241114给荣品PRO-RK3566开发板刷Rockchip原厂的Android13下适配RJ45以太网卡
2024/11/14 15:44


缘起:使用EVB2的方案,RJ45加进去怎么也不通。
实在没有办法,只能将荣品的SDK:rk-android13-20240713.tgz
解压缩,编译之后。
从中析取最小的DTS,然后拿掉不用的部分,比如LCD/TP等。
很艰难地得知/根据经验/很容易知道RJ45以太网卡的DTS代码块在这里:rp-gmac1-m0-pro-rk3566.dtsi


以太网卡终于可以打开了,但是还是有小BUG:
1、千兆网啊变成百兆网卡了。难道还有4根线中有GPIO引脚被复用了?
2、iperf3不能连接,原因待查。


Z:\Android13.0\kernel-5.10\arch\arm64\boot\dts\rockchip21\rk356x\rp-gmac1-m0-pro-rk3566.dtsi
Z:\repo_rk356x_android13\kernel-5.10\arch\arm64\boot\dts\rockchip\rk3566-evb2-lp4x-v10.dtsi

&dsi1_panel {
    power-supply = <&vcc3v3_lcd1_n>;
    reset-gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>;
    pinctrl-names = "default";
    pinctrl-0 = <&lcd1_rst_gpio>;
};

&gmac1 {
    phy-mode = "rgmii";
    clock_in_out = "output";

    snps,reset-gpio = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
    snps,reset-active-low;
    /* Reset time is 20ms, 100ms for rtl8211f */
    snps,reset-delays-us = <0 20000 100000>;

    assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>;
    assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&cru CLK_MAC1_2TOP>;
    assigned-clock-rates = <0>, <125000000>;

    pinctrl-names = "default";
    pinctrl-0 = <&gmac1m1_miim
             &gmac1m1_tx_bus2
             &gmac1m1_rx_bus2
             &gmac1m1_rgmii_clk
             &gmac1m1_rgmii_bus>;

    tx_delay = <0x4f>;
    rx_delay = <0x25>;

    phy-handle = <&rgmii_phy0>;
    status = "okay";
};

&i2c2 {

修改为:

&dsi1_panel {
    power-supply = <&vcc3v3_lcd1_n>;
    reset-gpios = <&gpio3 RK_PA4 GPIO_ACTIVE_LOW>;
    pinctrl-names = "default";
    pinctrl-0 = <&lcd1_rst_gpio>;
};

&gmac1 {
    phy-mode = "rgmii";
    clock_in_out = "input";

    snps,reset-gpio = <&gpio3 RK_PB4 GPIO_ACTIVE_LOW>;
    snps,reset-active-low;
    /* Reset time is 20ms, 100ms for rtl8211f */
    snps,reset-delays-us = <0 20000 100000>;

    assigned-clocks = <&cru SCLK_GMAC1_RX_TX>, <&cru SCLK_GMAC1>, <&cru CLK_MAC1_OUT>;
    assigned-clock-parents = <&cru SCLK_GMAC1_RGMII_SPEED>, <&gmac1_clkin>;
    assigned-clock-rates = <0>, <125000000>, <25000000>;

    pinctrl-names = "default";
    pinctrl-0 = <&gmac1m0_miim
             &gmac1m0_tx_bus2
             &gmac1m0_rx_bus2
             &gmac1m0_rgmii_clk
             &gmac1m0_rgmii_bus
             &gmac1m0_clkinout
             &eth1m0_pins>;

    tx_delay = <0x27>;
    rx_delay = <0x0c>;

    phy-handle = <&rgmii_phy1>;
    status = "okay";
};

&i2c2 {


&i2s2_2ch {
    pinctrl-0 = <&i2s2m0_sclktx &i2s2m0_lrcktx &i2s2m0_sdi &i2s2m0_sdo>;
    rockchip,bclk-fs = <32>;
    status = "disabled";
};

&mdio1 {
    rgmii_phy0: phy@0 {
        compatible = "ethernet-phy-ieee802.3-c22";
        reg = <0x0>;
    };

};

/*
 * power-supply should switche to vcc3v3_lcd1_n
 * when mipi panel is connected to dsi1.
 */
&gt1x {
    power-supply = <&vcc3v3_lcd0_n>;
};


修改为:

&i2s2_2ch {
    pinctrl-0 = <&i2s2m0_sclktx &i2s2m0_lrcktx &i2s2m0_sdi &i2s2m0_sdo>;
    rockchip,bclk-fs = <32>;
    status = "disabled";
};

&mdio1 {
    rgmii_phy1: phy@0 {
        compatible = "ethernet-phy-ieee802.3-c22";
        reg = <0x0>;
        clocks = <&cru CLK_MAC1_OUT>;
    };

};

/*
 * power-supply should switche to vcc3v3_lcd1_n
 * when mipi panel is connected to dsi1.
 */
&gt1x {
    power-supply = <&vcc3v3_lcd0_n>;
};

你加进去EVB2之后,还是不会找到以太网卡的!^_
于是用荣品的DTS和原厂的EVB2的DTS进行比对。
很艰难地得知/根据经验/很容易知道是显示部分影响了RJ45以太网卡。
我就简单干脆地关闭DSI0/DSI1和TP。


以太网卡终于可以打开了,但是还是有小BUG:
1、千兆网啊变成百兆网卡了。难道还有4根线中有GPIO引脚被复用了?
2、iperf3不能连接,原因待查。


viewpro@viewpro-ThinkBook-16-G5-IRH:~$ 
viewpro@viewpro-ThinkBook-16-G5-IRH:~$ iperf3 -c 192.168.3.149 -i 1 -t 36
Connecting to host 192.168.3.149, port 5201
[  5] local 192.168.3.71 port 43656 connected to 192.168.3.149 port 5201
iperf3: error - control socket has closed unexpectedly
viewpro@viewpro-ThinkBook-16-G5-IRH:~$ 


参考资料:
SDK\docs\cn\Common\GMAC\Rockchip_Developer_Guide_Linux_GMAC_CN.pdf


原文地址:https://blog.csdn.net/wb4916/article/details/143780637

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!