linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Clause-22/Clause-45 MDIO regmap support
@ 2021-06-03 18:25 Sander Vanheule
  2021-06-03 18:25 ` [RFC PATCH 1/2] regmap: mdio: Clean up invalid clause-22 addresses Sander Vanheule
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Sander Vanheule @ 2021-06-03 18:25 UTC (permalink / raw)
  To: Mark Brown, Andrew Lunn, Greg Kroah-Hartman, Rafael J . Wysocki,
	Andy Shevchenko
  Cc: linux-kernel, Sander Vanheule

The initial MDIO regmap implementation only supported (or claimed to
only support) clause-22 register access, with 5 bit register addresses.
However, this was not enforced sufficiently, and regnum values were
passed verbatim to the mdio bus subsystem.

These patches aim to enforce the register address width, and also add
clause-45 support for extended address spaces. A clause-45 address is
defined here as the composite of the device type (see MDIO_MMD_* in
include/uapi/linux/mdio.h) and the register number, for a total width of
21 bit.

I have zero experience with clause-45 devices, and no such devices
available for testing. As such, clause-45 code in the second patch is
entirely untested, although it isn't very complex.

Although these patches should eventually make it into regmap-mdio, I
would like to resolve some questions first.

1. I've opted to just ignore any bits that lie beyond the allowed address
   width. Would it be cleaner to raise an error instead?

2. Packing of the clause-45 register addresses (16 bit) and adressed device
   type (5 bit) is the same as in the mdio subsystem, resulting in a 21 bit
   address. Is this an appropriate way to pack this information into one
   address for the regmap interface?

The reasoning behind (1) is to allow the regmap user to use extra bits
as a way to virtually extend the address space. Note that this actually
results in aliasing. This can be useful if the data read from to a
register doesn't have the same meaning as the data written to it
(e.g. GPIO pin input and output data). An alternative solution to this
would be some concept of "aliased registers" in regmap -- like volatile or
precious registers.

Sander Vanheule (2):
  regmap: mdio: Clean up invalid clause-22 addresses
  regmap: mdio: Add clause-45 support

 drivers/base/regmap/regmap-mdio.c | 73 +++++++++++++++++++++++++------
 1 file changed, 59 insertions(+), 14 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-06-09 11:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 18:25 [RFC PATCH 0/2] Clause-22/Clause-45 MDIO regmap support Sander Vanheule
2021-06-03 18:25 ` [RFC PATCH 1/2] regmap: mdio: Clean up invalid clause-22 addresses Sander Vanheule
2021-06-03 18:25 ` [RFC PATCH 2/2] regmap: mdio: Add clause-45 support Sander Vanheule
2021-06-04 17:25 ` [RFC PATCH 0/2] Clause-22/Clause-45 MDIO regmap support Mark Brown
2021-06-04 18:16   ` Sander Vanheule
2021-06-07 11:54     ` Mark Brown
2021-06-07 12:06       ` Sander Vanheule
2021-06-07 12:14       ` Andy Shevchenko
2021-06-04 20:38   ` Andrew Lunn
2021-06-04 23:55 ` Andrew Lunn
2021-06-05  8:31 ` [PATCH] regmap: mdio: Reject invalid clause-22 addresses Sander Vanheule
2021-06-07 11:03   ` Mark Brown
2021-06-07 11:12     ` Sander Vanheule
2021-06-09 11:51     ` Sander Vanheule
2021-06-08 16:06 ` [RFC PATCH 0/2] Clause-22/Clause-45 MDIO regmap support Mark Brown

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).