]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: mdio: add regmap to bus structure
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Tue, 27 Jan 2026 07:33:34 +0000 (08:33 +0100)
committerRobert Marko <robimarko@gmail.com>
Sat, 31 Jan 2026 10:19:14 +0000 (11:19 +0100)
To convert the existing sw_xxx() commands the bus needs a regmap.
This is derived from the parent mfd node like in all other Realtek
drivers.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21741
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.12/drivers/net/mdio/mdio-realtek-otto.c

index 97fe300108948bd26284e77579adefd722d96355..eebf6d5274d6879f17c67efefae4635a72205b75 100644 (file)
@@ -1,10 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0-only
 
+#include <linux/fwnode.h>
 #include <linux/fwnode_mdio.h>
-#include <linux/mutex.h>
-#include <linux/of_mdio.h>
-#include <linux/of_net.h>
-#include <linux/of_platform.h>
+#include <linux/mfd/syscon.h>
+#include <linux/of.h>
 #include <linux/phy.h>
 #include <linux/platform_device.h>
 #include <linux/types.h>
 
 
 struct rtmdio_ctrl {
+       struct regmap *map;
        const struct rtmdio_config *cfg;
        int page[RTMDIO_MAX_PORT];
        bool raw[RTMDIO_MAX_PORT];
@@ -899,6 +899,10 @@ static int rtmdio_probe(struct platform_device *pdev)
 
        ctrl = bus->priv;
        ctrl->cfg = (const struct rtmdio_config *)device_get_match_data(dev);
+       ctrl->map = syscon_node_to_regmap(pdev->dev.of_node->parent);
+       if (IS_ERR(ctrl->map))
+               return PTR_ERR(ctrl->map);
+
        for (addr = 0; addr < RTMDIO_MAX_PORT; addr++)
                ctrl->smi_bus[addr] = -1;