From patchwork Thu Jun 22 18:05:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timur Tabi X-Patchwork-Id: 779663 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wtqJY1WrSz9sNv for ; Fri, 23 Jun 2017 04:06:05 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=codeaurora.org header.i=@codeaurora.org header.b="d7XaeK8f"; dkim=pass (1024-bit key) header.d=codeaurora.org header.i=@codeaurora.org header.b="d7XaeK8f"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753461AbdFVSGD (ORCPT ); Thu, 22 Jun 2017 14:06:03 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48680 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752374AbdFVSF4 (ORCPT ); Thu, 22 Jun 2017 14:05:56 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D730060A08; Thu, 22 Jun 2017 18:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498154755; bh=lGrHIs8FerqBya5Cy1Zmz9z79gT38EZyO/LbDifMek0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7XaeK8fboPLEQxzTLUd6EkabxcTlfGJEa9uo8FeTczwc4NuUt+0ryZpZ4LpDEJ0s zwtm8pSzOHHK98h5ogeqsCp+iLeoM88VEWCXXGI/+oAupFwpMXiIX+W6H6XQOvJquh WFheTgFqgiFcCHJ9sp8fxYv3D70SJASR6KjefYlY= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED, T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from timur-ubuntu.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: timur@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 1CCAA6095F; Thu, 22 Jun 2017 18:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1498154755; bh=lGrHIs8FerqBya5Cy1Zmz9z79gT38EZyO/LbDifMek0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d7XaeK8fboPLEQxzTLUd6EkabxcTlfGJEa9uo8FeTczwc4NuUt+0ryZpZ4LpDEJ0s zwtm8pSzOHHK98h5ogeqsCp+iLeoM88VEWCXXGI/+oAupFwpMXiIX+W6H6XQOvJquh WFheTgFqgiFcCHJ9sp8fxYv3D70SJASR6KjefYlY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 1CCAA6095F Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=timur@codeaurora.org From: Timur Tabi To: "David S. Miller" , 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 Message-Id: <1498154732-19854-2-git-send-email-timur@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1498154732-19854-1-git-send-email-timur@codeaurora.org> References: <1498154732-19854-1-git-send-email-timur@codeaurora.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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 Signed-off-by: Timur Tabi --- 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);