|
@@ -1643,7 +1643,7 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
|
|
struct resource *res;
|
|
struct resource *res;
|
|
void __iomem *addr = NULL;
|
|
void __iomem *addr = NULL;
|
|
struct net_device *ndev = NULL;
|
|
struct net_device *ndev = NULL;
|
|
- struct stmmac_priv *priv;
|
|
|
|
|
|
+ struct stmmac_priv *priv = NULL;
|
|
struct plat_stmmacenet_data *plat_dat;
|
|
struct plat_stmmacenet_data *plat_dat;
|
|
|
|
|
|
pr_info("STMMAC driver:\n\tplatform registration... ");
|
|
pr_info("STMMAC driver:\n\tplatform registration... ");
|
|
@@ -1708,10 +1708,12 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
|
|
/* Set the I/O base addr */
|
|
/* Set the I/O base addr */
|
|
ndev->base_addr = (unsigned long)addr;
|
|
ndev->base_addr = (unsigned long)addr;
|
|
|
|
|
|
- /* Verify embedded resource for the platform */
|
|
|
|
- ret = stmmac_claim_resource(pdev);
|
|
|
|
- if (ret < 0)
|
|
|
|
- goto out;
|
|
|
|
|
|
+ /* Custom initialisation */
|
|
|
|
+ if (priv->plat->init) {
|
|
|
|
+ ret = priv->plat->init(pdev);
|
|
|
|
+ if (unlikely(ret))
|
|
|
|
+ goto out;
|
|
|
|
+ }
|
|
|
|
|
|
/* MAC HW revice detection */
|
|
/* MAC HW revice detection */
|
|
ret = stmmac_mac_device_setup(ndev);
|
|
ret = stmmac_mac_device_setup(ndev);
|
|
@@ -1745,6 +1747,9 @@ static int stmmac_dvr_probe(struct platform_device *pdev)
|
|
|
|
|
|
out:
|
|
out:
|
|
if (ret < 0) {
|
|
if (ret < 0) {
|
|
|
|
+ if (priv->plat->exit)
|
|
|
|
+ priv->plat->exit(pdev);
|
|
|
|
+
|
|
platform_set_drvdata(pdev, NULL);
|
|
platform_set_drvdata(pdev, NULL);
|
|
release_mem_region(res->start, resource_size(res));
|
|
release_mem_region(res->start, resource_size(res));
|
|
if (addr != NULL)
|
|
if (addr != NULL)
|
|
@@ -1778,6 +1783,9 @@ static int stmmac_dvr_remove(struct platform_device *pdev)
|
|
|
|
|
|
stmmac_mdio_unregister(ndev);
|
|
stmmac_mdio_unregister(ndev);
|
|
|
|
|
|
|
|
+ if (priv->plat->exit)
|
|
|
|
+ priv->plat->exit(pdev);
|
|
|
|
+
|
|
platform_set_drvdata(pdev, NULL);
|
|
platform_set_drvdata(pdev, NULL);
|
|
unregister_netdev(ndev);
|
|
unregister_netdev(ndev);
|
|
|
|
|