summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleksij Rempel <o.rempel@pengutronix.de>2018-06-29 13:55:02 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2018-07-02 06:07:44 +0200
commit36260f162defe41fe144d69756990519c4188c83 (patch)
tree2f12ad23fa600b46bc5141dde3604e8dab1adf1c
parent0257de4753356c5e9a3a645f025f215e3037372f (diff)
downloadbarebox-36260f162defe41fe144d69756990519c4188c83.tar.gz
net: designware: make sure DMA is disabled on kernel start.
Halt is not automatically executed if we start the kernel. So, we may have potentially memory corruptions. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/net/designware.c8
-rw-r--r--drivers/net/designware.h1
-rw-r--r--drivers/net/designware_generic.c1
-rw-r--r--drivers/net/designware_socfpga.c1
4 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 862ee2f..49ddaa2 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -471,6 +471,7 @@ struct dw_eth_dev *dwc_drv_probe(struct device_d *dev)
miibus = &priv->miibus;
edev->priv = priv;
+ dev->priv = edev;
edev->parent = dev;
edev->open = dwc_ether_open;
edev->send = dwc_ether_send;
@@ -489,3 +490,10 @@ struct dw_eth_dev *dwc_drv_probe(struct device_d *dev)
return priv;
}
+
+void dwc_drv_remove(struct device_d *dev)
+{
+ struct eth_device *edev = dev->priv;
+
+ dwc_ether_halt(edev);
+}
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index 4a99fa2..6236d6c 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -51,6 +51,7 @@ struct dw_eth_drvdata {
};
struct dw_eth_dev *dwc_drv_probe(struct device_d *dev);
+void dwc_drv_remove(struct device_d *dev);
#define CONFIG_TX_DESCR_NUM 16
#define CONFIG_RX_DESCR_NUM 16
diff --git a/drivers/net/designware_generic.c b/drivers/net/designware_generic.c
index 29269de..9d125b4 100644
--- a/drivers/net/designware_generic.c
+++ b/drivers/net/designware_generic.c
@@ -55,6 +55,7 @@ static __maybe_unused struct of_device_id dwc_ether_compatible[] = {
static struct driver_d dwc_ether_driver = {
.name = "designware_eth",
.probe = dwc_ether_probe,
+ .remove = dwc_drv_remove,
.of_compatible = DRV_OF_COMPAT(dwc_ether_compatible),
};
device_platform_driver(dwc_ether_driver);
diff --git a/drivers/net/designware_socfpga.c b/drivers/net/designware_socfpga.c
index 154c38f..cb88882 100644
--- a/drivers/net/designware_socfpga.c
+++ b/drivers/net/designware_socfpga.c
@@ -179,6 +179,7 @@ static __maybe_unused struct of_device_id socfpga_dwc_ether_compatible[] = {
static struct driver_d socfpga_dwc_ether_driver = {
.name = "socfpga_designware_eth",
.probe = socfpga_dwc_ether_probe,
+ .remove = dwc_drv_remove,
.of_compatible = DRV_OF_COMPAT(socfpga_dwc_ether_compatible),
};
device_platform_driver(socfpga_dwc_ether_driver);