Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3682057pxv; Mon, 26 Jul 2021 09:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjML3cw3abyjBgt4gLiubKArnszzE8CDjgxcaPIefEd8vHrX6JE8O1sNvstNz3/l7HL2n2 X-Received: by 2002:a17:907:1614:: with SMTP id hb20mr18082464ejc.387.1627316237815; Mon, 26 Jul 2021 09:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627316237; cv=none; d=google.com; s=arc-20160816; b=LkdG5JCIcOKBFO9Nbh0ZKYZT88iouoE9+54no1jJB/3uNLE8DvEz7dlWebtgwpTu6d 4eV984SBGGd2NJ7/de3WJXg7/40IVK9p7WjaaYzk4jGWoeVtNZ3o1hGkjLITUz247rOT sDVRThixSlsy78xzoJPLDzPYeGvhTiaSgohRJdNWU+KeRcdaxxSzJ2C8RE+8JLHMDBJT zxWs848Jwt+/MluDKZ7Dh0hqBJH+7fD3hGbgIi8Az/UwxpXBvA1V4VOO5P/KEvj86Q3i TcqnP8CZ6uqtfc+Qqn5XMDV9hpNSm8Ea1XTDSyfZS5yuy4NUC+yVa6MnXQBKvE7AaSpD q/vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CeBgBQHD6fWsZX1QTBh9dJiLxhX2pLr9TzCjkQrkgkM=; b=uAOyAMKAynRVCBw2WY7K9FR5ymcukbsqeOyycxdGR/39o1jA6jGr37+/NM67JrMfkF RGb4A8yby+LXd//ZtyEL6f8yM68gkRCEKV/L2cOTtFQmf3QwNoNAMoRDdredofDsSzER paLTPXrmzeyZSikIGx6WMn3taq0tczjzbS26r+6qmwk+1zfhV/r60QgyzQ4yNVV+olGL VFSIQ/Z4TKtxoqaMGS7Zw767wvmyjWBobnO15rNnfXzxXzP7sc6PAceG2r6xw2LNCjOO E9c40MoYyCAjL+jRqgmfG6HHPjzVyWY7/kjV011kgZgh0vD+HrC5riPUDqHxzHMPbJRb peKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tvpr0hHm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si363314edq.70.2021.07.26.09.16.51; Mon, 26 Jul 2021 09:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Tvpr0hHm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236719AbhGZPeX (ORCPT + 99 others); Mon, 26 Jul 2021 11:34:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:60718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236778AbhGZPTa (ORCPT ); Mon, 26 Jul 2021 11:19:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BCC7D6056C; Mon, 26 Jul 2021 15:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315199; bh=7aB5M/EA6XknyCr/ipteyQEC7X8uS7XoSvnoKtqVPhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tvpr0hHmH1PU8GhzKL7GPDjbTXYmiSaxK9QlBklRGmDLaBjFVkr7lAA0LOCEzjnxq V5wLwjR8TcZpEzKzPXIM0qrgpEHEIJSpRB8RHpvuFHgIL+zPB0QafZNVV8ce7u0T/Z /S5E6paThCZu3jxCtpp/38YN10HvecPNKvUNs26g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Florian Fainelli , "David S. Miller" Subject: [PATCH 5.4 102/108] net: bcmgenet: ensure EXT_ENERGY_DET_MASK is clear Date: Mon, 26 Jul 2021 17:39:43 +0200 Message-Id: <20210726153834.946485110@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153831.696295003@linuxfoundation.org> References: <20210726153831.696295003@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Doug Berger commit 5a3c680aa2c12c90c44af383fe6882a39875ab81 upstream. Setting the EXT_ENERGY_DET_MASK bit allows the port energy detection logic of the internal PHY to prevent the system from sleeping. Some internal PHYs will report that energy is detected when the network interface is closed which can prevent the system from going to sleep if WoL is enabled when the interface is brought down. Since the driver does not support waking the system on this logic, this commit clears the bit whenever the internal PHY is powered up and the other logic for manipulating the bit is removed since it serves no useful function. Fixes: 1c1008c793fa ("net: bcmgenet: add main driver file") Signed-off-by: Doug Berger Acked-by: Florian Fainelli Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 16 ++-------------- drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 6 ------ 2 files changed, 2 insertions(+), 20 deletions(-) --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -1187,7 +1187,8 @@ static void bcmgenet_power_up(struct bcm switch (mode) { case GENET_POWER_PASSIVE: - reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS); + reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS | + EXT_ENERGY_DET_MASK); if (GENET_IS_V5(priv)) { reg &= ~(EXT_PWR_DOWN_PHY_EN | EXT_PWR_DOWN_PHY_RD | @@ -2901,12 +2902,6 @@ static int bcmgenet_open(struct net_devi bcmgenet_set_hw_addr(priv, dev->dev_addr); - if (priv->internal_phy) { - reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); - reg |= EXT_ENERGY_DET_MASK; - bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); - } - /* Disable RX/TX DMA and flush TX queues */ dma_ctrl = bcmgenet_dma_disable(priv); @@ -3623,7 +3618,6 @@ static int bcmgenet_resume(struct device struct bcmgenet_priv *priv = netdev_priv(dev); unsigned long dma_ctrl; int ret; - u32 reg; if (!netif_running(dev)) return 0; @@ -3655,12 +3649,6 @@ static int bcmgenet_resume(struct device bcmgenet_set_hw_addr(priv, dev->dev_addr); - if (priv->internal_phy) { - reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); - reg |= EXT_ENERGY_DET_MASK; - bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); - } - if (priv->wolopts) bcmgenet_power_up(priv, GENET_POWER_WOL_MAGIC); --- a/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c @@ -160,12 +160,6 @@ int bcmgenet_wol_power_down_cfg(struct b reg |= CMD_RX_EN; bcmgenet_umac_writel(priv, reg, UMAC_CMD); - if (priv->hw_params->flags & GENET_HAS_EXT) { - reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); - reg &= ~EXT_ENERGY_DET_MASK; - bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); - } - return 0; }