usb: dwc2: host: Fix remote wakeup when not in DWC2_L2
usb: dwc2: host: Fix remote wakeup when not in DWC2_L2

In commit 734643dfbdde ("usb: dwc2: host: add flag to reflect bus
state") we changed dwc2_port_suspend() not to set the lx_state
anymore (instead it sets the new bus_suspended variable).  This
introduced a bug where we would fail to detect device insertions if:

1. Plug empty hub into dwc2
2. Plug USB flash drive into the empty hub.
3. Wait a few seconds
4. Unplug USB flash drive
5. Less than 2 seconds after step 4, plug the USB flash drive in again.

The dwc2_hcd_rem_wakeup() function should have been changed to look at
the new bus_suspended variable.

Let's fix it.  Since commit b46146d59fda ("usb: dwc2: host: resume root
hub on remote wakeup") talks about needing the root hub resumed if the
bus was suspended, we'll include it in our test.

It appears that the "port_l1_change" should only be set to 1 if we were
in DWC2_L1 (the driver currently never sets this), so we'll update the
former "else" case based on this test.

Fixes: 734643dfbdde ("usb: dwc2: host: add flag to reflect bus state")
Acked-by: John Youn <d42a4eb72e2ed398cd02c138cc1131a66e2fa0de@synopsys.com>
Tested-by: Gregory Herrero <869cc571e08bd1797a017f1a62bfeeab83fe5bd7@intel.com>
Reviewed-by: Heiko Stuebner <9ab5f52a1ca0bcf4f70d6d9008e02f6134b5b8f2@sntech.de>
Signed-off-by: Douglas Anderson <49983c4a76b998672954ed5edf4a62db4a336502@chromium.org>
Signed-off-by: Felipe Balbi <94dddeeef08b001e003cce128ddc162a4e2c6cd2@ti.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs