On Sat, Jan 16, 2021 at 22:19, Pavel Šimerda <c...@simerda.eu> wrote:
> Provide a debugging interface to read and write MDIO registers directly
> without the need for a device driver.
>
> This is extremely useful when debugging switch hardware and phy hardware
> issues. The interface provides proper locking for communication that
> consists of a sequence of MDIO read/write commands.
>
> The interface binds directly to the MDIO bus abstraction in order to
> provide support for all devices whether there's a hardware driver for
> them or not. Registers are written by writing address, offset, and
> value in hex, separated by colon. Registeres are read by writing only
> address and offset, then reading the value.
>
> It can be easily tested using `socat`:
>
>     # socat - /sys/kernel/debug/mdio/f802c000.ethernet-ffffffff/control
>
> Example: Reading address 0x00 offset 0x00, value is 0x3000
>
>     Input: 00:00
>     Output: 3000
>
> Example: Writing address 0x00 offset 0x00, value 0x2100
>
>     Input: 00:00:2100
>
> Signed-off-by: Pavel Šimerda <c...@simerda.eu>

Hi Pavel,

I also tried my luck at adding an MDIO debug interface to the kernel a
while back:

https://lore.kernel.org/netdev/C42DZQLTPHM5.2THDSRK84BI3T@wkz-x280

The conclusion was that, while nice to have, it makes it too easy for
shady vendors to write out-of-tree drivers.

You might want to have a look at https://github.com/wkz/mdio-tools. It
solves the same issue that your debugfs interface does, and also some
other nice things like clause 45 addressing and atomic read/mask/write
operations.

Reply via email to