Skip to content

Commit

Permalink
net: mdio: mscc-miim: add ability to externally register phy reset co…
Browse files Browse the repository at this point in the history
…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 Jan 29, 2022
1 parent 89454d6 commit a2baa46
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion drivers/net/dsa/ocelot/seville_vsc9953.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
10 changes: 6 additions & 4 deletions drivers/net/mdio/mdio-mscc-miim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

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

ret = mscc_miim_setup(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(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, dev->of_node);
if (ret < 0) {
Expand Down
3 changes: 2 additions & 1 deletion include/linux/mdio/mdio-mscc-miim.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 a2baa46

Please sign in to comment.