From patchwork Mon Sep 20 21:54:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12506727 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.7 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 60232C433F5 for ; Tue, 21 Sep 2021 01:56:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4394860F0F for ; Tue, 21 Sep 2021 01:56:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238630AbhIUB6A (ORCPT ); Mon, 20 Sep 2021 21:58:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236284AbhIUBuB (ORCPT ); Mon, 20 Sep 2021 21:50:01 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03895C06AB02; Mon, 20 Sep 2021 14:54:27 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id c1so14596374pfp.10; Mon, 20 Sep 2021 14:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6TMCz/8qfUOEgicgpBPK3RdO5hHecgbWReCsG7+anNY=; b=UNQEmIs1Aa91/moZj2DcUghmgKwBVBW42H8SeEnBmQC/pc2uOhPdfrEKtNZy5PpzXj xDy702hyWuaCgC7kbJ3yz2bxDAdb101DFIBNnyG3iV0r5iYbgX8gXIKq173QoKAmxF4W ME5ThgcbbZK10IDBn6nlHY3qGxMTTemKweq6nl5KhaB4bzRaikUf1ErR+m9wmpO16PpD +OzJtNlrSWJaHTO9xgODNzgYu+N0SMAqp/1fsdxrWI3rs2s3SeZL3Ua0bwRpwI/7yiFe LNrf9EeGiru+g6JGa6ce9UkJ+W8dlSrfeO3e6X7Od+1LIbF7weMaCm2Kr7dGq+eysmdK vsBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6TMCz/8qfUOEgicgpBPK3RdO5hHecgbWReCsG7+anNY=; b=AMAc8VksIqNOgHI9PXuigR/CIJo7Pr2n8lRJteYsUqiF3pT6gqexwCaIUFyIFlVhWn 3XfXd3ryE6wAkeievz3jRI71srk/ecPw2SI5AiDk6ZyQCtx1sydCb1J+bfMtFCXRUVzp Zm+fx7+/AK1bu/G5LaHiNNVgIFmrgvOCuO9I/Z6mAUpX5nfYJeKKG6R0vnzmAh9IU68u QPJIr/tqeUJ+4GjX59pU/q99pILg5yElFU1klVa0RcogZ9MFoW8148Yt/tXu4IE1VnBx vKaNWBVlbIV90joR5NWTpd4LdbrQdpTAcAsN1eCvBqAwVUSzEJYO2GbuMG/fzcRvebzg Ds3A== X-Gm-Message-State: AOAM5301mIQHsQRMQDWyGzA7oybBkCF+pbZqnPpL/gPpb72kHGrM4N0P XwjzbmCSNrDHehBpKgwsbepqYh6jwVY= X-Google-Smtp-Source: ABdhPJwKDeZi9C4lhsdHRJH5HdwNzyyPOIXxAt1BMDAsk8CBzk51gI5tL5AUiiC6Ez0NFFtb+J3EXQ== X-Received: by 2002:a63:8ac4:: with SMTP id y187mr347862pgd.383.1632174866181; Mon, 20 Sep 2021 14:54:26 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m28sm16224297pgl.9.2021.09.20.14.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 14:54:25 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 1/5] net: phy: broadcom: Add IDDQ-SR mode Date: Mon, 20 Sep 2021 14:54:14 -0700 Message-Id: <20210920215418.3247054-2-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210920215418.3247054-1-f.fainelli@gmail.com> References: <20210920215418.3247054-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 Add support for putting the PHY into IDDQ Soft Recovery mode by setting the TOP_MISC register bits accordingly. This requires us to implement a custom bcm54xx_suspend() routine which diverges from genphy_suspend() in order to configure the PHY to enter IDDQ with software recovery as well as avoid doing a read/modify/write on the BMCR register. Doing a read/modify/write on the BMCR register means that the auto-negotation bit may remain which interferes with the ability to put the PHY into IDDQ-SR mode. We do software reset upon suspend in order to put the PHY back into its state prior to suspend as recommended by the datasheet. Signed-off-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 51 ++++++++++++++++++++++++++++++++++++++ include/linux/brcmphy.h | 8 ++++++ 2 files changed, 59 insertions(+) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index add0c4e33425..f5868a0dee4b 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -392,10 +392,50 @@ static int bcm54xx_config_init(struct phy_device *phydev) return 0; } +static int bcm54xx_iddq_set(struct phy_device *phydev, bool enable) +{ + int ret = 0; + + if (!(phydev->dev_flags & PHY_BRCM_IDDQ_SUSPEND)) + return ret; + + ret = bcm_phy_read_exp(phydev, BCM54XX_TOP_MISC_IDDQ_CTRL); + if (ret < 0) + goto out; + + if (enable) + ret |= BCM54XX_TOP_MISC_IDDQ_SR | BCM54XX_TOP_MISC_IDDQ_LP; + else + ret &= ~(BCM54XX_TOP_MISC_IDDQ_SR | BCM54XX_TOP_MISC_IDDQ_LP); + + ret = bcm_phy_write_exp(phydev, BCM54XX_TOP_MISC_IDDQ_CTRL, ret); +out: + return ret; +} + +static int bcm54xx_suspend(struct phy_device *phydev) +{ + int ret; + + /* We cannot use a read/modify/write here otherwise the PHY gets into + * a bad state where its LEDs keep flashing, thus defeating the purpose + * of low power mode. + */ + ret = phy_write(phydev, MII_BMCR, BMCR_PDOWN); + if (ret < 0) + return ret; + + return bcm54xx_iddq_set(phydev, true); +} + static int bcm54xx_resume(struct phy_device *phydev) { int ret; + ret = bcm54xx_iddq_set(phydev, false); + if (ret < 0) + return ret; + /* Writes to register other than BMCR would be ignored * unless we clear the PDOWN bit first */ @@ -408,6 +448,15 @@ static int bcm54xx_resume(struct phy_device *phydev) */ fsleep(40); + /* Issue a soft reset after clearing the power down bit + * and before doing any other configuration. + */ + if (phydev->dev_flags & PHY_BRCM_IDDQ_SUSPEND) { + ret = genphy_soft_reset(phydev); + if (ret < 0) + return ret; + } + return bcm54xx_config_init(phydev); } @@ -772,6 +821,8 @@ static struct phy_driver broadcom_drivers[] = { .config_intr = bcm_phy_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, .link_change_notify = bcm54xx_link_change_notify, + .suspend = bcm54xx_suspend, + .resume = bcm54xx_resume, }, { .phy_id = PHY_ID_BCM5461, .phy_id_mask = 0xfffffff0, diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h index 07e1dfadbbdf..b119d6819d6c 100644 --- a/include/linux/brcmphy.h +++ b/include/linux/brcmphy.h @@ -67,6 +67,7 @@ #define PHY_BRCM_CLEAR_RGMII_MODE 0x00000004 #define PHY_BRCM_DIS_TXCRXC_NOENRGY 0x00000008 #define PHY_BRCM_EN_MASTER_MODE 0x00000010 +#define PHY_BRCM_IDDQ_SUSPEND 0x000000220 /* Broadcom BCM7xxx specific workarounds */ #define PHY_BRCM_7XXX_REV(x) (((x) >> 8) & 0xff) @@ -84,6 +85,7 @@ #define MII_BCM54XX_EXP_DATA 0x15 /* Expansion register data */ #define MII_BCM54XX_EXP_SEL 0x17 /* Expansion register select */ +#define MII_BCM54XX_EXP_SEL_TOP 0x0d00 /* TOP_MISC expansion register select */ #define MII_BCM54XX_EXP_SEL_SSD 0x0e00 /* Secondary SerDes select */ #define MII_BCM54XX_EXP_SEL_ER 0x0f00 /* Expansion register select */ #define MII_BCM54XX_EXP_SEL_ETC 0x0d00 /* Expansion register spare + 2k mem */ @@ -243,6 +245,12 @@ #define MII_BCM54XX_EXP_EXP97 0x0f97 #define MII_BCM54XX_EXP_EXP97_MYST 0x0c0c +/* Top-MISC expansion registers */ +#define BCM54XX_TOP_MISC_IDDQ_CTRL (MII_BCM54XX_EXP_SEL_TOP + 0x06) +#define BCM54XX_TOP_MISC_IDDQ_LP (1 << 0) +#define BCM54XX_TOP_MISC_IDDQ_SD (1 << 2) +#define BCM54XX_TOP_MISC_IDDQ_SR (1 << 3) + /* * BCM5482: Secondary SerDes registers */ From patchwork Mon Sep 20 21:54:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12506731 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.7 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 7BA55C433EF for ; Tue, 21 Sep 2021 01:56:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6130160F0F for ; Tue, 21 Sep 2021 01:56:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238691AbhIUB6C (ORCPT ); Mon, 20 Sep 2021 21:58:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236286AbhIUBuB (ORCPT ); Mon, 20 Sep 2021 21:50:01 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C13AC06AB03; Mon, 20 Sep 2021 14:54:28 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id f3-20020a17090a638300b00199097ddf1aso513155pjj.0; Mon, 20 Sep 2021 14:54:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K7GTsxet9/y2vshzKDYfPB4KzqayYDkaHK/3vwe3MJg=; b=ZQ8N23b1TbKpylH/ORAaHHsH3GBDRZ7YCHCZ+nvIVpN0NURF6can38jzt3+YcL8Tsf e7I5kxj94hfbxD8atFArtodVxbkQV3sLBcNQ2Zzolfsn4qdZ2Q+2TF1Tmwsatp3IATSp YVMYygMspwdhj/5McsCg3+TW+lF52PVXQDkahxKRvYb98I0cJPkqBXBho+lFLI8qmKfg C9Juwsl4ixDNG7Y+GPYShpPS+CJuyvCJBF9KgebBKp9DDhi0fcXxIMPBJpGmx0jXm7kV 89tKFqyJWOwcbk/An29PU+g9X/XwgEihuNXwJKyiEEizj/aSgdjbVz5c/Pk81U5lSuz5 UThg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K7GTsxet9/y2vshzKDYfPB4KzqayYDkaHK/3vwe3MJg=; b=QXwgaLbwlOshajrDoEgbh88nZRXj/S/qRWMTNbyQHqeiGrmv4/iFmzM5sfTpmB4H1W 4uR1v7l9VaR/VpED4GCvWHEnu1vhGOE1VSy7Se0nQpGRK1BYdAhiV/a1cnUZQoV6gGk8 RENgr7k0jwRhVHN9W7WGHQgpBwtLNShKAziQ6dNVZrAGbrCpwJvXsL/fygIHzHh9rkZN ORO/CA8gFHQzjm0E/SU6I/Pq24PibCy7jVhDpf2awK0ZWZrk2ICaTBoaF+kueLCUkJje jPKJr9YKKYOlumdQjBfNyaHSqP33rjDR5oi+f/wWb8aaC16O2sHEuNRpYE3Mi6eAKCO5 XYSQ== X-Gm-Message-State: AOAM531X3HAQfwlJiN0cOcWmeMugsj7Nk9VBRt+DMGsdBPAjoLHNzEnL CxFKS67oUNlGkM7mwRpxxvo3dqCvExQ= X-Google-Smtp-Source: ABdhPJzGSdaE/kNPz/O1NJ6foIOu58blTNTiqiVTDiu0O7rUo9K7ytWN+zQqU/GNs1NglHHlVz3HYg== X-Received: by 2002:a17:902:e293:b0:13a:4f14:f24 with SMTP id o19-20020a170902e29300b0013a4f140f24mr24366267plc.4.1632174867400; Mon, 20 Sep 2021 14:54:27 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m28sm16224297pgl.9.2021.09.20.14.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 14:54:26 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 2/5] net: phy: broadcom: Wire suspend/resume for BCM50610 and BCM50610M Date: Mon, 20 Sep 2021 14:54:15 -0700 Message-Id: <20210920215418.3247054-3-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210920215418.3247054-1-f.fainelli@gmail.com> References: <20210920215418.3247054-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 These two Ethernet PHYs support IDDQ-SR therefore wire-up the suspend and resume callbacks to point to bcm54xx_suspend() and bcm54xx_resume(). Signed-off-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index f5868a0dee4b..952341e0baec 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -948,6 +948,8 @@ static struct phy_driver broadcom_drivers[] = { .config_intr = bcm_phy_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, .link_change_notify = bcm54xx_link_change_notify, + .suspend = bcm54xx_suspend, + .resume = bcm54xx_resume, }, { .phy_id = PHY_ID_BCM50610M, .phy_id_mask = 0xfffffff0, @@ -961,6 +963,8 @@ static struct phy_driver broadcom_drivers[] = { .config_intr = bcm_phy_config_intr, .handle_interrupt = bcm_phy_handle_interrupt, .link_change_notify = bcm54xx_link_change_notify, + .suspend = bcm54xx_suspend, + .resume = bcm54xx_resume, }, { .phy_id = PHY_ID_BCM57780, .phy_id_mask = 0xfffffff0, From patchwork Mon Sep 20 21:54:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12506733 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.7 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 DF1BDC433FE for ; Tue, 21 Sep 2021 01:56:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEB2E610A8 for ; Tue, 21 Sep 2021 01:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238730AbhIUB6D (ORCPT ); Mon, 20 Sep 2021 21:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236290AbhIUBuC (ORCPT ); Mon, 20 Sep 2021 21:50:02 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91D2CC06AB04; Mon, 20 Sep 2021 14:54:29 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id nn5-20020a17090b38c500b0019af1c4b31fso1005667pjb.3; Mon, 20 Sep 2021 14:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZmOHqsChp2kVGC4NmmlLg2wVuuPYUcY2cFvEjqxXRkQ=; b=oVYwHQoDV575JPkk1cIIp2zGJ8/UerEtQcZsBSreGRwOLNsVwr0qfmecU/Pe1vqZI7 FP2Sx15nhpWvTmE3kxKwRUdgINyJF0PxDxlVWt1EwDlgHAl3A7s1h6VAZ4zmWom6/GRa rNXEOL4Tk28w0IejhhQwB7ysGD5b+SyobiNxGNHWvAOjBimRCyBVoLzi9zh4XpLwsWHe N8Roz0QTbZrhL2k6U7YV7xBV8DIlzKfyaxyej3l0RYcFkTYRsfn+z7qluj0VmxxakjjG or97eBH4uGuAFbEbKv6AU+YLs2Mbt2wCMVbwozJ0J+11HIbaDqwnQ7JCH5ZNqztSbnnS lO2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZmOHqsChp2kVGC4NmmlLg2wVuuPYUcY2cFvEjqxXRkQ=; b=piS/cQeItX6F8C7eqsXYf1IaAwlqh+8Mf3GpRDx42LAdeJJDa+WHfvY8nlFYKQ60iP dkhDUeZEZgncc4fDFasUGLu7JhIfLkYFzv8xao3KGz+6lvjvmx8WAuUzYtBaG91FJ0+k LmrQPO2ZuomlsKtsXWPRDPsdgTjKLv6UF1UXlk06m/UbDtZicLggBihsfUUkvMnGGCXw M9y3+eNz+uz6fRVGPH4pFxaGUUE/a8F1Pk/gF7d5o9yqIDQuGo2mAQrTk1y+nJiiYu8e PVuB1iyRIejJyqzZW4HlavAMy0v/hBpfYrMU3NogzdCvuEYnjHa1gnHdNn9KH8+7R85+ XYlQ== X-Gm-Message-State: AOAM531pLlUIwWQblrWwtX1N6sYgWwAjt1sVPg8smi9Rs6rJzu+3nhkH +NDyoZaDo/VLNa75xgLVpdh/3DgQc5M= X-Google-Smtp-Source: ABdhPJw5S0pFwTSwn3edKT8NPeFLdXVE2I/YU8rD/zJHRk2xq7XoWX0PTV5yej3dAVHpbR7120Pd7A== X-Received: by 2002:a17:902:6848:b0:13a:46e1:2195 with SMTP id f8-20020a170902684800b0013a46e12195mr24601681pln.80.1632174868763; Mon, 20 Sep 2021 14:54:28 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m28sm16224297pgl.9.2021.09.20.14.54.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 14:54:28 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 3/5] net: phy: broadcom: Utilize appropriate suspend for BCM54810/11 Date: Mon, 20 Sep 2021 14:54:16 -0700 Message-Id: <20210920215418.3247054-4-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210920215418.3247054-1-f.fainelli@gmail.com> References: <20210920215418.3247054-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 Since we enable APD and DLL/RXC/TXC disable we need to use bcm54xx_suspend() in order not to do a read/modify/write of the BMCR register which is incompatible with the desired settings. Signed-off-by: Florian Fainelli --- drivers/net/phy/broadcom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c index 952341e0baec..bb5104ae4610 100644 --- a/drivers/net/phy/broadcom.c +++ b/drivers/net/phy/broadcom.c @@ -903,7 +903,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, .link_change_notify = bcm54xx_link_change_notify, }, { @@ -919,7 +919,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, .link_change_notify = bcm54xx_link_change_notify, }, { From patchwork Mon Sep 20 21:54:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12506735 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.7 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 A00F2C433EF for ; Tue, 21 Sep 2021 01:56:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8B63860F0F for ; Tue, 21 Sep 2021 01:56:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238775AbhIUB6F (ORCPT ); Mon, 20 Sep 2021 21:58:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236291AbhIUBuC (ORCPT ); Mon, 20 Sep 2021 21:50:02 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B459BC06AB05; Mon, 20 Sep 2021 14:54:30 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id p12-20020a17090adf8c00b0019c959bc795so1013397pjv.1; Mon, 20 Sep 2021 14:54:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bgYSRw/Vbtc/aybke5MCpFQvX34FKlB31rJwrenaP7Y=; b=b0j81DsihnJMfVi2zHg09br87QjGXthiyQh64RI/4gtGim/7bR9Se7hUKHQMHCy5nn Yu41LkUtECeTDkb83SkDKxvabElHPnkOZ6s4hEDD1VzmbCyXNbFOLFShFPkkHD2a3HRA Mbg0neS79fK8nsrb0FoH8kLAaJQQrEH4OnowFWSD0fCkK8oRtjO5BRfQTnGJdEwnR65O dUGAdTQJ9bdK8B8qsLq8r+IGyikhl+ZHfedOrFbah0Ed8jrLbuCLwpibdPn3KXNc2612 ym1F2M2WomeschkDXlHGqOoDE3nVrkHCm0ZU9dPuMkxVPVTnO3PyPHgoy9FjkOjtQmoa UNXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bgYSRw/Vbtc/aybke5MCpFQvX34FKlB31rJwrenaP7Y=; b=uczhkYqoMi1uXCNTDg2FHFuNxri1FTyfSssSdh+G9dponhkRtCkx4mZ1NGv4G7sKvu 3f4YUAUo0WcL1BhTmnU68p2IFLqMoEvY0acKseTR7s56EN3tTRDZw/Mj0LyAJa4NLp1v gnafdqwt6qXAgyBLbczKgYO2qDcIIU/bqi8gULkmQYDU5wOZu5qL0ue1KclZvXGj6wbW uF35HOkByKmU4K4zMcAoTmdyRsWut9bURC7sgF8/JdQXaedi4FGEc81eOss5ARFh6/4q hID/ROWVnUTLImYPDTqXaKe6SwzO3Fx61Xo0JkpO7cKWqj+j0Jl0isNfGjP66rYjtCf8 VTlA== X-Gm-Message-State: AOAM532vAjXUJc9wk8Ht+O5IR2ukafWJ2I+0fvgG6TysDtsPgFdPIghe 6zlZshUQdmKYF96vkDQWm213jW5zY+c= X-Google-Smtp-Source: ABdhPJy9InWR+BuiSP1O3oVTNJbydcBVFhoa+0BWQpjb2B8SBvBhkc1jFzq92K2Uf36pejsUsTmG/w== X-Received: by 2002:a17:90b:4d05:: with SMTP id mw5mr1232218pjb.175.1632174869968; Mon, 20 Sep 2021 14:54:29 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m28sm16224297pgl.9.2021.09.20.14.54.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 14:54:29 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 4/5] net: bcmgenet: Request APD, DLL disable and IDDQ-SR Date: Mon, 20 Sep 2021 14:54:17 -0700 Message-Id: <20210920215418.3247054-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210920215418.3247054-1-f.fainelli@gmail.com> References: <20210920215418.3247054-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 When interfacing with a Broadcom PHY, request the auto-power down, DLL disable and IDDQ-SR modes to be enabled. Signed-off-by: Florian Fainelli --- drivers/net/ethernet/broadcom/genet/bcmmii.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmmii.c b/drivers/net/ethernet/broadcom/genet/bcmmii.c index 2d29de9a33e3..ff1efd52ce16 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmmii.c +++ b/drivers/net/ethernet/broadcom/genet/bcmmii.c @@ -288,7 +288,9 @@ int bcmgenet_mii_probe(struct net_device *dev) struct device_node *dn = kdev->of_node; phy_interface_t phy_iface = priv->phy_interface; struct phy_device *phydev; - u32 phy_flags = 0; + u32 phy_flags = PHY_BRCM_AUTO_PWRDWN_ENABLE | + PHY_BRCM_DIS_TXCRXC_NOENRGY | + PHY_BRCM_IDDQ_SUSPEND; int ret; /* Communicate the integrated PHY revision */ From patchwork Mon Sep 20 21:54:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 12506737 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.7 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 BF549C433F5 for ; Tue, 21 Sep 2021 01:56:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABBEE60F0F for ; Tue, 21 Sep 2021 01:56:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238827AbhIUB6H (ORCPT ); Mon, 20 Sep 2021 21:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236301AbhIUBuD (ORCPT ); Mon, 20 Sep 2021 21:50:03 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8B4BC06AB06; Mon, 20 Sep 2021 14:54:31 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id t20so12965490pju.5; Mon, 20 Sep 2021 14:54:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WZ6RJ7HFQNhOC4mLQr6EMZ4GwtvjqnBfYVXzAg81n0o=; b=IubD7crUDdrfc2WtTw2ZcqZIQipVj6aN/zaJAHDUCVwpUrOTO40JypE//7wDwCRD4s tota9WbVPsBOM3rjl+pq58S7kBVAZtV7++GBJwxoQlkV9FYQ36h4pw/dvE6h+ptzfncN 2u/T0VooRv1b9rCU5MCea8zRzDYXLaB4tIf9xYAozGdei8ARy4CoVWOayXC5u7WhlnqI 0ul5HgLBT24b8MTTEiR+NQ+UaHk2JwWLj9DWrnOFgkfAHWSJCxx2S5Ip47jR2sxLT1Wn becIMK7KVoCO6n0E965fEoiLmF/kn8ZaOzNv0CQiTHekdcx0hTGJ7L6gZMiRBRRf3hb6 JluA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WZ6RJ7HFQNhOC4mLQr6EMZ4GwtvjqnBfYVXzAg81n0o=; b=rTJKF2UkQK9cqve7IIlZpx/vR9huelxCYMucDZdqG3V242AuqOSUzru91BPfdb4BJs otQdEF0qlWMeJpM2BHuBYjLvLHN1Vv3vlc46Scr0uI1AaOvCZjoHQbdaTJZbcGwOxkEc zWWOb1dZofwjhs2PgILoxXqVhgHnT190nq/WzCRuk/KGxONlmAZFLEa3L3ZZMh/48NwX N9A9xscKwrLmOm+ke3Rjmo7t7UudymdZTT+VTEZryL8jtRfgIpPjarUmn+qalVASfyG8 5b+//whRkQdbs1kpXRdrgWxKyKo+TxjilPx6z7wjEUTg8had6KuI3MW9skZXV23Ng78M KN8w== X-Gm-Message-State: AOAM531emnidUgyvuHmxs5sr5aTRyZa8TdUsh0iCzaYGjLC3HpjtbEWn oRHn2yPEasa+XrlW8nThDcjwKbfk42o= X-Google-Smtp-Source: ABdhPJySmdXkzaVQKWKLKiibo7jux4n/VMHKakyPXvk10SVtLpaA3vxvVnhYi0Bnub4faVDPaE4q3g== X-Received: by 2002:a17:90a:ea8b:: with SMTP id h11mr1344894pjz.124.1632174871072; Mon, 20 Sep 2021 14:54:31 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id m28sm16224297pgl.9.2021.09.20.14.54.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 14:54:30 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next 5/5] net: dsa: bcm_sf2: Request APD, DLL disable and IDDQ-SR Date: Mon, 20 Sep 2021 14:54:18 -0700 Message-Id: <20210920215418.3247054-6-f.fainelli@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210920215418.3247054-1-f.fainelli@gmail.com> References: <20210920215418.3247054-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 When interfacing with a Broadcom PHY, request the auto-power down, DLL disable and IDDQ-SR modes to be enabled. Signed-off-by: Florian Fainelli --- drivers/net/dsa/bcm_sf2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 6ce9ec1283e0..aa713936d77c 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -667,7 +667,9 @@ static u32 bcm_sf2_sw_get_phy_flags(struct dsa_switch *ds, int port) if (priv->int_phy_mask & BIT(port)) return priv->hw_params.gphy_rev; else - return 0; + return PHY_BRCM_AUTO_PWRDWN_ENABLE | + PHY_BRCM_DIS_TXCRXC_NOENRGY | + PHY_BRCM_IDDQ_SUSPEND; } static void bcm_sf2_sw_validate(struct dsa_switch *ds, int port,