History log of /linux-master/drivers/base/regmap/regmap-mdio.c
Revision Date Author Comments
# 7b3c4c37 15-Jan-2023 Andrew Lunn <andrew@lunn.ch>

regmap: Rework regmap_mdio_c45_{read|write} for new C45 API.

The MDIO subsystem is getting rid of MII_ADDR_C45 and thus also
encoding associated encoding of the C45 device address and register
address into one value. regmap-mdio also uses this encoding for the
C45 bus.

Move to the new C45 helpers for MDIO access and provide regmap-mdio
helper macros.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Michael Walle <michael@walle.cc>
Link: https://lore.kernel.org/r/20230116111509.4086236-1-michael@walle.cc
Signed-off-by: Mark Brown <broonie@kernel.org>


# 65aa371e 22-Oct-2021 Sean Anderson <sean.anderson@seco.com>

net: Convert more users of mdiobus_* to mdiodev_*

This converts users of mdiobus to mdiodev using the following semantic
patch:

@@
identifier mdiodev;
expression regnum;
@@

- mdiobus_read(mdiodev->bus, mdiodev->addr, regnum)
+ mdiodev_read(mdiodev, regnum)

@@
identifier mdiodev;
expression regnum, val;
@@

- mdiobus_write(mdiodev->bus, mdiodev->addr, regnum, val)
+ mdiodev_write(mdiodev, regnum, val)

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>


# 0df02409 09-Jun-2021 Sander Vanheule <sander@svanheule.net>

regmap: mdio: Reject invalid addresses

When an invalid register offset is provided, the upper bits are silently
discarded. Change this to return -ENXIO instead, to help catch potential
bugs.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Link: https://lore.kernel.org/r/047007e0e9fb596480829f11f8c7e6281d235c70.1623244066.git.sander@svanheule.net
Signed-off-by: Mark Brown <broonie@kernel.org>


# ce62df22 09-Jun-2021 Sander Vanheule <sander@svanheule.net>

regmap: mdio: Fix regmap_bus pointer constness

A const qualifier was omitted in the declaration of the regmap_bus
pointer, resulting in the following errors:

drivers/base/regmap/regmap-mdio.c: In function ‘__regmap_init_mdio’:
drivers/base/regmap/regmap-mdio.c:87:7: warning: assignment discards
‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
87 | bus = &regmap_mdio_c22_bus;
| ^
drivers/base/regmap/regmap-mdio.c:89:7: warning: assignment discards
‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
89 | bus = &regmap_mdio_c45_bus;
| ^

Fix this by ensuring the pointer has the same qualifiers as the assigned
values.

Fixes: f083be9db060 ("regmap: mdio: Add clause-45 support")
Signed-off-by: Sander Vanheule <sander@svanheule.net>
Link: https://lore.kernel.org/r/f304ca638ffdc66d4803a6df1f75436894bd1d5f.1623244066.git.sander@svanheule.net
Signed-off-by: Mark Brown <broonie@kernel.org>


# f083be9d 03-Jun-2021 Sander Vanheule <sander@svanheule.net>

regmap: mdio: Add clause-45 support

Modern ethernet phys support the so-called clause-45 register access
mode, which allows for register address widths of 16 bit.

Also allow for 16-bit register address widths, and return a regmap for
clause-45 access in that case.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Link: https://lore.kernel.org/r/9cc263e3e7d5865edd90453b4183f1cf363cb636.1622743333.git.sander@svanheule.net
Signed-off-by: Mark Brown <broonie@kernel.org>


# dff404de 03-Jun-2021 Sander Vanheule <sander@svanheule.net>

regmap: mdio: Clean up invalid clause-22 addresses

Currently a regmap configuration for regmap-mdio must have a register
address width of 5 bits (cf. clause-22 register access). This is not
enforced on the provided register addresses, which would enable
clause-45 MDIO bus access, if the right bit packing is used.

Prevent clause-45 access, and other invalid addresses, by masking the
provided register address.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Link: https://lore.kernel.org/r/f7013f67e6d6ff56ec98660f18320f6ffcc1a777.1622743333.git.sander@svanheule.net
Signed-off-by: Mark Brown <broonie@kernel.org>


# e56360d6 20-May-2021 Andy Shevchenko <andriy.shevchenko@linux.intel.com>

regmap: mdio: Don't modify output if error happened

regmap_mdio_read() breaks the principle of "no touch output till it's known
that the operation succeeds". Refactor it accordingly.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20210520120518.30490-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>


# 1f89d2fe 17-May-2021 Sander Vanheule <sander@svanheule.net>

regmap: Add MDIO bus support

Basic support for MDIO bus access. Support only includes clause-22
register access, with 5-bit addresses, and 16-bit wide registers.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
Link: https://lore.kernel.org/r/63b99a2fec2c4ea3c461d59d451af8d675ecf312.1621279162.git.sander@svanheule.net
Signed-off-by: Mark Brown <broonie@kernel.org>