Giter Site home page Giter Site logo

mdio-tools's People

Contributors

bmork avatar mhei avatar robimarko avatar sean-anderson-seco avatar troglobit avatar wkz avatar yegorich avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mdio-tools's Issues

Access PHY pages on LinkStreet

Hi!

I would like to read some values from other pages of the phy register in a LinkStreet Marvell.

I'm able to read the ID without any problems:

mdio mv* mvls 0 raw 0x03:2
0x0141

I can also change the page and read the temperature. But I would like to avoid the risk talked about out here and keep the operation atomic.

Is this possible?

Big thanks!

Custom Assembler Scripts

  • Implement a serializer/deserializer for a textual representation of mdio-netlink assembler
  • Add mdio BUS exec my-program.s, which would run the program and print any emitted data to stdout
  • Add a global -n/--dry-run option to mdio, which would dump the generated assembler for a given command.

Question install procedure mdio-tools

Hello WKZ,

i try to install the mdio-tools under Ubuntu 20.04 LTS. Following log:

ubuntu@ubuntu-VirtualBox:~/Desktop/mdio-tools-1.0.1$ cd kernel/
ubuntu@ubuntu-VirtualBox:~/Desktop/mdio-tools-1.0.1/kernel$ make
make -C /lib/modules/5.8.0-53-generic/build M=/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel modules
make[1]: Entering directory '/usr/src/linux-headers-5.8.0-53-generic'
  CC [M]  /home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.o
  MODPOST /home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/Module.symvers
  CC [M]  /home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.mod.o
  LD [M]  /home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.8.0-53-generic'
ubuntu@ubuntu-VirtualBox:~/Desktop/mdio-tools-1.0.1/kernel$ cd ..
ubuntu@ubuntu-VirtualBox:~/Desktop/mdio-tools-1.0.1$ ./configure --prefix=/usr && make all && sudo make install
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking whether make supports the include directive... yes (GNU style)
checking dependency style of gcc... gcc3
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for mnl... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/Makefile
config.status: creating man/Makefile
config.status: creating src/Makefile
config.status: creating src/mdio/Makefile
config.status: creating src/mvls/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
make  all-recursive
make[1]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
Making all in man
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/man'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/man'
Making all in src
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
Making all in mdio
make[3]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mdio'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mdio'
Making all in mvls
make[3]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mvls'
make[3]: Nothing to be done for 'all'.
make[3]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mvls'
make[3]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
Making all in include
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/include'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/include'
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
make[1]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
[sudo] password for ubuntu: 
Making install in man
make[1]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/man'
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/man'
make[2]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/share/man/man8'
 /usr/bin/install -c -m 644 mdio.8 mvls.8 '/usr/share/man/man8'
 /usr/bin/mkdir -p '/usr/share/man/man9'
 /usr/bin/install -c -m 644 mdio-netlink.9 '/usr/share/man/man9'
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/man'
make[1]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/man'
Making install in src
make[1]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
Making install in mdio
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mdio'
make[3]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mdio'
 /usr/bin/mkdir -p '/usr/sbin'
  /usr/bin/install -c mdio '/usr/sbin'
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mdio'
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mdio'
Making install in mvls
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mvls'
make[3]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mvls'
 /usr/bin/mkdir -p '/usr/sbin'
  /usr/bin/install -c mvls '/usr/sbin'
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mvls'
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src/mvls'
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
make[3]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
make[3]: Nothing to be done for 'install-exec-am'.
make[3]: Nothing to be done for 'install-data-am'.
make[3]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
make[1]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/src'
Making install in include
make[1]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/include'
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/include'
make[2]: Nothing to be done for 'install-exec-am'.
make[2]: Nothing to be done for 'install-data-am'.
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/include'
make[1]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1/include'
make[1]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
make[2]: Entering directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
make[2]: Nothing to be done for 'install-exec-am'.
 /usr/bin/mkdir -p '/usr/share/doc/mdio-tools'
 /usr/bin/install -c -m 644 README.md ChangeLog.md COPYING '/usr/share/doc/mdio-tools'
make[2]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
make[1]: Leaving directory '/home/ubuntu/Desktop/mdio-tools-1.0.1'
ubuntu@ubuntu-VirtualBox:~/Desktop/mdio-tools-1.0.1$ sudo mdio
modprobe: FATAL: Module mdio-netlink not found in directory /lib/modules/5.8.0-53-generic
ERROR: mdio-netlink module not detected, and could not be loaded.

If i run the tool after installation, I recieve the error that the kernel module not loaded. As workaround i use

