Skip to content

Commit f580170

Browse files
chenyu56felipebalbi
authored andcommitted
usb: dwc3: Add splitdisable quirk for Hisilicon Kirin Soc
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 <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent 2a87445 commit f580170

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

drivers/usb/dwc3/core.c

+25
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
pm_runtime_get_sync(dwc->dev);
124125

@@ -169,6 +170,11 @@ static void __dwc3_set_mode(struct work_struct *work)
169170
otg_set_vbus(dwc->usb2_phy->otg, true);
170171
phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
171172
phy_set_mode(dwc->usb3_generic_phy, PHY_MODE_USB_HOST);
173+
if (dwc->dis_split_quirk) {
174+
reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
175+
reg |= DWC3_GUCTL3_SPLITDISABLE;
176+
dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
177+
}
172178
}
173179
break;
174180
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

@@ -1886,10 +1895,26 @@ static int dwc3_resume(struct device *dev)
18861895

18871896
return 0;
18881897
}
1898+
1899+
static void dwc3_complete(struct device *dev)
1900+
{
1901+
struct dwc3 *dwc = dev_get_drvdata(dev);
1902+
u32 reg;
1903+
1904+
if (dwc->current_dr_role == DWC3_GCTL_PRTCAP_HOST &&
1905+
dwc->dis_split_quirk) {
1906+
reg = dwc3_readl(dwc->regs, DWC3_GUCTL3);
1907+
reg |= DWC3_GUCTL3_SPLITDISABLE;
1908+
dwc3_writel(dwc->regs, DWC3_GUCTL3, reg);
1909+
}
1910+
}
1911+
#else
1912+
#define dwc3_complete NULL
18891913
#endif /* CONFIG_PM_SLEEP */
18901914

18911915
static const struct dev_pm_ops dwc3_dev_pm_ops = {
18921916
SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
1917+
.complete = dwc3_complete,
18931918
SET_RUNTIME_PM_OPS(dwc3_runtime_suspend, dwc3_runtime_resume,
18941919
dwc3_runtime_idle)
18951920
};

drivers/usb/dwc3/core.h

+7
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)
@@ -1053,6 +1057,7 @@ struct dwc3_scratchpad_array {
10531057
* 2 - No de-emphasis
10541058
* 3 - Reserved
10551059
* @dis_metastability_quirk: set to disable metastability quirk.
1060+
* @dis_split_quirk: set to disable split boundary.
10561061
* @imod_interval: set the interrupt moderation interval in 250ns
10571062
* increments or 0 to disable.
10581063
*/
@@ -1246,6 +1251,8 @@ struct dwc3 {
12461251

12471252
unsigned dis_metastability_quirk:1;
12481253

1254+
unsigned dis_split_quirk:1;
1255+
12491256
u16 imod_interval;
12501257
};
12511258

0 commit comments

Comments
 (0)