Skip to content

Commit 9016fec

Browse files
P33Mpopcornmix
authored andcommitted
fiq_fsm: save PID on completion of interrupt OUT transfers
Also add edge case handling for interrupt transports. Note that for periodic split IN, data toggles are unimplemented in the OTG host hardware - it unconditionally accepts any PID.
1 parent 94f93e9 commit 9016fec

2 files changed

Lines changed: 22 additions & 22 deletions

File tree

‎drivers/usb/host/dwc_otg/dwc_otg_fiq_fsm.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -920,6 +920,8 @@ static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_c
920920
} else if (hcint.b.nyet) {
921921
/* Doh. Data lost. */
922922
st->fsm = FIQ_PER_SPLIT_NYET_ABORTED;
923+
} else if (hcint.b.xacterr || hcint.b.stall) {
924+
st->fsm = FIQ_PER_SPLIT_LS_ABORTED;
923925
} else {
924926
st->fsm = FIQ_PER_SPLIT_HS_ABORTED;
925927
}
@@ -999,8 +1001,8 @@ static int notrace noinline fiq_fsm_do_hcintr(struct fiq_state *state, int num_c
9991001
st->fsm = FIQ_PER_SPLIT_DONE;
10001002
}
10011003
}
1002-
} else if (hcint.b.xacterr) {
1003-
/* Local 3-strikes retry is handled by the core. This is a ERR response.*/
1004+
} else if (hcint.b.xacterr || hcint.b.stall) {
1005+
/* For xacterr, Local 3-strikes retry is handled by the core. This is a ERR response.*/
10041006
st->fsm = FIQ_PER_SPLIT_LS_ABORTED;
10051007
} else if (hcint.b.datatglerr) {
10061008
fiq_print(FIQDBG_INT, state, "TOGGLES");

‎drivers/usb/host/dwc_otg/dwc_otg_hcd_intr.c‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,36 +2402,32 @@ int32_t dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num)
24022402
* split transactions and do it ourselves.
24032403
*/
24042404
if (hc->ep_type == UE_INTERRUPT) {
2405-
if (hc->ep_is_in) {
2406-
if (hcint.b.nak) {
2405+
if (hcint.b.nak) {
24072406
handle_hc_nak_intr(hcd, hc, hc_regs, qtd);
2407+
} else if (hc->ep_is_in) {
2408+
int len;
2409+
len = dwc_otg_fiq_unsetup_per_dma(hcd, hc->qh, qtd, num);
2410+
//printk(KERN_NOTICE "FIQ Transaction: hc=%d len=%d urb_len = %d\n", num, len, qtd->urb->length);
2411+
qtd->urb->actual_length += len;
2412+
if (qtd->urb->actual_length >= qtd->urb->length) {
2413+
qtd->urb->status = 0;
2414+
hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status);
2415+
release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE);
24082416
} else {
2409-
int len;
2410-
len = dwc_otg_fiq_unsetup_per_dma(hcd, hc->qh, qtd, num);
2411-
//printk(KERN_NOTICE "FIQ Transaction: hc=%d len=%d urb_len = %d\n", num, len, qtd->urb->length);
2412-
qtd->urb->actual_length += len;
2413-
if (qtd->urb->actual_length >= qtd->urb->length) {
2417+
/* Interrupt transfer not complete yet - is it a short read? */
2418+
if (len < hc->max_packet) {
2419+
/* Interrupt transaction complete */
24142420
qtd->urb->status = 0;
24152421
hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status);
24162422
release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE);
24172423
} else {
2418-
/* Interrupt transfer not complete yet - is it a short read? */
2419-
if (len < hc->max_packet) {
2420-
/* Interrupt transaction complete */
2421-
qtd->urb->status = 0;
2422-
hcd->fops->complete(hcd, qtd->urb->priv, qtd->urb, qtd->urb->status);
2423-
release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_URB_COMPLETE);
2424-
} else {
2425-
/* Further transactions required */
2426-
release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE);
2427-
}
2428-
2424+
/* Further transactions required */
2425+
release_channel(hcd, hc, qtd, DWC_OTG_HC_XFER_COMPLETE);
24292426
}
2430-
24312427
}
2432-
24332428
} else {
24342429
/* Interrupt OUT complete. */
2430+
dwc_otg_hcd_save_data_toggle(hc, hc_regs, qtd);
24352431
qtd->urb->actual_length += hc->xfer_len;
24362432
if (qtd->urb->actual_length >= qtd->urb->length) {
24372433
qtd->urb->status = 0;
@@ -2524,6 +2520,8 @@ int32_t dwc_otg_hcd_handle_hc_fsm(dwc_otg_hcd_t *hcd, uint32_t num)
25242520
* TODO: need to issue a reset to the hub port. */
25252521
qtd->error_count += 3;
25262522
handle_hc_xacterr_intr(hcd, hc, hc_regs, qtd);
2523+
} else if (hcint.b.stall) {
2524+
handle_hc_stall_intr(hcd, hc, hc_regs, qtd);
25272525
} else {
25282526
printk_ratelimited(KERN_INFO "Transfer to device %d endpoint 0x%x failed "
25292527
"- FIQ reported FSM=%d. Data may have been lost.\n",

0 commit comments

Comments
 (0)