summaryrefslogtreecommitdiff
path: root/drivers/base/regmap/regmap-mdio.c
AgeCommit message (Collapse)AuthorFilesLines
2023-01-16regmap: Rework regmap_mdio_c45_{read|write} for new C45 API.Andrew Lunn1-18/+23
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>
2021-10-24net: Convert more users of mdiobus_* to mdiodev_*Sean Anderson1-3/+3
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>
2021-06-14regmap: mdio: Reject invalid addressesSander Vanheule1-4/+16
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>
2021-06-14regmap: mdio: Fix regmap_bus pointer constnessSander Vanheule1-1/+1
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>
2021-06-08regmap: mdio: Add clause-45 supportSander Vanheule1-14/+56
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>
2021-06-08regmap: mdio: Clean up invalid clause-22 addressesSander Vanheule1-3/+6
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>
2021-05-20regmap: mdio: Don't modify output if error happenedAndy Shevchenko1-2/+4
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>
2021-05-19regmap: Add MDIO bus supportSander Vanheule1-0/+57
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>