Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2887662rwb; Mon, 15 Aug 2022 13:20:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR4BzsnAZ77ItdRmXvY50IpsTacaIIko8kyG6CXw4ALOBbwKUzeelxZBM8mPwDLG1JSqZTjg X-Received: by 2002:a17:907:2e01:b0:730:a098:7257 with SMTP id ig1-20020a1709072e0100b00730a0987257mr11644475ejc.705.1660594842503; Mon, 15 Aug 2022 13:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594842; cv=none; d=google.com; s=arc-20160816; b=fehyoSlOOdkQbjyeSjlo4cxuOO/V5XkZfz/XKoIFusBoZVqm+ajk4vdJVl4mSIXVEv BGILT4UPEjQZEj5kvPC0Tsk4zA3KsV+ZjNOSwjK4eBX10Zb+fQFWqLdBhlip6A1m6ASY hgBAjXxO5vqj7LMCeGT+8G+j6nY/sQtzTkgQP2OXDSPi2vZQkWGlXJK+xGg6JjxmyS5V YR2TddOB2kuAVGHVmSBZhna1ENnmLfTEa9Ui2myHXOUF1Ibj7cj+hoJ4nuXLQl+oFPNX AVVRpUo1om5aNw0ki3EqHfrdF23IFPtsQSbgj6YILOhFjiBsjTUoet1CYA84SJCccPPP cFNw== 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=B9WjILa/Jz6CVFUheignKu31GApTxjQnvKqR4mPDmsY=; b=De38AI/fvBaoFlYvSmqBuJkxPGPkILE1aMK7gT/VdTsqHi1BSFPReZIjvVru1Mgu1D HUpdRcX2tJctEFBjrP/Jb9rYa+tS/13e4Lln0WglhMBQf0UI6E1RPMLIIo9c1aemfUsa W/elqNJhjGACNNpnqFCqpD5bOgVBZ8u4ZAI8cZk3p3T7Hp5HqZh6T5RPaLNcMpeQ3bL5 V67cYzerRAx/KomlL+ZygY4O3/CaWheTErMc8DN+05yblM11tmSYMYXxczKKqvpj1nY9 5CgvgN2i22/dx0JvJXex99Mv6Zk/B7KE+HRW5sWc+Sbo0QQNUZcezVmaCm/OJ3/2ffWY HcMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kp2kNMgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l14-20020a50d6ce000000b00440072d0ae3si8558796edj.196.2022.08.15.13.20.12; Mon, 15 Aug 2022 13:20:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=kp2kNMgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1345853AbiHOUDr (ORCPT + 99 others); Mon, 15 Aug 2022 16:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239498AbiHOUCT (ORCPT ); Mon, 15 Aug 2022 16:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 638AA7CB7F; Mon, 15 Aug 2022 11:54:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E4FF461228; Mon, 15 Aug 2022 18:54:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECDCFC433C1; Mon, 15 Aug 2022 18:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589648; bh=sCNQHxIcqQE3JOMnC1htlcE1nC/bTIllDvjHDq3ZsNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kp2kNMgi+KK1wTkhw+Wh5ypVbNvhZqSVmcyqBvnsMCV2R2qyto1TyA3qOZDnQzs6g +45HT2gfmG+1tpbAaSOlVjATcwxr9b6eZF5KlhzG+vDJIwQH3KlvS6oeumD0w/IhDT DdDNXx6c0+Y4XGs+7uSSyJTC6x05CPpM/jWfCEWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Han , Lukas Wunner , Jakub Kicinski Subject: [PATCH 5.15 768/779] net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode Date: Mon, 15 Aug 2022 20:06:52 +0200 Message-Id: <20220815180410.211874258@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lukas Wunner commit 2642cc6c3bbe0900ba15bab078fd15ad8baccbc5 upstream. Simon reports that if two LAN9514 USB adapters are directly connected without an intermediate switch, the link fails to come up and link LEDs remain dark. The issue was introduced by commit 1ce8b37241ed ("usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling"). The PHY suffers from a known erratum wherein link detection becomes unreliable if Energy Detect Power-Down is used. In poll mode, the driver works around the erratum by briefly disabling EDPD for 640 msec to detect a neighbor, then re-enabling it to save power. In interrupt mode, no interrupt is signaled if EDPD is used by both link partners, so it must not be enabled at all. We'll recoup the power savings by enabling SUSPEND1 mode on affected LAN95xx chips in a forthcoming commit. Fixes: 1ce8b37241ed ("usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling") Reported-by: Simon Han Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/439a3f3168c2f9d44b5fd9bb8d2b551711316be6.1655714438.git.lukas@wunner.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/phy/smsc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -110,7 +110,7 @@ static int smsc_phy_config_init(struct p struct smsc_phy_priv *priv = phydev->priv; int rc; - if (!priv->energy_enable) + if (!priv->energy_enable || phydev->irq != PHY_POLL) return 0; rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); @@ -210,6 +210,8 @@ static int lan95xx_config_aneg_ext(struc * response on link pulses to detect presence of plugged Ethernet cable. * The Energy Detect Power-Down mode is enabled again in the end of procedure to * save approximately 220 mW of power if cable is unplugged. + * The workaround is only applicable to poll mode. Energy Detect Power-Down may + * not be used in interrupt mode lest link change detection becomes unreliable. */ static int lan87xx_read_status(struct phy_device *phydev) { @@ -217,7 +219,7 @@ static int lan87xx_read_status(struct ph int err = genphy_read_status(phydev); - if (!phydev->link && priv->energy_enable) { + if (!phydev->link && priv->energy_enable && phydev->irq == PHY_POLL) { /* Disable EDPD to wake up PHY */ int rc = phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0)