blob: 356e3054609dc19e6af780484a22e6869b515252 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 6597af4e4835ec0709638d48f73c11b5c624790f Mon Sep 17 00:00:00 2001
2From: Al Cooper <alcooperx@gmail.com>
3Date: Fri, 3 Jan 2020 13:18:01 -0500
4Subject: [PATCH] phy: usb: Put USB phys into IDDQ on suspend to save power in
5 S2 mode
6
7Currently the Phy driver will put the USB phys into the max
8power saving mode (IDDQ) when there is no corresponding XHCI, EHCI
9or OHCI client (through rmmod, unbind or if the driver is not
10builtin). This change will also put the Phys into IDDQ mode
11on suspend so that S2 will get the additional power savings.
12
13Signed-off-by: Al Cooper <alcooperx@gmail.com>
14Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
15Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
16---
17 drivers/phy/broadcom/phy-brcm-usb-init.c | 2 --
18 drivers/phy/broadcom/phy-brcm-usb.c | 11 +++++++++--
19 2 files changed, 9 insertions(+), 4 deletions(-)
20
21--- a/drivers/phy/broadcom/phy-brcm-usb-init.c
22+++ b/drivers/phy/broadcom/phy-brcm-usb-init.c
23@@ -1002,8 +1002,6 @@ void brcm_usb_uninit_common(struct brcm_
24
25 void brcm_usb_uninit_eohci(struct brcm_usb_init_params *params)
26 {
27- if (USB_CTRL_MASK_FAMILY(params, USB_PM, USB20_HC_RESETB))
28- USB_CTRL_UNSET_FAMILY(params, USB_PM, USB20_HC_RESETB);
29 }
30
31 void brcm_usb_uninit_xhci(struct brcm_usb_init_params *params)
32--- a/drivers/phy/broadcom/phy-brcm-usb.c
33+++ b/drivers/phy/broadcom/phy-brcm-usb.c
34@@ -381,8 +381,15 @@ static int brcm_usb_phy_suspend(struct d
35 struct brcm_usb_phy_data *priv = dev_get_drvdata(dev);
36
37 if (priv->init_count) {
38- clk_disable_unprepare(priv->usb_20_clk);
39- clk_disable_unprepare(priv->usb_30_clk);
40+ if (priv->phys[BRCM_USB_PHY_3_0].inited)
41+ brcm_usb_uninit_xhci(&priv->ini);
42+ if (priv->phys[BRCM_USB_PHY_2_0].inited)
43+ brcm_usb_uninit_eohci(&priv->ini);
44+ brcm_usb_uninit_common(&priv->ini);
45+ if (priv->phys[BRCM_USB_PHY_3_0].inited)
46+ clk_disable_unprepare(priv->usb_30_clk);
47+ if (priv->phys[BRCM_USB_PHY_2_0].inited)
48+ clk_disable_unprepare(priv->usb_20_clk);
49 }
50 return 0;
51 }