|
@@ -200,7 +200,6 @@ static int stmmac_dt_phy(struct plat_stmmacenet_data *plat,
|
|
/**
|
|
/**
|
|
* stmmac_probe_config_dt - parse device-tree driver parameters
|
|
* stmmac_probe_config_dt - parse device-tree driver parameters
|
|
* @pdev: platform_device structure
|
|
* @pdev: platform_device structure
|
|
- * @plat: driver data platform structure
|
|
|
|
* @mac: MAC address to use
|
|
* @mac: MAC address to use
|
|
* Description:
|
|
* Description:
|
|
* this function is to read the driver parameters from device-tree and
|
|
* this function is to read the driver parameters from device-tree and
|
|
@@ -306,7 +305,7 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
|
|
dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
|
|
dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg),
|
|
GFP_KERNEL);
|
|
GFP_KERNEL);
|
|
if (!dma_cfg) {
|
|
if (!dma_cfg) {
|
|
- of_node_put(plat->phy_node);
|
|
|
|
|
|
+ stmmac_remove_config_dt(pdev, plat);
|
|
return ERR_PTR(-ENOMEM);
|
|
return ERR_PTR(-ENOMEM);
|
|
}
|
|
}
|
|
plat->dma_cfg = dma_cfg;
|
|
plat->dma_cfg = dma_cfg;
|
|
@@ -329,14 +328,37 @@ stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
|
|
|
|
|
|
return plat;
|
|
return plat;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * stmmac_remove_config_dt - undo the effects of stmmac_probe_config_dt()
|
|
|
|
+ * @pdev: platform_device structure
|
|
|
|
+ * @plat: driver data platform structure
|
|
|
|
+ *
|
|
|
|
+ * Release resources claimed by stmmac_probe_config_dt().
|
|
|
|
+ */
|
|
|
|
+void stmmac_remove_config_dt(struct platform_device *pdev,
|
|
|
|
+ struct plat_stmmacenet_data *plat)
|
|
|
|
+{
|
|
|
|
+ struct device_node *np = pdev->dev.of_node;
|
|
|
|
+
|
|
|
|
+ if (of_phy_is_fixed_link(np))
|
|
|
|
+ of_phy_deregister_fixed_link(np);
|
|
|
|
+ of_node_put(plat->phy_node);
|
|
|
|
+}
|
|
#else
|
|
#else
|
|
struct plat_stmmacenet_data *
|
|
struct plat_stmmacenet_data *
|
|
stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
|
|
stmmac_probe_config_dt(struct platform_device *pdev, const char **mac)
|
|
{
|
|
{
|
|
return ERR_PTR(-ENOSYS);
|
|
return ERR_PTR(-ENOSYS);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void stmmac_remove_config_dt(struct platform_device *pdev,
|
|
|
|
+ struct plat_stmmacenet_data *plat)
|
|
|
|
+{
|
|
|
|
+}
|
|
#endif /* CONFIG_OF */
|
|
#endif /* CONFIG_OF */
|
|
EXPORT_SYMBOL_GPL(stmmac_probe_config_dt);
|
|
EXPORT_SYMBOL_GPL(stmmac_probe_config_dt);
|
|
|
|
+EXPORT_SYMBOL_GPL(stmmac_remove_config_dt);
|
|
|
|
|
|
int stmmac_get_platform_resources(struct platform_device *pdev,
|
|
int stmmac_get_platform_resources(struct platform_device *pdev,
|
|
struct stmmac_resources *stmmac_res)
|
|
struct stmmac_resources *stmmac_res)
|
|
@@ -392,10 +414,13 @@ int stmmac_pltfr_remove(struct platform_device *pdev)
|
|
{
|
|
{
|
|
struct net_device *ndev = platform_get_drvdata(pdev);
|
|
struct net_device *ndev = platform_get_drvdata(pdev);
|
|
struct stmmac_priv *priv = netdev_priv(ndev);
|
|
struct stmmac_priv *priv = netdev_priv(ndev);
|
|
|
|
+ struct plat_stmmacenet_data *plat = priv->plat;
|
|
int ret = stmmac_dvr_remove(&pdev->dev);
|
|
int ret = stmmac_dvr_remove(&pdev->dev);
|
|
|
|
|
|
- if (priv->plat->exit)
|
|
|
|
- priv->plat->exit(pdev, priv->plat->bsp_priv);
|
|
|
|
|
|
+ if (plat->exit)
|
|
|
|
+ plat->exit(pdev, plat->bsp_priv);
|
|
|
|
+
|
|
|
|
+ stmmac_remove_config_dt(pdev, plat);
|
|
|
|
|
|
return ret;
|
|
return ret;
|
|
}
|
|
}
|