From patchwork Wed Mar 10 20:41:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12129339 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46D8FC433DB for ; Wed, 10 Mar 2021 20:42:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0076F64FAF for ; Wed, 10 Mar 2021 20:42:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231962AbhCJUlv (ORCPT ); Wed, 10 Mar 2021 15:41:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231935AbhCJUld (ORCPT ); Wed, 10 Mar 2021 15:41:33 -0500 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48377C061574 for ; Wed, 10 Mar 2021 12:41:33 -0800 (PST) Received: by mail-pf1-x435.google.com with SMTP id e26so4292250pfd.9 for ; Wed, 10 Mar 2021 12:41:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yZAbveqKHb9nZIWQzQ5m9x5vCRGgZKRadCqC047fdS0=; b=SSf3mB2LkMoTx99zXJ6i447NkYfudCivMYVVdPkX7N+m1p/v8X0LiVMG4wNiUT83hR VMIUpm9W/k8qfVQBYwBxpaKctXEv8xz2bdyIVLsmAuMcwMOwJzbpl+KAXTUx/iRvAigS b4IWli6Tm0XoKZ+oueV4R8t/11mBSZUgVoBpVBKx5ZXJiZNt2MBo5z80ZBrmjm+AvxpH szC3a+XkoKcV4PYqhzQA/rdfeb8BTUjY4J/ySBCDuk9P3KA/2YRkkBZr3Ac7ziSO6aov 2TRMcjj1Y3mybj6W50Ivx4w49fEtk7CUQPID4X9FT7lfnaMM12M1JX6nnhnjBi2E9BuB Bk5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yZAbveqKHb9nZIWQzQ5m9x5vCRGgZKRadCqC047fdS0=; b=YjCXi9bl3IhzPL9sUBqWzenZeglNhVon2ujJapTnsaBRjMQ+jl12uQYQ6fu31CLOND u/mGbRh15KTz7QeXHNUpnzfVoFTXniZpIsAJqQV+zGJpM3jQtClEs2PJ2pkCX+CJVjyC zZ8FMmZpPEns/S1MVWc0zHeAd8SB7X8hNJ4WB3Kjcpv4tollH9Q/VDXQ7Ih851n+JlMO 9bPYOzK9aM0Xr5Cyuk8iE+ubHeWBSTGA/87pe+/OnXEWuQ4x0rWneV7QCwMVP9oYKZGK h6OKt0ixmSXjcUGg7faMU5e6m3OouMaZpRvzPN8kdeoDM2CxTFLquXv2eqw0gE7tulhh l7jA== X-Gm-Message-State: AOAM5336kKc6N6NRV2UQCeIxyeNcWrnQjdGjFzPYRV7hEJx0rWFTN3vK 88M47Lwsu/t7HqmlMNgoyriobX+puYY= X-Google-Smtp-Source: ABdhPJy3m7rc7z32g00IWnfdhCmQdsTW4RF9gHavxA7v+GIxhkH10y3yDZz82D9PDeanatYhHmzrkQ== X-Received: by 2002:a62:3c4:0:b029:1ee:9771:2621 with SMTP id 187-20020a6203c40000b02901ee97712621mr4520292pfd.47.1615408892502; Wed, 10 Mar 2021 12:41:32 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 1sm370213pfh.90.2021.03.10.12.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 12:41:32 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , andrew@lunn.ch, hkallweit1@gmail.com, kuba@kernel.org, davem@davemloft.net Subject: [PATCH net 1/3] net: phy: broadcom: Add power down exit reset state delay Date: Wed, 10 Mar 2021 12:41:04 -0800 Message-Id: <20210310204106.2767772-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210310204106.2767772-1-f.fainelli@gmail.com> References: <20210310204106.2767772-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Per the datasheet, when we clear the power down bit, the PHY remains in an internal reset state for 40us and then resume normal operation. Account for that delay to avoid any issues in the future if genphy_resume() changes. Fixes: fe26821fa614 ("net: phy: broadcom: Wire suspend/resume for BCM54810") Signed-off-by: Florian Fainelli Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/net/phy/broadcom.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index fa0be591ae79..b8eb736fb456 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -399,6 +399,11 @@ static int bcm54xx_resume(struct phy_device *phydev) if (ret < 0) return ret; + /* Upon exiting power down, the PHY remains in an internal reset state + * for 40us + */ + usleep(40); + return bcm54xx_config_init(phydev); } From patchwork Wed Mar 10 20:41:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12129345 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10B93C4332D for ; Wed, 10 Mar 2021 20:42:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3F0F64FAF for ; Wed, 10 Mar 2021 20:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231997AbhCJUlw (ORCPT ); Wed, 10 Mar 2021 15:41:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231959AbhCJUle (ORCPT ); Wed, 10 Mar 2021 15:41:34 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D6A8C061574 for ; Wed, 10 Mar 2021 12:41:34 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id p21so12180431pgl.12 for ; Wed, 10 Mar 2021 12:41:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ij8Hc6almb7rYgIAUR8gU2x64ABzwdSHskk6pI5i4u4=; b=W97tR+C64ciKlRcjzq0+vvPSz5CzR6YgvYr72bWqekGj3JKak4Qr2y0veWoc6rwal1 lZqPUpT9hfeKwV7dVujPw85frGnDd+EVWhkkjnwX6a663cOGayyLkUOHifN7zJWeSWAY xZg/2hnblVjUPsB1su3DRp8mD5i7evp+kBQ9IxAuGHQnK4GMFptiytlJbZ7KeEWNPbXM QDY3Nt09IpJK5Qd9DAxpvctSnyydY78GO7oqbTKhw7N3D0UA96B00kFZV9/hLnywXQhL ed3+4vsjMoC7g9ABE9y0vOSC/iXraZ2+7veGCR2abVp3/HjTV9en46B3K08w/Az+0lTC c4bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ij8Hc6almb7rYgIAUR8gU2x64ABzwdSHskk6pI5i4u4=; b=QzMUf8WzJrYcWATA9IMmnJRqDpc+dEPXI0E6kxlqc75kgQXOQBSahKB1ClMO1K/PpO 0l86U2JEvqOABwFjPG8hFh27YCrRicWMA77MJ/mfe6JQZu6S2C/ViA0O+9Z6h06waqBl bqdmDl9Eo7wBeD7z1HfGpYaTUuK8MQ5MGZd9qDDcGxWoHBocaSGMZSp/19/xxUupuQeF D+yzGeL+NZDTxlvsSlU6waML2q/NZbvw+YXo5LfjO0tdeh7KE4z1HQF+y87PxUu97vCz a9HUsjNTruE5k0/9i0ZDfgSSsyBtw1gcFD8MrfNDAopaZVdPWGis1/XDUO+93Haxsmc4 Uwgg== X-Gm-Message-State: AOAM530av5ICS/gO3IOTsKkunPSbEql3w/Nzwdr5bmOxHliVaI3hzcqS dKvrDzuCCRgTZeON0w5oHyovqSJIl6c= X-Google-Smtp-Source: ABdhPJy7D5FACyQB8QpqNh96vrh12oxoTmxUi+9SawcGKN1hlaWiroI+jGjiaA7L10McZlahPtE8Eg== X-Received: by 2002:a63:4956:: with SMTP id y22mr4367845pgk.309.1615408893645; Wed, 10 Mar 2021 12:41:33 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 1sm370213pfh.90.2021.03.10.12.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 12:41:33 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , andrew@lunn.ch, hkallweit1@gmail.com, kuba@kernel.org, davem@davemloft.net Subject: [PATCH net 2/3] net: phy: broadcom: Only set BMCR.PDOWN to suspend Date: Wed, 10 Mar 2021 12:41:05 -0800 Message-Id: <20210310204106.2767772-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210310204106.2767772-1-f.fainelli@gmail.com> References: <20210310204106.2767772-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org B50212E PHYs have been observed to get into an incorrect state with the visible effect of having both activity and link LEDs flashing alternatively instead of being turned off as intended when genphy_suspend() was issued. The BCM54810 is a similar design and equally suffers from that issue. The datasheet is not particularly clear whether a read/modify/write sequence is acceptable and only indicates that BMCR.PDOWN=1 should be utilized to enter the power down mode. When this was done the PHYs were always measured to have power levels that match the expectations and LEDs powered off. Fixes: fe26821fa614 ("net: phy: broadcom: Wire suspend/resume for BCM54810") Signed-off-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index b8eb736fb456..b33ffd44f799 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -388,6 +388,21 @@ static int bcm54xx_config_init(struct phy_device *phydev) return 0; } +static int bcm54xx_suspend(struct phy_device *phydev) +{ + /* We cannot perform a read/modify/write like what genphy_suspend() + * does because depending on the time we can observe the PHY having + * both of its LEDs flashing indicating that it is in an incorrect + * state and not powered down as expected. + * + * There is not a clear indication in the datasheet whether a + * read/modify/write would be acceptable, but a blind write to the + * register has been proven to be functional unlike the + * Read/Modify/Write. + */ + return phy_write(phydev, MII_BMCR, BMCR_PDOWN); +} + static int bcm54xx_resume(struct phy_device *phydev) { int ret; @@ -778,7 +793,7 @@ static struct phy_driver broadcom_drivers[] = { .config_aneg = bcm5481_config_aneg, .config_intr = bcm_phy_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, - .suspend = genphy_suspend, + .suspend = bcm54xx_suspend, .resume = bcm54xx_resume, }, { .phy_id = PHY_ID_BCM54811, From patchwork Wed Mar 10 20:41:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12129341 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D65DC433E9 for ; Wed, 10 Mar 2021 20:42:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F4E264FD3 for ; Wed, 10 Mar 2021 20:42:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232017AbhCJUlx (ORCPT ); Wed, 10 Mar 2021 15:41:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbhCJUlf (ORCPT ); Wed, 10 Mar 2021 15:41:35 -0500 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8DEC061574 for ; Wed, 10 Mar 2021 12:41:35 -0800 (PST) Received: by mail-pg1-x532.google.com with SMTP id 16so5754684pgo.13 for ; Wed, 10 Mar 2021 12:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VyG04wrih8NReE1caAJfJObEM9wOJAjCsx7lqTeXEJk=; b=bKk+w4heHTPaHAO2kBaBGm+Z7iri/PQtO5oF9C0l6bH7pI/sHcpUT7jDd5OXIzLr6k 0q449fxHcmLz0UiP95EaDPliuyGRSRTEys3Ctctu4yFF2o2dk99q288Yc12E3oyS9aCt 9rmIqNW83rxH0cmZvVt+8kjaYdcxwYDV22OzTlUPBgNno0Sq46jTMVpOo+x+i2VdmaOR vpaBKnc7WnAp5/Jlo2sD5oQb9R/X55TnVN77d63l/8U1NY18g1jXxzZfNraV2N58Mhoy CPk1/clPnYIBUwqX//HBDKz5UBu4HavgI4d0bkxNjol2rhvasr42r4TZiGbhCrPsRyyc XJiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VyG04wrih8NReE1caAJfJObEM9wOJAjCsx7lqTeXEJk=; b=VJcWO/owypTkkBLPhJUcX5HdPyZbP5J63Cma3k3mnBCPfHg/Cs/cPZb2fEA6rWadOG LXN7piHwE2u/HFahVg0kjc2DOProRGxDnVloYHup0leLpGuF55emutDkQH4mfuApFOow tKXd+J2XvbK7ffNrcXf5jcrnEk2y0fUX5xAYXOA4zRh7CwhadmfQgk4S2Fiu0yCKASJb MZQm7JxvKM36u1k25c/IUiSpY5cxNLMaeUGYU0v41DbLBaEtKsTchRIzT+q5kqFBzfOC WxayJngKcmgOe/dxAWR1krfJHt3zgJ9+hDq0e0wqdS8rl6ny5tJnRRhAWmcCg61Tp652 pWEw== X-Gm-Message-State: AOAM533F6GEuBAq70zjWgRUWYBEnHxxqydQQSgsHiqtYU2jb33qafenM wv/9IYa5WS5YzyLiByRriFJin772cdk= X-Google-Smtp-Source: ABdhPJwS8WZWwkxnYdsKDWn39zUckQJoqMF8H2U14VxatZ0MPP6Hxys3d3lQ0Mxp933XnhQTePnUVw== X-Received: by 2002:a63:5a50:: with SMTP id k16mr4255298pgm.155.1615408894880; Wed, 10 Mar 2021 12:41:34 -0800 (PST) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id 1sm370213pfh.90.2021.03.10.12.41.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 12:41:34 -0800 (PST) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , andrew@lunn.ch, hkallweit1@gmail.com, kuba@kernel.org, davem@davemloft.net Subject: [PATCH net 3/3] net: phy: broadcom: Use corrected suspend for BCM54811 Date: Wed, 10 Mar 2021 12:41:06 -0800 Message-Id: <20210310204106.2767772-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210310204106.2767772-1-f.fainelli@gmail.com> References: <20210310204106.2767772-1-f.fainelli@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Use the non read/modify/write version of the suspend procedure for the BCM54811 PHY. Fixes: b0ed0bbfb304 ("net: phy: broadcom: add support for BCM54811 PHY") Signed-off-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index b33ffd44f799..14980ef44b42 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -804,7 +804,7 @@ static struct phy_driver broadcom_drivers[] = { .config_aneg = bcm5481_config_aneg, .config_intr = bcm_phy_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, - .suspend = genphy_suspend, + .suspend = bcm54xx_suspend, .resume = bcm54xx_resume, }, { .phy_id = PHY_ID_BCM5482,