sudo insmod mdio-netlink.ko

Then works the tool proper. Do you have an suggestion?

Thanks for your help. BR,
Andreas

mvls: failed discovering any devices: No error information

Hi,

First of all, thanks for the hard work on the tool, it has really helped me the last few months.

I am working on MikroTik RB5009 support for OpenWrt under 5.15, the mdio tool has proved extremely useful so far
with the MV88E6393X switch, it uses.
I just saw today that you have an mvls tool that is Link Street specific for providing various access to the switch using devlink.
This is something that would be really useful for me, so I tried using it, first of all, OpenWrt doesn't package it but that was easy to fix as well as updating the kernel module and userspace to 1.0.1 release(I have a PR for that).
But then I tried using it, but it failed with:

root@OpenWrt:/# mvls 
mvls: failed discovering any devices: No error information

I looked and the devlink part looks to be exposed just fine:

root@OpenWrt:/# devlink dev
mdio_bus/f212a200.mdio-mii:00
root@OpenWrt:/# devlink region
mdio_bus/f212a200.mdio-mii:00/global1: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/global2: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/atu: size 49152 snapshot []
mdio_bus/f212a200.mdio-mii:00/vtu: size 131072 snapshot []
mdio_bus/f212a200.mdio-mii:00/pvt: size 1024 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []
mdio_bus/f212a200.mdio-mii:00/port: size 64 snapshot []

The switch uses single-chip adressing.

Do you maybe have some ideas?

Regards,
Robert

Build 'mdio-netlink.c' fails with Ubuntu 18.04 LTS

Hi WKZ,

first of all thanks for the tool - it's really helpful in the Lab!

If I like to compile the Kernel Module in Ubuntu 18.04 LTS:

ubuntu@ubuntu-VirtualBox:~/Desktop/mdio-tools-1.0.1/kernel$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04.6 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.6 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

I got an error "error: implicit declaration of function ‘mdio_find_bus’":

ubuntu@ubuntu-VirtualBox:~/Desktop/mdio-tools-1.0.1/kernel$ make
make -C /lib/modules/5.4.0-91-generic/build M=/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel modules
make[1]: Entering directory '/usr/src/linux-headers-5.4.0-91-generic'
  CC [M]  /home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.o
/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.c: In function ‘mdio_nl_cmd_xfer’:
/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.c:386:14: error: implicit declaration of function ‘mdio_find_bus’; did you mean ‘mdio_nl_flush’? [-Werror=implicit-function-declaration]
  xfer.mdio = mdio_find_bus(nla_data(info->attrs[MDIO_NLA_BUS_ID]));
              ^~~~~~~~~~~~~
              mdio_nl_flush
/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.c:386:12: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
  xfer.mdio = mdio_find_bus(nla_data(info->attrs[MDIO_NLA_BUS_ID]));
            ^
cc1: some warnings being treated as errors
scripts/Makefile.build:270: recipe for target '/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.o' failed
make[2]: *** [/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel/mdio-netlink.o] Error 1
Makefile:1762: recipe for target '/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel' failed
make[1]: *** [/home/ubuntu/Desktop/mdio-tools-1.0.1/kernel] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.4.0-91-generic'
Makefile:7: recipe for target 'all' failed
make: *** [all] Error 2

Is the tool only for later os-releases suitable?

Thanks for your help! Best Regards Andreas

Sourcing release version from git tag is fragile

It has been brought to my attention (thanks @troglobit) that some distributions (notably Debian) will always run autoreconf on all packages.

The current flow only considers two scenarios:

  1. Building from git clone. configure must be generated, but .git is available so the version can be found.
  2. Building from release tarball. configure is already generated so it does not matter that .git is missing.

But in order to support regeneration of configure from release tarballs, the version info must be manually managed in configure.ac. Perhaps we can at least work out some way of appending git version info if it is available.

Cannot build mdio-netlink for kernel version 4.19 (I know it claims to be at least 5.2)

I have board with kernel version 4.19 and it seems like the tool is not compatible with that version. Is it true?
I checked here https://elixir.bootlin.com/linux/v4.19/ident and it looks like I am missing couple of functions, and build fails with error:

