usb: dwc_otg: Fix possible misbehavior during pcd reset 46/230246/2 accepted/tizen/unified/20200410.015546 submit/tizen/20200409.072845
authorDongwoo Lee <dwoo08.lee@samsung.com>
Thu, 9 Apr 2020 01:20:59 +0000 (10:20 +0900)
committerJunghoon Kim <jhoon20.kim@samsung.com>
Thu, 9 Apr 2020 06:35:23 +0000 (06:35 +0000)
The peripheral controller cannot occasionally, especially in first
boot right after the target is flashed with new images, provide
descriptor after usb reset when the gadget driver is composed with
multiple functions such as sdb and mtp.

I found the problem can be resolved by getting rid of possible
unnecessary works on reset interrupt handler. Removed jobs in this
commit consist of two parts: rxfifo flush and set DPID with DATA0.
Though I cannot figure out how two jobs influence on the reset
behavior, removing these seems quite reasonable since two parts are not
used anywhere in similar dwc vendor drivers. In addition, this just
changes behavior of reset interrupt handler, so other functionalities
are not affected.

Change-Id: I7ab93bb60331e27ece62bb9d5e8e01b1591cf2dc
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c

index 4e4318a..916f06f 100644 (file)
@@ -892,20 +892,8 @@ int32_t dwc_otg_pcd_handle_usb_reset_intr(dwc_otg_pcd_t * pcd)
                DWC_WRITE_REG32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32);
        }
 
-       /* Set data pid0 for all eps except for ep0 */
-       doepctl.b.setd0pid = 1;
-       for (i = 1; i <= dev_if->num_out_eps; i++) {
-               dwc_write_reg32(&dev_if->out_ep_regs[i]->doepctl, doepctl.d32);
-       }
-
-       diepctl.b.setd0pid = 1;
-       for (i = 1; i <= dev_if->num_in_eps; i++) {
-               dwc_write_reg32(&dev_if->in_ep_regs[i]->diepctl, diepctl.d32);
-       }
        /* Flush the NP Tx FIFO */
        dwc_otg_flush_tx_fifo(core_if, 0x10);
-       /* Flush the NP Rx FIFO */
-       dwc_otg_flush_rx_fifo(core_if);
        /* Flush the Learning Queue */
        resetctl.b.intknqflsh = 1;
        DWC_WRITE_REG32(&core_if->core_global_regs->grstctl, resetctl.d32);