Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X96Max+ PHY (IP1001M) support #258

Closed
psergeevich opened this issue Apr 22, 2022 · 37 comments
Closed

X96Max+ PHY (IP1001M) support #258

psergeevich opened this issue Apr 22, 2022 · 37 comments
Labels
question Further information is requested support This need is supported

Comments

@psergeevich
Copy link

The ICPLUS IP1001M Ethernet Transceiver installed on TV-box, and it does not supported by Armbian. There are driver sources: https://github.com/torvalds/linux/blob/master/drivers/net/phy/icplus.c
Can you add IP1001M support to your Armbian image?

@ophub
Copy link
Owner

ophub commented Apr 23, 2022

Thanks for sharing, I will test it

@ophub
Copy link
Owner

ophub commented Apr 23, 2022

do you have this device? Take a photo. You need to take more high-definition pictures. Around the chip, the package of ip1001 is different from that of 8211, and the external network components are different. There are also startup logs.

@psergeevich
Copy link
Author

Ether

@psergeevich
Copy link
Author

Общий вид

@psergeevich
Copy link
Author

общий вид

@psergeevich
Copy link
Author

You can point places, which interest you, and I will take a photo of them. More photos here: https://drive.google.com/drive/folders/1sEZd837fwvmknJ2FtDvdf_i-f9Y1YnNm?usp=sharing

@ophub
Copy link
Owner

ophub commented Apr 23, 2022

Okay, let's share a few days first

@ophub
Copy link
Owner

ophub commented Apr 23, 2022

Take a frontal photo around the ip1001m chip, take a few more photos, and take a look at the surrounding package structure.

@psergeevich
Copy link
Author

log.zip

@psergeevich
Copy link
Author

IMG_20220423_202938
IMG_20220423_203017
IMG_20220423_203034
IMG_20220423_203044
IMG_20220423_203108
IMG_20220423_203125
IMG_20220423_203135
IMG_20220423_203156
IMG_20220423_203356
IMG_20220423_203411
IMG_20220423_203423
IMG_20220423_203448
IMG_20220423_203548
IMG_20220423_203608
IMG_20220423_203622

@ophub
Copy link
Owner

ophub commented Apr 24, 2022

1
2

According to the log, the phy addr is incorrect, so it is necessary to measure the addr, specifically whether the level of the above 5 pins is high or low. The phy addr of RTL8211F is 0, but this value may be other values, there are 32 kinds from 00000-11111, or you can try one by one.

3

If you have a multimeter, it is very convenient, you can get the correct result once you measure it, otherwise you have to keep changing the dtb

4

These two feet are also tested, involving the values of rx_delay and tx_delay

2007171936_IC-Plus-IP1001M_C703552.pdf

@psergeevich
Copy link
Author

Pins and voltages:
48 - 3.3v
49 - 3.3v
50 - 0.18v
51 - 0.18v
53 - 0.18v
7 - 1.8v
8 - 1.8v

@ophub
Copy link
Owner

ophub commented Apr 25, 2022

Received, thanks for the feedback

@ophub
Copy link
Owner

ophub commented Apr 25, 2022

@psergeevich

ip1001m-dtb.zip

According to your feedback, there are a total of 4 possibilities. You download the file and decompress it, put the 4 dtb files into the /boot/dtb/amlogic directory, modify the dtb file name in /boot/uEnv.txt, and see which one It can drive your IP1001M network card normally, and feedback the results after the test, thank you. reboot after each modification to see if the network is normal.

dmesg | grep eth

@ophub ophub added the question Further information is requested label Apr 25, 2022
@psergeevich
Copy link
Author

All 4 dtb-files working normally. After reboot with each of them network is normal.
I tested download/upload internet speed with "speedtest" python packet, and all results the same (about 50 Mbit/s).
I tested download speed with wget 50 MB file and found differences:
meson-sm1-x96-max-plus-ip1001m-id - best results. First downloading about 2MB/s, subsequents - 6 MB/s
meson-sm1-x96-max-plus-ip1001m-rxid - all attempts about 2 - 2.5 MB/s
meson-sm1-x96-max-plus-ip1001 - about 800-900 MB/s
meson-sm1-x96-max-plus-ip1001m-txid - about 500 - 600 MB/s

Interface speed was 100 Mbit/s, because I did not have gigabit switch. Boot logs and another info I will send further.

@psergeevich
Copy link
Author

results.zip

@ophub ophub added the support This need is supported label Apr 26, 2022
@ophub
Copy link
Owner

ophub commented Apr 26, 2022

@psergeevich

IP1001MDTB.zip

meson-sm1-x96-max-plus-ip1001 - about 800-900 MB/s
meson-sm1-x96-max-plus-ip1001m-txid - about 500 - 600 MB/s

These two are the first choice, but the first one cannot be optimized, and the second one can be further fine-tuned. Attached is the fine-tuned dtb, you can test which one is better.
Need to use iperf3 test to get more accurate test data, data in both directions of uplink and downlink

iPerf3 Speed Test Tool:
https://iperf.fr/iperf-doc.php
https://www.jianshu.com/p/01cc7f11bbb9

@psergeevich
Copy link
Author

I connected X96Max+ to PC with gigabit ethernet adapter (192.168.5.3) and launched iperf3 -s on PC. On X96Max+ I launched 3 times for every .dtb:

iperf3 -c 192.168.5.3
iperf3 -c 192.168.5.3 -R
iperf3 -c 192.168.5.3 -u -b 0
iperf3 -c 192.168.5.3 -u -b 0 -R

All results are stored in files named xxxr.y, where:
xxx - last digits in .dtb-file name
r - present if reverse mode (-R key) used
y - test sequence number (0 - 2)
All files I will send further.

@psergeevich
Copy link
Author

results.zip

@ophub
Copy link
Owner

ophub commented Apr 27, 2022

Thank you very much for your test. Now the dtb file of 2800 is tentatively used. Please execute the following command and give feedback on the execution result. This should be added to the comments of the dts file.

cat /sys/class/net/eth0/phydev/phy_id

@psergeevich
Copy link
Author

execution result: 0x02430d91

@ophub
Copy link
Owner

ophub commented Apr 27, 2022

Thank you very much for the very detailed test report for x96max plus v5.1 (ip1001m phy), your contribution has been recorded in the contributor list. Now unifreq has added that dtb in his relevant kernel. In the future, more users of this network card can benefit from your contribution.

unifreq/linux-5.15.y@bca00ac

unifreq/linux-5.10.y@2d09c24

unifreq/linux-5.4.y@172adad

unifreq/linux-5.17.y@e983ac4

@harrydou123
Copy link

I found my tvbox model X96Max_Plus2_AI has a ip1001m chip. It's ethernet works fine in anroid9.

Recently I tested the armbian system, changed uEnv.txt FDT option to meson-sm1-x96-max-plus-ip1001m.dtb in /dtb/amlogic/ directory and above zips, but the eth0 still doesn't work.

I missed something? need recompile a new kernel?

uname -a
Linux armbian 5.10.113-meson64-dev #2 SMP PREEMPT Wed Apr 27 13:15:52 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

