Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3084829rwb; Mon, 15 Aug 2022 17:45:27 -0700 (PDT) X-Google-Smtp-Source: AA6agR7y4Qe5vd519xTHIxYhILxBJ/BB2a3NYmV0/STwfZ8ktp+dekFCvqrElmqRl4CjfWnWBrKl X-Received: by 2002:a17:906:f88f:b0:731:463d:4b15 with SMTP id lg15-20020a170906f88f00b00731463d4b15mr11791644ejb.299.1660610726849; Mon, 15 Aug 2022 17:45:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610726; cv=none; d=google.com; s=arc-20160816; b=QTzr5Xsx8MNl70ZRPG6Y1GXm35Dvaw41miYyP+hYcLxUWTPOLavrS/Fno3OWGzAwza qc0r4Tjm+aWCvBbkb13UhKuzecvKpLiAOW6oN/Rwg3gXjCKIK/KINa74Tme4Ne8sHsmC IHwAi6j5ywkYlsT3FrhxqLJLGHEviZG/hH8833JK/suQ7lZFk2r0d/ceTzsL2mnQJcdB dPWxpC7c+yIGUkZmGvetcYVCm0OJ/ZA0jl9+2IUdXgzyxlKriYDwNaJ93Otkbf8bZoF0 62f7eJhTwFGTN9ZuUHc9EU12lUWxId5IlOM5HHhjRxUqKoMAceFQXP81aNDjmbrqfYOL FGRg== 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=nMH8fPfF7bnr9wP0adlzr+/I95WpdxotrAwrIVtSOu9zIlos6lZ+GkE+nM4B0qtYTL eNRe5j9QJ4SO3UBJHEr3eisMBa6jgnR6Ii1ogi8sjMX9qxsYmowC31HGut8bQgBYCXHT eoHH+ctbXMf4L2ZEQdM3jXXBIhIpGF2KGVwPoc3OJMI0EHDGOBI1YV8nhewckUDSXaqx h86DdACUAzAiA7OzcmTUpOiRD77PEaxGqliSszQt8kZiTUHmDZX5xkhJLlMFu/Cp/iPn z7lb5+niMPay6+/TcX9medbNy4iuFuwD+Xm/VMlJ8oAmgd0/Gx96wYky4PUqm3XWv+ob 4v8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HSK4rZgK; 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 d12-20020a50f68c000000b0043b753b1e6asi8619046edn.225.2022.08.15.17.45.02; Mon, 15 Aug 2022 17:45:26 -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=HSK4rZgK; 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 S1354455AbiHOXpm (ORCPT + 99 others); Mon, 15 Aug 2022 19:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354296AbiHOXlt (ORCPT ); Mon, 15 Aug 2022 19:41:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7499D2A414; Mon, 15 Aug 2022 13:11:48 -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 ams.source.kernel.org (Postfix) with ESMTPS id 2B560B80EAD; Mon, 15 Aug 2022 20:11:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70F53C433C1; Mon, 15 Aug 2022 20:11:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594305; bh=sCNQHxIcqQE3JOMnC1htlcE1nC/bTIllDvjHDq3ZsNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSK4rZgK/gKM4ACwZ8Oj3El+DDhRafw/kkAo9U/difW93scZTw04MQSuPFrNK+xAf IkuH3/0+iSQnegXB3E7iqjdHWAzfN6PGSsrwd9+fpH6HfBrkKPeDG3ayDwDYtwt6OK f/sbUcWZbX87TpThJCCxKwtZFsNItSwGYboiBmxI= 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.18 1090/1095] net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode Date: Mon, 15 Aug 2022 20:08:09 +0200 Message-Id: <20220815180514.105918423@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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)