Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2716690imj; Mon, 11 Feb 2019 07:25:51 -0800 (PST) X-Google-Smtp-Source: AHgI3IabFlHVvE+pBtGuGwBRSvl8PRDDvlMe2S0vOKSf6E1/bGs0xD3s3UG3eJ3Al2bzK01vkYdv X-Received: by 2002:a62:1e45:: with SMTP id e66mr36985485pfe.152.1549898751300; Mon, 11 Feb 2019 07:25:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898751; cv=none; d=google.com; s=arc-20160816; b=l4CAI5LjVgxtkmgDSYyT9yb1C1gEd13d9v6dR80BNBzzpOQFJoOgJRUe3swDLIYUYw mDw+0Pc2u22+yt8zIOV5p8U+28+LweJTWwPoJlt+eDgcAeY4xt2xfjTuMvsljjyqtHEu riv/Wzu1dgx+ueE2y/Q0+uD5vppoFqMESFM1z72/DlcXqxuLRzfC+ubzYn4up8Jv9syc TrliZ1z/tASSphoIt7PzNzaiFO8Dg3dYbr73xtBWxKVPbP1zxz3BlQ7q4KzocCS90Rd4 CywjyzlYl2OYFkwI4Sv0C25ure4QtiqmHduww6w/VL1dikEyDLU08NChlKEDjGVVDRvA NQpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=VgwdTWZWYo5GOQW1D29+1ZGPWSMCpRtnaV3h8tT1zxw=; b=RxMt/HU3C7iBEAQgGe7uoLeCG8B8YKJP0PP7urIlRtBcZ89J+/GMC8AsRKN8jrieok 3cUcNvLfKzNFUDgi3VO9QCS/xe6TI9B37vJW0mWKfZLDyLqqpg6yMLeamzsMjrMEVY+L DsiA+7vD+c9EYqXhPBfomx3P0+gZvAnrhYqC+pzoer2cYDetBNfAdyGXZQzJan9/NbRg VDkwC/9iGFsnPUJWikZO66ksHjdIhVMSYcgByA7yk4A1Ka3n0H62hhb3bIEPtHdKFa0E UFZsubPVb7eWR+N6qikuGuaH7340D5qTZ+Iu2GaRIu6Y+eAivdNXeGX3OLL1h66FfhCt JIUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2umM1BNf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m3si10158632pgs.8.2019.02.11.07.25.11; Mon, 11 Feb 2019 07:25:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=2umM1BNf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390430AbfBKPCe (ORCPT + 99 others); Mon, 11 Feb 2019 10:02:34 -0500 Received: from mail.kernel.org ([198.145.29.99]:50690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389635AbfBKPC3 (ORCPT ); Mon, 11 Feb 2019 10:02:29 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 496DB222A7; Mon, 11 Feb 2019 15:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897348; bh=Jztei4wtUJY23q7+WOE14c2Cnm/qGhQw5d89Fch0mR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2umM1BNfSi7iS31ZnJukbb2PwG9alG97SsUtlTfjydt5JZ5NFTNK0qvZFCrJ/Q/et 16zf1ptG3eZaqDSIQ9RCyf1ac1vbtcLTgjdpdxc9d9m61PiQnrdBsqyETQ8UyiGWfk 5ddrYKkjdX1IAO4WykWXzuRFGhwgvIFzPMcvf9Gc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "David S. Miller" Subject: [PATCH 4.14 172/205] net: systemport: Fix WoL with password after deep sleep Date: Mon, 11 Feb 2019 15:19:30 +0100 Message-Id: <20190211141839.609290443@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli [ Upstream commit 8dfb8d2cceb76b74ad5b58cc65c75994329b4d5e ] Broadcom STB chips support a deep sleep mode where all register contents are lost. Because we were stashing the MagicPacket password into some of these registers a suspend into that deep sleep then a resumption would not lead to being able to wake-up from MagicPacket with password again. Fix this by keeping a software copy of the password and program it during suspend. Fixes: 83e82f4c706b ("net: systemport: add Wake-on-LAN support") Signed-off-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/bcmsysport.c | 25 ++++++++++--------------- drivers/net/ethernet/broadcom/bcmsysport.h | 2 ++ 2 files changed, 12 insertions(+), 15 deletions(-) --- a/drivers/net/ethernet/broadcom/bcmsysport.c +++ b/drivers/net/ethernet/broadcom/bcmsysport.c @@ -519,7 +519,6 @@ static void bcm_sysport_get_wol(struct n struct ethtool_wolinfo *wol) { struct bcm_sysport_priv *priv = netdev_priv(dev); - u32 reg; wol->supported = WAKE_MAGIC | WAKE_MAGICSECURE; wol->wolopts = priv->wolopts; @@ -527,11 +526,7 @@ static void bcm_sysport_get_wol(struct n if (!(priv->wolopts & WAKE_MAGICSECURE)) return; - /* Return the programmed SecureOn password */ - reg = umac_readl(priv, UMAC_PSW_MS); - put_unaligned_be16(reg, &wol->sopass[0]); - reg = umac_readl(priv, UMAC_PSW_LS); - put_unaligned_be32(reg, &wol->sopass[2]); + memcpy(wol->sopass, priv->sopass, sizeof(priv->sopass)); } static int bcm_sysport_set_wol(struct net_device *dev, @@ -547,13 +542,8 @@ static int bcm_sysport_set_wol(struct ne if (wol->wolopts & ~supported) return -EINVAL; - /* Program the SecureOn password */ - if (wol->wolopts & WAKE_MAGICSECURE) { - umac_writel(priv, get_unaligned_be16(&wol->sopass[0]), - UMAC_PSW_MS); - umac_writel(priv, get_unaligned_be32(&wol->sopass[2]), - UMAC_PSW_LS); - } + if (wol->wolopts & WAKE_MAGICSECURE) + memcpy(priv->sopass, wol->sopass, sizeof(priv->sopass)); /* Flag the device and relevant IRQ as wakeup capable */ if (wol->wolopts) { @@ -2221,12 +2211,17 @@ static int bcm_sysport_suspend_to_wol(st unsigned int timeout = 1000; u32 reg; - /* Password has already been programmed */ reg = umac_readl(priv, UMAC_MPD_CTRL); reg |= MPD_EN; reg &= ~PSW_EN; - if (priv->wolopts & WAKE_MAGICSECURE) + if (priv->wolopts & WAKE_MAGICSECURE) { + /* Program the SecureOn password */ + umac_writel(priv, get_unaligned_be16(&priv->sopass[0]), + UMAC_PSW_MS); + umac_writel(priv, get_unaligned_be32(&priv->sopass[2]), + UMAC_PSW_LS); reg |= PSW_EN; + } umac_writel(priv, reg, UMAC_MPD_CTRL); /* Make sure RBUF entered WoL mode as result */ --- a/drivers/net/ethernet/broadcom/bcmsysport.h +++ b/drivers/net/ethernet/broadcom/bcmsysport.h @@ -11,6 +11,7 @@ #ifndef __BCM_SYSPORT_H #define __BCM_SYSPORT_H +#include #include /* Receive/transmit descriptor format */ @@ -754,6 +755,7 @@ struct bcm_sysport_priv { unsigned int crc_fwd:1; u16 rev; u32 wolopts; + u8 sopass[SOPASS_MAX]; unsigned int wol_irq_disabled:1; /* MIB related fields */