Commit 755f5738 authored by Dejin Zheng's avatar Dejin Zheng Committed by David S. Miller

net: broadcom: fix a mistake about ioremap resource

Commit d7a5502b ("net: broadcom: convert to
devm_platform_ioremap_resource_byname()") will broke this driver.
idm_base and nicpm_base were optional, after this change, they are
mandatory. it will probe fails with -22 when the dtb doesn't have them
defined. so revert part of this commit and make idm_base and nicpm_base
as optional.

Fixes: d7a5502b ("net: broadcom: convert to devm_platform_ioremap_resource_byname()")
Reported-by: default avatarJonathan Richardson <jonathan.richardson@broadcom.com>
Cc: Scott Branden <scott.branden@broadcom.com>
Cc: Ray Jui <ray.jui@broadcom.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: default avatarDejin Zheng <zhengdejin5@gmail.com>
Acked-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bd4af432
...@@ -172,6 +172,7 @@ static int bgmac_probe(struct platform_device *pdev) ...@@ -172,6 +172,7 @@ static int bgmac_probe(struct platform_device *pdev)
{ {
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct bgmac *bgmac; struct bgmac *bgmac;
struct resource *regs;
const u8 *mac_addr; const u8 *mac_addr;
bgmac = bgmac_alloc(&pdev->dev); bgmac = bgmac_alloc(&pdev->dev);
...@@ -206,16 +207,21 @@ static int bgmac_probe(struct platform_device *pdev) ...@@ -206,16 +207,21 @@ static int bgmac_probe(struct platform_device *pdev)
if (IS_ERR(bgmac->plat.base)) if (IS_ERR(bgmac->plat.base))
return PTR_ERR(bgmac->plat.base); return PTR_ERR(bgmac->plat.base);
bgmac->plat.idm_base = regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
devm_platform_ioremap_resource_byname(pdev, "idm_base"); if (regs) {
if (IS_ERR(bgmac->plat.idm_base)) bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
return PTR_ERR(bgmac->plat.idm_base); if (IS_ERR(bgmac->plat.idm_base))
bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK; return PTR_ERR(bgmac->plat.idm_base);
bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
}
bgmac->plat.nicpm_base = regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
devm_platform_ioremap_resource_byname(pdev, "nicpm_base"); if (regs) {
if (IS_ERR(bgmac->plat.nicpm_base)) bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
return PTR_ERR(bgmac->plat.nicpm_base); regs);
if (IS_ERR(bgmac->plat.nicpm_base))
return PTR_ERR(bgmac->plat.nicpm_base);
}
bgmac->read = platform_bgmac_read; bgmac->read = platform_bgmac_read;
bgmac->write = platform_bgmac_write; bgmac->write = platform_bgmac_write;
......
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