Closed huangya90 closed 1 year ago
Well...yes and no. You can certainly get to all the registers by manually following the steps laid out in the datasheet for each read/write. But I would really recommend that you write your own qca
addressing mode, which will handle all the gory details for you.
Have a look at https://github.com/wkz/mdio-tools/blob/master/src/mdio/xrs.c for a simple example. If you were to write the corresponding read/write implementations for your hardware, you could then say something like mdio 3* qca <REG>
to read a register.
Thanks. close this issue.
Hi,
Can I use this tool to read all registers of QCA 8337 switch? [1] is the datasheet. In chapter 5.1, we can see there are many registers are listed such as Global control registers, ACL control registers and Phy control registers. I expect we can use this tool like "mdio address width_of_register" to read and "mdio address width_of_register value" to write. "width_of_register" may be 8 bit or 16 bit. But I did not find example like this. Would you help? Thanks a lot.
Below is the output when I plug one cable to one port root@OpenWrt:/# mdio 37000000.mdio-mii fixed-0 root@OpenWrt:/# mdio 3* DEV PHY-ID LINK 0x00 0x004dd036 down 0x01 0x004dd036 down 0x02 0x004dd036 down 0x03 0x004dd036 down 0x04 0x004dd036 up 0x10 0x00000760 down 0x11 0x00000000 down 0x12 0x12000000 down 0x13 0x00000000 down 0x14 0x00000000 down 0x15 0x00000000 up 0x16 0x00000000 down 0x17 0x00000000 down 0x18 0x00000760 down
After unplug the same cable: root@OpenWrt:/# mdio 3* DEV PHY-ID LINK 0x00 0x004dd036 down 0x01 0x004dd036 down 0x02 0x004dd036 down 0x03 0x004dd036 down 0x04 0x004dd036 down 0x10 0x00000760 down 0x11 0x00000000 down 0x12 0x12000000 down 0x13 0x00000000 down 0x14 0x00000000 down 0x15 0x00000000 up 0x16 0x00000000 down 0x17 0x00000000 down 0x18 0x00000760 down
[1] https://github.com/Deoptim/atheros/blob/master/QCA8337-datasheet.pdf