.../git/kernel/compat.h:14:33: error: 'MII_DEVADDR_C45_SHIFT' undeclared (first use in this function)
| 14 | return MII_ADDR_C45 | devad << MII_DEVADDR_C45_SHIFT | regnum;
| | ^~~~~~~~~~~~~~~~~~~~~
git/kernel/compat.h:14:33: note: each undeclared identifier is reported only once for each function it appears in
| ...git/kernel/mdio-netlink.c: At top level:
| ...git/kernel/mdio-netlink.c:288:23: error: implicit declaration of function 'NLA_POLICY_MAX' [-Werror=implicit-function-declaration]
| 288 | [MDIO_NLA_TIMEOUT] = NLA_POLICY_MAX(NLA_U16, 10 * MSEC_PER_SEC),
| | ^~~~~~~~~~~~~~
|...git/kernel/mdio-netlink.c:288:23: error: initializer element is not constant
| ...git/kernel/mdio-netlink.c:288:23: note: (near initialization for 'mdio_nl_policy[2].type')
|...git/kernel/mdio-netlink.c:289:23: error: implicit declaration of function 'NLA_POLICY_VALIDATE_FN' [-Werror=implicit-function-declaration]
| 289 | [MDIO_NLA_PROG] = NLA_POLICY_VALIDATE_FN(NLA_BINARY,
| | ^~~~~~~~~~~~~~~~~~~~~~
| ...git/kernel/mdio-netlink.c:289:23: error: initializer element is not constant
| ...git/kernel/mdio-netlink.c:289:23: note: (near initialization for 'mdio_nl_policy[3].type')
| ...git/kernel/mdio-netlink.c:285:67: warning: missing braces around initializer [-Wmissing-braces]
| 285 | static const struct nla_policy mdio_nl_policy[MDIO_NLA_MAX + 1] = {
| | ^
| ......
| 288 | [MDIO_NLA_TIMEOUT] = NLA_POLICY_MAX(NLA_U16, 10 * MSEC_PER_SEC),
| | { }
| 289 | [MDIO_NLA_PROG] = NLA_POLICY_VALIDATE_FN(NLA_BINARY,
| | {
| 290 | mdio_nl_validate_prog,
| 291 | 0x1000),
| | }
| ...git/kernel/mdio-netlink.c:285:67: warning: missing braces around initializer [-Wmissing-braces]
| 285 | static const struct nla_policy mdio_nl_policy[MDIO_NLA_MAX + 1] = {
| | ^
| ......
| 288 | [MDIO_NLA_TIMEOUT] = NLA_POLICY_MAX(NLA_U16, 10 * MSEC_PER_SEC),
| | { }
| 289 | [MDIO_NLA_PROG] = NLA_POLICY_VALIDATE_FN(NLA_BINARY,
| | {
| 290 | mdio_nl_validate_prog,
| 291 | 0x1000),
| | }
| ...git/kernel/mdio-netlink.c:285:67: warning: missing braces around initializer [-Wmissing-braces]
| 285 | static const struct nla_policy mdio_nl_policy[MDIO_NLA_MAX + 1] = {
| | ^
| ......
| 288 | [MDIO_NLA_TIMEOUT] = NLA_POLICY_MAX(NLA_U16, 10 * MSEC_PER_SEC),
| | { }
| 289 | [MDIO_NLA_PROG] = NLA_POLICY_VALIDATE_FN(NLA_BINARY,
| | {
| 290 | mdio_nl_validate_prog,
| 291 | 0x1000),
| | }
| ...git/kernel/mdio-netlink.c:430:3: error: 'struct genl_family' has no member named 'policy'
| 430 | .policy = mdio_nl_policy,
| | ^~~~~~
| ...git/kernel/mdio-netlink.c:430:14: warning: initialization of 'unsigned int' from 'const struct nla_policy *' makes integer from pointer without a cast [-Wint-conversion]
| 430 | .policy = mdio_nl_policy,
| | ^~~~~~~~~~~~~~
| ...git/kernel/mdio-netlink.c:430:14: note: (near initialization for 'mdio_nl_family.n_mcgrps')
| In file included from ...git/kernel/mdio-netlink.c:11:
| ...git/kernel/compat.h: In function 'mdiobus_c45_addr':
| ...git/kernel/compat.h:15:1: warning: control reaches end of non-void function [-Wreturn-type]
| 15 | }
| | ^

I am using Yocto Project to install mdio-tools to system. Does anyone know how to solve this compatibility issue? I tried to patch the kernel but it is disaster :) Maybe I am missing something
(I successfully installed it on system using Yocto Project where kernel version is 5.15, but I cannot update from 4.19 on this system...)

MASK in raw REG [DATA[/MASK]] seems not work

Hi wkz,

it seems that the masking feature does not work on mdio-tools v1.0.0.

Following example code:

$ mdio stmmac-1 0x01 raw 22 0    # set to zero
$ mdio stmmac-1 0x01 raw 22 3/1 # only LSB should written
$ mdio stmmac-1 0x01 raw 22
0x0003

If i try it with hexadecimal numbers same result:

$ mdio stmmac-1 0x01 raw 22 0            # set to zero
$ mdio stmmac-1 0x01 raw 22 0x3/0x1 # only LSB should written
$ mdio stmmac-1 0x01 raw 22
0x0003

Thanks for your help!

Best Regards,
Andreas

ERROR: Unable to read status (-5)

I'm running mdio command on a TI's AM335x (BeagleBone-like) machine with kernel 6.1.27:

# mdio
[   42.970370] mdio_netlink: loading out-of-tree module taints kernel.
4a101000.mdio
fixed-0
# mdio 4*
ERROR: Unable to read status (-5)

Are there any special requirements for the kernel and network chip features?

Device Auto Detection

It would be great if mdio could auto detect commonly used devices and let the user access them with a simple alias.

Ideas:

  • Associate a simple numeric ID with each bus
  • Use sysfs to figure out PHY<->netdev associations
  • Use devlink to locate DSA switches
  • Probe buses to find devices

Create aliases based on:

  1. Associated netdev name, if available
  2. Object type combined with bus ID and address

Example usage:

root@box # mdio dev
DEV         TYPE     ADDR  BUS
mmd0-9      mmd       0x9  *et@30be0000!mdio!switch@4!mdio
mmd0-a      mmd       0xa  *et@30be0000!mdio!switch@4!mdio
eth3        mva       0x8  *et@30be0000!mdio!switch@4!mdio
eth4        mva       0x7  *et@30be0000!mdio!switch@4!mdio
mvls4-4     mvls      0x4  30be0000.ethernet-1
phy0-0      phy       0x0  *et@30be0000!mdio!switch@4!mdio
phy0-1      phy       0x1  *et@30be0000!mdio!switch@4!mdio
phy0-2      phy       0x2  *et@30be0000!mdio!switch@4!mdio
phy0-3      phy       0x3  *et@30be0000!mdio!switch@4!mdio
phy0-4      phy       0x4  *et@30be0000!mdio!switch@4!mdio
phy0-5      phy       0x5  *et@30be0000!mdio!switch@4!mdio
phy0-6      phy       0x6  *et@30be0000!mdio!switch@4!mdio

On such a system

  • mdio dev eth3 raw copper:1 would expand to:
    • mdio *et@30be0000!mdio!switch@4!mdio mva 8 raw copper:1
  • mdio dev mvls4-4 raw g1:0x1a would expand to:
    • mdio 30be0000.ethernet-1 mvls 4 raw g1:0x1a

etc.

bus.c:4:24: fatal error: linux/mdio.h: No such file or directory

commit 8321689

make all-recursive
make[1]: Entering directory '/tmp/mdio-tools'
Making all in man
make[2]: Entering directory '/tmp/mdio-tools/man'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/tmp/mdio-tools/man'
Making all in src
make[2]: Entering directory '/tmp/mdio-tools/src'
Making all in mdio
make[3]: Entering directory '/tmp/mdio-tools/src/mdio'
CC mdio-bus.o
bus.c:4:24: fatal error: linux/mdio.h: No such file or directory
compilation terminated.
make[3]: *** [Makefile:385: mdio-bus.o] Error 1
make[3]: Leaving directory '/tmp/mdio-tools/src/mdio'
make[2]: *** [Makefile:311: all-recursive] Error 1
make[2]: Leaving directory '/tmp/mdio-tools/src'
make[1]: *** [Makefile:411: all-recursive] Error 1
make[1]: Leaving directory '/tmp/mdio-tools'
make: *** [Makefile:331: all] Error 2

[question] read registers of QCA 8337 switch

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

Mess Up of page Register ends in wrong PHY-ID

Hello WKZ,

thanks again for the great tool!

It seems that I found an interesting behaviour. If I run the tool the first time with following command:

$ sudo mdio stmmac-1
 DEV          PHY-ID  LINK
0x01  0x01410dd1  down
0x15  0x00000000  down

works the tool perfectly.

Now I mess up the page register, f.e.

$ sudo mdio stmmac-1 0x01 raw 22 6

and rerun again:

$ sudo mdio stmmac-1
 DEV          PHY-ID  LINK
0x01  0x00000000  down
0x15  0x00000000  down

Then the wrong PHY-ID is readen.

One Solution could be to check the value of the page register before read the PHY-ID.
Thanks for your Help.

Best Regards,
Andreas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.