dmesg |grep eth
[ 0.000000] psci: probing for conduit method from DT.
[ 5.519913] meson8b-dwmac ff3f0000.ethernet: IRQ eth_wake_irq not found
[ 5.521299] meson8b-dwmac ff3f0000.ethernet: IRQ eth_lpi not found
[ 5.527612] meson8b-dwmac ff3f0000.ethernet: PTP uses main clock
[ 5.534122] meson8b-dwmac ff3f0000.ethernet: no reset control found
[ 5.540709] meson8b-dwmac ff3f0000.ethernet: User ID: 0x11, Synopsys ID: 0x37
[ 5.547574] meson8b-dwmac ff3f0000.ethernet: DWMAC1000
[ 5.551837] meson8b-dwmac ff3f0000.ethernet: DMA HW capability register supported
[ 5.560032] meson8b-dwmac ff3f0000.ethernet: RX Checksum Offload Engine supported
[ 5.566677] meson8b-dwmac ff3f0000.ethernet: COE Type 2
[ 5.571846] meson8b-dwmac ff3f0000.ethernet: TX Checksum insertion supported
[ 5.579626] meson8b-dwmac ff3f0000.ethernet: Wake-Up On Lan supported
[ 5.585213] meson8b-dwmac ff3f0000.ethernet: Normal descriptors
[ 5.591853] meson8b-dwmac ff3f0000.ethernet: Ring mode enabled
[ 5.596857] meson8b-dwmac ff3f0000.ethernet: Enable RX Mitigation via HW Watchdog Timer
[ 17.816440] meson8b-dwmac ff3f0000.ethernet eth0: no phy at addr -1
[ 17.820112] meson8b-dwmac ff3f0000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[ 17.991023] meson8b-dwmac ff3f0000.ethernet eth0: no phy at addr -1
[ 17.993989] meson8b-dwmac ff3f0000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[ 18.022483] meson8b-dwmac ff3f0000.ethernet eth0: no phy at addr -1
[ 18.025340] meson8b-dwmac ff3f0000.ethernet eth0: stmmac_open: Cannot attach to PHY (error: -19)
[ 18.068480] meson8b-dwmac ff3f0000.ethernet eth0: no phy at addr -1

@ophub
Copy link
Owner

ophub commented May 9, 2022

Download today's firmware test

@harrydou123
Copy link

换成5月9日固件错识依旧。拆了测电压和psergeevich测的数据基本一致,但pin7不同。我测的pin7电压0.17v,与上面的数据电平相反。
我对arm dtb dts转换不是很熟,帮我生成一个dtb文件测试,将不胜感激。

@ophub
Copy link
Owner

ophub commented May 10, 2022

用dtc工具反编译成dts,修改后再编译成dtb

安装工具包:
sudo apt install device-tree-compiler

这是反编译命令:
dtc -I dtb -O dts -o /tmp/xxxxx.dts xxxxxx.dtb

这是编译命令:
dtc -I dts -O dtb -o xxxxxxx .dtb xxxxxxxx.dts

@ophub
Copy link
Owner

ophub commented May 14, 2022

换成5月9日固件错识依旧。拆了测电压和psergeevich测的数据基本一致,但pin7不同。我测的pin7电压0.17v,与上面的数据电平相反。
我对arm dtb dts转换不是很熟,帮我生成一个dtb文件测试,将不胜感激。

@harrydou123
把你的测量结果发一下,#309 (comment) 他今天反应说现在的dtb在usb使用正常,写入emmc后网络无法使用。
用你的测试结果生成一个dtb试试

@harrydou123
Copy link

不好意,忙回复晚了。我用dtc工具作了穷举测试USB启动都没成功。万用表笔不趁手,正在网购中,我尽快反馈。
box版本号Q5X3_141 V5.1 21094, 板号D0709 7006 QC PASS GJHY 4+64

@ophub
Copy link
Owner

ophub commented May 18, 2022

@psergeevich @harrydou123

#309

psergeevich重新测试了,结果还是一样的,等你测试完了反馈下

@harrydou123
Copy link

harrydou123 commented May 19, 2022

测了一下最新版本Armbian_Aml_jammy_server_05.18.2024中的Armbian_22.05.0_Aml_s905x3_jammy_5.10.116_2022.05.18.1932.img镜像,出现多个版本都能重现的问题,只是不同版本phandler冲突值不同。

按照5.10内核补丁提示,比较两个设备树。
diff meson-sm1-x96-max-plus-oc.dts meson-sm1-x96-max-plus-ip1001m.dts

261c261
<                       rx-internal-delay-ps = <0x320>;
---
>                       rx-internal-delay-ps = <0xaf0>;
1821,1822c1821,1822
<                                       ethernet-phy@0 {
<                                               reg = <0x00>;
---
>                                       ethernet-phy@3 {
>                                               reg = <0x03>;
2699c2699
<                                       compatible = "realtek,rtl8822cs-bt";
---
>                                       compatible = "brcm,bcm43438-bt";
2709c2709
<                                       status = "disabled";
---
>                                       status = "okay";


根据上下文,得到meson-sm1-x96-max-plus-ip1001m.dts

1807                         mdio-multiplexer@4c000 {
1808                                 compatible = "amlogic,g12a-mdio-mux";
1809                                 reg = <0x00 0x4c000 0x00 0xa4>;
1810                                 clocks = <0x02 0x13 0x1b 0x02 0xb1>;
1811                                 clock-names = "pclk\0clkin0\0clkin1";
1812                                 mdio-parent-bus = <0x1d>;
1813                                 #address-cells = <0x01>;
1814                                 #size-cells = <0x00>;
1815
1816                                 mdio@0 {
1817                                         reg = <0x00>;
1818                                         #address-cells = <0x01>;
1819                                         #size-cells = <0x00>;
1820
1821                                         ethernet-phy@3 {
1822                                                 reg = <0x03>;
1823                                                 max-speed = <0x3e8>;
1824                                                 reset-assert-us = <0x2710>;
1825                                                 reset-deassert-us = <0x13880>;
1826                                                 reset-gpios = <0x1e 0x0f 0x07>;
1827                                                 interrupt-parent = <0x1f>;
1828                                                 interrupts = <0x1a 0x08>;
1829                                                 phandle = <0x13>;
1830                                         };
1831                                 };
1832
1833                                 mdio@1 {
1834                                         reg = <0x01>;
1835                                         #address-cells = <0x01>;
1836                                         #size-cells = <0x00>;
1837
1838                                         ethernet_phy@8 {
1839                                                 compatible = "ethernet-phy-id0180.3301\0ethernet-phy-ieee802.3-c22";
1840                                                 interrupts = <0x00 0x09 0x04>;
1841                                                 reg = <0x08>;
1842                                                 max-speed = <0x64>;
1843                                         };
1844                                 };
1845                         };

在系统设置arm中armbian-config中,逐层找到armbian-config--System--Dtc--current.dts,mdio@0中ethernet-phy@3部分未加载。

1778                         mdio-multiplexer@4c000 {
1779                                 compatible = "amlogic,g12a-mdio-mux";
1780                                 reg = <0x00 0x4c000 0x00 0xa4>;
1781                                 clocks = <0x02 0x13 0x18 0x02 0xb1>;
1782                                 clock-names = "pclk\0clkin0\0clkin1";
1783                                 mdio-parent-bus = <0x1a>;
1784                                 #address-cells = <0x01>;
1785                                 #size-cells = <0x00>;
1786
1787                                 mdio@0 {
1788                                         reg = <0x00>;
1789                                         #address-cells = <0x01>;
1790                                         #size-cells = <0x00>;
1791                                 };
1792
1793                                 mdio@1 {
1794                                         reg = <0x01>;
1795                                         #address-cells = <0x01>;
1796                                         #size-cells = <0x00>;
1797
1798                                         ethernet_phy@8 {
1799                                                 compatible = "ethernet-phy-id0180.3301\0ethernet-phy-ieee802.3-c22";
1800                                                 interrupts = <0x00 0x09 0x04>;
1801                                                 reg = <0x08>;
1802                                                 max-speed = <0x64>;
1803                                                 phandle = <0x11>;
1804                                         };
1805                                 };
1806                         };

将差别部分

1822                                                 reg = <0x03>;
1823                                                 max-speed = <0x3e8>;
1824                                                 reset-assert-us = <0x2710>;
1825                                                 reset-deassert-us = <0x13880>;
1826                                                 reset-gpios = <0x1e 0x0f 0x07>;
1827                                                 interrupt-parent = <0x1f>;
1828                                                 interrupts = <0x1a 0x08>;
1829                                                 phandle = <0x13>;
1830                                         };

插入current.dts,由armbian自己生成dtb文件,和hdmi部分的phandle号冲突,报以下错误:
/tmp/tmp.mWkYh9rd2Q/current.dts:1792.56-1801.43: ERROR (explicit_phandles): /soc/bus@ff600000/mdio-multiplexer@4c000/mdio@0/ethernet-phy@3: duplicated phandle 0x13 (seen before at /soc/bus@ff600000/bus@34400/pinctrl@40/hdmitx_ddc)

diff.zip

@harrydou123
Copy link

harrydou123 commented May 19, 2022

补充:
我不懂arm,phandle瞎赋值0xff是可以通过的,但无效。
还有ethernet-phy和ethernet_phy同时出现在上下文是什么情况?
不懂就问:)

