From patchwork Fri Jul 10 12:46:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas Ferre X-Patchwork-Id: 1326755 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org (client-ip=23.128.96.18; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=microchip.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=microchip.com header.i=@microchip.com header.a=rsa-sha256 header.s=mchp header.b=iAEGsQJI; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by ozlabs.org (Postfix) with ESMTP id 4B3CWK1B9Zz9sRR for ; Fri, 10 Jul 2020 22:47:57 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727927AbgGJMrc (ORCPT ); Fri, 10 Jul 2020 08:47:32 -0400 Received: from esa3.microchip.iphmx.com ([68.232.153.233]:50543 "EHLO esa3.microchip.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbgGJMra (ORCPT ); Fri, 10 Jul 2020 08:47:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1594385249; x=1625921249; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3dSAtd0YST9naogJUwhR283iRPreXicwpYimF4Vmvi0=; b=iAEGsQJIbz2QIwJd9GGxifSENkQEEskX8osCpOkgrEPgvyO93dTal5O+ qAu3zxe9vJQr9ZY6BevRZZ5NGVdrkSuuhSe7XpZLL9cAayHH8UTD/Ktit GZqFw5BxcSF7DvkYyJlKDHiSEInQb0wRfoySX8kip6ogWLXxp/icX0qZZ YtvzWhpr51OAZYzb7cb7Hof8reaXPm/5sy2BKZnEx8JSkYZwtkMJxvqZD QHGLqiIXyQCv1rRn4/oH9d1/k+UJY7NvgVTc5OtSNqgk0HrJvF2Na0hyY XXkyQHEH+jdoLNjz9SlbsF14Itp3ysthIHPzePFbRRvffwdWCn305KYqk w==; IronPort-SDR: SwZKNCbVMNiyrrtLkALj6JNq8fh0MZ2dVkj7HytbeXgGXnQikweAeLAJJZiauk3XXQbrW+8uNf bARdVIdkKIbaDpuw0Y0q1X69lwMLUcRxQcsGNpVxM63XK02v7LTkUYimiatzLPvANHSA4hDT0s VnF6QH+kB6ZDZSxKqfXEvytZGi608N7K5pOmZX1eBjV1cgjwfIFxSaxrDHYx/3U24KK3wKCoJI 6A58hGLNlafdyqhigrB7r25poiUmOZs+e1T2c0gW3X2FsJ0X8DMrkj+UlpOy7Ulbv7E8IOBsWa aM8= X-IronPort-AV: E=Sophos;i="5.75,335,1589266800"; d="scan'208";a="83305784" Received: from smtpout.microchip.com (HELO email.microchip.com) ([198.175.253.82]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 10 Jul 2020 05:47:29 -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.1979.3; Fri, 10 Jul 2020 05:47:01 -0700 Received: from ness.mchp-main.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.1979.3 via Frontend Transport; Fri, 10 Jul 2020 05:47:25 -0700 From: To: , , , Claudiu Beznea , , CC: , "David S. Miller" , Alexandre Belloni , , Nicolas Ferre , Sergio Prado Subject: [PATCH v5 2/5] net: macb: mark device wake capable when "magic-packet" property present Date: Fri, 10 Jul 2020 14:46:42 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.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 55e680f35022..4cafe343c0a2 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -4422,7 +4422,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);