* [PATCH v1] net: ag71xx: disable eth interface on barebox shutdown
@ 2017-09-18 16:41 Oleksij Rempel
2017-09-20 6:22 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Oleksij Rempel @ 2017-09-18 16:41 UTC (permalink / raw)
To: barebox; +Cc: Oleksij Rempel
If not disable, DMA RX engine will keep to write in to allocated
memory area. As soon as some code or data of target OS will be placed to
this area it will be overwritten by incoming network package.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
---
drivers/net/ag71xx.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/net/ag71xx.c b/drivers/net/ag71xx.c
index 54f0bd9aa..1cec26360 100644
--- a/drivers/net/ag71xx.c
+++ b/drivers/net/ag71xx.c
@@ -578,6 +578,7 @@ static int ag71xx_probe(struct device_d *dev)
priv = xzalloc(sizeof(struct ag71xx));
edev = &priv->netdev;
miibus = &priv->miibus;
+ dev->priv = edev;
edev->priv = priv;
edev->init = ag71xx_ether_init;
@@ -659,6 +660,13 @@ static int ag71xx_probe(struct device_d *dev)
return 0;
}
+static void ag71xx_remove(struct device_d *dev)
+{
+ struct eth_device *edev = dev->priv;
+
+ ag71xx_ether_halt(edev);
+}
+
static __maybe_unused struct of_device_id ag71xx_dt_ids[] = {
{ .compatible = "qca,ar9331-ge0", .data = &ag71xx_cfg_ar9331_ge0, },
{ .compatible = "qca,ar9344-gmac0", .data = &ag71xx_cfg_ar9344_gmac0, },
@@ -668,6 +676,7 @@ static __maybe_unused struct of_device_id ag71xx_dt_ids[] = {
static struct driver_d ag71xx_driver = {
.name = "ag71xx-gmac",
.probe = ag71xx_probe,
+ .remove = ag71xx_remove,
.of_compatible = DRV_OF_COMPAT(ag71xx_dt_ids),
};
device_platform_driver(ag71xx_driver);
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1] net: ag71xx: disable eth interface on barebox shutdown
2017-09-18 16:41 [PATCH v1] net: ag71xx: disable eth interface on barebox shutdown Oleksij Rempel
@ 2017-09-20 6:22 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2017-09-20 6:22 UTC (permalink / raw)
To: Oleksij Rempel; +Cc: barebox
On Mon, Sep 18, 2017 at 06:41:45PM +0200, Oleksij Rempel wrote:
> If not disable, DMA RX engine will keep to write in to allocated
> memory area. As soon as some code or data of target OS will be placed to
> this area it will be overwritten by incoming network package.
>
> Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
> ---
> drivers/net/ag71xx.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
Applied, thanks
Sascha
>
> diff --git a/drivers/net/ag71xx.c b/drivers/net/ag71xx.c
> index 54f0bd9aa..1cec26360 100644
> --- a/drivers/net/ag71xx.c
> +++ b/drivers/net/ag71xx.c
> @@ -578,6 +578,7 @@ static int ag71xx_probe(struct device_d *dev)
> priv = xzalloc(sizeof(struct ag71xx));
> edev = &priv->netdev;
> miibus = &priv->miibus;
> + dev->priv = edev;
> edev->priv = priv;
>
> edev->init = ag71xx_ether_init;
> @@ -659,6 +660,13 @@ static int ag71xx_probe(struct device_d *dev)
> return 0;
> }
>
> +static void ag71xx_remove(struct device_d *dev)
> +{
> + struct eth_device *edev = dev->priv;
> +
> + ag71xx_ether_halt(edev);
> +}
> +
> static __maybe_unused struct of_device_id ag71xx_dt_ids[] = {
> { .compatible = "qca,ar9331-ge0", .data = &ag71xx_cfg_ar9331_ge0, },
> { .compatible = "qca,ar9344-gmac0", .data = &ag71xx_cfg_ar9344_gmac0, },
> @@ -668,6 +676,7 @@ static __maybe_unused struct of_device_id ag71xx_dt_ids[] = {
> static struct driver_d ag71xx_driver = {
> .name = "ag71xx-gmac",
> .probe = ag71xx_probe,
> + .remove = ag71xx_remove,
> .of_compatible = DRV_OF_COMPAT(ag71xx_dt_ids),
> };
> device_platform_driver(ag71xx_driver);
> --
> 2.11.0
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-20 6:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18 16:41 [PATCH v1] net: ag71xx: disable eth interface on barebox shutdown Oleksij Rempel
2017-09-20 6:22 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox