From: justinpopo6@gmail.com
To: alcooperx@gmail.com, kishon@ti.com, vkoul@kernel.org,
f.fainelli@gmail.com, linux-kernel@vger.kernel.org,
linux-phy@lists.infradead.org
Cc: bcm-kernel-feedback-list@broadcom.com,
Justin Chen <justinpopo6@gmail.com>
Subject: [PATCH 6/6] phy: usb: Fix clock imbalance for suspend/resume
Date: Wed, 5 Oct 2022 14:30:18 -0700 [thread overview]
Message-ID: <1665005418-15807-7-git-send-email-justinpopo6@gmail.com> (raw)
In-Reply-To: <1665005418-15807-1-git-send-email-justinpopo6@gmail.com>
From: Justin Chen <justinpopo6@gmail.com>
We should be disabling clocks when wake from USB is not needed. Since
this wasn't done, we had a clock imbalance since clocks were always
being enabled on resume.
Fixes: ae532b2b7aa5 ("usb: Add "wake on" functionality for newer Synopsis XHCI controllers")
Fixes: b0c0b66c0b43 ("phy: usb: Add support for wake and USB low power mode for 7211 S2/S5")
Signed-off-by: Justin Chen <justinpopo6@gmail.com>
---
drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c | 2 --
drivers/phy/broadcom/phy-brcm-usb-init.h | 1 -
drivers/phy/broadcom/phy-brcm-usb.c | 8 +++++---
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
index f78cff2..76cf428 100644
--- a/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
+++ b/drivers/phy/broadcom/phy-brcm-usb-init-synopsys.c
@@ -430,7 +430,6 @@ void brcm_usb_dvr_init_7216(struct brcm_usb_init_params *params)
params->family_name = "7216";
params->ops = &bcm7216_ops;
- params->suspend_with_clocks = true;
}
void brcm_usb_dvr_init_7211b0(struct brcm_usb_init_params *params)
@@ -440,5 +439,4 @@ void brcm_usb_dvr_init_7211b0(struct brcm_usb_init_params *params)
params->family_name = "7211";
params->ops = &bcm7211b0_ops;
- params->suspend_with_clocks = true;
}
diff --git a/drivers/phy/broadcom/phy-brcm-usb-init.h b/drivers/phy/broadcom/phy-brcm-usb-init.h
index bedf2b8..f9fbf8f 100644
--- a/drivers/phy/broadcom/phy-brcm-usb-init.h
+++ b/drivers/phy/broadcom/phy-brcm-usb-init.h
@@ -62,7 +62,6 @@ struct brcm_usb_init_params {
const struct brcm_usb_init_ops *ops;
struct regmap *syscon_piarbctl;
bool wake_enabled;
- bool suspend_with_clocks;
};
void brcm_usb_dvr_init_4908(struct brcm_usb_init_params *params);
diff --git a/drivers/phy/broadcom/phy-brcm-usb.c b/drivers/phy/broadcom/phy-brcm-usb.c
index d97fa58..aafba4a 100644
--- a/drivers/phy/broadcom/phy-brcm-usb.c
+++ b/drivers/phy/broadcom/phy-brcm-usb.c
@@ -602,7 +602,7 @@ static int brcm_usb_phy_suspend(struct device *dev)
* and newer XHCI->2.0-clks/3.0-clks.
*/
- if (!priv->ini.suspend_with_clocks) {
+ if (!priv->ini.wake_enabled) {
if (priv->phys[BRCM_USB_PHY_3_0].inited)
clk_disable_unprepare(priv->usb_30_clk);
if (priv->phys[BRCM_USB_PHY_2_0].inited ||
@@ -619,8 +619,10 @@ static int brcm_usb_phy_resume(struct device *dev)
{
struct brcm_usb_phy_data *priv = dev_get_drvdata(dev);
- clk_prepare_enable(priv->usb_20_clk);
- clk_prepare_enable(priv->usb_30_clk);
+ if (!priv->ini.wake_enabled) {
+ clk_prepare_enable(priv->usb_20_clk);
+ clk_prepare_enable(priv->usb_30_clk);
+ }
brcm_usb_init_ipp(&priv->ini);
/*
--
2.7.4
next prev parent reply other threads:[~2022-10-05 21:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-05 21:30 [PATCH 0/6] Various bug fixes/improvements for phy-brcm-usb driver justinpopo6
2022-10-05 21:30 ` [PATCH 1/6] phy: usb: Improve port mode selection justinpopo6
2022-10-06 22:05 ` Florian Fainelli
2022-10-05 21:30 ` [PATCH 2/6] phy: usb: s2 WoL wakeup_count not incremented for USB->Eth devices justinpopo6
2022-10-06 22:05 ` Florian Fainelli
2022-10-05 21:30 ` [PATCH 3/6] phy: usb: Migrate to BIT and BITMASK macros justinpopo6
2022-10-06 22:07 ` Florian Fainelli
2022-10-05 21:30 ` [PATCH 4/6] phy: usb: Disable phy auto-suspend justinpopo6
2022-10-06 22:07 ` Florian Fainelli
2022-10-05 21:30 ` [PATCH 5/6] phy: usb: Use slow clock for wake enabled suspend justinpopo6
2022-10-06 22:07 ` Florian Fainelli
2022-10-05 21:30 ` justinpopo6 [this message]
2022-10-06 22:08 ` [PATCH 6/6] phy: usb: Fix clock imbalance for suspend/resume Florian Fainelli
2022-11-01 17:40 ` [PATCH 0/6] Various bug fixes/improvements for phy-brcm-usb driver Justin Chen
2022-11-05 7:43 ` Vinod Koul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1665005418-15807-7-git-send-email-justinpopo6@gmail.com \
--to=justinpopo6@gmail.com \
--cc=alcooperx@gmail.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=f.fainelli@gmail.com \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®