Skip to content
Permalink
Browse files
net: mdio: mscc-miim: add ability to externally register phy reset co…
…ntrol

The ocelot-ext driver requires the phys to be externally controlled by an
optional parameter. This commit exposes that variable so it can be
utilized.

Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
  • Loading branch information
colin-foster-in-advantage authored and intel-lab-lkp committed Dec 18, 2021
1 parent 2ba1689 commit 82c0240e048ab8cb99b1acfa42497eb5e4a3a067
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
@@ -1021,7 +1021,8 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocelot)

rc = mscc_miim_setup(dev, &bus, "VSC9953 internal MDIO bus",
ocelot->targets[GCB],
ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK]);
ocelot->map[GCB][GCB_MIIM_MII_STATUS & REG_MASK],
NULL, 0);

if (rc) {
dev_err(dev, "failed to setup MDIO bus\n");
@@ -188,7 +188,8 @@ static const struct regmap_config mscc_miim_regmap_config = {
};

int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,
struct regmap *mii_regmap, int status_offset)
struct regmap *mii_regmap, int status_offset,
struct regmap *phy_regmap, int phy_offset)
{
struct mscc_miim_dev *miim;
struct mii_bus *bus;
@@ -210,6 +211,8 @@ int mscc_miim_setup(struct device *dev, struct mii_bus **pbus, const char *name,

miim->regs = mii_regmap;
miim->mii_status_offset = status_offset;
miim->phy_regs = phy_regmap;
miim->phy_reset_offset = phy_offset;

*pbus = bus;

@@ -257,15 +260,14 @@ static int mscc_miim_probe(struct platform_device *pdev)
}
}

ret = mscc_miim_setup(&pdev->dev, &bus, "mscc_miim", mii_regmap, 0);
ret = mscc_miim_setup(&pdev->dev, &bus, "mscc_miim", mii_regmap, 0,
phy_regmap, 0);
if (ret < 0) {
dev_err(&pdev->dev, "Unable to setup the MDIO bus\n");
return ret;
}

miim = bus->priv;
miim->phy_regs = phy_regmap;
miim->phy_reset_offset = 0;

ret = of_mdiobus_register(bus, pdev->dev.of_node);
if (ret < 0) {
@@ -14,6 +14,7 @@

int mscc_miim_setup(struct device *device, struct mii_bus **bus,
const char *name, struct regmap *mii_regmap,
int status_offset);
int status_offset, struct regmap *phy_regmap,
int phy_offset);

#endif

0 comments on commit 82c0240

Please sign in to comment.