]> git.ipfire.org Git - thirdparty/openwrt.git/commit
realtek: mdio: use regmap_bulk_write() in RTL838x path
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Mon, 27 Apr 2026 16:58:59 +0000 (18:58 +0200)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 1 May 2026 10:14:50 +0000 (12:14 +0200)
commit2d2f0fbc701abcdb476a239a7b486bd94f0de9c5
tree17fd463d76505648ae6d8b0dafbce538cf5fe8b3
parent5309d460b0d0476fd8485eba7b7fa8fb8aee2b17
realtek: mdio: use regmap_bulk_write() in RTL838x path

The regmap conversion only replaced the old sw() macros with their
regmap counterparts. Neither access optimization nor error handling
took place. Redesign the mdio access as follows:

- The c22/c45/read/write functions only prepare a data structure
  that describes the to-be-executed command.
- rtmdio_xxxx_run_cmd() is enhanced to bulk write the data into the
  SoC, issue all the I/O and do proper error handling. Additionally
  the signature is changed to allow read & write operations.

The bulk commands introduce some subtle changes.

- Before this patch only the needed registers were written. After
  the conversion all phy control registers are set up.
- The register write order changes

This is no issue as the hardware starts operation when issuing the
run_cmd() and only accesses the needed registers per operation.

For now adapt only the RTL838x path. Where needed rename "err" to
"ret" for consistency with kernel conventions.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23092
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.18/drivers/net/mdio/mdio-realtek-otto.c