Skip to content

Commit f815885

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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 3ad4527 commit f815885

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
@@ -119,6 +119,7 @@ static void __dwc3_set_mode(struct work_struct *work)
119119
struct dwc3 *dwc = work_to_dwc(work);
120120
unsigned long flags;
121121
int ret;
122+
u32 reg;
122123

123124
if (dwc->dr_mode != USB_DR_MODE_OTG)
124125
return;
@@ -172,6 +173,11 @@ static void __dwc3_set_mode(struct work_struct *work)
172173
otg_set_vbus(dwc->usb2_phy->otg, true);
173174
phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
174175
phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST);
176+
if (dwc->dis_split_quirk) {
177+
reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
178+
reg |= DWC3_GUCTL3_SPLITDISABLE;
179+
dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
180+
}
175181
}
176182
break;
177183
case DWC3_GCTL_PRTCAP_DEVICE:
@@ -1349,6 +1355,9 @@ static void dwc3_get_properties(struct dwc3 *dwc)
13491355
dwc->dis_metastability_quirk = device_property_read_bool(dev,
13501356
"snps,dis_metastability_quirk");
13511357

1358+
dwc->dis_split_quirk = device_property_read_bool(dev,
1359+
"snps,dis-split-quirk");
1360+
13521361
dwc->lpm_nyet_threshold = lpm_nyet_threshold;
13531362
dwc->tx_de_emphasis = tx_de_emphasis;
13541363

@@ -1866,10 +1875,26 @@ static int dwc3_resume(struct device *dev)
18661875

18671876
return 0;
18681877
}
1878+
1879+
static void dwc3_complete(struct device *dev)
1880+
{
1881+
struct dwc3 *dwc = dev_get_drvdata(dev);
1882+
u32 reg;
1883+
1884+
if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
1885+
dwc->dis_split_quirk) {
1886+
reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
1887+
reg |= DWC3_GUCTL3_SPLITDISABLE;
1888+
dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
1889+
}
1890+
}
1891+
#else
1892+
#define dwc3_complete NULL
18691893
#endif /* CONFIG_PM_SLEEP */
18701894

18711895
static const struct dev_pm_ops dwc3_dev_pm_ops = {
18721896
SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
1897+
.complete = dwc3_complete,
18731898
SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume,
18741899
dwc3_runtime_idle)
18751900
};

drivers/usb/dwc3/core.h

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

140140
#define DWC3_GHWPARAMS8 0xc600
141+
#define DWC3_GUCTL3 0xc60c
141142
#define DWC3_GFLADJ 0xc630
142143

143144
/* Device Registers */
@@ -380,6 +381,9 @@
380381
/* Global User Control Register 2 */
381382
#define DWC3_GUCTL2_RST_ACTBITLATER BIT(14)
382383

384+
/* Global User Control Register 3 */
385+
#define DWC3_GUCTL3_SPLITDISABLE BIT(14)
386+
383387
/* Device Configuration Register */
384388
#define DWC3_DCFG_DEVADDR(addr) ((addr) << 3)
385389
#define DWC3_DCFG_DEVADDR_MASK DWC3_DCFG_DEVADDR(0x7f)
@@ -1052,6 +1056,7 @@ struct dwc3_scratchpad_array {
10521056
* 2 - No de-emphasis
10531057
* 3 - Reserved
10541058
* @dis_metastability_quirk: set to disable metastability quirk.
1059+
* @dis_split_quirk: set to disable split boundary.
10551060
* @imod_interval: set the interrupt moderation interval in 250ns
10561061
* increments or 0 to disable.
10571062
*/
@@ -1245,6 +1250,8 @@ struct dwc3 {
12451250

12461251
unsigned dis_metastability_quirk:1;
12471252

1253+
unsigned dis_split_quirk:1;
1254+
12481255
u16 imod_interval;
12491256
};
12501257

0 commit comments

Comments
 (0)