Re: [PATCH 2/4] usb: dwc2: optionally assert phy reset when waking up

From: Doug Anderson
Date: Tue Apr 16 2019 - 17:54:44 EST


Hi,

On Fri, Apr 12, 2019 at 4:56 PM Matthias Kaehlcke <mka@xxxxxxxxxxxx> wrote:
> > @@ -5271,11 +5282,10 @@ int dwc2_hcd_init(struct dwc2_hsotg *hsotg)
> > hsotg->hc_ptr_array[i] = channel;
> > }
> >
> > - /* Initialize hsotg start work */
> > + /* Initialize work */
> > INIT_DELAYED_WORK(&hsotg->start_work, dwc2_hcd_start_func);
> > -
> > - /* Initialize port reset work */
> > INIT_DELAYED_WORK(&hsotg->reset_work, dwc2_hcd_reset_func);
> > + INIT_WORK(&hsotg->phy_reset_work, dwc2_hcd_phy_reset_func);
>
> You also want to make sure that the work is cancelled when the
> controller is stopped/removed. It seems dwc2_hcd_stop() would be a
> suitable place for that.

Good point. dwc2_hcd_stop() doesn't work though because it's called
with interrupts disabled (because it's holding the hsotg->lock
spinlock). I put it in dwc2_hcd_free() where there's another similar
cancel.

-Doug