]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: mdio-mt7531-mmio: use common header priv struct
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 9 Feb 2026 11:45:05 +0000 (12:45 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 23 Feb 2026 21:28:16 +0000 (15:28 -0600)
Instead of having duplicate priv struct for mdio-mt7531-mmio driver in
both driver and header, use the one exposed by the header directly.

This make sure we have consistent priv struct if the driver will be
updated in the future.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
drivers/net/mdio-mt7531-mmio.c

index 3e325ca58da2d0570265c90b6c79dfd3794ee2b8..58cb6e503b87da847a26ff4d30d1e1497fdae057 100644 (file)
@@ -6,6 +6,8 @@
 #include <linux/iopoll.h>
 #include <miiphy.h>
 
+#include "mdio-mt7531-mmio.h"
+
 #define MT7531_PHY_IAC                 0x701c
 #define   MT7531_PHY_ACS_ST            BIT(31)
 #define   MT7531_MDIO_REG_ADDR_CL22    GENMASK(29, 25)
 #define MT7531_MDIO_TIMEOUT            100000
 #define MT7531_MDIO_SLEEP              20
 
-struct mt7531_mdio_priv {
-       phys_addr_t switch_regs;
-};
-
-static int mt7531_mdio_wait_busy(struct mt7531_mdio_priv *priv)
+static int mt7531_mdio_wait_busy(struct mt7531_mdio_mmio_priv *priv)
 {
        unsigned int busy;
 
@@ -38,7 +36,7 @@ static int mt7531_mdio_wait_busy(struct mt7531_mdio_priv *priv)
                                        MT7531_MDIO_SLEEP, MT7531_MDIO_TIMEOUT);
 }
 
-static int mt7531_mdio_read(struct mt7531_mdio_priv *priv, int addr, int devad, int reg)
+static int mt7531_mdio_read(struct mt7531_mdio_mmio_priv *priv, int addr, int devad, int reg)
 {
        u32 val;
 
@@ -75,7 +73,7 @@ static int mt7531_mdio_read(struct mt7531_mdio_priv *priv, int addr, int devad,
        return val & MT7531_MDIO_RW_DATA;
 }
 
-static int mt7531_mdio_write(struct mt7531_mdio_priv *priv, int addr, int devad,
+static int mt7531_mdio_write(struct mt7531_mdio_mmio_priv *priv, int addr, int devad,
                             int reg, u16 value)
 {
        u32 val;
@@ -115,7 +113,7 @@ static int mt7531_mdio_write(struct mt7531_mdio_priv *priv, int addr, int devad,
 
 int mt7531_mdio_mmio_read(struct mii_dev *bus, int addr, int devad, int reg)
 {
-       struct mt7531_mdio_priv *priv = bus->priv;
+       struct mt7531_mdio_mmio_priv *priv = bus->priv;
 
        return mt7531_mdio_read(priv, addr, devad, reg);
 }
@@ -123,14 +121,14 @@ int mt7531_mdio_mmio_read(struct mii_dev *bus, int addr, int devad, int reg)
 int mt7531_mdio_mmio_write(struct mii_dev *bus, int addr, int devad,
                           int reg, u16 value)
 {
-       struct mt7531_mdio_priv *priv = bus->priv;
+       struct mt7531_mdio_mmio_priv *priv = bus->priv;
 
        return mt7531_mdio_write(priv, addr, devad, reg, value);
 }
 
 static int dm_mt7531_mdio_read(struct udevice *dev, int addr, int devad, int reg)
 {
-       struct mt7531_mdio_priv *priv = dev_get_priv(dev);
+       struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
 
        return mt7531_mdio_read(priv, addr, devad, reg);
 }
@@ -138,7 +136,7 @@ static int dm_mt7531_mdio_read(struct udevice *dev, int addr, int devad, int reg
 static int dm_mt7531_mdio_write(struct udevice *dev, int addr, int devad,
                                int reg, u16 value)
 {
-       struct mt7531_mdio_priv *priv = dev_get_priv(dev);
+       struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
 
        return mt7531_mdio_write(priv, addr, devad, reg, value);
 }
@@ -150,7 +148,7 @@ static const struct mdio_ops mt7531_mdio_ops = {
 
 static int mt7531_mdio_probe(struct udevice *dev)
 {
-       struct mt7531_mdio_priv *priv = dev_get_priv(dev);
+       struct mt7531_mdio_mmio_priv *priv = dev_get_priv(dev);
 
        priv->switch_regs = dev_read_addr(dev);
        if (priv->switch_regs == FDT_ADDR_T_NONE)
@@ -164,5 +162,5 @@ U_BOOT_DRIVER(mt7531_mdio) = {
        .id             = UCLASS_MDIO,
        .probe          = mt7531_mdio_probe,
        .ops            = &mt7531_mdio_ops,
-       .priv_auto        = sizeof(struct mt7531_mdio_priv),
+       .priv_auto        = sizeof(struct mt7531_mdio_mmio_priv),
 };