Commit a45cfcc6 authored by Grygorii Strashko's avatar Grygorii Strashko Committed by David S. Miller

net: ethernet: ti: am65-cpsw-nuss: use of_platform_device_create() for mdio

The MCU CPSW expected to populate only MDIO device, but follow up patches
will add "compatible" property to the MCU CPSW CPTS node which will cause
creation of CPTS device and MCU CPSW init failure. Hence, switch to use
of_platform_device_create() instead of of_platform_populate() for MDIO
device population.
Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a8c9baf2
...@@ -2031,10 +2031,21 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) ...@@ -2031,10 +2031,21 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = of_platform_populate(dev->of_node, NULL, NULL, dev); node = of_get_child_by_name(dev->of_node, "mdio");
/* We do not want to force this, as in some cases may not have child */ if (!node) {
if (ret) dev_warn(dev, "MDIO node not found\n");
dev_warn(dev, "populating child nodes err:%d\n", ret); } else if (of_device_is_available(node)) {
struct platform_device *mdio_pdev;
mdio_pdev = of_platform_device_create(node, NULL, dev);
if (!mdio_pdev) {
ret = -ENODEV;
goto err_pm_clear;
}
common->mdio_dev = &mdio_pdev->dev;
}
of_node_put(node);
am65_cpsw_nuss_get_ver(common); am65_cpsw_nuss_get_ver(common);
...@@ -2090,7 +2101,8 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev) ...@@ -2090,7 +2101,8 @@ static int am65_cpsw_nuss_probe(struct platform_device *pdev)
return 0; return 0;
err_of_clear: err_of_clear:
of_platform_depopulate(dev); of_platform_device_destroy(common->mdio_dev, NULL);
err_pm_clear:
pm_runtime_put_sync(dev); pm_runtime_put_sync(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
return ret; return ret;
...@@ -2115,7 +2127,7 @@ static int am65_cpsw_nuss_remove(struct platform_device *pdev) ...@@ -2115,7 +2127,7 @@ static int am65_cpsw_nuss_remove(struct platform_device *pdev)
*/ */
am65_cpsw_nuss_cleanup_ndev(common); am65_cpsw_nuss_cleanup_ndev(common);
of_platform_depopulate(dev); of_platform_device_destroy(common->mdio_dev, NULL);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/platform_device.h>
struct am65_cpts; struct am65_cpts;
...@@ -76,6 +77,7 @@ struct am65_cpsw_pdata { ...@@ -76,6 +77,7 @@ struct am65_cpsw_pdata {
struct am65_cpsw_common { struct am65_cpsw_common {
struct device *dev; struct device *dev;
struct device *mdio_dev;
const struct am65_cpsw_pdata *pdata; const struct am65_cpsw_pdata *pdata;
void __iomem *ss_base; void __iomem *ss_base;
......
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