diff options
author | Grigor Tovmasyan <Grigor.Tovmasyan@synopsys.com> | 2018-08-29 21:01:59 +0400 |
---|---|---|
committer | Felipe Balbi <felipe.balbi@linux.intel.com> | 2018-10-02 10:50:22 +0300 |
commit | 15d9dbf8cbd4fc777a7fc92209903dbb47d0783e (patch) | |
tree | 9ea88c0c423b03f6fe674e22153a91e6d41d06d4 /drivers/usb/dwc2/gadget.c | |
parent | f3a61e4e033e808e7ac1239b151ec46f833fff4a (diff) | |
download | linux-15d9dbf8cbd4fc777a7fc92209903dbb47d0783e.tar.bz2 |
usb: dwc2: gadget: Program GREFCLK register
Added dwc2_gadget_program_ref_clk function to program GREFCLK
register in device mode.
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Grigor Tovmasyan <tovmasya@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc2/gadget.c')
-rw-r--r-- | drivers/usb/dwc2/gadget.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 9de16453a890..e8dd6897e2c3 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3418,6 +3418,10 @@ void dwc2_hsotg_core_init_disconnected(struct dwc2_hsotg *hsotg, /* configure the core to support LPM */ dwc2_gadget_init_lpm(hsotg); + /* program GREFCLK register if needed */ + if (using_desc_dma(hsotg) && hsotg->params.service_interval) + dwc2_gadget_program_ref_clk(hsotg); + /* must be at-least 3ms to allow bus to see disconnect */ mdelay(3); @@ -5002,6 +5006,25 @@ void dwc2_gadget_init_lpm(struct dwc2_hsotg *hsotg) } /** + * dwc2_gadget_program_ref_clk - Program GREFCLK register in device mode + * + * @hsotg: Programming view of DWC_otg controller + * + */ +void dwc2_gadget_program_ref_clk(struct dwc2_hsotg *hsotg) +{ + u32 val = 0; + + val |= GREFCLK_REF_CLK_MODE; + val |= hsotg->params.ref_clk_per << GREFCLK_REFCLKPER_SHIFT; + val |= hsotg->params.sof_cnt_wkup_alert << + GREFCLK_SOF_CNT_WKUP_ALERT_SHIFT; + + dwc2_writel(hsotg, val, GREFCLK); + dev_dbg(hsotg->dev, "GREFCLK=0x%08x\n", dwc2_readl(hsotg, GREFCLK)); +} + +/** * dwc2_gadget_enter_hibernation() - Put controller in Hibernation. * * @hsotg: Programming view of the DWC_otg controller |