Commit c448c898 authored by Horatiu Vultur's avatar Horatiu Vultur Committed by David S. Miller

net: mdio: mscc-miim: Set back the optional resource.

In the blamed commit, the second memory resource was not considered
anymore as optional. On some platforms like sparx5 the second resource
is optional. So add it back as optional and restore the comment that
says so.

Fixes: a27a7628 ("net: mdio: mscc-miim: convert to a regmap implementation")
Signed-off-by: default avatarHoratiu Vultur <horatiu.vultur@microchip.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 94dd016a
......@@ -219,9 +219,10 @@ EXPORT_SYMBOL(mscc_miim_setup);
static int mscc_miim_probe(struct platform_device *pdev)
{
struct regmap *mii_regmap, *phy_regmap;
struct regmap *mii_regmap, *phy_regmap = NULL;
void __iomem *regs, *phy_regs;
struct mscc_miim_dev *miim;
struct resource *res;
struct mii_bus *bus;
int ret;
......@@ -239,7 +240,10 @@ static int mscc_miim_probe(struct platform_device *pdev)
return PTR_ERR(mii_regmap);
}
phy_regs = devm_platform_ioremap_resource(pdev, 1);
/* This resource is optional */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (res) {
phy_regs = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(phy_regs)) {
dev_err(&pdev->dev, "Unable to map internal phy registers\n");
return PTR_ERR(phy_regs);
......@@ -251,6 +255,7 @@ static int mscc_miim_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "Unable to create phy register regmap\n");
return PTR_ERR(phy_regmap);
}
}
ret = mscc_miim_setup(&pdev->dev, &bus, "mscc_miim", mii_regmap, 0);
if (ret < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment