From 5c3cf2427c7599bafa82194a85bb266da95087dc Mon Sep 17 00:00:00 2001 From: Elson Roy Serrao Date: Mon, 12 Aug 2019 12:59:07 -0700 Subject: [PATCH] usb: dwc3: Enable PHY deep low power mode in L1 suspend Currently controller is enabling only shallow low power mode during L1 suspend in host mode. Power savings can be improved by allowing deep low power mode allowing PLL to be turned OFF. Configuring the GUCTL1 register to enable this feature. Change-Id: Iea6cfa2c9085a01f45a9f0d633c80368ad085806 Signed-off-by: Elson Roy Serrao Signed-off-by: Jack Pham --- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/dwc3-msm.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 36855e5c13f8..e5998bab73f5 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -265,6 +265,7 @@ #define DWC3_GUCTL1_TX_IPGAP_LINECHECK_DIS BIT(28) #define DWC3_GUCTL1_DEV_L1_EXIT_BY_HW BIT(24) #define DWC3_GUCTL1_IP_GAP_ADD_ON(n) (n << 21) +#define DWC3_GUCTL1_L1_SUSP_THRLD_EN_FOR_HOST BIT(8) /* Global Status Register */ #define DWC3_GSTS_OTG_IP BIT(10) diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 2aa755a0f7ee..4324b869f81b 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -2436,6 +2436,10 @@ static void dwc3_en_sleep_mode(struct dwc3_msm *mdwc) reg = dwc3_msm_read_reg(mdwc->base, DWC3_GUSB2PHYCFG(0)); reg |= DWC3_GUSB2PHYCFG_ENBLSLPM; dwc3_msm_write_reg(mdwc->base, DWC3_GUSB2PHYCFG(0), reg); + + reg = dwc3_msm_read_reg(mdwc->base, DWC3_GUCTL1); + reg |= DWC3_GUCTL1_L1_SUSP_THRLD_EN_FOR_HOST; + dwc3_msm_write_reg(mdwc->base, DWC3_GUCTL1, reg); } static void dwc3_dis_sleep_mode(struct dwc3_msm *mdwc) @@ -2445,6 +2449,10 @@ static void dwc3_dis_sleep_mode(struct dwc3_msm *mdwc) reg = dwc3_msm_read_reg(mdwc->base, DWC3_GUSB2PHYCFG(0)); reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; dwc3_msm_write_reg(mdwc->base, DWC3_GUSB2PHYCFG(0), reg); + + reg = dwc3_msm_read_reg(mdwc->base, DWC3_GUCTL1); + reg &= ~DWC3_GUCTL1_L1_SUSP_THRLD_EN_FOR_HOST; + dwc3_msm_write_reg(mdwc->base, DWC3_GUCTL1, reg); } static void dwc3_msm_power_collapse_por(struct dwc3_msm *mdwc)