Commit ced9eee1 authored by Douglas Anderson's avatar Douglas Anderson Committed by Felipe Balbi

usb: dwc2: host: Rename some fields in struct dwc2_qh

This no-op change just does some renames to simplify a future patch.

1. The "interval" field is renamed to "host_interval" to make it more
   obvious that this interval may be 8 times the interval that the
   device sees (if we're doing split transactions).  A future patch will
   also add the "device_interval" field.
2. The "usecs" field is renamed to "host_us" again to make it more
   obvious that this is the time for the transaction as seen by the
   host.  For split transactions the device may see a much longer
   transaction time.  A future patch will also add "device_us".
3. The "sched_frame" field is renamed to "next_active_frame".  The name
   "sched_frame" kept confusing me because it felt like something more
   permament (the QH's reservation or something).  The name
   "next_active_frame" makes it more obvious that this field is
   constantly changing.
Acked-by: default avatarJohn Youn <johnyoun@synopsys.com>
Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
Tested-by: default avatarHeiko Stuebner <heiko@sntech.de>
Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: default avatarFelipe Balbi <balbi@kernel.org>
parent 4e50e011
...@@ -236,10 +236,14 @@ enum dwc2_transaction_type { ...@@ -236,10 +236,14 @@ enum dwc2_transaction_type {
* @do_split: Full/low speed endpoint on high-speed hub requires split * @do_split: Full/low speed endpoint on high-speed hub requires split
* @td_first: Index of first activated isochronous transfer descriptor * @td_first: Index of first activated isochronous transfer descriptor
* @td_last: Index of last activated isochronous transfer descriptor * @td_last: Index of last activated isochronous transfer descriptor
* @usecs: Bandwidth in microseconds per (micro)frame * @host_us: Bandwidth in microseconds per transfer as seen by host
* @interval: Interval between transfers in (micro)frames * @host_interval: Interval between transfers as seen by the host. If
* @sched_frame: (Micro)frame to initialize a periodic transfer. * the host is high speed and the device is low speed this
* The transfer executes in the following (micro)frame. * will be 8 times device interval.
* @next_active_frame: (Micro)frame before we next need to put something on
* the bus. We'll move the qh to active here. If the
* host is in high speed mode this will be a uframe. If
* the host is in low speed mode this will be a full frame.
* @frame_usecs: Internal variable used by the microframe scheduler * @frame_usecs: Internal variable used by the microframe scheduler
* @start_split_frame: (Micro)frame at which last start split was initialized * @start_split_frame: (Micro)frame at which last start split was initialized
* @ntd: Actual number of transfer descriptors in a list * @ntd: Actual number of transfer descriptors in a list
...@@ -272,9 +276,9 @@ struct dwc2_qh { ...@@ -272,9 +276,9 @@ struct dwc2_qh {
u8 do_split; u8 do_split;
u8 td_first; u8 td_first;
u8 td_last; u8 td_last;
u16 usecs; u16 host_us;
u16 interval; u16 host_interval;
u16 sched_frame; u16 next_active_frame;
u16 frame_usecs[8]; u16 frame_usecs[8];
u16 start_split_frame; u16 start_split_frame;
u16 ntd; u16 ntd;
...@@ -651,7 +655,7 @@ static inline u16 dwc2_hcd_get_ep_bandwidth(struct dwc2_hsotg *hsotg, ...@@ -651,7 +655,7 @@ static inline u16 dwc2_hcd_get_ep_bandwidth(struct dwc2_hsotg *hsotg,
return 0; return 0;
} }
return qh->usecs; return qh->host_us;
} }
extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg, extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg,
......
...@@ -81,7 +81,7 @@ static u16 dwc2_max_desc_num(struct dwc2_qh *qh) ...@@ -81,7 +81,7 @@ static u16 dwc2_max_desc_num(struct dwc2_qh *qh)
static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) static u16 dwc2_frame_incr_val(struct dwc2_qh *qh)
{ {
return qh->dev_speed == USB_SPEED_HIGH ? return qh->dev_speed == USB_SPEED_HIGH ?
(qh->interval + 8 - 1) / 8 : qh->interval; (qh->host_interval + 8 - 1) / 8 : qh->host_interval;
} }
static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
...@@ -252,7 +252,7 @@ static void dwc2_update_frame_list(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -252,7 +252,7 @@ static void dwc2_update_frame_list(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
chan = qh->channel; chan = qh->channel;
inc = dwc2_frame_incr_val(qh); inc = dwc2_frame_incr_val(qh);
if (qh->ep_type == USB_ENDPOINT_XFER_ISOC) if (qh->ep_type == USB_ENDPOINT_XFER_ISOC)
i = dwc2_frame_list_idx(qh->sched_frame); i = dwc2_frame_list_idx(qh->next_active_frame);
else else
i = 0; i = 0;
...@@ -278,13 +278,13 @@ static void dwc2_update_frame_list(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -278,13 +278,13 @@ static void dwc2_update_frame_list(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
return; return;
chan->schinfo = 0; chan->schinfo = 0;
if (chan->speed == USB_SPEED_HIGH && qh->interval) { if (chan->speed == USB_SPEED_HIGH && qh->host_interval) {
j = 1; j = 1;
/* TODO - check this */ /* TODO - check this */
inc = (8 + qh->interval - 1) / qh->interval; inc = (8 + qh->host_interval - 1) / qh->host_interval;
for (i = 0; i < inc; i++) { for (i = 0; i < inc; i++) {
chan->schinfo |= j; chan->schinfo |= j;
j = j << qh->interval; j = j << qh->host_interval;
} }
} else { } else {
chan->schinfo = 0xff; chan->schinfo = 0xff;
...@@ -431,7 +431,10 @@ static u16 dwc2_calc_starting_frame(struct dwc2_hsotg *hsotg, ...@@ -431,7 +431,10 @@ static u16 dwc2_calc_starting_frame(struct dwc2_hsotg *hsotg,
hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg);
/* sched_frame is always frame number (not uFrame) both in FS and HS! */ /*
* next_active_frame is always frame number (not uFrame) both in FS
* and HS!
*/
/* /*
* skip_frames is used to limit activated descriptors number * skip_frames is used to limit activated descriptors number
...@@ -514,13 +517,13 @@ static u16 dwc2_recalc_initial_desc_idx(struct dwc2_hsotg *hsotg, ...@@ -514,13 +517,13 @@ static u16 dwc2_recalc_initial_desc_idx(struct dwc2_hsotg *hsotg,
*/ */
fr_idx_tmp = dwc2_frame_list_idx(frame); fr_idx_tmp = dwc2_frame_list_idx(frame);
fr_idx = (FRLISTEN_64_SIZE + fr_idx = (FRLISTEN_64_SIZE +
dwc2_frame_list_idx(qh->sched_frame) - fr_idx_tmp) dwc2_frame_list_idx(qh->next_active_frame) -
% dwc2_frame_incr_val(qh); fr_idx_tmp) % dwc2_frame_incr_val(qh);
fr_idx = (fr_idx + fr_idx_tmp) % FRLISTEN_64_SIZE; fr_idx = (fr_idx + fr_idx_tmp) % FRLISTEN_64_SIZE;
} else { } else {
qh->sched_frame = dwc2_calc_starting_frame(hsotg, qh, qh->next_active_frame = dwc2_calc_starting_frame(hsotg, qh,
&skip_frames); &skip_frames);
fr_idx = dwc2_frame_list_idx(qh->sched_frame); fr_idx = dwc2_frame_list_idx(qh->next_active_frame);
} }
qh->td_first = qh->td_last = dwc2_frame_to_desc_idx(qh, fr_idx); qh->td_first = qh->td_last = dwc2_frame_to_desc_idx(qh, fr_idx);
...@@ -583,7 +586,7 @@ static void dwc2_init_isoc_dma_desc(struct dwc2_hsotg *hsotg, ...@@ -583,7 +586,7 @@ static void dwc2_init_isoc_dma_desc(struct dwc2_hsotg *hsotg,
u16 next_idx; u16 next_idx;
idx = qh->td_last; idx = qh->td_last;
inc = qh->interval; inc = qh->host_interval;
hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg);
cur_idx = dwc2_frame_list_idx(hsotg->frame_number); cur_idx = dwc2_frame_list_idx(hsotg->frame_number);
next_idx = dwc2_desclist_idx_inc(qh->td_last, inc, qh->dev_speed); next_idx = dwc2_desclist_idx_inc(qh->td_last, inc, qh->dev_speed);
...@@ -605,11 +608,11 @@ static void dwc2_init_isoc_dma_desc(struct dwc2_hsotg *hsotg, ...@@ -605,11 +608,11 @@ static void dwc2_init_isoc_dma_desc(struct dwc2_hsotg *hsotg,
} }
} }
if (qh->interval) { if (qh->host_interval) {
ntd_max = (dwc2_max_desc_num(qh) + qh->interval - 1) / ntd_max = (dwc2_max_desc_num(qh) + qh->host_interval - 1) /
qh->interval; qh->host_interval;
if (skip_frames && !qh->channel) if (skip_frames && !qh->channel)
ntd_max -= skip_frames / qh->interval; ntd_max -= skip_frames / qh->host_interval;
} }
max_xfer_size = qh->dev_speed == USB_SPEED_HIGH ? max_xfer_size = qh->dev_speed == USB_SPEED_HIGH ?
...@@ -1029,7 +1032,7 @@ static void dwc2_complete_isoc_xfer_ddma(struct dwc2_hsotg *hsotg, ...@@ -1029,7 +1032,7 @@ static void dwc2_complete_isoc_xfer_ddma(struct dwc2_hsotg *hsotg,
idx); idx);
if (rc < 0) if (rc < 0)
return; return;
idx = dwc2_desclist_idx_inc(idx, qh->interval, idx = dwc2_desclist_idx_inc(idx, qh->host_interval,
chan->speed); chan->speed);
if (!rc) if (!rc)
continue; continue;
...@@ -1039,7 +1042,7 @@ static void dwc2_complete_isoc_xfer_ddma(struct dwc2_hsotg *hsotg, ...@@ -1039,7 +1042,7 @@ static void dwc2_complete_isoc_xfer_ddma(struct dwc2_hsotg *hsotg,
/* rc == DWC2_CMPL_STOP */ /* rc == DWC2_CMPL_STOP */
if (qh->interval >= 32) if (qh->host_interval >= 32)
goto stop_scan; goto stop_scan;
qh->td_first = idx; qh->td_first = idx;
......
...@@ -148,9 +148,11 @@ static void dwc2_sof_intr(struct dwc2_hsotg *hsotg) ...@@ -148,9 +148,11 @@ static void dwc2_sof_intr(struct dwc2_hsotg *hsotg)
while (qh_entry != &hsotg->periodic_sched_inactive) { while (qh_entry != &hsotg->periodic_sched_inactive) {
qh = list_entry(qh_entry, struct dwc2_qh, qh_list_entry); qh = list_entry(qh_entry, struct dwc2_qh, qh_list_entry);
qh_entry = qh_entry->next; qh_entry = qh_entry->next;
if (dwc2_frame_num_le(qh->sched_frame, hsotg->frame_number)) { if (dwc2_frame_num_le(qh->next_active_frame,
dwc2_sch_vdbg(hsotg, "QH=%p ready fn=%04x, sch=%04x\n", hsotg->frame_number)) {
qh, hsotg->frame_number, qh->sched_frame); dwc2_sch_vdbg(hsotg, "QH=%p ready fn=%04x, nxt=%04x\n",
qh, hsotg->frame_number,
qh->next_active_frame);
/* /*
* Move QH to the ready list to be executed next * Move QH to the ready list to be executed next
...@@ -1368,7 +1370,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg, ...@@ -1368,7 +1370,7 @@ static void dwc2_hc_nyet_intr(struct dwc2_hsotg *hsotg,
int frnum = dwc2_hcd_get_frame_number(hsotg); int frnum = dwc2_hcd_get_frame_number(hsotg);
if (dwc2_full_frame_num(frnum) != if (dwc2_full_frame_num(frnum) !=
dwc2_full_frame_num(chan->qh->sched_frame)) { dwc2_full_frame_num(chan->qh->next_active_frame)) {
/* /*
* No longer in the same full speed frame. * No longer in the same full speed frame.
* Treat this as a transaction error. * Treat this as a transaction error.
......
...@@ -78,7 +78,7 @@ static void dwc2_do_unreserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -78,7 +78,7 @@ static void dwc2_do_unreserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
list_del_init(&qh->qh_list_entry); list_del_init(&qh->qh_list_entry);
/* Update claimed usecs per (micro)frame */ /* Update claimed usecs per (micro)frame */
hsotg->periodic_usecs -= qh->usecs; hsotg->periodic_usecs -= qh->host_us;
if (hsotg->core_params->uframe_sched > 0) { if (hsotg->core_params->uframe_sched > 0) {
int i; int i;
...@@ -193,40 +193,40 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -193,40 +193,40 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
int bytecount = int bytecount =
dwc2_hb_mult(qh->maxp) * dwc2_max_packet(qh->maxp); dwc2_hb_mult(qh->maxp) * dwc2_max_packet(qh->maxp);
qh->usecs = NS_TO_US(usb_calc_bus_time(qh->do_split ? qh->host_us = NS_TO_US(usb_calc_bus_time(qh->do_split ?
USB_SPEED_HIGH : dev_speed, qh->ep_is_in, USB_SPEED_HIGH : dev_speed, qh->ep_is_in,
qh->ep_type == USB_ENDPOINT_XFER_ISOC, qh->ep_type == USB_ENDPOINT_XFER_ISOC,
bytecount)); bytecount));
/* Ensure frame_number corresponds to the reality */ /* Ensure frame_number corresponds to the reality */
hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg);
/* Start in a slightly future (micro)frame */ /* Start in a slightly future (micro)frame */
qh->sched_frame = dwc2_frame_num_inc(hsotg->frame_number, qh->next_active_frame = dwc2_frame_num_inc(hsotg->frame_number,
SCHEDULE_SLOP); SCHEDULE_SLOP);
qh->interval = urb->interval; qh->host_interval = urb->interval;
dwc2_sch_dbg(hsotg, "QH=%p init sch=%04x, fn=%04x, int=%#x\n", dwc2_sch_dbg(hsotg, "QH=%p init nxt=%04x, fn=%04x, int=%#x\n",
qh, qh->sched_frame, hsotg->frame_number, qh, qh->next_active_frame, hsotg->frame_number,
qh->interval); qh->host_interval);
#if 0 #if 0
/* Increase interrupt polling rate for debugging */ /* Increase interrupt polling rate for debugging */
if (qh->ep_type == USB_ENDPOINT_XFER_INT) if (qh->ep_type == USB_ENDPOINT_XFER_INT)
qh->interval = 8; qh->host_interval = 8;
#endif #endif
hprt = dwc2_readl(hsotg->regs + HPRT0); hprt = dwc2_readl(hsotg->regs + HPRT0);
prtspd = (hprt & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT; prtspd = (hprt & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT;
if (prtspd == HPRT0_SPD_HIGH_SPEED && if (prtspd == HPRT0_SPD_HIGH_SPEED &&
(dev_speed == USB_SPEED_LOW || (dev_speed == USB_SPEED_LOW ||
dev_speed == USB_SPEED_FULL)) { dev_speed == USB_SPEED_FULL)) {
qh->interval *= 8; qh->host_interval *= 8;
qh->sched_frame |= 0x7; qh->next_active_frame |= 0x7;
qh->start_split_frame = qh->sched_frame; qh->start_split_frame = qh->next_active_frame;
dwc2_sch_dbg(hsotg, dwc2_sch_dbg(hsotg,
"QH=%p init*8 sch=%04x, fn=%04x, int=%#x\n", "QH=%p init*8 nxt=%04x, fn=%04x, int=%#x\n",
qh, qh->sched_frame, hsotg->frame_number, qh, qh->next_active_frame,
qh->interval); hsotg->frame_number, qh->host_interval);
} }
dev_dbg(hsotg->dev, "interval=%d\n", qh->interval); dev_dbg(hsotg->dev, "interval=%d\n", qh->host_interval);
} }
dev_vdbg(hsotg->dev, "DWC OTG HCD QH Initialized\n"); dev_vdbg(hsotg->dev, "DWC OTG HCD QH Initialized\n");
...@@ -277,9 +277,9 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -277,9 +277,9 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
if (qh->ep_type == USB_ENDPOINT_XFER_INT) { if (qh->ep_type == USB_ENDPOINT_XFER_INT) {
dev_vdbg(hsotg->dev, "DWC OTG HCD QH - usecs = %d\n", dev_vdbg(hsotg->dev, "DWC OTG HCD QH - usecs = %d\n",
qh->usecs); qh->host_us);
dev_vdbg(hsotg->dev, "DWC OTG HCD QH - interval = %d\n", dev_vdbg(hsotg->dev, "DWC OTG HCD QH - interval = %d\n",
qh->interval); qh->host_interval);
} }
} }
...@@ -404,19 +404,19 @@ static int dwc2_check_periodic_bandwidth(struct dwc2_hsotg *hsotg, ...@@ -404,19 +404,19 @@ static int dwc2_check_periodic_bandwidth(struct dwc2_hsotg *hsotg,
* High speed mode * High speed mode
* Max periodic usecs is 80% x 125 usec = 100 usec * Max periodic usecs is 80% x 125 usec = 100 usec
*/ */
max_claimed_usecs = 100 - qh->usecs; max_claimed_usecs = 100 - qh->host_us;
} else { } else {
/* /*
* Full speed mode * Full speed mode
* Max periodic usecs is 90% x 1000 usec = 900 usec * Max periodic usecs is 90% x 1000 usec = 900 usec
*/ */
max_claimed_usecs = 900 - qh->usecs; max_claimed_usecs = 900 - qh->host_us;
} }
if (hsotg->periodic_usecs > max_claimed_usecs) { if (hsotg->periodic_usecs > max_claimed_usecs) {
dev_err(hsotg->dev, dev_err(hsotg->dev,
"%s: already claimed usecs %d, required usecs %d\n", "%s: already claimed usecs %d, required usecs %d\n",
__func__, hsotg->periodic_usecs, qh->usecs); __func__, hsotg->periodic_usecs, qh->host_us);
status = -ENOSPC; status = -ENOSPC;
} }
...@@ -443,7 +443,7 @@ void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg) ...@@ -443,7 +443,7 @@ void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg)
static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{ {
unsigned short utime = qh->usecs; unsigned short utime = qh->host_us;
int i; int i;
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
...@@ -462,7 +462,7 @@ static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -462,7 +462,7 @@ static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
*/ */
static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
{ {
unsigned short utime = qh->usecs; unsigned short utime = qh->host_us;
unsigned short xtime; unsigned short xtime;
int t_left; int t_left;
int i; int i;
...@@ -608,11 +608,11 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -608,11 +608,11 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
/* Set the new frame up */ /* Set the new frame up */
if (frame >= 0) { if (frame >= 0) {
qh->sched_frame &= ~0x7; qh->next_active_frame &= ~0x7;
qh->sched_frame |= (frame & 7); qh->next_active_frame |= (frame & 7);
dwc2_sch_dbg(hsotg, dwc2_sch_dbg(hsotg,
"QH=%p sched_p sch=%04x, uf=%d\n", "QH=%p sched_p nxt=%04x, uf=%d\n",
qh, qh->sched_frame, frame); qh, qh->next_active_frame, frame);
} }
if (status > 0) if (status > 0)
...@@ -641,7 +641,7 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -641,7 +641,7 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
hsotg->periodic_channels++; hsotg->periodic_channels++;
/* Update claimed usecs per (micro)frame */ /* Update claimed usecs per (micro)frame */
hsotg->periodic_usecs += qh->usecs; hsotg->periodic_usecs += qh->host_us;
} }
qh->unreserve_pending = 0; qh->unreserve_pending = 0;
...@@ -716,7 +716,7 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -716,7 +716,7 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
/* QH already in a schedule */ /* QH already in a schedule */
return 0; return 0;
if (!dwc2_frame_num_le(qh->sched_frame, hsotg->frame_number) && if (!dwc2_frame_num_le(qh->next_active_frame, hsotg->frame_number) &&
!hsotg->frame_number) { !hsotg->frame_number) {
u16 new_frame; u16 new_frame;
...@@ -725,9 +725,9 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) ...@@ -725,9 +725,9 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh)
new_frame = dwc2_frame_num_inc(hsotg->frame_number, new_frame = dwc2_frame_num_inc(hsotg->frame_number,
SCHEDULE_SLOP); SCHEDULE_SLOP);
dwc2_sch_vdbg(hsotg, "QH=%p reset sch=%04x=>%04x\n", dwc2_sch_vdbg(hsotg, "QH=%p reset nxt=%04x=>%04x\n",
qh, qh->sched_frame, new_frame); qh, qh->next_active_frame, new_frame);
qh->sched_frame = new_frame; qh->next_active_frame = new_frame;
} }
/* Add the new QH to the appropriate schedule */ /* Add the new QH to the appropriate schedule */
...@@ -793,10 +793,10 @@ static void dwc2_sched_periodic_split(struct dwc2_hsotg *hsotg, ...@@ -793,10 +793,10 @@ static void dwc2_sched_periodic_split(struct dwc2_hsotg *hsotg,
int sched_next_periodic_split) int sched_next_periodic_split)
{ {
u16 incr; u16 incr;
u16 old_frame = qh->sched_frame; u16 old_frame = qh->next_active_frame;
if (sched_next_periodic_split) { if (sched_next_periodic_split) {
qh->sched_frame = frame_number; qh->next_active_frame = frame_number;
incr = dwc2_frame_num_inc(qh->start_split_frame, 1); incr = dwc2_frame_num_inc(qh->start_split_frame, 1);
if (dwc2_frame_num_le(frame_number, incr)) { if (dwc2_frame_num_le(frame_number, incr)) {
/* /*
...@@ -807,23 +807,24 @@ static void dwc2_sched_periodic_split(struct dwc2_hsotg *hsotg, ...@@ -807,23 +807,24 @@ static void dwc2_sched_periodic_split(struct dwc2_hsotg *hsotg,
*/ */
if (qh->ep_type != USB_ENDPOINT_XFER_ISOC || if (qh->ep_type != USB_ENDPOINT_XFER_ISOC ||
qh->ep_is_in != 0) { qh->ep_is_in != 0) {
qh->sched_frame = qh->next_active_frame = dwc2_frame_num_inc(
dwc2_frame_num_inc(qh->sched_frame, 1); qh->next_active_frame, 1);
} }
} }
} else { } else {
qh->sched_frame = dwc2_frame_num_inc(qh->start_split_frame, qh->next_active_frame =
qh->interval); dwc2_frame_num_inc(qh->start_split_frame,
if (dwc2_frame_num_le(qh->sched_frame, frame_number)) qh->host_interval);
qh->sched_frame = frame_number; if (dwc2_frame_num_le(qh->next_active_frame, frame_number))
qh->sched_frame |= 0x7; qh->next_active_frame = frame_number;
qh->start_split_frame = qh->sched_frame; qh->next_active_frame |= 0x7;
qh->start_split_frame = qh->next_active_frame;
} }
dwc2_sch_vdbg(hsotg, "QH=%p next(%d) fn=%04x, sch=%04x=>%04x (%+d)\n", dwc2_sch_vdbg(hsotg, "QH=%p next(%d) fn=%04x, nxt=%04x=>%04x (%+d)\n",
qh, sched_next_periodic_split, frame_number, old_frame, qh, sched_next_periodic_split, frame_number, old_frame,
qh->sched_frame, qh->next_active_frame,
dwc2_frame_num_dec(qh->sched_frame, old_frame)); dwc2_frame_num_dec(qh->next_active_frame, old_frame));
} }
/* /*
...@@ -861,10 +862,10 @@ void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -861,10 +862,10 @@ void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
dwc2_sched_periodic_split(hsotg, qh, frame_number, dwc2_sched_periodic_split(hsotg, qh, frame_number,
sched_next_periodic_split); sched_next_periodic_split);
} else { } else {
qh->sched_frame = dwc2_frame_num_inc(qh->sched_frame, qh->next_active_frame = dwc2_frame_num_inc(
qh->interval); qh->next_active_frame, qh->host_interval);
if (dwc2_frame_num_le(qh->sched_frame, frame_number)) if (dwc2_frame_num_le(qh->next_active_frame, frame_number))
qh->sched_frame = frame_number; qh->next_active_frame = frame_number;
} }
if (list_empty(&qh->qtd_list)) { if (list_empty(&qh->qtd_list)) {
...@@ -876,9 +877,9 @@ void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, ...@@ -876,9 +877,9 @@ void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh,
* appropriate queue * appropriate queue
*/ */
if ((hsotg->core_params->uframe_sched > 0 && if ((hsotg->core_params->uframe_sched > 0 &&
dwc2_frame_num_le(qh->sched_frame, frame_number)) || dwc2_frame_num_le(qh->next_active_frame, frame_number)) ||
(hsotg->core_params->uframe_sched <= 0 && (hsotg->core_params->uframe_sched <= 0 &&
qh->sched_frame == frame_number)) qh->next_active_frame == frame_number))
list_move_tail(&qh->qh_list_entry, list_move_tail(&qh->qh_list_entry,
&hsotg->periodic_sched_ready); &hsotg->periodic_sched_ready);
else else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment