Read/Modify Phy registers at Linux in custom board based on LS1046A

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Read/Modify Phy registers at Linux in custom board based on LS1046A

2,552 Views
Ghouse
Contributor V

HI All,

Iam using a custom board based on LS1046ARDB, however iam using Marvel Phy 88e1512 in my design.

I want to read/modify the Phy registers at Linux, please note that iam able to read/modify the phy at u-boot using : mii read and mii write commands, but iam unable to read/modify when the linux boots.

Although i used the ethtool -d command, but it is not working in the linux.

PLease provide your help/support

Thank u.

0 Kudos
Reply
6 Replies

2,510 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please enable CONFIG_MARVELL_PHY in you Linux Kernel configuration file.

Please modify the following in dts file arch/arm64/boot/dts/freescale/fsl-ls1046a-rdb.dts to specify phy address in "reg" property. You could get phy address with command "mdio list" in u-boot prompt.

mdio@fc000 {
rgmii_phy1: ethernet-phy@1 {
reg = <0x1>;
rtl821x,aldps-disable;
};

rgmii_phy2: ethernet-phy@2 {
reg = <0x2>;
rtl821x,aldps-disable;
};

sgmii_phy1: ethernet-phy@3 {
reg = <0x3>;
};

sgmii_phy2: ethernet-phy@4 {
reg = <0x4>;
};
};

0 Kudos
Reply

2,504 Views
Ghouse
Contributor V

Hi @yipingwang 

Thank u for the reply,

Changes as indicated are made,

Please note that iam able to read/modify phy registers at uboot, however i want to read/modify the phy register after booting to Linux terminal.

Although i tried using "ethtool -d fm1-mac3"  but i got following error

"Cannot get register dump: Operation not supported"

Please let me know what can be done.

Thank u.

0 Kudos
Reply

2,453 Views
yipingwang
NXP TechSupport
NXP TechSupport

I also got the same result on LS1046ARDB after typing command "ethtool -d fm1-mac3". You can see register dump is not supported with the following command.

root@ls1046ardb:~# ethtool -i fm1-mac3
driver: fsl_dpa
version: 5.15.71
firmware-version: 0
expansion-rom-version:
bus-info: soc:fsl,dpaa
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: no
supports-priv-flags: no
root@ls1046ardb:~#

 

Please run "ethtool fm1-mac3" to get the general PHY information and verify whether you can run ping command successfully through fm1-mac3.

root@ls1046ardb:~# ethtool fm1-mac3
Settings for fm1-mac3:
Supported ports: [ MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supported pause frame use: Symmetric Receive-only
Supports auto-negotiation: Yes
Supported FEC modes: Not reported
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised pause frame use: Symmetric Receive-only
Advertised auto-negotiation: Yes
Advertised FEC modes: Not reported
Link partner advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Link partner advertised pause frame use: No
Link partner advertised auto-negotiation: Yes
Link partner advertised FEC modes: Not reported
Speed: 1000Mb/s
Duplex: Full
Auto-negotiation: on
master-slave cfg: preferred slave
master-slave status: master
Port: Twisted Pair
PHYAD: 1
Transceiver: external
MDI-X: Unknown
Supports Wake-on: d
Wake-on: d
Current message level: 0x00007fff (32767)
drv probe link timer ifdown ifup rx_err tx_err tx _queued intr tx_done rx_status pktdata hw wol
Link detected: yes

0 Kudos
Reply

2,441 Views
Ghouse
Contributor V

Hi @yipingwang 

Thanks for the reply,

I have used the command ethtool -i fm1-mac3 but the Fiber link is not up, please note that my main intention is to modify the Marvell Phy Reg 20_18.2:0  to value 0x6(so that the fiber mode is up).

In u boot mode i was able to modify the phy register using miiread and miiwrite commands and iam able to ping the fiber interface successfully.

the problem is when the OS boots, i dont know how to modify that Marvell Phy Register.

Please help me out.

Thank u.

 

Tags (1)
0 Kudos
Reply

2,426 Views
yipingwang
NXP TechSupport
NXP TechSupport

For PHY registers read and write, you could clone phytool and build it from: https://github.com/wkz/phytool.git

Then copy phytool to the target board to use it.

In the default Linux Kernel driver, phytool write is not supported, you need to apply the attached patches.

0 Kudos
Reply

2,128 Views
Ghouse
Contributor V

Hi @yipingwang ,

I have used the patched and now iam able to successfully modify the phy registers at the OS level using the phytool.

I am also using the following command to change the interface settings for the OPtical to work, and it is working fine.

ethtool -s fm1-mac3 autoneg off speed 1000 duplex full

Now, Iam using KNI in my project and i have assigned the KNI to fm1-mac4, can i use the same commands to read phy connected to the KNI???

 

Please provide your help/support.

Thank u.

0 Kudos
Reply