nvethernet: Add .shutdown routine for eqos driver

Issue:
 During system shutdown ethernet controller
 still accessed system memory which resulted in
 memory fault irq causing kernel panic.

Fix:
 register .shutdown driver ops for eqos which gets
 called during system shutdown and deinits the dma,
 mac and clocks hw and sw allocated resources.

Bug 200763727

Change-Id: Ic2eeacbf17c2cf500a051f2608e3d30a9b1e806b
Signed-off-by: Sushil Singh <sushilkumars@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2597538
Reviewed-by: Narayan Reddy <narayanr@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Bhadram Varka <vbhadram@nvidia.com>
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Sushil Singh
2021-09-20 22:14:46 +05:30
committed by Revanth Kumar Uppala
parent 59dcc1f31e
commit f87b6efd44

View File

@@ -6526,6 +6526,28 @@ static int ether_remove(struct platform_device *pdev)
return 0;
}
/**
* @brief Ethernet platform driver shutdown.
*
* Alogorithm: Stops and Deinits PHY, MAC, DMA and Clks hardware and
* release SW allocated resources(buffers, workqueues etc).
*
* @param[in] pdev: Platform device associated with platform driver.
*/
static void ether_shutdown(struct platform_device *pdev)
{
struct net_device *ndev = platform_get_drvdata(pdev);
struct ether_priv_data *pdata = netdev_priv(ndev);
int ret = -1;
if (!netif_running(ndev))
return;
ret = ether_close(ndev);
if (ret)
dev_err(pdata->dev, "Failure in ether_close");
}
#ifdef CONFIG_PM
/**
* @brief Ethernet platform driver suspend noirq callback.
@@ -6845,6 +6867,7 @@ MODULE_DEVICE_TABLE(of, ether_of_match);
static struct platform_driver ether_driver = {
.probe = ether_probe,
.remove = ether_remove,
.shutdown = ether_shutdown,
.driver = {
.name = "nvethernet",
.of_match_table = ether_of_match,