Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2749596imj; Mon, 11 Feb 2019 07:56:32 -0800 (PST) X-Google-Smtp-Source: AHgI3IZPBxVoO4GJnf6D9VEPeYOHb43Jqe72wykofJvnQ+b+m90G2V4Nctx0PjIlJbffh3/yQnaz X-Received: by 2002:a63:f74f:: with SMTP id f15mr34173671pgk.190.1549900592208; Mon, 11 Feb 2019 07:56:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900592; cv=none; d=google.com; s=arc-20160816; b=katA3jidGo5rvFHFb4sDxectLkmMSVMLP2uPgpiD74Nqk2eTY0IMiYWWL+JeAnONL/ aIAJt2eyk2DiAnRX7uT5eOZIpI5+r+g7JWrV1aPA6m2sfL/gUviifv3jnEFxLCJ6Rcok EGqbhnQYB8DMcOCJy5PFmOXvhFSd9EPxvBGtMiGvttogJHoIcy61QUxl7V/iYDJWfu0n OOXXb/S94NaWPwAiHFK40DtLFW5o2e5cPr5lz7IyrCFgBwmp78Or2YuLCIo+/WMg7BC9 j3pyRmZ/VhUnei0sJgVZ/5sDsdkb+ZSq1AZq14Rqp7GaWeqmncwQGy1tLZ1NaTJXJzw0 HB1A== 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=PFLR83ekiV7BIC+8M+RXWW+cYPLkaIdhfD713oYC3iU=; b=xPH7XdqyjmNjDdmW2EcUF3kh2o88+75AU//AMfYSZZ7w5pXXQtyHtjFaMmDc0YnCP3 Vur+qvJ13lDhCG7dwIvzAQ2JBpV+ng03KYdMQ3E/ySoIzMYqSDgrMMzNjQC7h36LGYTJ j1W34mpGBZLGSj63ITjtewSioZtKJOf4mywP4PscfKu3FkitKfmUygS5oxJGC6Gi7rhu A9D2Br6eFSSU//Ystt86hKq6co6f8rr12QL4pA3wvfNKMeUHVrzps6m5lI4eCLobGcA9 kb4OWDzVsqn4/ViXv3Vl9rTOJzdgLK+QBp8BYMkP6+n3tFf6H9lfyTiPo/PSzpNvPKLv EEyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JlIcwS8E; 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 g128si9591792pgc.352.2019.02.11.07.56.16; Mon, 11 Feb 2019 07:56:32 -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=JlIcwS8E; 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 S1731008AbfBKOfX (ORCPT + 99 others); Mon, 11 Feb 2019 09:35:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:43970 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730453AbfBKOfU (ORCPT ); Mon, 11 Feb 2019 09:35:20 -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 6C98D20700; Mon, 11 Feb 2019 14:35:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895719; bh=jlmU8ebLk/KoKFkf7OmM5L+IihRgnlBY7Vo68Z1AAGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JlIcwS8EmN9V5xJzWZuUugdP+SwyCKMN+P/50Fk9BTfshwXilPczdYax5/ilr5MAA LbP51BCCtpKvhUKPQtMvXxQWWrU1HjUWMR7sesYCFaHPIAGoC4I7R1gvuFamsVREw6 N8Smiur6IFd+6C70ay1K6tO75uawAIXshh6Rl5Kg= 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.20 300/352] net: systemport: Fix WoL with password after deep sleep Date: Mon, 11 Feb 2019 15:18:47 +0100 Message-Id: <20190211141905.951705741@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@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.20-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 @@ -520,7 +520,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 | WAKE_FILTER; wol->wolopts = priv->wolopts; @@ -528,11 +527,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, @@ -548,13 +543,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) { @@ -2592,13 +2582,18 @@ static int bcm_sysport_suspend_to_wol(st unsigned int index, i = 0; u32 reg; - /* Password has already been programmed */ reg = umac_readl(priv, UMAC_MPD_CTRL); if (priv->wolopts & (WAKE_MAGIC | WAKE_MAGICSECURE)) 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); if (priv->wolopts & WAKE_FILTER) { --- a/drivers/net/ethernet/broadcom/bcmsysport.h +++ b/drivers/net/ethernet/broadcom/bcmsysport.h @@ -12,6 +12,7 @@ #define __BCM_SYSPORT_H #include +#include #include #include @@ -778,6 +779,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 */