Lines Matching refs:td

82 #define td_udev(td)	((td)->ep_data->dev)  argument
115 #define td_residue(td) ((__s8)(td->residue)) argument
116 #define td_ly_base_addr(td) (__le16_to_cpu((td)->ly_base_addr)) argument
117 #define td_port_length(td) (__le16_to_cpu((td)->port_length)) argument
118 #define td_next_td_addr(td) (__le16_to_cpu((td)->next_td_addr)) argument
120 #define td_active(td) ((td)->retry_cnt & TD_RETRYCNTMASK_ACT_FLG) argument
121 #define td_length(td) (td_port_length(td) & TD_PORTLENMASK_DL) argument
123 #define td_sequence_ok(td) (!td->status || \ argument
124 (!(td->status & TD_STATUSMASK_SEQ) == \
125 !(td->ctrl_reg & SEQ_SEL)))
127 #define td_acked(td) (!td->status || \ argument
128 (td->status & TD_STATUSMASK_ACK))
129 #define td_actual_bytes(td) (td_length(td) - td_residue(td)) argument
136 static void dbg_td(struct c67x00_hcd *c67x00, struct c67x00_td *td, char *msg) in dbg_td() argument
140 dev_dbg(dev, "### %s at 0x%04x\n", msg, td->td_addr); in dbg_td()
141 dev_dbg(dev, "urb: 0x%p\n", td->urb); in dbg_td()
142 dev_dbg(dev, "endpoint: %4d\n", usb_pipeendpoint(td->pipe)); in dbg_td()
143 dev_dbg(dev, "pipeout: %4d\n", usb_pipeout(td->pipe)); in dbg_td()
144 dev_dbg(dev, "ly_base_addr: 0x%04x\n", td_ly_base_addr(td)); in dbg_td()
145 dev_dbg(dev, "port_length: 0x%04x\n", td_port_length(td)); in dbg_td()
146 dev_dbg(dev, "pid_ep: 0x%02x\n", td->pid_ep); in dbg_td()
147 dev_dbg(dev, "dev_addr: 0x%02x\n", td->dev_addr); in dbg_td()
148 dev_dbg(dev, "ctrl_reg: 0x%02x\n", td->ctrl_reg); in dbg_td()
149 dev_dbg(dev, "status: 0x%02x\n", td->status); in dbg_td()
150 dev_dbg(dev, "retry_cnt: 0x%02x\n", td->retry_cnt); in dbg_td()
151 dev_dbg(dev, "residue: 0x%02x\n", td->residue); in dbg_td()
152 dev_dbg(dev, "next_td_addr: 0x%04x\n", td_next_td_addr(td)); in dbg_td()
153 dev_dbg(dev, "data: %*ph\n", td_length(td), td->data); in dbg_td()
200 struct c67x00_td *td; in c67x00_release_urb() local
218 list_for_each_entry(td, &c67x00->td_list, td_list) in c67x00_release_urb()
219 if (urb == td->urb) in c67x00_release_urb()
220 td->urb = NULL; in c67x00_release_urb()
567 struct c67x00_td *td; in c67x00_create_td() local
577 td = kzalloc(sizeof(*td), GFP_ATOMIC); in c67x00_create_td()
578 if (!td) in c67x00_create_td()
581 td->pipe = urb->pipe; in c67x00_create_td()
582 td->ep_data = urbp->ep_data; in c67x00_create_td()
584 if ((td_udev(td)->speed == USB_SPEED_LOW) && in c67x00_create_td()
588 switch (usb_pipetype(td->pipe)) { in c67x00_create_td()
610 td->td_addr = c67x00->next_td_addr; in c67x00_create_td()
614 td->ly_base_addr = __cpu_to_le16(c67x00->next_buf_addr); in c67x00_create_td()
615 td->port_length = __cpu_to_le16((c67x00->sie->sie_num << 15) | in c67x00_create_td()
617 td->pid_ep = ((pid & 0xF) << TD_PIDEP_OFFSET) | in c67x00_create_td()
618 (usb_pipeendpoint(td->pipe) & 0xF); in c67x00_create_td()
619 td->dev_addr = usb_pipedevice(td->pipe) & 0x7F; in c67x00_create_td()
620 td->ctrl_reg = cmd; in c67x00_create_td()
621 td->status = 0; in c67x00_create_td()
622 td->retry_cnt = (tt << TT_OFFSET) | (active_flag << 4) | retry_cnt; in c67x00_create_td()
623 td->residue = 0; in c67x00_create_td()
624 td->next_td_addr = __cpu_to_le16(c67x00->next_td_addr); in c67x00_create_td()
627 td->data = data; in c67x00_create_td()
628 td->urb = urb; in c67x00_create_td()
629 td->privdata = privdata; in c67x00_create_td()
633 list_add_tail(&td->td_list, &c67x00->td_list); in c67x00_create_td()
637 static inline void c67x00_release_td(struct c67x00_td *td) in c67x00_release_td() argument
639 list_del_init(&td->td_list); in c67x00_release_td()
640 kfree(td); in c67x00_release_td()
798 struct c67x00_td *td, *ttd; in c67x00_fill_frame() local
804 list_for_each_entry_safe(td, ttd, &c67x00->td_list, td_list) { in c67x00_fill_frame()
805 dbg_td(c67x00, td, "Unprocessed td"); in c67x00_fill_frame()
806 c67x00_release_td(td); in c67x00_fill_frame()
830 c67x00_parse_td(struct c67x00_hcd *c67x00, struct c67x00_td *td) in c67x00_parse_td() argument
833 td->td_addr, td, CY_TD_SIZE); in c67x00_parse_td()
835 if (usb_pipein(td->pipe) && td_actual_bytes(td)) in c67x00_parse_td()
836 c67x00_ll_read_mem_le16(c67x00->sie->dev, td_ly_base_addr(td), in c67x00_parse_td()
837 td->data, td_actual_bytes(td)); in c67x00_parse_td()
840 static int c67x00_td_to_error(struct c67x00_hcd *c67x00, struct c67x00_td *td) in c67x00_td_to_error() argument
842 if (td->status & TD_STATUSMASK_ERR) { in c67x00_td_to_error()
843 dbg_td(c67x00, td, "ERROR_FLAG"); in c67x00_td_to_error()
846 if (td->status & TD_STATUSMASK_STALL) { in c67x00_td_to_error()
850 if (td->status & TD_STATUSMASK_TMOUT) { in c67x00_td_to_error()
851 dbg_td(c67x00, td, "TIMEOUT"); in c67x00_td_to_error()
858 static inline int c67x00_end_of_data(struct c67x00_td *td) in c67x00_end_of_data() argument
861 struct urb *urb = td->urb; in c67x00_end_of_data()
864 act_bytes = td_actual_bytes(td); in c67x00_end_of_data()
869 maxps = usb_maxpacket(td_udev(td), td->pipe); in c67x00_end_of_data()
892 struct c67x00_td *td, *tmp; in c67x00_clear_pipe() local
893 td = last_td; in c67x00_clear_pipe()
895 while (td->td_list.next != &c67x00->td_list) { in c67x00_clear_pipe()
896 td = list_entry(td->td_list.next, struct c67x00_td, td_list); in c67x00_clear_pipe()
897 if (td->pipe == last_td->pipe) { in c67x00_clear_pipe()
898 c67x00_release_td(td); in c67x00_clear_pipe()
899 td = tmp; in c67x00_clear_pipe()
901 tmp = td; in c67x00_clear_pipe()
908 struct c67x00_td *td) in c67x00_handle_successful_td() argument
910 struct urb *urb = td->urb; in c67x00_handle_successful_td()
915 urb->actual_length += td_actual_bytes(td); in c67x00_handle_successful_td()
917 switch (usb_pipetype(td->pipe)) { in c67x00_handle_successful_td()
920 switch (td->privdata) { in c67x00_handle_successful_td()
930 if (c67x00_end_of_data(td)) { in c67x00_handle_successful_td()
932 c67x00_clear_pipe(c67x00, td); in c67x00_handle_successful_td()
945 if (unlikely(c67x00_end_of_data(td))) { in c67x00_handle_successful_td()
946 c67x00_clear_pipe(c67x00, td); in c67x00_handle_successful_td()
953 static void c67x00_handle_isoc(struct c67x00_hcd *c67x00, struct c67x00_td *td) in c67x00_handle_isoc() argument
955 struct urb *urb = td->urb; in c67x00_handle_isoc()
961 cnt = td->privdata; in c67x00_handle_isoc()
963 if (td->status & TD_ERROR_MASK) in c67x00_handle_isoc()
966 urb->iso_frame_desc[cnt].actual_length = td_actual_bytes(td); in c67x00_handle_isoc()
967 urb->iso_frame_desc[cnt].status = c67x00_td_to_error(c67x00, td); in c67x00_handle_isoc()
980 struct c67x00_td *td, *tmp; in c67x00_check_td_list() local
985 list_for_each_entry_safe(td, tmp, &c67x00->td_list, td_list) { in c67x00_check_td_list()
987 c67x00_parse_td(c67x00, td); in c67x00_check_td_list()
988 urb = td->urb; /* urb can be NULL! */ in c67x00_check_td_list()
993 if (usb_pipeisoc(td->pipe)) { in c67x00_check_td_list()
995 c67x00_handle_isoc(c67x00, td); in c67x00_check_td_list()
1002 if (td->status & TD_ERROR_MASK) { in c67x00_check_td_list()
1004 c67x00_td_to_error(c67x00, td)); in c67x00_check_td_list()
1008 if ((td->status & TD_STATUSMASK_NAK) || !td_sequence_ok(td) || in c67x00_check_td_list()
1009 !td_acked(td)) in c67x00_check_td_list()
1015 if (unlikely(td->status & TD_STATUSMASK_OVF)) { in c67x00_check_td_list()
1016 if (td_residue(td) & TD_RESIDUE_OVERFLOW) { in c67x00_check_td_list()
1024 c67x00_handle_successful_td(c67x00, td); in c67x00_check_td_list()
1028 c67x00_clear_pipe(c67x00, td); in c67x00_check_td_list()
1030 usb_settoggle(td_udev(td), usb_pipeendpoint(td->pipe), in c67x00_check_td_list()
1031 usb_pipeout(td->pipe), in c67x00_check_td_list()
1032 !(td->ctrl_reg & SEQ_SEL)); in c67x00_check_td_list()
1034 tmp = list_entry(td->td_list.next, typeof(*td), td_list); in c67x00_check_td_list()
1035 c67x00_release_td(td); in c67x00_check_td_list()
1052 static void c67x00_send_td(struct c67x00_hcd *c67x00, struct c67x00_td *td) in c67x00_send_td() argument
1054 int len = td_length(td); in c67x00_send_td()
1056 if (len && ((td->pid_ep & TD_PIDEPMASK_PID) != TD_PID_IN)) in c67x00_send_td()
1057 c67x00_ll_write_mem_le16(c67x00->sie->dev, td_ly_base_addr(td), in c67x00_send_td()
1058 td->data, len); in c67x00_send_td()
1061 td->td_addr, td, CY_TD_SIZE); in c67x00_send_td()
1066 struct c67x00_td *td; in c67x00_send_frame() local
1073 list_for_each_entry(td, &c67x00->td_list, td_list) { in c67x00_send_frame()
1074 if (td->td_list.next == &c67x00->td_list) in c67x00_send_frame()
1075 td->next_td_addr = 0; /* Last td in list */ in c67x00_send_frame()
1077 c67x00_send_td(c67x00, td); in c67x00_send_frame()