Lines Matching refs:td

628 static void pipe_setting(struct r8a66597 *r8a66597, struct r8a66597_td *td)  in pipe_setting()  argument
631 struct urb *urb = td->urb; in pipe_setting()
633 if (td->pipenum > 0) { in pipe_setting()
634 info = &td->pipe->info; in pipe_setting()
641 r8a66597_pipe_toggle(r8a66597, td->pipe, 0); in pipe_setting()
642 pipe_toggle_set(r8a66597, td->pipe, urb, 0); in pipe_setting()
643 clear_all_buffer(r8a66597, td->pipe); in pipe_setting()
647 pipe_toggle_restore(r8a66597, td->pipe, urb); in pipe_setting()
835 struct r8a66597_td *td, *next; in force_dequeue() local
842 list_for_each_entry_safe(td, next, list, queue) { in force_dequeue()
843 if (td->address != address) in force_dequeue()
846 urb = td->urb; in force_dequeue()
847 list_del(&td->queue); in force_dequeue()
848 kfree(td); in force_dequeue()
1065 struct r8a66597_td *td) in prepare_setup_packet() argument
1068 __le16 *p = (__le16 *)td->urb->setup_packet; in prepare_setup_packet()
1071 r8a66597_write(r8a66597, make_devsel(td->address) | td->maxpacket, in prepare_setup_packet()
1084 struct r8a66597_td *td) in prepare_packet_read() argument
1086 struct urb *urb = td->urb; in prepare_packet_read()
1093 r8a66597_pipe_toggle(r8a66597, td->pipe, 1); in prepare_packet_read()
1096 pipe_irq_disable(r8a66597, td->pipenum); in prepare_packet_read()
1097 pipe_start(r8a66597, td->pipe); in prepare_packet_read()
1098 pipe_irq_enable(r8a66597, urb, td->pipenum); in prepare_packet_read()
1101 pipe_irq_disable(r8a66597, td->pipenum); in prepare_packet_read()
1102 pipe_setting(r8a66597, td); in prepare_packet_read()
1103 pipe_stop(r8a66597, td->pipe); in prepare_packet_read()
1104 r8a66597_write(r8a66597, ~(1 << td->pipenum), BRDYSTS); in prepare_packet_read()
1106 if (td->pipe->pipetre) { in prepare_packet_read()
1108 td->pipe->pipetre); in prepare_packet_read()
1112 td->maxpacket), in prepare_packet_read()
1113 td->pipe->pipetrn); in prepare_packet_read()
1115 td->pipe->pipetre); in prepare_packet_read()
1118 pipe_start(r8a66597, td->pipe); in prepare_packet_read()
1119 pipe_irq_enable(r8a66597, urb, td->pipenum); in prepare_packet_read()
1126 struct r8a66597_td *td) in prepare_packet_write() argument
1129 struct urb *urb = td->urb; in prepare_packet_write()
1132 pipe_stop(r8a66597, td->pipe); in prepare_packet_write()
1137 r8a66597_pipe_toggle(r8a66597, td->pipe, 1); in prepare_packet_write()
1142 pipe_setting(r8a66597, td); in prepare_packet_write()
1143 if (td->pipe->pipetre) in prepare_packet_write()
1144 r8a66597_bclr(r8a66597, TRENB, td->pipe->pipetre); in prepare_packet_write()
1146 r8a66597_write(r8a66597, ~(1 << td->pipenum), BRDYSTS); in prepare_packet_write()
1148 fifo_change_from_pipe(r8a66597, td->pipe); in prepare_packet_write()
1149 tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); in prepare_packet_write()
1151 pipe_irq_enable(r8a66597, urb, td->pipenum); in prepare_packet_write()
1153 packet_write(r8a66597, td->pipenum); in prepare_packet_write()
1154 pipe_start(r8a66597, td->pipe); in prepare_packet_write()
1159 struct r8a66597_td *td) in prepare_status_packet() argument
1161 struct urb *urb = td->urb; in prepare_status_packet()
1163 r8a66597_pipe_toggle(r8a66597, td->pipe, 1); in prepare_status_packet()
1164 pipe_stop(r8a66597, td->pipe); in prepare_status_packet()
1181 pipe_start(r8a66597, td->pipe); in prepare_status_packet()
1194 static int start_transfer(struct r8a66597 *r8a66597, struct r8a66597_td *td) in start_transfer() argument
1196 BUG_ON(!td); in start_transfer()
1198 switch (td->type) { in start_transfer()
1200 if (is_set_address(td->urb->setup_packet)) { in start_transfer()
1201 td->set_address = 1; in start_transfer()
1202 td->urb->setup_packet[2] = alloc_usb_address(r8a66597, in start_transfer()
1203 td->urb); in start_transfer()
1204 if (td->urb->setup_packet[2] == 0) in start_transfer()
1207 prepare_setup_packet(r8a66597, td); in start_transfer()
1210 prepare_packet_read(r8a66597, td); in start_transfer()
1213 prepare_packet_write(r8a66597, td); in start_transfer()
1216 prepare_status_packet(r8a66597, td); in start_transfer()
1226 static int check_transfer_finish(struct r8a66597_td *td, struct urb *urb) in check_transfer_finish() argument
1229 if (urb->number_of_packets == td->iso_cnt) in check_transfer_finish()
1235 (td->short_packet) || (td->zero_packet)) in check_transfer_finish()
1242 static void set_td_timer(struct r8a66597 *r8a66597, struct r8a66597_td *td) in set_td_timer() argument
1246 BUG_ON(!td); in set_td_timer()
1248 if (!list_empty(&r8a66597->pipe_queue[td->pipenum]) && in set_td_timer()
1249 !usb_pipecontrol(td->urb->pipe) && usb_pipein(td->urb->pipe)) { in set_td_timer()
1250 r8a66597->timeout_map |= 1 << td->pipenum; in set_td_timer()
1251 switch (usb_pipetype(td->urb->pipe)) { in set_td_timer()
1261 mod_timer(&r8a66597->timers[td->pipenum].td, in set_td_timer()
1267 static void finish_request(struct r8a66597 *r8a66597, struct r8a66597_td *td, in finish_request() argument
1276 if (likely(td)) { in finish_request()
1277 if (td->set_address && (status != 0 || urb->unlinked)) in finish_request()
1280 pipe_toggle_save(r8a66597, td->pipe, urb); in finish_request()
1281 list_del(&td->queue); in finish_request()
1282 kfree(td); in finish_request()
1296 td = r8a66597_get_td(r8a66597, pipenum); in finish_request()
1297 if (unlikely(!td)) in finish_request()
1300 start_transfer(r8a66597, td); in finish_request()
1301 set_td_timer(r8a66597, td); in finish_request()
1310 struct r8a66597_td *td = r8a66597_get_td(r8a66597, pipenum); in packet_read() local
1315 if (unlikely(!td)) in packet_read()
1317 urb = td->urb; in packet_read()
1319 fifo_change_from_pipe(r8a66597, td->pipe); in packet_read()
1320 tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); in packet_read()
1322 pipe_stop(r8a66597, td->pipe); in packet_read()
1325 finish_request(r8a66597, td, pipenum, td->urb, -EPIPE); in packet_read()
1333 urb->iso_frame_desc[td->iso_cnt].offset); in packet_read()
1334 urb_len = urb->iso_frame_desc[td->iso_cnt].length; in packet_read()
1339 bufsize = min(urb_len, (int) td->maxpacket); in packet_read()
1351 td->zero_packet = 1; in packet_read()
1353 td->short_packet = 1; in packet_read()
1356 urb->iso_frame_desc[td->iso_cnt].actual_length = size; in packet_read()
1357 urb->iso_frame_desc[td->iso_cnt].status = status; in packet_read()
1358 td->iso_cnt++; in packet_read()
1363 if (finish || check_transfer_finish(td, urb)) { in packet_read()
1364 pipe_stop(r8a66597, td->pipe); in packet_read()
1372 r8a66597_write(r8a66597, BCLR, td->pipe->fifoctr); in packet_read()
1374 r8a66597_read_fifo(r8a66597, td->pipe->fifoaddr, in packet_read()
1379 finish_request(r8a66597, td, pipenum, urb, status); in packet_read()
1387 struct r8a66597_td *td = r8a66597_get_td(r8a66597, pipenum); in packet_write() local
1390 if (unlikely(!td)) in packet_write()
1392 urb = td->urb; in packet_write()
1394 fifo_change_from_pipe(r8a66597, td->pipe); in packet_write()
1395 tmp = r8a66597_read(r8a66597, td->pipe->fifoctr); in packet_write()
1397 pipe_stop(r8a66597, td->pipe); in packet_write()
1400 finish_request(r8a66597, td, pipenum, urb, -EPIPE); in packet_write()
1405 bufsize = td->maxpacket; in packet_write()
1408 urb->iso_frame_desc[td->iso_cnt].offset); in packet_write()
1410 (int)urb->iso_frame_desc[td->iso_cnt].length); in packet_write()
1421 r8a66597_write_fifo(r8a66597, td->pipe, buf, size); in packet_write()
1422 if (!usb_pipebulk(urb->pipe) || td->maxpacket != size) in packet_write()
1423 r8a66597_write(r8a66597, BVAL, td->pipe->fifoctr); in packet_write()
1429 urb->iso_frame_desc[td->iso_cnt].actual_length = size; in packet_write()
1430 urb->iso_frame_desc[td->iso_cnt].status = 0; in packet_write()
1431 td->iso_cnt++; in packet_write()
1435 if (check_transfer_finish(td, urb)) { in packet_write()
1447 struct r8a66597_td *td = r8a66597_get_td(r8a66597, 0); in check_next_phase() local
1451 if (unlikely(!td)) in check_next_phase()
1453 urb = td->urb; in check_next_phase()
1455 switch (td->type) { in check_next_phase()
1458 if (check_transfer_finish(td, urb)) in check_next_phase()
1459 td->type = USB_PID_ACK; in check_next_phase()
1463 td->type = USB_PID_ACK; in check_next_phase()
1465 td->type = USB_PID_OUT; in check_next_phase()
1467 td->type = USB_PID_IN; in check_next_phase()
1475 finish_request(r8a66597, td, 0, urb, status); in check_next_phase()
1477 start_transfer(r8a66597, td); in check_next_phase()
1482 struct r8a66597_td *td = r8a66597_get_td(r8a66597, pipenum); in get_urb_error() local
1484 if (td) { in get_urb_error()
1485 u16 pid = r8a66597_read(r8a66597, td->pipe->pipectr) & PID; in get_urb_error()
1500 struct r8a66597_td *td; in irq_pipe_ready() local
1506 td = r8a66597_get_td(r8a66597, 0); in irq_pipe_ready()
1507 if (td && td->type == USB_PID_IN) in irq_pipe_ready()
1517 td = r8a66597_get_td(r8a66597, pipenum); in irq_pipe_ready()
1518 if (unlikely(!td)) in irq_pipe_ready()
1521 if (td->type == USB_PID_IN) in irq_pipe_ready()
1523 else if (td->type == USB_PID_OUT) in irq_pipe_ready()
1535 struct r8a66597_td *td; in irq_pipe_empty() local
1542 td = r8a66597_get_td(r8a66597, 0); in irq_pipe_empty()
1543 if (td && td->type != USB_PID_OUT) in irq_pipe_empty()
1551 struct r8a66597_td *td; in irq_pipe_empty() local
1552 td = r8a66597_get_td(r8a66597, pipenum); in irq_pipe_empty()
1553 if (unlikely(!td)) in irq_pipe_empty()
1556 tmp = r8a66597_read(r8a66597, td->pipe->pipectr); in irq_pipe_empty()
1560 finish_request(r8a66597, td, pipenum, td->urb, in irq_pipe_empty()
1587 struct r8a66597_td *td; in irq_pipe_nrdy() local
1588 td = r8a66597_get_td(r8a66597, pipenum); in irq_pipe_nrdy()
1589 if (unlikely(!td)) in irq_pipe_nrdy()
1594 pipe_stop(r8a66597, td->pipe); in irq_pipe_nrdy()
1595 finish_request(r8a66597, td, pipenum, td->urb, status); in irq_pipe_nrdy()
1727 struct r8a66597_td *td; in r8a66597_interval_timer() local
1737 td = r8a66597_get_td(r8a66597, pipenum); in r8a66597_interval_timer()
1738 if (td) in r8a66597_interval_timer()
1739 start_transfer(r8a66597, td); in r8a66597_interval_timer()
1747 struct r8a66597_timers *timers = from_timer(timers, t, td); in r8a66597_td_timer()
1751 struct r8a66597_td *td, *new_td = NULL; in r8a66597_td_timer() local
1758 if (timer_pending(&r8a66597->timers[pipenum].td)) in r8a66597_td_timer()
1761 td = r8a66597_get_td(r8a66597, pipenum); in r8a66597_td_timer()
1762 if (!td) { in r8a66597_td_timer()
1767 if (td->urb->actual_length) { in r8a66597_td_timer()
1768 set_td_timer(r8a66597, td); in r8a66597_td_timer()
1772 pipe = td->pipe; in r8a66597_td_timer()
1776 new_td = td; in r8a66597_td_timer()
1782 new_td = td; in r8a66597_td_timer()
1785 } while (td != new_td && td->address == new_td->address && in r8a66597_td_timer()
1786 td->pipe->info.epnum == new_td->pipe->info.epnum); in r8a66597_td_timer()
1790 if (td == new_td) in r8a66597_td_timer()
1858 struct r8a66597_td *td; in r8a66597_make_td() local
1861 td = kzalloc(sizeof(struct r8a66597_td), GFP_ATOMIC); in r8a66597_make_td()
1862 if (td == NULL) in r8a66597_make_td()
1866 td->pipenum = pipenum; in r8a66597_make_td()
1867 td->pipe = hep->hcpriv; in r8a66597_make_td()
1868 td->urb = urb; in r8a66597_make_td()
1869 td->address = get_urb_to_r8a66597_addr(r8a66597, urb); in r8a66597_make_td()
1870 td->maxpacket = usb_maxpacket(urb->dev, urb->pipe); in r8a66597_make_td()
1872 td->type = USB_PID_SETUP; in r8a66597_make_td()
1874 td->type = USB_PID_IN; in r8a66597_make_td()
1876 td->type = USB_PID_OUT; in r8a66597_make_td()
1877 INIT_LIST_HEAD(&td->queue); in r8a66597_make_td()
1879 return td; in r8a66597_make_td()
1888 struct r8a66597_td *td = NULL; in r8a66597_urb_enqueue() local
1918 td = r8a66597_make_td(r8a66597, urb, hep); in r8a66597_urb_enqueue()
1919 if (td == NULL) { in r8a66597_urb_enqueue()
1923 if (list_empty(&r8a66597->pipe_queue[td->pipenum])) in r8a66597_urb_enqueue()
1925 list_add_tail(&td->queue, &r8a66597->pipe_queue[td->pipenum]); in r8a66597_urb_enqueue()
1926 urb->hcpriv = td; in r8a66597_urb_enqueue()
1929 if (td->pipe->info.timer_interval) { in r8a66597_urb_enqueue()
1930 r8a66597->interval_map |= 1 << td->pipenum; in r8a66597_urb_enqueue()
1931 mod_timer(&r8a66597->timers[td->pipenum].interval, in r8a66597_urb_enqueue()
1933 td->pipe->info.timer_interval)); in r8a66597_urb_enqueue()
1935 ret = start_transfer(r8a66597, td); in r8a66597_urb_enqueue()
1937 list_del(&td->queue); in r8a66597_urb_enqueue()
1938 kfree(td); in r8a66597_urb_enqueue()
1942 set_td_timer(r8a66597, td); in r8a66597_urb_enqueue()
1956 struct r8a66597_td *td; in r8a66597_urb_dequeue() local
1966 td = urb->hcpriv; in r8a66597_urb_dequeue()
1967 pipe_stop(r8a66597, td->pipe); in r8a66597_urb_dequeue()
1968 pipe_irq_disable(r8a66597, td->pipenum); in r8a66597_urb_dequeue()
1969 disable_irq_empty(r8a66597, td->pipenum); in r8a66597_urb_dequeue()
1970 finish_request(r8a66597, td, td->pipenum, urb, status); in r8a66597_urb_dequeue()
1984 struct r8a66597_td *td; in r8a66597_endpoint_disable() local
2004 td = r8a66597_get_td(r8a66597, pipenum); in r8a66597_endpoint_disable()
2005 if (td) in r8a66597_endpoint_disable()
2006 urb = td->urb; in r8a66597_endpoint_disable()
2007 finish_request(r8a66597, td, pipenum, urb, -ESHUTDOWN); in r8a66597_endpoint_disable()
2480 timer_setup(&r8a66597->timers[i].td, r8a66597_td_timer, 0); in r8a66597_probe()