Skip to content

Commit f79d247

Browse files
jhovoldsmb49
authored andcommitted
USB: dwc3: gadget: drop dead hibernation code
BugLink: https://bugs.launchpad.net/bugs/2028580 [ Upstream commit bdb19d0 ] The hibernation code is broken and has never been enabled in mainline and should thus be dropped. Remove the hibernation bits from the gadget code, which effectively reverts commits e1dadd3 ("usb: dwc3: workaround: bogus hibernation events") and 7b2a036 ("usb: dwc3: gadget: set KEEP_CONNECT in case of hibernation") except for the spurious interrupt warning. Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com> Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Link: https://lore.kernel.org/r/20230404072524.19014-5-johan+linaro@kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Stable-dep-of: 39674be ("usb: dwc3: gadget: Execute gadget stop after halting the controller") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 4bc497a commit f79d247

1 file changed

Lines changed: 6 additions & 40 deletions

File tree

drivers/usb/dwc3/gadget.c

Lines changed: 6 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,7 +2478,7 @@ static void __dwc3_gadget_set_speed(struct dwc3 *dwc)
24782478
dwc3_writel(dwc->regs, DWC3_DCFG, reg);
24792479
}
24802480

2481-
static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
2481+
static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on)
24822482
{
24832483
u32 reg;
24842484
u32 timeout = 2000;
@@ -2497,17 +2497,11 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
24972497
reg &= ~DWC3_DCTL_KEEP_CONNECT;
24982498
reg |= DWC3_DCTL_RUN_STOP;
24992499

2500-
if (dwc->has_hibernation)
2501-
reg |= DWC3_DCTL_KEEP_CONNECT;
2502-
25032500
__dwc3_gadget_set_speed(dwc);
25042501
dwc->pullups_connected = true;
25052502
} else {
25062503
reg &= ~DWC3_DCTL_RUN_STOP;
25072504

2508-
if (dwc->has_hibernation && !suspend)
2509-
reg &= ~DWC3_DCTL_KEEP_CONNECT;
2510-
25112505
dwc->pullups_connected = false;
25122506
}
25132507

@@ -2589,7 +2583,7 @@ static int dwc3_gadget_soft_disconnect(struct dwc3 *dwc)
25892583
* remaining event generated by the controller while polling for
25902584
* DSTS.DEVCTLHLT.
25912585
*/
2592-
return dwc3_gadget_run_stop(dwc, false, false);
2586+
return dwc3_gadget_run_stop(dwc, false);
25932587
}
25942588

25952589
static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
@@ -2643,7 +2637,7 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on)
26432637

26442638
dwc3_event_buffers_setup(dwc);
26452639
__dwc3_gadget_start(dwc);
2646-
ret = dwc3_gadget_run_stop(dwc, true, false);
2640+
ret = dwc3_gadget_run_stop(dwc, true);
26472641
}
26482642

26492643
pm_runtime_put(dwc->dev);
@@ -4210,30 +4204,6 @@ static void dwc3_gadget_suspend_interrupt(struct dwc3 *dwc,
42104204
dwc->link_state = next;
42114205
}
42124206

4213-
static void dwc3_gadget_hibernation_interrupt(struct dwc3 *dwc,
4214-
unsigned int evtinfo)
4215-
{
4216-
unsigned int is_ss = evtinfo & BIT(4);
4217-
4218-
/*
4219-
* WORKAROUND: DWC3 revision 2.20a with hibernation support
4220-
* have a known issue which can cause USB CV TD.9.23 to fail
4221-
* randomly.
4222-
*
4223-
* Because of this issue, core could generate bogus hibernation
4224-
* events which SW needs to ignore.
4225-
*
4226-
* Refers to:
4227-
*
4228-
* STAR#9000546576: Device Mode Hibernation: Issue in USB 2.0
4229-
* Device Fallback from SuperSpeed
4230-
*/
4231-
if (is_ss ^ (dwc->speed == USB_SPEED_SUPER))
4232-
return;
4233-
4234-
/* enter hibernation here */
4235-
}
4236-
42374207
static void dwc3_gadget_interrupt(struct dwc3 *dwc,
42384208
const struct dwc3_event_devt *event)
42394209
{
@@ -4251,11 +4221,7 @@ static void dwc3_gadget_interrupt(struct dwc3 *dwc,
42514221
dwc3_gadget_wakeup_interrupt(dwc);
42524222
break;
42534223
case DWC3_DEVICE_EVENT_HIBER_REQ:
4254-
if (dev_WARN_ONCE(dwc->dev, !dwc->has_hibernation,
4255-
"unexpected hibernation event\n"))
4256-
break;
4257-
4258-
dwc3_gadget_hibernation_interrupt(dwc, event->event_info);
4224+
dev_WARN_ONCE(dwc->dev, true, "unexpected hibernation event\n");
42594225
break;
42604226
case DWC3_DEVICE_EVENT_LINK_STATUS_CHANGE:
42614227
dwc3_gadget_linksts_change_interrupt(dwc, event->event_info);
@@ -4592,7 +4558,7 @@ int dwc3_gadget_suspend(struct dwc3 *dwc)
45924558
if (!dwc->gadget_driver)
45934559
return 0;
45944560

4595-
dwc3_gadget_run_stop(dwc, false, false);
4561+
dwc3_gadget_run_stop(dwc, false);
45964562

45974563
spin_lock_irqsave(&dwc->lock, flags);
45984564
dwc3_disconnect_gadget(dwc);
@@ -4613,7 +4579,7 @@ int dwc3_gadget_resume(struct dwc3 *dwc)
46134579
if (ret < 0)
46144580
goto err0;
46154581

4616-
ret = dwc3_gadget_run_stop(dwc, true, false);
4582+
ret = dwc3_gadget_run_stop(dwc, true);
46174583
if (ret < 0)
46184584
goto err1;
46194585

0 commit comments

Comments
 (0)