Skip to content

Commit

Permalink
net: mdio-ipq4019: Fix the error for an optional regs resource
Browse files Browse the repository at this point in the history
The second resource is optional which is only provided on the chipset
IPQ5018. But the blamed commit ignores that and if the resource is
not there it just fails.

the resource is used like this,
	if (priv->eth_ldo_rdy) {
		val = readl(priv->eth_ldo_rdy);
		val |= BIT(0);
		writel(val, priv->eth_ldo_rdy);
		fsleep(IPQ_PHY_SET_DELAY_US);
	}

This patch reverts that to still allow the second resource to be optional
because other SoC have the some MDIO controller and doesn't need to
second resource.

Fixes: fa14d03 ("net: mdio-ipq4019: Make use of devm_platform_ioremap_resource()")
Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://lore.kernel.org/r/20210928134849.2092-1-caihuoqing@baidu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Cai Huoqing authored and Jakub Kicinski committed Sep 29, 2021
1 parent 4ccb9f0 commit 9e28cfe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/mdio/mdio-ipq4019.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ static int ipq4019_mdio_probe(struct platform_device *pdev)
{
struct ipq4019_mdio_data *priv;
struct mii_bus *bus;
struct resource *res;
int ret;

bus = devm_mdiobus_alloc_size(&pdev->dev, sizeof(*priv));
Expand All @@ -224,7 +225,10 @@ static int ipq4019_mdio_probe(struct platform_device *pdev)
return PTR_ERR(priv->mdio_clk);

/* The platform resource is provided on the chipset IPQ5018 */
priv->eth_ldo_rdy = devm_platform_ioremap_resource(pdev, 1);
/* This resource is optional */
res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (res)
priv->eth_ldo_rdy = devm_ioremap_resource(&pdev->dev, res);

bus->name = "ipq4019_mdio";
bus->read = ipq4019_mdio_read;
Expand Down

0 comments on commit 9e28cfe

Please sign in to comment.