All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@codeaurora.org>
To: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: timur@codeaurora.org
Subject: [PATCH 1/3] net: qcom/emac: add shutdown function
Date: Thu, 22 Jun 2017 13:05:30 -0500	[thread overview]
Message-ID: <1498154732-19854-2-git-send-email-timur@codeaurora.org> (raw)
In-Reply-To: <1498154732-19854-1-git-send-email-timur@codeaurora.org>

The shutdown function halts all DMA and interrupts, so that all
operations are discontinued when the system shuts down, e.g. via
kexec or a forced reboot.

Tested-by: Tyler Baicar <tbaicar@codeaurora.org>
Signed-off-by: Timur Tabi <timur@codeaurora.org>
---
 drivers/net/ethernet/qualcomm/emac/emac.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c
index 98a326f..77c5c92 100644
--- a/drivers/net/ethernet/qualcomm/emac/emac.c
+++ b/drivers/net/ethernet/qualcomm/emac/emac.c
@@ -762,6 +762,19 @@ static int emac_remove(struct platform_device *pdev)
 	return 0;
 }
 
+static void emac_shutdown(struct platform_device *pdev)
+{
+	struct net_device *netdev = dev_get_drvdata(&pdev->dev);
+	struct emac_adapter *adpt = netdev_priv(netdev);
+	struct emac_sgmii *sgmii = &adpt->phy;
+
+	/* Closing the SGMII turns off its interrupts */
+	sgmii->close(adpt);
+
+	/* Resetting the MAC turns off all DMA and its interrupts */
+	emac_mac_reset(adpt);
+}
+
 static struct platform_driver emac_platform_driver = {
 	.probe	= emac_probe,
 	.remove	= emac_remove,
@@ -770,6 +783,7 @@ static int emac_remove(struct platform_device *pdev)
 		.of_match_table = emac_dt_match,
 		.acpi_match_table = ACPI_PTR(emac_acpi_match),
 	},
+	.shutdown = emac_shutdown,
 };
 
 module_platform_driver(emac_platform_driver);
-- 
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc.  Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2017-06-22 18:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-22 18:05 [PATCH 0/3] net: qcom/emac: various minor improvements Timur Tabi
2017-06-22 18:05 ` Timur Tabi [this message]
2017-06-22 18:05 ` [PATCH 2/3] net: qcom/emac: do not reset the EMAC during initialization Timur Tabi
2017-06-23 18:00   ` David Miller
2017-06-23 18:37     ` Timur Tabi
2017-06-23 18:54       ` David Miller
2017-06-22 18:05 ` [PATCH 3/3] net: qcom/emac: add support for emulation systems Timur Tabi
  -- strict thread matches above, loose matches on Subject: below --
2017-06-23 19:33 [PATCH 0/3][v2] net: qcom/emac: various minor improvements Timur Tabi
2017-06-23 19:33 ` [PATCH 1/3] net: qcom/emac: add shutdown function Timur Tabi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1498154732-19854-2-git-send-email-timur@codeaurora.org \
    --to=timur@codeaurora.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.