特细的表笔发货慢已动态清零,重新买了个有细笔头的万用表,针脚电压请再等几日。

@harrydou123
Copy link

harrydou123 commented May 19, 2022

附件是我从网卡可以正常工作的android9系统/proc/device-tree中copy下来的 ethernet@ff3f0000目录,不知是否有帮助。
ethernet@ff3f0000.zip

@harrydou123
Copy link

我测的电压
48--3.35
49--3.35
50--0.17
51--0.17
7---0.17
8---3.35

@ophub
Copy link
Owner

ophub commented Jun 1, 2022

@harrydou123

meson-sm1-x96-max-plus-ip1001m.dtb.zip

Download this file and unzip it, then overwrite the file with the same name in /boot/dtb/amlogic/meson-sm1-x96-max-plus-ip1001m.dtb and restart it.

Feedback the test results.

@Loncc
Copy link

Loncc commented Jul 25, 2022

最新的dtb armbian不会报error-19了,但是连接电脑会一直无法获取ip地址。
The latest dtb wont cause armbian error -19, but when I connect it to my PC, my PC still cannnot get ip address.

@QQ43935353
Copy link

QQ43935353 commented Apr 21, 2023

How can I get in touch with you. My box is also ip1001M, which can only use 100M rate. Please help to debug it. Thanks

48 - 0v
49 - 0v
50 - 2.53v
51 - 2.53v
53 - 2.53v
7 - 2.53v
8 - 0v

https://github.com/cm9vdA/build-linux/blob/master/boot/dts/amlogic/mainline/deprecated/meson-g12b-magic-cube-x1.dts

@QQ43935353
Copy link

Android 9 system dts

ethernet@ff3f0000 {
compatible = "amlogic, g12a-eth-dwmac", "snps,dwmac";
reg = <0x0 0xff3f0000 0x0 0x10000 0x0 0xff634540 0x0 0x8 0x0 0xff64c000 0x0 0xa0 0x0 0xffd01008 0x0 0x4>;
reg-names = "eth_base", "eth_cfg", "eth_pll", "eth_reset";
interrupts = <0x0 0x8 0x1>;
interrupt-names = "macirq";
status = "okay";
clocks = <0x13 0x38>;
clock-names = "ethclk81";
pll_val = <0x9c0040a 0x927e0000 0xac5f49e5>;
analog_val = <0x20200000 0xc000 0x23>;
pinctrl-names = "external_eth_pins";
pinctrl-0 = <0x29>;
mc_val = <0x1609>;
cali_val = <0x80000>;
internal_phy = <0x0>;
phandle = <0xb0>;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested support This need is supported
Projects
None yet
Development

No branches or pull requests

5 participants