diff options
author | Douglas Anderson <dianders@chromium.org> | 2016-01-28 21:20:04 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@kernel.org> | 2016-03-04 08:14:43 -0500 |
commit | ced9eee1229db3bbe683ae17e0a91a8642382a39 (patch) | |
tree | 5ab28900b5acadce93c596aabf94966e4e134f10 | |
parent | 4e50e0110c5cdc6d361b813692857e09ec918c9d (diff) |
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: John Youn <johnyoun@synopsys.com>
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
-rw-r--r-- | drivers/usb/dwc2/hcd.h | 20 | ||||
-rw-r--r-- | drivers/usb/dwc2/hcd_ddma.c | 37 | ||||
-rw-r--r-- | drivers/usb/dwc2/hcd_intr.c | 10 | ||||
-rw-r--r-- | drivers/usb/dwc2/hcd_queue.c | 107 |
4 files changed, 92 insertions, 82 deletions
diff --git a/drivers/usb/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h index 79473ea35bd6..10c35585a2bd 100644 --- a/drivers/usb/dwc2/hcd.h +++ b/drivers/usb/dwc2/hcd.h | |||
@@ -236,10 +236,14 @@ enum dwc2_transaction_type { | |||
236 | * @do_split: Full/low speed endpoint on high-speed hub requires split | 236 | * @do_split: Full/low speed endpoint on high-speed hub requires split |
237 | * @td_first: Index of first activated isochronous transfer descriptor | 237 | * @td_first: Index of first activated isochronous transfer descriptor |
238 | * @td_last: Index of last activated isochronous transfer descriptor | 238 | * @td_last: Index of last activated isochronous transfer descriptor |
239 | * @usecs: Bandwidth in microseconds per (micro)frame | 239 | * @host_us: Bandwidth in microseconds per transfer as seen by host |
240 | * @interval: Interval between transfers in (micro)frames | 240 | * @host_interval: Interval between transfers as seen by the host. If |
241 | * @sched_frame: (Micro)frame to initialize a periodic transfer. | 241 | * the host is high speed and the device is low speed this |
242 | * The transfer executes in the following (micro)frame. | 242 | * will be 8 times device interval. |
243 | * @next_active_frame: (Micro)frame before we next need to put something on | ||
244 | * the bus. We'll move the qh to active here. If the | ||
245 | * host is in high speed mode this will be a uframe. If | ||
246 | * the host is in low speed mode this will be a full frame. | ||
243 | * @frame_usecs: Internal variable used by the microframe scheduler | 247 | * @frame_usecs: Internal variable used by the microframe scheduler |
244 | * @start_split_frame: (Micro)frame at which last start split was initialized | 248 | * @start_split_frame: (Micro)frame at which last start split was initialized |
245 | * @ntd: Actual number of transfer descriptors in a list | 249 | * @ntd: Actual number of transfer descriptors in a list |
@@ -272,9 +276,9 @@ struct dwc2_qh { | |||
272 | u8 do_split; | 276 | u8 do_split; |
273 | u8 td_first; | 277 | u8 td_first; |
274 | u8 td_last; | 278 | u8 td_last; |
275 | u16 usecs; | 279 | u16 host_us; |
276 | u16 interval; | 280 | u16 host_interval; |
277 | u16 sched_frame; | 281 | u16 next_active_frame; |
278 | u16 frame_usecs[8]; | 282 | u16 frame_usecs[8]; |
279 | u16 start_split_frame; | 283 | u16 start_split_frame; |
280 | u16 ntd; | 284 | u16 ntd; |
@@ -651,7 +655,7 @@ static inline u16 dwc2_hcd_get_ep_bandwidth(struct dwc2_hsotg *hsotg, | |||
651 | return 0; | 655 | return 0; |
652 | } | 656 | } |
653 | 657 | ||
654 | return qh->usecs; | 658 | return qh->host_us; |
655 | } | 659 | } |
656 | 660 | ||
657 | extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg, | 661 | extern void dwc2_hcd_save_data_toggle(struct dwc2_hsotg *hsotg, |
diff --git a/drivers/usb/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c index faca7aaec1a5..2ff517a0210f 100644 --- a/drivers/usb/dwc2/hcd_ddma.c +++ b/drivers/usb/dwc2/hcd_ddma.c | |||
@@ -81,7 +81,7 @@ static u16 dwc2_max_desc_num(struct dwc2_qh *qh) | |||
81 | static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) | 81 | static u16 dwc2_frame_incr_val(struct dwc2_qh *qh) |
82 | { | 82 | { |
83 | return qh->dev_speed == USB_SPEED_HIGH ? | 83 | return qh->dev_speed == USB_SPEED_HIGH ? |
84 | (qh->interval + 8 - 1) / 8 : qh->interval; | 84 | (qh->host_interval + 8 - 1) / 8 : qh->host_interval; |
85 | } | 85 | } |
86 | 86 | ||
87 | static int dwc2_desc_list_alloc(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | 87 | 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 | chan = qh->channel; | 252 | chan = qh->channel; |
253 | inc = dwc2_frame_incr_val(qh); | 253 | inc = dwc2_frame_incr_val(qh); |
254 | if (qh->ep_type == USB_ENDPOINT_XFER_ISOC) | 254 | if (qh->ep_type == USB_ENDPOINT_XFER_ISOC) |
255 | i = dwc2_frame_list_idx(qh->sched_frame); | 255 | i = dwc2_frame_list_idx(qh->next_active_frame); |
256 | else | 256 | else |
257 | i = 0; | 257 | i = 0; |
258 | 258 | ||
@@ -278,13 +278,13 @@ static void dwc2_update_frame_list(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
278 | return; | 278 | return; |
279 | 279 | ||
280 | chan->schinfo = 0; | 280 | chan->schinfo = 0; |
281 | if (chan->speed == USB_SPEED_HIGH && qh->interval) { | 281 | if (chan->speed == USB_SPEED_HIGH && qh->host_interval) { |
282 | j = 1; | 282 | j = 1; |
283 | /* TODO - check this */ | 283 | /* TODO - check this */ |
284 | inc = (8 + qh->interval - 1) / qh->interval; | 284 | inc = (8 + qh->host_interval - 1) / qh->host_interval; |
285 | for (i = 0; i < inc; i++) { | 285 | for (i = 0; i < inc; i++) { |
286 | chan->schinfo |= j; | 286 | chan->schinfo |= j; |
287 | j = j << qh->interval; | 287 | j = j << qh->host_interval; |
288 | } | 288 | } |
289 | } else { | 289 | } else { |
290 | chan->schinfo = 0xff; | 290 | chan->schinfo = 0xff; |
@@ -431,7 +431,10 @@ static u16 dwc2_calc_starting_frame(struct dwc2_hsotg *hsotg, | |||
431 | 431 | ||
432 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); | 432 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); |
433 | 433 | ||
434 | /* sched_frame is always frame number (not uFrame) both in FS and HS! */ | 434 | /* |
435 | * next_active_frame is always frame number (not uFrame) both in FS | ||
436 | * and HS! | ||
437 | */ | ||
435 | 438 | ||
436 | /* | 439 | /* |
437 | * skip_frames is used to limit activated descriptors number | 440 | * 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 | */ | 517 | */ |
515 | fr_idx_tmp = dwc2_frame_list_idx(frame); | 518 | fr_idx_tmp = dwc2_frame_list_idx(frame); |
516 | fr_idx = (FRLISTEN_64_SIZE + | 519 | fr_idx = (FRLISTEN_64_SIZE + |
517 | dwc2_frame_list_idx(qh->sched_frame) - fr_idx_tmp) | 520 | dwc2_frame_list_idx(qh->next_active_frame) - |
518 | % dwc2_frame_incr_val(qh); | 521 | fr_idx_tmp) % dwc2_frame_incr_val(qh); |
519 | fr_idx = (fr_idx + fr_idx_tmp) % FRLISTEN_64_SIZE; | 522 | fr_idx = (fr_idx + fr_idx_tmp) % FRLISTEN_64_SIZE; |
520 | } else { | 523 | } else { |
521 | qh->sched_frame = dwc2_calc_starting_frame(hsotg, qh, | 524 | qh->next_active_frame = dwc2_calc_starting_frame(hsotg, qh, |
522 | &skip_frames); | 525 | &skip_frames); |
523 | fr_idx = dwc2_frame_list_idx(qh->sched_frame); | 526 | fr_idx = dwc2_frame_list_idx(qh->next_active_frame); |
524 | } | 527 | } |
525 | 528 | ||
526 | qh->td_first = qh->td_last = dwc2_frame_to_desc_idx(qh, fr_idx); | 529 | 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 | u16 next_idx; | 586 | u16 next_idx; |
584 | 587 | ||
585 | idx = qh->td_last; | 588 | idx = qh->td_last; |
586 | inc = qh->interval; | 589 | inc = qh->host_interval; |
587 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); | 590 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); |
588 | cur_idx = dwc2_frame_list_idx(hsotg->frame_number); | 591 | cur_idx = dwc2_frame_list_idx(hsotg->frame_number); |
589 | next_idx = dwc2_desclist_idx_inc(qh->td_last, inc, qh->dev_speed); | 592 | 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 | } | 608 | } |
606 | } | 609 | } |
607 | 610 | ||
608 | if (qh->interval) { | 611 | if (qh->host_interval) { |
609 | ntd_max = (dwc2_max_desc_num(qh) + qh->interval - 1) / | 612 | ntd_max = (dwc2_max_desc_num(qh) + qh->host_interval - 1) / |
610 | qh->interval; | 613 | qh->host_interval; |
611 | if (skip_frames && !qh->channel) | 614 | if (skip_frames && !qh->channel) |
612 | ntd_max -= skip_frames / qh->interval; | 615 | ntd_max -= skip_frames / qh->host_interval; |
613 | } | 616 | } |
614 | 617 | ||
615 | max_xfer_size = qh->dev_speed == USB_SPEED_HIGH ? | 618 | 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 | idx); | 1032 | idx); |
1030 | if (rc < 0) | 1033 | if (rc < 0) |
1031 | return; | 1034 | return; |
1032 | idx = dwc2_desclist_idx_inc(idx, qh->interval, | 1035 | idx = dwc2_desclist_idx_inc(idx, qh->host_interval, |
1033 | chan->speed); | 1036 | chan->speed); |
1034 | if (!rc) | 1037 | if (!rc) |
1035 | continue; | 1038 | continue; |
@@ -1039,7 +1042,7 @@ static void dwc2_complete_isoc_xfer_ddma(struct dwc2_hsotg *hsotg, | |||
1039 | 1042 | ||
1040 | /* rc == DWC2_CMPL_STOP */ | 1043 | /* rc == DWC2_CMPL_STOP */ |
1041 | 1044 | ||
1042 | if (qh->interval >= 32) | 1045 | if (qh->host_interval >= 32) |
1043 | goto stop_scan; | 1046 | goto stop_scan; |
1044 | 1047 | ||
1045 | qh->td_first = idx; | 1048 | qh->td_first = idx; |
diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c index 3d686540d250..97aa6ca3a12e 100644 --- a/drivers/usb/dwc2/hcd_intr.c +++ b/drivers/usb/dwc2/hcd_intr.c | |||
@@ -148,9 +148,11 @@ static void dwc2_sof_intr(struct dwc2_hsotg *hsotg) | |||
148 | while (qh_entry != &hsotg->periodic_sched_inactive) { | 148 | while (qh_entry != &hsotg->periodic_sched_inactive) { |
149 | qh = list_entry(qh_entry, struct dwc2_qh, qh_list_entry); | 149 | qh = list_entry(qh_entry, struct dwc2_qh, qh_list_entry); |
150 | qh_entry = qh_entry->next; | 150 | qh_entry = qh_entry->next; |
151 | if (dwc2_frame_num_le(qh->sched_frame, hsotg->frame_number)) { | 151 | if (dwc2_frame_num_le(qh->next_active_frame, |
152 | dwc2_sch_vdbg(hsotg, "QH=%p ready fn=%04x, sch=%04x\n", | 152 | hsotg->frame_number)) { |
153 | qh, hsotg->frame_number, qh->sched_frame); | 153 | dwc2_sch_vdbg(hsotg, "QH=%p ready fn=%04x, nxt=%04x\n", |
154 | qh, hsotg->frame_number, | ||
155 | qh->next_active_frame); | ||
154 | 156 | ||
155 | /* | 157 | /* |
156 | * Move QH to the ready list to be executed next | 158 | * 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 | int frnum = dwc2_hcd_get_frame_number(hsotg); | 1370 | int frnum = dwc2_hcd_get_frame_number(hsotg); |
1369 | 1371 | ||
1370 | if (dwc2_full_frame_num(frnum) != | 1372 | if (dwc2_full_frame_num(frnum) != |
1371 | dwc2_full_frame_num(chan->qh->sched_frame)) { | 1373 | dwc2_full_frame_num(chan->qh->next_active_frame)) { |
1372 | /* | 1374 | /* |
1373 | * No longer in the same full speed frame. | 1375 | * No longer in the same full speed frame. |
1374 | * Treat this as a transaction error. | 1376 | * Treat this as a transaction error. |
diff --git a/drivers/usb/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c index b9e4867e1afd..39f4de6279f8 100644 --- a/drivers/usb/dwc2/hcd_queue.c +++ b/drivers/usb/dwc2/hcd_queue.c | |||
@@ -78,7 +78,7 @@ static void dwc2_do_unreserve(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | |||
78 | list_del_init(&qh->qh_list_entry); | 78 | list_del_init(&qh->qh_list_entry); |
79 | 79 | ||
80 | /* Update claimed usecs per (micro)frame */ | 80 | /* Update claimed usecs per (micro)frame */ |
81 | hsotg->periodic_usecs -= qh->usecs; | 81 | hsotg->periodic_usecs -= qh->host_us; |
82 | 82 | ||
83 | if (hsotg->core_params->uframe_sched > 0) { | 83 | if (hsotg->core_params->uframe_sched > 0) { |
84 | int i; | 84 | int i; |
@@ -193,40 +193,40 @@ static void dwc2_qh_init(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
193 | int bytecount = | 193 | int bytecount = |
194 | dwc2_hb_mult(qh->maxp) * dwc2_max_packet(qh->maxp); | 194 | dwc2_hb_mult(qh->maxp) * dwc2_max_packet(qh->maxp); |
195 | 195 | ||
196 | qh->usecs = NS_TO_US(usb_calc_bus_time(qh->do_split ? | 196 | qh->host_us = NS_TO_US(usb_calc_bus_time(qh->do_split ? |
197 | USB_SPEED_HIGH : dev_speed, qh->ep_is_in, | 197 | USB_SPEED_HIGH : dev_speed, qh->ep_is_in, |
198 | qh->ep_type == USB_ENDPOINT_XFER_ISOC, | 198 | qh->ep_type == USB_ENDPOINT_XFER_ISOC, |
199 | bytecount)); | 199 | bytecount)); |
200 | 200 | ||
201 | /* Ensure frame_number corresponds to the reality */ | 201 | /* Ensure frame_number corresponds to the reality */ |
202 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); | 202 | hsotg->frame_number = dwc2_hcd_get_frame_number(hsotg); |
203 | /* Start in a slightly future (micro)frame */ | 203 | /* Start in a slightly future (micro)frame */ |
204 | qh->sched_frame = dwc2_frame_num_inc(hsotg->frame_number, | 204 | qh->next_active_frame = dwc2_frame_num_inc(hsotg->frame_number, |
205 | SCHEDULE_SLOP); | 205 | SCHEDULE_SLOP); |
206 | qh->interval = urb->interval; | 206 | qh->host_interval = urb->interval; |
207 | dwc2_sch_dbg(hsotg, "QH=%p init sch=%04x, fn=%04x, int=%#x\n", | 207 | dwc2_sch_dbg(hsotg, "QH=%p init nxt=%04x, fn=%04x, int=%#x\n", |
208 | qh, qh->sched_frame, hsotg->frame_number, | 208 | qh, qh->next_active_frame, hsotg->frame_number, |
209 | qh->interval); | 209 | qh->host_interval); |
210 | #if 0 | 210 | #if 0 |
211 | /* Increase interrupt polling rate for debugging */ | 211 | /* Increase interrupt polling rate for debugging */ |
212 | if (qh->ep_type == USB_ENDPOINT_XFER_INT) | 212 | if (qh->ep_type == USB_ENDPOINT_XFER_INT) |
213 | qh->interval = 8; | 213 | qh->host_interval = 8; |
214 | #endif | 214 | #endif |
215 | hprt = dwc2_readl(hsotg->regs + HPRT0); | 215 | hprt = dwc2_readl(hsotg->regs + HPRT0); |
216 | prtspd = (hprt & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT; | 216 | prtspd = (hprt & HPRT0_SPD_MASK) >> HPRT0_SPD_SHIFT; |
217 | if (prtspd == HPRT0_SPD_HIGH_SPEED && | 217 | if (prtspd == HPRT0_SPD_HIGH_SPEED && |
218 | (dev_speed == USB_SPEED_LOW || | 218 | (dev_speed == USB_SPEED_LOW || |
219 | dev_speed == USB_SPEED_FULL)) { | 219 | dev_speed == USB_SPEED_FULL)) { |
220 | qh->interval *= 8; | 220 | qh->host_interval *= 8; |
221 | qh->sched_frame |= 0x7; | 221 | qh->next_active_frame |= 0x7; |
222 | qh->start_split_frame = qh->sched_frame; | 222 | qh->start_split_frame = qh->next_active_frame; |
223 | dwc2_sch_dbg(hsotg, | 223 | dwc2_sch_dbg(hsotg, |
224 | "QH=%p init*8 sch=%04x, fn=%04x, int=%#x\n", | 224 | "QH=%p init*8 nxt=%04x, fn=%04x, int=%#x\n", |
225 | qh, qh->sched_frame, hsotg->frame_number, | 225 | qh, qh->next_active_frame, |
226 | qh->interval); | 226 | hsotg->frame_number, qh->host_interval); |
227 | 227 | ||
228 | } | 228 | } |
229 | dev_dbg(hsotg->dev, "interval=%d\n", qh->interval); | 229 | dev_dbg(hsotg->dev, "interval=%d\n", qh->host_interval); |
230 | } | 230 | } |
231 | 231 | ||
232 | dev_vdbg(hsotg->dev, "DWC OTG HCD QH Initialized\n"); | 232 | 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 | 277 | ||
278 | if (qh->ep_type == USB_ENDPOINT_XFER_INT) { | 278 | if (qh->ep_type == USB_ENDPOINT_XFER_INT) { |
279 | dev_vdbg(hsotg->dev, "DWC OTG HCD QH - usecs = %d\n", | 279 | dev_vdbg(hsotg->dev, "DWC OTG HCD QH - usecs = %d\n", |
280 | qh->usecs); | 280 | qh->host_us); |
281 | dev_vdbg(hsotg->dev, "DWC OTG HCD QH - interval = %d\n", | 281 | dev_vdbg(hsotg->dev, "DWC OTG HCD QH - interval = %d\n", |
282 | qh->interval); | 282 | qh->host_interval); |
283 | } | 283 | } |
284 | } | 284 | } |
285 | 285 | ||
@@ -404,19 +404,19 @@ static int dwc2_check_periodic_bandwidth(struct dwc2_hsotg *hsotg, | |||
404 | * High speed mode | 404 | * High speed mode |
405 | * Max periodic usecs is 80% x 125 usec = 100 usec | 405 | * Max periodic usecs is 80% x 125 usec = 100 usec |
406 | */ | 406 | */ |
407 | max_claimed_usecs = 100 - qh->usecs; | 407 | max_claimed_usecs = 100 - qh->host_us; |
408 | } else { | 408 | } else { |
409 | /* | 409 | /* |
410 | * Full speed mode | 410 | * Full speed mode |
411 | * Max periodic usecs is 90% x 1000 usec = 900 usec | 411 | * Max periodic usecs is 90% x 1000 usec = 900 usec |
412 | */ | 412 | */ |
413 | max_claimed_usecs = 900 - qh->usecs; | 413 | max_claimed_usecs = 900 - qh->host_us; |
414 | } | 414 | } |
415 | 415 | ||
416 | if (hsotg->periodic_usecs > max_claimed_usecs) { | 416 | if (hsotg->periodic_usecs > max_claimed_usecs) { |
417 | dev_err(hsotg->dev, | 417 | dev_err(hsotg->dev, |
418 | "%s: already claimed usecs %d, required usecs %d\n", | 418 | "%s: already claimed usecs %d, required usecs %d\n", |
419 | __func__, hsotg->periodic_usecs, qh->usecs); | 419 | __func__, hsotg->periodic_usecs, qh->host_us); |
420 | status = -ENOSPC; | 420 | status = -ENOSPC; |
421 | } | 421 | } |
422 | 422 | ||
@@ -443,7 +443,7 @@ void dwc2_hcd_init_usecs(struct dwc2_hsotg *hsotg) | |||
443 | 443 | ||
444 | static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | 444 | static int dwc2_find_single_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) |
445 | { | 445 | { |
446 | unsigned short utime = qh->usecs; | 446 | unsigned short utime = qh->host_us; |
447 | int i; | 447 | int i; |
448 | 448 | ||
449 | for (i = 0; i < 8; i++) { | 449 | 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 | */ | 462 | */ |
463 | static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | 463 | static int dwc2_find_multi_uframe(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) |
464 | { | 464 | { |
465 | unsigned short utime = qh->usecs; | 465 | unsigned short utime = qh->host_us; |
466 | unsigned short xtime; | 466 | unsigned short xtime; |
467 | int t_left; | 467 | int t_left; |
468 | int i; | 468 | int i; |
@@ -608,11 +608,11 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | |||
608 | 608 | ||
609 | /* Set the new frame up */ | 609 | /* Set the new frame up */ |
610 | if (frame >= 0) { | 610 | if (frame >= 0) { |
611 | qh->sched_frame &= ~0x7; | 611 | qh->next_active_frame &= ~0x7; |
612 | qh->sched_frame |= (frame & 7); | 612 | qh->next_active_frame |= (frame & 7); |
613 | dwc2_sch_dbg(hsotg, | 613 | dwc2_sch_dbg(hsotg, |
614 | "QH=%p sched_p sch=%04x, uf=%d\n", | 614 | "QH=%p sched_p nxt=%04x, uf=%d\n", |
615 | qh, qh->sched_frame, frame); | 615 | qh, qh->next_active_frame, frame); |
616 | } | 616 | } |
617 | 617 | ||
618 | if (status > 0) | 618 | if (status > 0) |
@@ -641,7 +641,7 @@ static int dwc2_schedule_periodic(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | |||
641 | hsotg->periodic_channels++; | 641 | hsotg->periodic_channels++; |
642 | 642 | ||
643 | /* Update claimed usecs per (micro)frame */ | 643 | /* Update claimed usecs per (micro)frame */ |
644 | hsotg->periodic_usecs += qh->usecs; | 644 | hsotg->periodic_usecs += qh->host_us; |
645 | } | 645 | } |
646 | 646 | ||
647 | qh->unreserve_pending = 0; | 647 | qh->unreserve_pending = 0; |
@@ -716,7 +716,7 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | |||
716 | /* QH already in a schedule */ | 716 | /* QH already in a schedule */ |
717 | return 0; | 717 | return 0; |
718 | 718 | ||
719 | if (!dwc2_frame_num_le(qh->sched_frame, hsotg->frame_number) && | 719 | if (!dwc2_frame_num_le(qh->next_active_frame, hsotg->frame_number) && |
720 | !hsotg->frame_number) { | 720 | !hsotg->frame_number) { |
721 | u16 new_frame; | 721 | u16 new_frame; |
722 | 722 | ||
@@ -725,9 +725,9 @@ int dwc2_hcd_qh_add(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh) | |||
725 | new_frame = dwc2_frame_num_inc(hsotg->frame_number, | 725 | new_frame = dwc2_frame_num_inc(hsotg->frame_number, |
726 | SCHEDULE_SLOP); | 726 | SCHEDULE_SLOP); |
727 | 727 | ||
728 | dwc2_sch_vdbg(hsotg, "QH=%p reset sch=%04x=>%04x\n", | 728 | dwc2_sch_vdbg(hsotg, "QH=%p reset nxt=%04x=>%04x\n", |
729 | qh, qh->sched_frame, new_frame); | 729 | qh, qh->next_active_frame, new_frame); |
730 | qh->sched_frame = new_frame; | 730 | qh->next_active_frame = new_frame; |
731 | } | 731 | } |
732 | 732 | ||
733 | /* Add the new QH to the appropriate schedule */ | 733 | /* Add the new QH to the appropriate schedule */ |
@@ -793,10 +793,10 @@ static void dwc2_sched_periodic_split(struct dwc2_hsotg *hsotg, | |||
793 | int sched_next_periodic_split) | 793 | int sched_next_periodic_split) |
794 | { | 794 | { |
795 | u16 incr; | 795 | u16 incr; |
796 | u16 old_frame = qh->sched_frame; | 796 | u16 old_frame = qh->next_active_frame; |
797 | 797 | ||
798 | if (sched_next_periodic_split) { | 798 | if (sched_next_periodic_split) { |
799 | qh->sched_frame = frame_number; | 799 | qh->next_active_frame = frame_number; |
800 | incr = dwc2_frame_num_inc(qh->start_split_frame, 1); | 800 | incr = dwc2_frame_num_inc(qh->start_split_frame, 1); |
801 | if (dwc2_frame_num_le(frame_number, incr)) { | 801 | if (dwc2_frame_num_le(frame_number, incr)) { |
802 | /* | 802 | /* |
@@ -807,23 +807,24 @@ static void dwc2_sched_periodic_split(struct dwc2_hsotg *hsotg, | |||
807 | */ | 807 | */ |
808 | if (qh->ep_type != USB_ENDPOINT_XFER_ISOC || | 808 | if (qh->ep_type != USB_ENDPOINT_XFER_ISOC || |
809 | qh->ep_is_in != 0) { | 809 | qh->ep_is_in != 0) { |
810 | qh->sched_frame = | 810 | qh->next_active_frame = dwc2_frame_num_inc( |
811 | dwc2_frame_num_inc(qh->sched_frame, 1); | 811 | qh->next_active_frame, 1); |
812 | } | 812 | } |
813 | } | 813 | } |
814 | } else { | 814 | } else { |
815 | qh->sched_frame = dwc2_frame_num_inc(qh->start_split_frame, | 815 | qh->next_active_frame = |
816 | qh->interval); | 816 | dwc2_frame_num_inc(qh->start_split_frame, |
817 | if (dwc2_frame_num_le(qh->sched_frame, frame_number)) | 817 | qh->host_interval); |
818 | qh->sched_frame = frame_number; | 818 | if (dwc2_frame_num_le(qh->next_active_frame, frame_number)) |
819 | qh->sched_frame |= 0x7; | 819 | qh->next_active_frame = frame_number; |
820 | qh->start_split_frame = qh->sched_frame; | 820 | qh->next_active_frame |= 0x7; |
821 | qh->start_split_frame = qh->next_active_frame; | ||
821 | } | 822 | } |
822 | 823 | ||
823 | dwc2_sch_vdbg(hsotg, "QH=%p next(%d) fn=%04x, sch=%04x=>%04x (%+d)\n", | 824 | dwc2_sch_vdbg(hsotg, "QH=%p next(%d) fn=%04x, nxt=%04x=>%04x (%+d)\n", |
824 | qh, sched_next_periodic_split, frame_number, old_frame, | 825 | qh, sched_next_periodic_split, frame_number, old_frame, |
825 | qh->sched_frame, | 826 | qh->next_active_frame, |
826 | dwc2_frame_num_dec(qh->sched_frame, old_frame)); | 827 | dwc2_frame_num_dec(qh->next_active_frame, old_frame)); |
827 | } | 828 | } |
828 | 829 | ||
829 | /* | 830 | /* |
@@ -861,10 +862,10 @@ void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
861 | dwc2_sched_periodic_split(hsotg, qh, frame_number, | 862 | dwc2_sched_periodic_split(hsotg, qh, frame_number, |
862 | sched_next_periodic_split); | 863 | sched_next_periodic_split); |
863 | } else { | 864 | } else { |
864 | qh->sched_frame = dwc2_frame_num_inc(qh->sched_frame, | 865 | qh->next_active_frame = dwc2_frame_num_inc( |
865 | qh->interval); | 866 | qh->next_active_frame, qh->host_interval); |
866 | if (dwc2_frame_num_le(qh->sched_frame, frame_number)) | 867 | if (dwc2_frame_num_le(qh->next_active_frame, frame_number)) |
867 | qh->sched_frame = frame_number; | 868 | qh->next_active_frame = frame_number; |
868 | } | 869 | } |
869 | 870 | ||
870 | if (list_empty(&qh->qtd_list)) { | 871 | if (list_empty(&qh->qtd_list)) { |
@@ -876,9 +877,9 @@ void dwc2_hcd_qh_deactivate(struct dwc2_hsotg *hsotg, struct dwc2_qh *qh, | |||
876 | * appropriate queue | 877 | * appropriate queue |
877 | */ | 878 | */ |
878 | if ((hsotg->core_params->uframe_sched > 0 && | 879 | if ((hsotg->core_params->uframe_sched > 0 && |
879 | dwc2_frame_num_le(qh->sched_frame, frame_number)) || | 880 | dwc2_frame_num_le(qh->next_active_frame, frame_number)) || |
880 | (hsotg->core_params->uframe_sched <= 0 && | 881 | (hsotg->core_params->uframe_sched <= 0 && |
881 | qh->sched_frame == frame_number)) | 882 | qh->next_active_frame == frame_number)) |
882 | list_move_tail(&qh->qh_list_entry, | 883 | list_move_tail(&qh->qh_list_entry, |
883 | &hsotg->periodic_sched_ready); | 884 | &hsotg->periodic_sched_ready); |
884 | else | 885 | else |