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

Generic USB to MDIO adapter support? #40

Open
AlbrechtL opened this issue Jan 19, 2025 · 1 comment
Open

Generic USB to MDIO adapter support? #40

AlbrechtL opened this issue Jan 19, 2025 · 1 comment

Comments

@AlbrechtL
Copy link

Hi @wkz,

This is more likely an off-topic question or disucssion.

I'm working with some switch chips (e.g. Realtek RTL8305, RTL8309, maybe IC+ IP175G in the future) and I have low level MDIO access to it. Currently, I'm using ESP8266 or STM32 development boards for it, which gives me UART access to the switch registers. While looking for a more convenient way to access to switch chip registers, I found your project which seems to be what I need! I'm also interested playing with DSA (I know that RTL8305, RTL8309 chips are not supported by DSA currently).

While looking how to add MDIO to a standard Linux PC I found your mvusb driver. It seems to be that this is exactly what I'm planning to do. Accessing a MDIO via an USB interface.

So my question is: Do you think it is possible to use your mvusb driver to access generic switch chips via MDIO when we have a generic USB-MDIO adapter or dongle? And if yes, can I use your program mdio-tools to access the registers?

Out there, there are cheap STM32 blue pill boards with USB device support (CPU STM32F103C8) which can be used as development hardware. Your mvusb driver seems to be relatively simple and I think it could be worth a try that the STM32F103C8 behaves like the Marvell USB-MDIO adapter. Do you have the same opinion that a STM32 firmware should be relatively simple? Taking registers via USB, pushing it to MDIO and vice versa?

I'm not an expert in Linux DSA and switchdev and I don't know if, once we have a generic USB to MDIO adapter, it can be useful used?

Before I start a new project, I would like to know your opinion if you are interested.

@wkz
Copy link
Owner

wkz commented Jan 20, 2025

While looking for a more convenient way to access to switch chip registers, I found your project which seems to be what I need!

Cool! 😎

So my question is: Do you think it is possible to use your mvusb driver to access generic switch chips via MDIO when we have a generic USB-MDIO adapter or dongle?

If it follows the same protocol, then yes. You have to either advertise same the VID/PID as the original dongle, or add your ID to the driver. ...or forcefully bind the driver from userspace, I suppose.

And if yes, can I use your program mdio-tools to access the registers?

Most definitely! I often use mvusb+mdio-tools to play around with various devboards. Any bus available in /sys/class/mdio_bus/ can be utilized by mdio-tools

Do you have the same opinion that a STM32 firmware should be relatively simple? Taking registers via USB, pushing it to MDIO and vice versa?

That would be my guess, yes 👍

I'm not an expert in Linux DSA and switchdev and I don't know if, once we have a generic USB to MDIO adapter, it can be useful used?

I am not sure I understand this question. But I have successfully deployed setups like this:

.-------.     .----------.     .-----------.
|      USB---USB mvusb MDIO---MDIO        ETH
|  SoC  |     '----------'     |  Switch  ETH
|      ETH--------------------ETH         ETH
'-------'                      '-----------'

Where the DSA driver for the switch picks up the three external ports on the right, so that you can use them in Linux. Is that what you mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants