Skip to content

Commit a317705

Browse files
chenyu56gregkh
authored andcommitted
usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc
[ Upstream commit f580170 ] SPLIT_BOUNDARY_DISABLE should be set for DesignWare USB3 DRD Core of Hisilicon Kirin Soc when dwc3 core act as host. [mchehab: dropped a dev_dbg() as only traces are now allowwed on this driver] Signed-off-by: Yu Chen <chenyu56@huawei.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Signed-off-by: Felipe Balbi <balbi@kernel.org> Stable-dep-of: 0d410e8 ("usb: dwc3: core: Stop processing of pending events if controller is halted") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 2b8f2af commit a317705

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

drivers/usb/dwc3/core.c

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ static void __dwc3_set_mode(struct work_struct *work)
116116
struct dwc3 *dwc = work_to_dwc(work);
117117
unsigned long flags;
118118
int ret;
119+
u32 reg;
119120

120121
if (dwc->dr_mode != USB_DR_MODE_OTG)
121122
return;
@@ -167,6 +168,11 @@ static void __dwc3_set_mode(struct work_struct *work)
167168
otg_set_vbus(dwc->usb2_phy->otg, true);
168169
phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
169170
phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST);
171+
if (dwc->dis_split_quirk) {
172+
reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
173+
reg |= DWC3_GUCTL3_SPLITDISABLE;
174+
dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
175+
}
170176
}
171177
break;
172178
case DWC3_GCTL_PRTCAP_DEVICE:
@@ -1314,6 +1320,9 @@ static void dwc3_get_properties(struct dwc3 *dwc)
13141320
dwc->dis_metastability_quirk = device_property_read_bool(dev,
13151321
"snps,dis_metastability_quirk");
13161322

1323+
dwc->dis_split_quirk = device_property_read_bool(dev,
1324+
"snps,dis-split-quirk");
1325+
13171326
dwc->lpm_nyet_threshold = lpm_nyet_threshold;
13181327
dwc->tx_de_emphasis = tx_de_emphasis;
13191328

@@ -1850,10 +1859,26 @@ static int dwc3_resume(struct device *dev)
18501859

18511860
return 0;
18521861
}
1862+
1863+
static void dwc3_complete(struct device *dev)
1864+
{
1865+
struct dwc3 *dwc = dev_get_drvdata(dev);
1866+
u32 reg;
1867+
1868+
if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
1869+
dwc->dis_split_quirk) {
1870+
reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
1871+
reg |= DWC3_GUCTL3_SPLITDISABLE;
1872+
dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
1873+
}
1874+
}
1875+
#else
1876+
#define dwc3_complete NULL
18531877
#endif /* CONFIG_PM_SLEEP */
18541878

18551879
static const struct dev_pm_ops dwc3_dev_pm_ops = {
18561880
SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
1881+
.complete = dwc3_complete,
18571882
SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume,
18581883
dwc3_runtime_idle)
18591884
};

drivers/usb/dwc3/core.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
#define DWC3_GEVNTCOUNT(n) (0xc40c + ((n) * 0x10))
136136

137137
#define DWC3_GHWPARAMS8 0xc600
138+
#define DWC3_GUCTL3 0xc60c
138139
#define DWC3_GFLADJ 0xc630
139140

140141
/* Device Registers */
@@ -362,6 +363,9 @@
362363
/* Global User Control Register 2 */
363364
#define DWC3_GUCTL2_RST_ACTBITLATER BIT(14)
364365

366+
/* Global User Control Register 3 */
367+
#define DWC3_GUCTL3_SPLITDISABLE BIT(14)
368+
365369
/* Device Configuration Register */
366370
#define DWC3_DCFG_DEVADDR(addr) ((addr) << 3)
367371
#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f)
@@ -1004,6 +1008,7 @@ struct dwc3_scratchpad_array {
10041008
* 2 - No de-emphasis
10051009
* 3 - Reserved
10061010
* @dis_metastability_quirk: set to disable metastability quirk.
1011+
* @dis_split_quirk: set to disable split boundary.
10071012
* @imod_interval: set the interrupt moderation interval in 250ns
10081013
* increments or 0 to disable.
10091014
*/
@@ -1175,6 +1180,8 @@ struct dwc3 {
11751180

11761181
unsigned dis_metastability_quirk:1;
11771182

1183+
unsigned dis_split_quirk:1;
1184+
11781185
u16 imod_interval;
11791186
};
11801187

0 commit comments

Comments
 (0)