mediatek: Add support for Xiaomi Redmi Router AX6S
[openwrt/staging/mkresin.git] / target / linux / bcm4908 / patches-5.4 / 084-v5.6-0003-phy-usb-Put-USB-phys-into-IDDQ-on-suspend-to-save-po.patch
1 From 6597af4e4835ec0709638d48f73c11b5c624790f Mon Sep 17 00:00:00 2001
2 From: Al Cooper <alcooperx@gmail.com>
3 Date: Fri, 3 Jan 2020 13:18:01 -0500
4 Subject: [PATCH] phy: usb: Put USB phys into IDDQ on suspend to save power in
5 S2 mode
6
7 Currently the Phy driver will put the USB phys into the max
8 power saving mode (IDDQ) when there is no corresponding XHCI, EHCI
9 or OHCI client (through rmmod, unbind or if the driver is not
10 builtin). This change will also put the Phys into IDDQ mode
11 on suspend so that S2 will get the additional power savings.
12
13 Signed-off-by: Al Cooper <alcooperx@gmail.com>
14 Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
15 Signed-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 }