netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tobias Waldekranz <tobias@waldekranz.com>
To: "Pavel Šimerda" <code@simerda.eu>, netdev@vger.kernel.org
Cc: "Pavel Šimerda" <code@simerda.eu>
Subject: Re: [PATCH net-next] net: mdio: access c22 registers via debugfs
Date: Tue, 19 Jan 2021 00:27:08 +0100	[thread overview]
Message-ID: <87h7ndker7.fsf@waldekranz.com> (raw)
In-Reply-To: <20210116211916.8329-1-code@simerda.eu>

On Sat, Jan 16, 2021 at 22:19, Pavel Šimerda <code@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 <code@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.

  parent reply	other threads:[~2021-01-18 23:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-16 21:19 [PATCH net-next] net: mdio: access c22 registers via debugfs Pavel Šimerda
2021-01-16 22:41 ` kernel test robot
2021-01-16 23:20 ` kernel test robot
2021-01-16 23:20 ` [RFC PATCH] net: mdio: mdio_debug_fops can be static kernel test robot
2021-01-16 23:23 ` [PATCH net-next] net: mdio: access c22 registers via debugfs kernel test robot
2021-01-18 23:27 ` Tobias Waldekranz [this message]
2021-01-19  0:55   ` Pavel Šimerda
2021-01-19  1:08   ` Pavel Šimerda
2021-01-19  1:11     ` Pavel Šimerda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7ndker7.fsf@waldekranz.com \
    --to=tobias@waldekranz.com \
    --cc=code@simerda.eu \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).