From patchwork Mon May 4 13:44:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 11526017 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DA8315AB for ; Mon, 4 May 2020 13:48:05 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CC54321582 for ; Mon, 4 May 2020 13:48:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="UebuiEKC"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="aTuYKR9n" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC54321582 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=p1wc57h7DI42+tLvcTS1ECxWwSQ7GR0TBLsVz+fvgPg=; b=UebuiEKCkKxl8A X9MkmKJ7j7DVnCbSSPx0jZYoG65UlcGDkgM/7TtuHMS6Etsf/IADSIHPyOi6mP5GqeRrpXGBGnPQP H17yvzx2Ni89JgJAFyUY2nj7HDOnMLUnzDExSmo4qrrfaYNZzMlf7WUCpCWSdYcrYVBGKYJRxozjt sSIEAYxbRGmu3o8Kf7lhTmPfOQPyTVZa9KtH5Cr7KTrGUgKZLJDV6FCryPNVPsQZhdeqzsd1EJCQT Fe8o4wFqpZXE8hIkba5x9UdvpjLUBjMU0xQ4y1aaziGMuipNH+U8Tv6xg72mLJ8K5DUEr0DUVn+rq 88Tss+0i1bm57AvkZj2A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbRw-0008D5-FM; Mon, 04 May 2020 13:48:00 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbR7-0007HX-H5 for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:47:10 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1588600029; x=1620136029; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tE91w861pxg0ps3UOR5O7pcA0Vt5sQbNgdVLyXzR7B0=; b=aTuYKR9nM4LzuHmvsisDfpISudcILZi78YDMP9YsGyaZcRcCzzUxfEUF wv2xu2g7c/4HsRZIOWbrSQbJ+RsMY7X3Uch+E8mNfgKfJ+Pb0Gsd9Jcsz KFENzw0sbJghHjiC36OEmyKD8YgFFU8653BnWZP2N+173DD3yzsvX6SZX DU86HJXJQl05k70CsCoHHG2dy4/8aF72/9jt8to9fslRJLnvg1t+B3Qxo P37ryOBdAUuT5OBbwzyZoQO75fSqfidDR+6Y9qZ9uiQ0EzxZGGjYABEJ7 KCRhWGToiYowQKQpAN1kAcildjO69GqRwGsIie9xZZyq3y6Y6tskFSUiI Q==; IronPort-SDR: +xPiIMwaLvNJjMlB6h11BC5RYHbjuL+WHgjVAB8fBLQ4obJ7YVwoNMs/BCNYNygc/WnXieRiwB uZQcvgxafDKeofruOtThliYyd48KHyWwYUN3vkZYJPpmqfBbRv8FU8oWUvr6E1GjkfcTHn2oso Tw2eK1Gcn+F6b2tFx8SLZZGMX1+jC4RshTUJ/ki/ZhY/n4l7Pmi8E1IImzUsRJMTVgPIgW6bcE kmxVFIwQWskwhqVxEb2/X199I8CxZOQgghJhoiEpRTjb0z6YXpLfDzQajhYeQWrfgYoNXORi/A ngc= X-IronPort-AV: E=Sophos;i="5.73,352,1583218800"; d="scan'208";a="74135752" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 May 2020 06:46:33 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 May 2020 06:46:33 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 4 May 2020 06:46:30 -0700 From: To: , , "Claudiu Beznea" , Subject: [PATCH v3 1/7] net: macb: fix wakeup test in runtime suspend/resume routines Date: Mon, 4 May 2020 15:44:16 +0200 Message-ID: <760ececd082c834c1ab4b1b410c605cc10bb6224.1588597759.git.nicolas.ferre@microchip.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_064709_624482_942F49B4 X-CRM114-Status: GOOD ( 10.04 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.149.84 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Alexandre Belloni , f.fainelli@gmail.com, michal.simek@xilinx.com, antoine.tenart@bootlin.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nicolas Ferre Use the proper struct device pointer to check if the wakeup flag and wakeup source are positioned. Use the one passed by function call which is equivalent to &bp->dev->dev.parent. It's preventing the trigger of a spurious interrupt in case the Wake-on-Lan feature is used. Fixes: bc1109d04c39 ("net: macb: Add pm runtime support") Cc: Claudiu Beznea Cc: Harini Katakam Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index a0e8c5bbabc0..d1b4d6b6d7c8 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4616,7 +4616,7 @@ static int __maybe_unused macb_runtime_suspend(struct device *dev) struct net_device *netdev = dev_get_drvdata(dev); struct macb *bp = netdev_priv(netdev); - if (!(device_may_wakeup(&bp->dev->dev))) { + if (!(device_may_wakeup(dev))) { clk_disable_unprepare(bp->tx_clk); clk_disable_unprepare(bp->hclk); clk_disable_unprepare(bp->pclk); @@ -4632,7 +4632,7 @@ static int __maybe_unused macb_runtime_resume(struct device *dev) struct net_device *netdev = dev_get_drvdata(dev); struct macb *bp = netdev_priv(netdev); - if (!(device_may_wakeup(&bp->dev->dev))) { + if (!(device_may_wakeup(dev))) { clk_prepare_enable(bp->pclk); clk_prepare_enable(bp->hclk); clk_prepare_enable(bp->tx_clk); From patchwork Mon May 4 13:44:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 11526007 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CA86A15AB for ; Mon, 4 May 2020 13:46:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A82C0208DB for ; Mon, 4 May 2020 13:46:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="frQUNxtr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="wnWJ1Yxj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A82C0208DB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=5V77d7UX7CzA5UgoEUCtcZKJPu4LUwpHMplkQwjJyhM=; b=frQUNxtrKbCLEz FVOZcCkVj90uXodOGrzA8AXwtpvq+oo9huzFGfrVjQlodIe2N4pG2G+vAr/8mM+tqbe5UbOr0736l DC8rE90AXDWeOHRzdQw18eq0/p3S5DIdoiTWFdctedwRYYbw+WW+KMM5vQ0yqaOaExDUDSwH1PoLt Fo52M6+3fov5FtV3Uh+kNIBD4Y9iiC/PcYOt/+0E4o4R2c3WqMTypC8yY2Kr9ZsfA7l1IGz78fE2P fWIHv0pPAp57b0KqF+ISAupLD/PXBpGTyzWPZ/RPRfmPK+u5BgRTfXSYFpYAmWJX3WI15Yf/zCoMW 8jjimrvXaaOOD8JW+/2w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbQj-0006vO-54; Mon, 04 May 2020 13:46:45 +0000 Received: from esa3.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbQe-0006tz-UA for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:46:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1588600000; x=1620136000; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=e+zzAJaYzelyzPPipowOqC3N1EqhQqggcsRkXu8EpRs=; b=wnWJ1YxjNSx3wih87dIF6LQ/DI6UAn06Ol/95GCZZUkPVM0JDRXD3FPp Jxc7HjZ+lW3/a5FBRJqDZpMjrw7/khbquMnu2weQ+zT58mcyBpkhllqO+ tM6wxWROapuKsJ4DSFzhQSUcJJeJjMmShMMWNSbJTodsUtGQEskORfI1x Dr/KaUf/ZHzffeD9wXTksX6YgLVWaJ1OuCqRwjqHmpZ4zunVIfQS35Ps/ kY06cxeDFVD5AwWL003mHLeicKdwcy6ik9wXoPN/0ffXqYxq6Oohd3C4z zOUtVT4A2Orb3n/qg83JVOCi+aAEjzxo8tmNha87k9orFxYn9jTS0Xm9C w==; IronPort-SDR: U6f2ndBh/Q51eX2UgthWQWst6qY/Mk/cR/vjfXibcc/+4vMKA3Lj3eHJeqfE51iHIYkBuvboB1 i/nTOLBXyfNcMEnsJqpU8fWlqigFxqlffWA5eNErVFkh76NqI/uzFLMxpyh0dBQEgrtx120ul2 w3mfduBGe2Rkb8M4DliDpQsPwuuBK7q44RjfllkpfQ+rP1wkLuPkYFGhMHxyKKmJvrzN0MNV0K wZ55eXoIL+TTB+GO8HeNmGCYc1TBhjpZ5EM4bUvBYFfa2etvDAF6KWX7rx2Uk3YYcxY5Pyi9Ge Sj0= X-IronPort-AV: E=Sophos;i="5.73,352,1583218800"; d="scan'208";a="75424641" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 May 2020 06:46:36 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 May 2020 06:46:40 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 4 May 2020 06:46:33 -0700 From: To: , , "Claudiu Beznea" , Subject: [PATCH v3 2/7] net: macb: mark device wake capable when "magic-packet" property present Date: Mon, 4 May 2020 15:44:17 +0200 Message-ID: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_064641_003331_0066E443 X-CRM114-Status: GOOD ( 12.33 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.153.233 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Alexandre Belloni , f.fainelli@gmail.com, michal.simek@xilinx.com, antoine.tenart@bootlin.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, Sergio Prado , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nicolas Ferre Change the way the "magic-packet" DT property is handled in the macb_probe() function, matching DT binding documentation. Now we mark the device as "wakeup capable" instead of calling the device_init_wakeup() function that would enable the wakeup source. For Ethernet WoL, enabling the wakeup_source is done by using ethtool and associated macb_set_wol() function that already calls device_set_wakeup_enable() for this purpose. That would reduce power consumption by cutting more clocks if "magic-packet" property is set but WoL is not configured by ethtool. Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Sergio Prado Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index d1b4d6b6d7c8..629660d9f17e 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4384,7 +4384,7 @@ static int macb_probe(struct platform_device *pdev) bp->wol = 0; if (of_get_property(np, "magic-packet", NULL)) bp->wol |= MACB_WOL_HAS_MAGIC_PACKET; - device_init_wakeup(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); + device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET); spin_lock_init(&bp->lock); From patchwork Mon May 4 13:44:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 11526009 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9386F14C0 for ; Mon, 4 May 2020 13:46:58 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6EC1421974 for ; Mon, 4 May 2020 13:46:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="trSqhVe9"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="GUKtUz59" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6EC1421974 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=gRBW95457bDBAeyRjsPH+aeQtKKcdBPf+3bysAsMP1k=; b=trSqhVe9ktzjDX lFCkS411dmuNvKu+qLlq+9oeD4CEt67hgloh169y5CPZmpldOAJCvTp2FB/dn9n+yVcHkLke/ockW vA4U9smg7QSvpH1tj2QDan5n89zH2H8R52G3d1PfGa8omylkHRyWZ1cZ/ye3cCrTng9Ldx7Kb1cvb lrdVP6VFAPOSz9SJlH3wsAJOTEXfI1/MtvhJSKN+vUP1vUKSU1qXKZ0jGTkbs9PbNqmHjcR0rZtYI NIM9V75xQMTsvKUmdOVaBHD6Iu/X7K6X0F/voe5EwO8yXNzxy/4uNkEg+IDZ/233QnVCT2y5OdJll 9pXnI0hvZaZJlZqbqw2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbQs-00074q-M7; Mon, 04 May 2020 13:46:54 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbQj-0006uu-1Y for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:46:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1588600005; x=1620136005; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=whBsw4kM37oC48LZNraq7LicT0Inj42IPZNti4XR4P4=; b=GUKtUz59hmGd0WekkHJ6cez/24A1BCBadyupP17MYiJeSJ1ThlpFWc63 3h2FtEbqA34drcnpWj/npdzQVTO6zZqoEN+YeHkrxqxW0C3c7Glb+CRQz vhjrgL5U3FRaJKy7Zfa0+eDZzFFD2s6FEl52/qtF2QoJnOqJSmdf2XQcy tD234EP+C4Mi19mApS/D1b4igzWdSjiawmD29dlZ0fJPi+2M4+Ct/e4Ns j9EVsoeIAtIKzU9sGSm64Rrkxb1XNk7NegcSl6FP7LCM2uqLXGrShdMAt at4V3Ickl7itUFDdFO0BLRVOoIdSxxF1dzo9zJRePj8rJH2JlH9RMKus8 g==; IronPort-SDR: LumqkHTJSRFkcdQcszXWJ/1BI2OAqeYYMllFqaJw6msYulxLZmBwaO4kiyQxsaD1AF15W6l/0f hykMO6hI9hD1zb67vv4LAntP1+9lDW3TiJbqzYYWJgg2bTz6ac1pHOH4lHYG0JzSsAFtnY9/5o 8VMwEeF9UemY0FK9TBt57+XeWiiTjihQpkLlQmJ7o4NkxyoL3CVtzlLkHspxu4KfubjtTbDooI QlRxY0EhCcewXHbC2bncWYsHMR+ve5X43cl69c/T1UaAYxlz/AwQNApx32iLjyKD3eFA1k3E75 lu4= X-IronPort-AV: E=Sophos;i="5.73,352,1583218800"; d="scan'208";a="72332636" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 May 2020 06:46:39 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 May 2020 06:46:40 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 4 May 2020 06:46:36 -0700 From: To: , , "Claudiu Beznea" , Subject: [PATCH v3 3/7] net: macb: fix macb_get/set_wol() when moving to phylink Date: Mon, 4 May 2020 15:44:18 +0200 Message-ID: <77a2227ac02b432f42ed454e1ad94e15863ae2ff.1588597759.git.nicolas.ferre@microchip.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_064645_132921_0750213F X-CRM114-Status: GOOD ( 11.80 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Alexandre Belloni , f.fainelli@gmail.com, michal.simek@xilinx.com, antoine.tenart@bootlin.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nicolas Ferre Keep previous function goals and integrate phylink actions to them. phylink_ethtool_get_wol() is not enough to figure out if Ethernet driver supports Wake-on-Lan. Initialization of "supported" and "wolopts" members is done in phylink function, no need to keep them in calling function. phylink_ethtool_set_wol() return value is not enough to determine if WoL is enabled for the calling Ethernet driver. Call it first but don't rely on its return value as most of simple PHY drivers don't implement a set_wol() function. Fixes: 7897b071ac3b ("net: macb: convert to phylink") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Antoine Tenart Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb_main.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 629660d9f17e..b17a33c60cd4 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -2813,21 +2813,23 @@ static void macb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct macb *bp = netdev_priv(netdev); - wol->supported = 0; - wol->wolopts = 0; - - if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) + if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) { phylink_ethtool_get_wol(bp->phylink, wol); + wol->supported |= WAKE_MAGIC; + + if (bp->wol & MACB_WOL_ENABLED) + wol->wolopts |= WAKE_MAGIC; + } } static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) { struct macb *bp = netdev_priv(netdev); - int ret; - ret = phylink_ethtool_set_wol(bp->phylink, wol); - if (!ret) - return 0; + /* Pass the order to phylink layer. + * Don't test return value as set_wol() is often not supported. + */ + phylink_ethtool_set_wol(bp->phylink, wol); if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) || (wol->wolopts & ~WAKE_MAGIC)) From patchwork Mon May 4 13:44:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 11526011 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E40415AB for ; Mon, 4 May 2020 13:47:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06AE7215A4 for ; Mon, 4 May 2020 13:47:12 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="aiZ88P8I"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="WOD8ByVs" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06AE7215A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q0nX5XDToF4+y8AZyCuYkRTeCs5bJk2MHCisDNF+H7Y=; b=aiZ88P8I/hXA7N GTMQfz7c7c+bt6NXR7bCgDFa8dn1J6dp3wbN7+sGKLy9Z9FrOKIx6qCCFXL7SvAAEJ5Wk2JkfvgO8 Z7XmPDcTOnYbfMDXqyfpHPyVJAn3uwxEYst+IMkFuNuBwm0gk7mSNU9KrhfXrWnY74VHQeMpaowll UWzlai/6hVNNvSYzkqcOsGqrWR1baHseJhBKVRYIDdqjzXwdD3eqQmLjj6+9UF4mrZY4mln11nuyk 1oMO2HzWpwvIPCZR4o3n1DeMIpQC+vmb7zDBtPQtAWk2vSOSO9Q3qwwaRxHVUqWOkoj8NLH7di+Nf L6iohb09bYLL2lNMwqoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbR6-0007LM-Qg; Mon, 04 May 2020 13:47:08 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbQk-0006uu-Pg for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:46:48 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1588600006; x=1620136006; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=c3iuhkwHDW+6rW4ZzAEBKYMLJ0sc8jLJEmEwsrWvUFs=; b=WOD8ByVsR9J82bNWj8wVJAJ6Zcz7IQW62czkTKmzM/cAZwdgs4E3ExVh u5DwOhv6j6K50ZD72fpiwpFh6hwIHF0WfsUBfw1kz6Eq6p7mb1zM78jfu v6PoUw8YCbO+sPvTj/8jxHLGjbng3SuZapskwRD1dXjOwhHS7UojOlT40 cZBA7h5FTl5yjoXrpCJC5Z60qpjTSMtXnJF7qSRoGy78Y3Ito3hKWOWXT StDVL2ypt7LpDywENbtPVVxr2yH2zyhT/Aa7SGVn+TxjoUKwhPeKyLxgR iAh0KTsLFTohoMY32RyQSW1h84qiT7Zaot0zw+DAofbyv6hENjGjbGwlB w==; IronPort-SDR: qByEXUbz+XJu7zWYLrooIYhzLlJmc87a2ewZUokCHS5HEddGKdDpE2W7gODtBNCTltx0Q0yiVf ZScTbvdSukfaShDaFP+cBcost0Jduqg5aOxlJc18rGx1U0uwZBldTWg758tSp/b2Kta86DhQGG 42GoMey4Fqqt4T1Jf+qwiOv3+JdO0HBngzngBQjVyvaZ+1VPthx8R3oMnSQT6v2af+vVGw+NZB F4anYAfmu+MIiX7FSByadjD4UOa/R3C01wCcHQ1OPIQX5pSUrTG/luCnfvAtF9GrTOh0ykXDLl 03c= X-IronPort-AV: E=Sophos;i="5.73,352,1583218800"; d="scan'208";a="72332643" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 May 2020 06:46:43 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 May 2020 06:46:43 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 4 May 2020 06:46:39 -0700 From: To: , , "Claudiu Beznea" , Subject: [PATCH v3 4/7] net: macb: fix macb_suspend() by removing call to netif_carrier_off() Date: Mon, 4 May 2020 15:44:19 +0200 Message-ID: <2b377e5705ced4b0171e07642a891f2416b94945.1588597759.git.nicolas.ferre@microchip.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_064646_938532_425632AB X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Alexandre Belloni , f.fainelli@gmail.com, michal.simek@xilinx.com, antoine.tenart@bootlin.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nicolas Ferre As we now use the phylink call to phylink_stop() in the non-WoL path, there is no need for this call to netif_carrier_off() anymore. It can disturb the underlying phylink FSM. Fixes: 7897b071ac3b ("net: macb: convert to phylink") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Antoine Tenart Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- Changes in v2: - new in v2 serries drivers/net/ethernet/cadence/macb_main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index b17a33c60cd4..72b8983a763a 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4562,7 +4562,6 @@ static int __maybe_unused macb_suspend(struct device *dev) bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT); } - netif_carrier_off(netdev); if (bp->ptp_info) bp->ptp_info->ptp_remove(netdev); pm_runtime_force_suspend(dev); From patchwork Mon May 4 13:44:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 11526019 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5D67B15E6 for ; Mon, 4 May 2020 13:48:22 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A81B21775 for ; Mon, 4 May 2020 13:48:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nLp2RlIF"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="Dzvo488r" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A81B21775 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r7LE0FlTiszbwjusoN4J/2j6oXEp9X2zdx5HTBGl5rM=; b=nLp2RlIFIAZ1PW dd1a8uRDuULhysOHle0/xksh9iBoRu7U9vKjzABVsW+RtnmomS624tzbiBdeLSLEmcHdGRSr90AUo xBoCTDscHTHPLaUblrX0UY04inZfs2Zlj/+kSUuyZSEomuETefbBWJI3u95jSj881+pyIQD7saeBk BqdxLdVaztzAeHu4jjAXWxz+w+3Td+L3joQ/ITNU2mR2/PEq5amH8lEehpZNSpJf5b8/HvHrD7mV2 eJyf3gyDTRCtnBAdD4AW86uHEuHr/S7ojRk9pxZm5prKGnjov1hKGb5zcEJpvvTgsI3UHOk6XqOwX 7HEeWWxP7RDt3W5TpisA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbSF-0008Uw-Fz; Mon, 04 May 2020 13:48:19 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbRC-0007HX-4F for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:47:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1588600034; x=1620136034; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mzrqr3G8iZcqzNlVDE8Bp5RQaqxIcZQVI/t/Po77lqo=; b=Dzvo488rFJa9UZTXw3ieACa6lO5TM2ZkVNSbdGR1fefCydRi8+djJAbB iJ+GQyxgwlzDFFvAUJDXJbU4wpRhnUnW2ZsOi5AKFWwoePSJqh0pRJqXz ontKjKxTPcqzTqncKyA5AXYUbBoit4VDR/+FWKzofCXtUQC0UpOIBIFK3 lI+eEoTO1+kgpo2WS2O9NVuZKwF3LMn0DKyHoVjh3Af3iNXHlC41Hv9gi xwBOmvKERyCl5v6cXMIxgWAIxp6CJx/Keid8sRpMmhWUrP0c5/EScQ3lk PgP43FFx+9ZEIzHFW0jnB2yppPvlu18vIbl9u/UQ3w/volzMPYIj23fC4 A==; IronPort-SDR: LeACB26FaamIcb3cWCu14cDkh7tkabI+Vn9g6mb3xiWVIhmhOIFGRmrVEaPdZYcyRxphPIvZDb bCeBfPdHJzJ0mmMOQ7lZSLepDazjBEc+AEMm66TG9HDNtrHpg1Bc8t/HUg8+hCagAZzOAvj6QU 3cqm82Tuq0a13UI//9/vdtaT394pfxcMM137Qx4Q9u8655KKUIgbHJdjK/RjqgX6dr5ZoEvLZ/ a3Yn0ml1wP7PlX8eqixy+x2euT/aUdRWeSDJl/5jCUS4Fp4k/3ZSZdy05ydRkTnBECJwQItQlb VYE= X-IronPort-AV: E=Sophos;i="5.73,352,1583218800"; d="scan'208";a="74135784" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 May 2020 06:46:46 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 May 2020 06:46:47 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 4 May 2020 06:46:43 -0700 From: To: , , "Claudiu Beznea" , Subject: [PATCH v3 5/7] net: macb: fix call to pm_runtime in the suspend/resume functions Date: Mon, 4 May 2020 15:44:20 +0200 Message-ID: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_064714_410906_C2960186 X-CRM114-Status: GOOD ( 11.09 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.149.84 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Alexandre Belloni , f.fainelli@gmail.com, michal.simek@xilinx.com, antoine.tenart@bootlin.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, Sergio Prado , "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nicolas Ferre The calls to pm_runtime_force_suspend/resume() functions are only relevant if the device is not configured to act as a WoL wakeup source. Add the device_may_wakeup() test before calling them. Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet") Cc: Claudiu Beznea Cc: Harini Katakam Cc: Sergio Prado Reviewed-by: Florian Fainelli Signed-off-by: Nicolas Ferre --- Changes in v3: - remove the parenthesis around device_may_wakeup() Changes in v2: - new in v2 serries drivers/net/ethernet/cadence/macb_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index 72b8983a763a..b42831966ffa 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4564,7 +4564,8 @@ static int __maybe_unused macb_suspend(struct device *dev) if (bp->ptp_info) bp->ptp_info->ptp_remove(netdev); - pm_runtime_force_suspend(dev); + if (!device_may_wakeup(dev)) + pm_runtime_force_suspend(dev); return 0; } @@ -4579,7 +4580,8 @@ static int __maybe_unused macb_resume(struct device *dev) if (!netif_running(netdev)) return 0; - pm_runtime_force_resume(dev); + if (!device_may_wakeup(dev)) + pm_runtime_force_resume(dev); if (bp->wol & MACB_WOL_ENABLED) { macb_writel(bp, IDR, MACB_BIT(WOL)); From patchwork Mon May 4 13:44:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 11526021 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 39E5F15AB for ; Mon, 4 May 2020 13:48:38 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD5AD215A4 for ; Mon, 4 May 2020 13:48:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="SyZF4cv+"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="vg/zj4HE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD5AD215A4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9pVny6b87GrA7XgICaoyfv3OkZ0VVSmlSeGKE5SXb1Q=; b=SyZF4cv+Fo2OD8 lugricUZvjGESOQPmkX8p5OGmL5lpmF0SWDCvN2bLajjHVyf45vVK0r4tWlMN79G1RZ4PfG/tNTAP ajL6+B0BixWVLcKlHJjOd9AA67ss1qTf1GhsJ1ROJkVrHnqocpfqMLrfP9DD1Vp0POCSoHaou1Pjm +jHq8W+x+weLDFxYGuuF4hO89fUemB6W3wBuCzHkXtp7/YA8Z3u4QXfr8KYZhdjvzWmKApxpCDbtR BZM9Tb+x4934Cdn46pL9hDFvsRXroeJfWkSFL8IAGMsZHUIbOMKCzx9g16i+YWNcvmUgLyteCAgl/ 3cuVU2wb4EbtnbGiyHCw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbSQ-0000Ei-WA; Mon, 04 May 2020 13:48:31 +0000 Received: from esa2.microchip.iphmx.com ([68.232.149.84]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbRF-0007HX-0h for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:47:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1588600036; x=1620136036; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q6EJYEgo6TTkdEUEUvJ8NkL7PVRlN42+i6jsPqyUwcI=; b=vg/zj4HEOV3c3F9Y0cvOk6O/5/PQ0/O4X+/SeKWn/nhAdIIOGfJ4teGi SeN9SMZk0cWPnUN9Q5A2S5+mffpL4ers50inwF9x++ziqr22blDCTnlmP xaeV/S85vkJCAzXZc/0A2w0lw+oYmb6O30W5zs5rXOC6Hz32ge5yxsfDx xuy15FGRunMKp33h96e17IAUBOAfrPmqX4qlvM7N3qw6f2xRiAt1TNM9z N09ckoi/rWTJ1r9xt2Nw1u5bAuM9Q/9yPsG7YqVpC13skyW4cu5uDG/eP xmbTHPiCER8NcM95YACxtzGADwq8iYUkVTdMLc7VXlNOEsQQ2Qu7YIJBK w==; IronPort-SDR: zQW9TDcKhjP9IpJCWMuNK9Tpy8ncuBujb5VFiXjQkc2uRxnJn63tuQQwFLxSUAwm3o4WOjeAGA i/0tXcyYk0ujZW9MTvKQZIXxd41crW3FcfLotOTUV23sPHie3Th7s6bJkwR2C3KZ0tA9Yty51Z abdPucRHexiBmkpdI3iQC0p9/N9IP3Gw5sZV9SRMJWsHAwYpR2mxk9fQzu5qDLkoUm6zP1orO8 xSCX7gec1uojnHMKDfdTR3qmi261UNsGsGJ/fPcgdYTpM6tkRl54tT4Hq6rzuAMNAs2tJ79OPE OnY= X-IronPort-AV: E=Sophos;i="5.73,352,1583218800"; d="scan'208";a="74135793" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 May 2020 06:46:49 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 May 2020 06:46:50 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 4 May 2020 06:46:46 -0700 From: To: , , "Claudiu Beznea" , Subject: [PATCH v3 6/7] net: macb: WoL support for GEM type of Ethernet controller Date: Mon, 4 May 2020 15:44:21 +0200 Message-ID: <953a18aa4eaed3637050422156cb6ffbe6554156.1588597759.git.nicolas.ferre@microchip.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_064717_243780_2F64677A X-CRM114-Status: GOOD ( 18.94 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.149.84 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Alexandre Belloni , f.fainelli@gmail.com, michal.simek@xilinx.com, antoine.tenart@bootlin.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nicolas Ferre Adapt the Wake-on-Lan feature to the Cadence GEM Ethernet controller. This controller has different register layout and cannot be handled by previous code. We disable completely interrupts on all the queues but the queue 0. Handling of WoL interrupt is done in another interrupt handler positioned depending on the controller version used, just between suspend() and resume() calls. It allows to lower pressure on the generic interrupt hot path by removing the need to handle 2 tests for each IRQ: the first figuring out the controller revision, the second for actually knowing if the WoL bit is set. Queue management in suspend()/resume() functions inspired from RFC patch by Harini Katakam , thanks! Cc: Claudiu Beznea Cc: Harini Katakam Signed-off-by: Nicolas Ferre --- Changes in v3: - In macb_resume(), move to a more in-depth re-configuration of the controller even on the non-WoL path in order to accept deeper sleep states. - this ends up having a phylink_stop()/phylink_start() for each of the WoL/!WoL paths - In macb_resume(), keep setting the MPE bit in NCR register which is needed in case of deep power saving mode used - Tests done in "standby" as well as our deeper Power Management mode: Backup Self-Refresh (BSR) Changes in v2: - Addition of pm_wakeup_event() in WoL IRQ - In macb_resume(), removal of setting the MPE bit in NCR register which is not needed in any case: IP is reset on the usual path and kept alive if WoL is used - In macb_resume(), complete reset of the controller is kept only for non-WoL case. For the WoL case, we only replace the usual IRQ handler. drivers/net/ethernet/cadence/macb.h | 3 + drivers/net/ethernet/cadence/macb_main.c | 141 +++++++++++++++++++---- 2 files changed, 122 insertions(+), 22 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h index ab827fb4b6b9..4f1b41569260 100644 --- a/drivers/net/ethernet/cadence/macb.h +++ b/drivers/net/ethernet/cadence/macb.h @@ -90,6 +90,7 @@ #define GEM_SA3T 0x009C /* Specific3 Top */ #define GEM_SA4B 0x00A0 /* Specific4 Bottom */ #define GEM_SA4T 0x00A4 /* Specific4 Top */ +#define GEM_WOL 0x00b8 /* Wake on LAN */ #define GEM_EFTSH 0x00e8 /* PTP Event Frame Transmitted Seconds Register 47:32 */ #define GEM_EFRSH 0x00ec /* PTP Event Frame Received Seconds Register 47:32 */ #define GEM_PEFTSH 0x00f0 /* PTP Peer Event Frame Transmitted Seconds Register 47:32 */ @@ -396,6 +397,8 @@ #define MACB_PDRSFT_SIZE 1 #define MACB_SRI_OFFSET 26 /* TSU Seconds Register Increment */ #define MACB_SRI_SIZE 1 +#define GEM_WOL_OFFSET 28 /* Enable wake-on-lan interrupt */ +#define GEM_WOL_SIZE 1 /* Timer increment fields */ #define MACB_TI_CNS_OFFSET 0 diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index b42831966ffa..be8454a8535b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1513,6 +1513,35 @@ static void macb_tx_restart(struct macb_queue *queue) macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); } +static irqreturn_t gem_wol_interrupt(int irq, void *dev_id) +{ + struct macb_queue *queue = dev_id; + struct macb *bp = queue->bp; + u32 status; + + status = queue_readl(queue, ISR); + + if (unlikely(!status)) + return IRQ_NONE; + + spin_lock(&bp->lock); + + if (status & GEM_BIT(WOL)) { + queue_writel(queue, IDR, GEM_BIT(WOL)); + gem_writel(bp, WOL, 0); + netdev_vdbg(bp->dev, "GEM WoL: queue = %u, isr = 0x%08lx\n", + (unsigned int)(queue - bp->queues), + (unsigned long)status); + if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) + queue_writel(queue, ISR, GEM_BIT(WOL)); + pm_wakeup_event(&bp->pdev->dev, 0); + } + + spin_unlock(&bp->lock); + + return IRQ_HANDLED; +} + static irqreturn_t macb_interrupt(int irq, void *dev_id) { struct macb_queue *queue = dev_id; @@ -3306,6 +3335,8 @@ static const struct ethtool_ops macb_ethtool_ops = { static const struct ethtool_ops gem_ethtool_ops = { .get_regs_len = macb_get_regs_len, .get_regs = macb_get_regs, + .get_wol = macb_get_wol, + .set_wol = macb_set_wol, .get_link = ethtool_op_get_link, .get_ts_info = macb_get_ts_info, .get_ethtool_stats = gem_get_ethtool_stats, @@ -4534,20 +4565,54 @@ static int __maybe_unused macb_suspend(struct device *dev) struct macb_queue *queue = bp->queues; unsigned long flags; unsigned int q; + int err; if (!netif_running(netdev)) return 0; if (bp->wol & MACB_WOL_ENABLED) { - macb_writel(bp, IER, MACB_BIT(WOL)); - macb_writel(bp, WOL, MACB_BIT(MAG)); - enable_irq_wake(bp->queues[0].irq); - netif_device_detach(netdev); - } else { - netif_device_detach(netdev); + spin_lock_irqsave(&bp->lock, flags); + /* Flush all status bits */ + macb_writel(bp, TSR, -1); + macb_writel(bp, RSR, -1); for (q = 0, queue = bp->queues; q < bp->num_queues; - ++q, ++queue) - napi_disable(&queue->napi); + ++q, ++queue) { + /* Disable all interrupts */ + queue_writel(queue, IDR, -1); + queue_readl(queue, ISR); + if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) + queue_writel(queue, ISR, -1); + } + /* Change interrupt handler and + * Enable WoL IRQ on queue 0 + */ + if (macb_is_gem(bp)) { + devm_free_irq(dev, bp->queues[0].irq, bp->queues); + err = devm_request_irq(dev, bp->queues[0].irq, gem_wol_interrupt, + IRQF_SHARED, netdev->name, bp->queues); + if (err) { + dev_err(dev, + "Unable to request IRQ %d (error %d)\n", + bp->queues[0].irq, err); + return err; + } + queue_writel(bp->queues, IER, GEM_BIT(WOL)); + gem_writel(bp, WOL, MACB_BIT(MAG)); + } else { + queue_writel(bp->queues, IER, MACB_BIT(WOL)); + macb_writel(bp, WOL, MACB_BIT(MAG)); + } + spin_unlock_irqrestore(&bp->lock, flags); + + enable_irq_wake(bp->queues[0].irq); + } + + netif_device_detach(netdev); + for (q = 0, queue = bp->queues; q < bp->num_queues; + ++q, ++queue) + napi_disable(&queue->napi); + + if (!(bp->wol & MACB_WOL_ENABLED)) { rtnl_lock(); phylink_stop(bp->phylink); rtnl_unlock(); @@ -4575,7 +4640,9 @@ static int __maybe_unused macb_resume(struct device *dev) struct net_device *netdev = dev_get_drvdata(dev); struct macb *bp = netdev_priv(netdev); struct macb_queue *queue = bp->queues; + unsigned long flags; unsigned int q; + int err; if (!netif_running(netdev)) return 0; @@ -4584,29 +4651,59 @@ static int __maybe_unused macb_resume(struct device *dev) pm_runtime_force_resume(dev); if (bp->wol & MACB_WOL_ENABLED) { - macb_writel(bp, IDR, MACB_BIT(WOL)); - macb_writel(bp, WOL, 0); - disable_irq_wake(bp->queues[0].irq); - } else { - macb_writel(bp, NCR, MACB_BIT(MPE)); - - if (netdev->hw_features & NETIF_F_NTUPLE) - gem_writel_n(bp, ETHT, SCRT2_ETHT, bp->pm_data.scrt2); + spin_lock_irqsave(&bp->lock, flags); + /* Disable WoL */ + if (macb_is_gem(bp)) { + queue_writel(bp->queues, IDR, GEM_BIT(WOL)); + gem_writel(bp, WOL, 0); + } else { + queue_writel(bp->queues, IDR, MACB_BIT(WOL)); + macb_writel(bp, WOL, 0); + } + /* Clear ISR on queue 0 */ + queue_readl(bp->queues, ISR); + if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) + queue_writel(bp->queues, ISR, -1); + /* Replace interrupt handler on queue 0 */ + devm_free_irq(dev, bp->queues[0].irq, bp->queues); + err = devm_request_irq(dev, bp->queues[0].irq, macb_interrupt, + IRQF_SHARED, netdev->name, bp->queues); + if (err) { + dev_err(dev, + "Unable to request IRQ %d (error %d)\n", + bp->queues[0].irq, err); + return err; + } + spin_unlock_irqrestore(&bp->lock, flags); - if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) - macb_or_gem_writel(bp, USRIO, bp->pm_data.usrio); + disable_irq_wake(bp->queues[0].irq); - for (q = 0, queue = bp->queues; q < bp->num_queues; - ++q, ++queue) - napi_enable(&queue->napi); + /* Now make sure we disable phy before moving + * to common restore path + */ rtnl_lock(); - phylink_start(bp->phylink); + phylink_stop(bp->phylink); rtnl_unlock(); } + for (q = 0, queue = bp->queues; q < bp->num_queues; + ++q, ++queue) + napi_enable(&queue->napi); + + if (netdev->hw_features & NETIF_F_NTUPLE) + gem_writel_n(bp, ETHT, SCRT2_ETHT, bp->pm_data.scrt2); + + if (!(bp->caps & MACB_CAPS_USRIO_DISABLED)) + macb_or_gem_writel(bp, USRIO, bp->pm_data.usrio); + + macb_writel(bp, NCR, MACB_BIT(MPE)); macb_init_hw(bp); macb_set_rx_mode(netdev); macb_restore_features(bp); + rtnl_lock(); + phylink_start(bp->phylink); + rtnl_unlock(); + netif_device_attach(netdev); if (bp->ptp_info) bp->ptp_info->ptp_init(netdev); From patchwork Mon May 4 13:44:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 11526013 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BA0414C0 for ; Mon, 4 May 2020 13:47:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 299AB21582 for ; Mon, 4 May 2020 13:47:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="LR3Jd7le"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="xWik7MKI" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 299AB21582 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=microchip.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0iFX5dJwIJC4oo9j67FaX5/qrwiIurASm8Ea1LK40yo=; b=LR3Jd7leeQjARn hpXTJt2bo48f6Xl//JTjju1xvqv1vB9K31q7TbVEobIOf3srCJiwiiB4kIvi4ODORvjzsTqBAObf3 /mSRi8ltfZo5B6X97Ay9FIdq8vWyToW4on/lBvmKhQwlGpVVXE0EB3xklBtZkphpF94gXRWDqn6NC aQy+uztDZby3PwCOqySVAO8KuN8iFxPV+SaYYT71TKE+mG1yEfXlV582Uz3BiyNgSI585iG/bWLTs vQfocum0CgCtKBHCLecKQ+yYaE51O/r7Yv+5O855QXZbwH1jltcIJU+HuxHcCHb8A1AvIU8hGvnie DFPjauLHpvP0SLTgb4Hg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbRP-0007d1-7F; Mon, 04 May 2020 13:47:27 +0000 Received: from esa4.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jVbQt-00076c-En for linux-arm-kernel@lists.infradead.org; Mon, 04 May 2020 13:46:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1588600015; x=1620136015; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=12xjLzI1c4xmu9itMWLk1HDPDRb1cJVAi53VDaonBYc=; b=xWik7MKIt16Q5SnCNyW+FlIlmcCLjhmxim5bimD/QEZ/oo5yscII1NoL EpnKeGASpq5BnxRFXFqp3WbwF1phDw/4kL1av/qpmMrvkJ8TQhpfck3lZ j7vmxitHzCfuwvuXNEXmfrODHK0oHEH8/dTS6eWkSAp7VTWbpwHWwR4ov QpDGFeB97EVR/m3CsvqlbpRe9achaZaT8P9duDhJ6vapjQID8k/3r03kn u31AaewXyR5Ng7VNAwjtJZfqOLIO8AO7DS/Vx6bGCxV9a+vtTWZUxtfpd bbLHIVJmJDYNC89ZMTVnde1TKo0gyEqWf+gk73VvJ+LNkPEveU3ljvjK2 w==; IronPort-SDR: ZXnc/wUiGFY/B3+inZSWq9bYwDHFMMv3hrflf0gpSWTmhoAoRQl28agtHAlcsB0fncaWN094wj 6m69xlWsR7TZQ5Xt6UQAvMnAkKi7jB5A4N1ih6mVK6fuc3mhGSf+bFPG4u3+/BlFaeJ2LFcQBO Ros5J1KaJ3lXYJRQT1aoSbX5Oxuafoo4gkY45I7J7eT0mOJmvKQNL+iuow+fzLZ5kuRr2wW4rh RKAp+9dKTK+m5NszmJ1KBO8qSes+Nq3HIP+mQwEme7+0EhsxzAIQs244SrkL9XVd+p5oh6P81A 4LM= X-IronPort-AV: E=Sophos;i="5.73,352,1583218800"; d="scan'208";a="72332658" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 04 May 2020 06:46:52 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Mon, 4 May 2020 06:46:53 -0700 Received: from localhost.localdomain (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1713.5 via Frontend Transport; Mon, 4 May 2020 06:46:49 -0700 From: To: , , "Claudiu Beznea" , Subject: [PATCH v3 7/7] net: macb: Add WoL interrupt support for MACB type of Ethernet controller Date: Mon, 4 May 2020 15:44:22 +0200 Message-ID: X-Mailer: git-send-email 2.26.2 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200504_064655_590846_4EC79385 X-CRM114-Status: GOOD ( 13.01 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.4 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [68.232.154.123 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andrew@lunn.ch, Alexandre Belloni , f.fainelli@gmail.com, michal.simek@xilinx.com, antoine.tenart@bootlin.com, linux@armlinux.org.uk, linux-kernel@vger.kernel.org, "David S. Miller" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Nicolas Ferre Handle the Wake-on-Lan interrupt for the Cadence MACB Ethernet controller. As we do for the GEM version, we handle of WoL interrupt in a specialized interrupt handler for MACB version that is positionned just between suspend() and resume() calls. Cc: Claudiu Beznea Cc: Harini Katakam Signed-off-by: Nicolas Ferre --- Changes in v2: - Addition of pm_wakeup_event() in WoL IRQ drivers/net/ethernet/cadence/macb_main.c | 39 +++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index be8454a8535b..f8dc3c1b807b 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -1513,6 +1513,35 @@ static void macb_tx_restart(struct macb_queue *queue) macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART)); } +static irqreturn_t macb_wol_interrupt(int irq, void *dev_id) +{ + struct macb_queue *queue = dev_id; + struct macb *bp = queue->bp; + u32 status; + + status = queue_readl(queue, ISR); + + if (unlikely(!status)) + return IRQ_NONE; + + spin_lock(&bp->lock); + + if (status & MACB_BIT(WOL)) { + queue_writel(queue, IDR, MACB_BIT(WOL)); + macb_writel(bp, WOL, 0); + netdev_vdbg(bp->dev, "MACB WoL: queue = %u, isr = 0x%08lx\n", + (unsigned int)(queue - bp->queues), + (unsigned long)status); + if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE) + queue_writel(queue, ISR, MACB_BIT(WOL)); + pm_wakeup_event(&bp->pdev->dev, 0); + } + + spin_unlock(&bp->lock); + + return IRQ_HANDLED; +} + static irqreturn_t gem_wol_interrupt(int irq, void *dev_id) { struct macb_queue *queue = dev_id; @@ -4586,8 +4615,8 @@ static int __maybe_unused macb_suspend(struct device *dev) /* Change interrupt handler and * Enable WoL IRQ on queue 0 */ + devm_free_irq(dev, bp->queues[0].irq, bp->queues); if (macb_is_gem(bp)) { - devm_free_irq(dev, bp->queues[0].irq, bp->queues); err = devm_request_irq(dev, bp->queues[0].irq, gem_wol_interrupt, IRQF_SHARED, netdev->name, bp->queues); if (err) { @@ -4599,6 +4628,14 @@ static int __maybe_unused macb_suspend(struct device *dev) queue_writel(bp->queues, IER, GEM_BIT(WOL)); gem_writel(bp, WOL, MACB_BIT(MAG)); } else { + err = devm_request_irq(dev, bp->queues[0].irq, macb_wol_interrupt, + IRQF_SHARED, netdev->name, bp->queues); + if (err) { + dev_err(dev, + "Unable to request IRQ %d (error %d)\n", + bp->queues[0].irq, err); + return err; + } queue_writel(bp->queues, IER, MACB_BIT(WOL)); macb_writel(bp, WOL, MACB_BIT(MAG)); }