Lines Matching refs:pipenum
50 static void enable_pipe_irq(struct r8a66597 *r8a66597, u16 pipenum, in enable_pipe_irq() argument
58 r8a66597_bset(r8a66597, (1 << pipenum), reg); in enable_pipe_irq()
62 static void disable_pipe_irq(struct r8a66597 *r8a66597, u16 pipenum, in disable_pipe_irq() argument
70 r8a66597_bclr(r8a66597, (1 << pipenum), reg); in disable_pipe_irq()
101 static inline u16 control_reg_get_pid(struct r8a66597 *r8a66597, u16 pipenum) in control_reg_get_pid() argument
106 if (pipenum == 0) { in control_reg_get_pid()
108 } else if (pipenum < R8A66597_MAX_NUM_PIPE) { in control_reg_get_pid()
109 offset = get_pipectr_addr(pipenum); in control_reg_get_pid()
113 pipenum); in control_reg_get_pid()
119 static inline void control_reg_set_pid(struct r8a66597 *r8a66597, u16 pipenum, in control_reg_set_pid() argument
124 if (pipenum == 0) { in control_reg_set_pid()
126 } else if (pipenum < R8A66597_MAX_NUM_PIPE) { in control_reg_set_pid()
127 offset = get_pipectr_addr(pipenum); in control_reg_set_pid()
131 pipenum); in control_reg_set_pid()
135 static inline void pipe_start(struct r8a66597 *r8a66597, u16 pipenum) in pipe_start() argument
137 control_reg_set_pid(r8a66597, pipenum, PID_BUF); in pipe_start()
140 static inline void pipe_stop(struct r8a66597 *r8a66597, u16 pipenum) in pipe_stop() argument
142 control_reg_set_pid(r8a66597, pipenum, PID_NAK); in pipe_stop()
145 static inline void pipe_stall(struct r8a66597 *r8a66597, u16 pipenum) in pipe_stall() argument
147 control_reg_set_pid(r8a66597, pipenum, PID_STALL); in pipe_stall()
150 static inline u16 control_reg_get(struct r8a66597 *r8a66597, u16 pipenum) in control_reg_get() argument
155 if (pipenum == 0) { in control_reg_get()
157 } else if (pipenum < R8A66597_MAX_NUM_PIPE) { in control_reg_get()
158 offset = get_pipectr_addr(pipenum); in control_reg_get()
162 pipenum); in control_reg_get()
168 static inline void control_reg_sqclr(struct r8a66597 *r8a66597, u16 pipenum) in control_reg_sqclr() argument
172 pipe_stop(r8a66597, pipenum); in control_reg_sqclr()
174 if (pipenum == 0) { in control_reg_sqclr()
176 } else if (pipenum < R8A66597_MAX_NUM_PIPE) { in control_reg_sqclr()
177 offset = get_pipectr_addr(pipenum); in control_reg_sqclr()
181 pipenum); in control_reg_sqclr()
185 static void control_reg_sqset(struct r8a66597 *r8a66597, u16 pipenum) in control_reg_sqset() argument
189 pipe_stop(r8a66597, pipenum); in control_reg_sqset()
191 if (pipenum == 0) { in control_reg_sqset()
193 } else if (pipenum < R8A66597_MAX_NUM_PIPE) { in control_reg_sqset()
194 offset = get_pipectr_addr(pipenum); in control_reg_sqset()
198 "unexpect pipe num(%d)\n", pipenum); in control_reg_sqset()
202 static u16 control_reg_sqmon(struct r8a66597 *r8a66597, u16 pipenum) in control_reg_sqmon() argument
206 if (pipenum == 0) { in control_reg_sqmon()
208 } else if (pipenum < R8A66597_MAX_NUM_PIPE) { in control_reg_sqmon()
209 offset = get_pipectr_addr(pipenum); in control_reg_sqmon()
213 "unexpect pipe num(%d)\n", pipenum); in control_reg_sqmon()
219 static u16 save_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum) in save_usb_toggle() argument
221 return control_reg_sqmon(r8a66597, pipenum); in save_usb_toggle()
224 static void restore_usb_toggle(struct r8a66597 *r8a66597, u16 pipenum, in restore_usb_toggle() argument
228 control_reg_sqset(r8a66597, pipenum); in restore_usb_toggle()
230 control_reg_sqclr(r8a66597, pipenum); in restore_usb_toggle()
233 static inline int get_buffer_size(struct r8a66597 *r8a66597, u16 pipenum) in get_buffer_size() argument
238 if (pipenum == 0) { in get_buffer_size()
247 r8a66597_write(r8a66597, pipenum, PIPESEL); in get_buffer_size()
269 static void r8a66597_change_curpipe(struct r8a66597 *r8a66597, u16 pipenum, in r8a66597_change_curpipe() argument
275 if (!pipenum) { in r8a66597_change_curpipe()
280 loop = pipenum; in r8a66597_change_curpipe()
296 static void pipe_change(struct r8a66597 *r8a66597, u16 pipenum) in pipe_change() argument
298 struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; in pipe_change()
303 r8a66597_mdfy(r8a66597, pipenum, CURPIPE, ep->fifosel); in pipe_change()
401 r8a66597_mdfy(r8a66597, ep->pipenum, CURPIPE, ep->fifosel); in pipe_initialize()
412 u16 pipenum, int dma) in r8a66597_ep_setting() argument
419 ep->pipectr = get_pipectr_addr(pipenum); in r8a66597_ep_setting()
420 if (is_bulk_pipe(pipenum) || is_isoc_pipe(pipenum)) { in r8a66597_ep_setting()
421 ep->pipetre = get_pipetre_addr(pipenum); in r8a66597_ep_setting()
422 ep->pipetrn = get_pipetrn_addr(pipenum); in r8a66597_ep_setting()
427 ep->pipenum = pipenum; in r8a66597_ep_setting()
429 r8a66597->pipenum2ep[pipenum] = ep; in r8a66597_ep_setting()
438 u16 pipenum = ep->pipenum; in r8a66597_ep_release() local
440 if (pipenum == 0) in r8a66597_ep_release()
445 ep->pipenum = 0; in r8a66597_ep_release()
461 if (ep->pipenum) /* already allocated pipe */ in alloc_pipe_config()
539 info.pipe = ep->pipenum; in free_pipe_config()
548 static void pipe_irq_enable(struct r8a66597 *r8a66597, u16 pipenum) in pipe_irq_enable() argument
550 enable_irq_ready(r8a66597, pipenum); in pipe_irq_enable()
551 enable_irq_nrdy(r8a66597, pipenum); in pipe_irq_enable()
554 static void pipe_irq_disable(struct r8a66597 *r8a66597, u16 pipenum) in pipe_irq_disable() argument
556 disable_irq_ready(r8a66597, pipenum); in pipe_irq_disable()
557 disable_irq_nrdy(r8a66597, pipenum); in pipe_irq_disable()
573 pipe_change(r8a66597, ep->pipenum); in start_ep0_write()
586 static void disable_fifosel(struct r8a66597 *r8a66597, u16 pipenum, in disable_fifosel() argument
592 if (tmp == pipenum) in disable_fifosel()
596 static void change_bfre_mode(struct r8a66597 *r8a66597, u16 pipenum, in change_bfre_mode() argument
599 struct r8a66597_ep *ep = r8a66597->pipenum2ep[pipenum]; in change_bfre_mode()
603 r8a66597_write(r8a66597, pipenum, PIPESEL); in change_bfre_mode()
609 pipe_stop(r8a66597, pipenum); in change_bfre_mode()
610 disable_fifosel(r8a66597, pipenum, CFIFOSEL); in change_bfre_mode()
611 disable_fifosel(r8a66597, pipenum, D0FIFOSEL); in change_bfre_mode()
612 disable_fifosel(r8a66597, pipenum, D1FIFOSEL); in change_bfre_mode()
614 toggle = save_usb_toggle(r8a66597, pipenum); in change_bfre_mode()
616 r8a66597_write(r8a66597, pipenum, PIPESEL); in change_bfre_mode()
626 restore_usb_toggle(r8a66597, pipenum, toggle); in change_bfre_mode()
639 if (!is_bulk_pipe(ep->pipenum)) in sudmac_alloc_channel()
652 change_bfre_mode(r8a66597, ep->pipenum, 1); in sudmac_alloc_channel()
704 pipe_change(r8a66597, ep->pipenum); in start_packet_write()
705 disable_irq_empty(r8a66597, ep->pipenum); in start_packet_write()
706 pipe_start(r8a66597, ep->pipenum); in start_packet_write()
711 r8a66597_write(r8a66597, ~(1 << ep->pipenum), BRDYSTS); in start_packet_write()
714 pipe_change(r8a66597, ep->pipenum); in start_packet_write()
715 disable_irq_empty(r8a66597, ep->pipenum); in start_packet_write()
716 pipe_start(r8a66597, ep->pipenum); in start_packet_write()
719 pipe_irq_enable(r8a66597, ep->pipenum); in start_packet_write()
724 pipe_change(r8a66597, ep->pipenum); in start_packet_write()
725 disable_irq_nrdy(r8a66597, ep->pipenum); in start_packet_write()
726 pipe_start(r8a66597, ep->pipenum); in start_packet_write()
727 enable_irq_nrdy(r8a66597, ep->pipenum); in start_packet_write()
737 u16 pipenum = ep->pipenum; in start_packet_read() local
739 if (ep->pipenum == 0) { in start_packet_read()
742 pipe_start(r8a66597, pipenum); in start_packet_read()
743 pipe_irq_enable(r8a66597, pipenum); in start_packet_read()
745 pipe_stop(r8a66597, pipenum); in start_packet_read()
747 enable_irq_nrdy(r8a66597, pipenum); in start_packet_read()
757 change_bfre_mode(r8a66597, ep->pipenum, 0); in start_packet_read()
758 pipe_start(r8a66597, pipenum); /* trigger once */ in start_packet_read()
759 pipe_irq_enable(r8a66597, pipenum); in start_packet_read()
761 pipe_change(r8a66597, pipenum); in start_packet_read()
763 pipe_start(r8a66597, pipenum); /* trigger once */ in start_packet_read()
905 if (unlikely(ep->pipenum == 0)) { in transfer_complete()
942 u16 pipenum = ep->pipenum; in irq_ep0_write() local
945 pipe_change(r8a66597, pipenum); in irq_ep0_write()
961 bufsize = get_buffer_size(r8a66597, pipenum); in irq_ep0_write()
980 disable_irq_ready(r8a66597, pipenum); in irq_ep0_write()
981 disable_irq_empty(r8a66597, pipenum); in irq_ep0_write()
983 disable_irq_ready(r8a66597, pipenum); in irq_ep0_write()
984 enable_irq_empty(r8a66597, pipenum); in irq_ep0_write()
986 pipe_start(r8a66597, pipenum); in irq_ep0_write()
996 u16 pipenum = ep->pipenum; in irq_packet_write() local
999 pipe_change(r8a66597, pipenum); in irq_packet_write()
1002 pipe_stop(r8a66597, pipenum); in irq_packet_write()
1003 pipe_irq_disable(r8a66597, pipenum); in irq_packet_write()
1005 "write fifo not ready. pipnum=%d\n", pipenum); in irq_packet_write()
1010 bufsize = get_buffer_size(r8a66597, pipenum); in irq_packet_write()
1030 disable_irq_ready(r8a66597, pipenum); in irq_packet_write()
1031 enable_irq_empty(r8a66597, pipenum); in irq_packet_write()
1033 disable_irq_empty(r8a66597, pipenum); in irq_packet_write()
1034 pipe_irq_enable(r8a66597, pipenum); in irq_packet_write()
1045 u16 pipenum = ep->pipenum; in irq_packet_read() local
1049 pipe_change(r8a66597, pipenum); in irq_packet_read()
1053 pipe_stop(r8a66597, pipenum); in irq_packet_read()
1054 pipe_irq_disable(r8a66597, pipenum); in irq_packet_read()
1061 bufsize = get_buffer_size(r8a66597, pipenum); in irq_packet_read()
1077 pipe_stop(r8a66597, pipenum); in irq_packet_read()
1078 pipe_irq_disable(r8a66597, pipenum); in irq_packet_read()
1091 if ((ep->pipenum != 0) && finish) in irq_packet_read()
1098 u16 pipenum; in irq_pipe_ready() local
1110 for (pipenum = 1; pipenum < R8A66597_MAX_NUM_PIPE; pipenum++) { in irq_pipe_ready()
1111 check = 1 << pipenum; in irq_pipe_ready()
1114 ep = r8a66597->pipenum2ep[pipenum]; in irq_pipe_ready()
1129 u16 pipenum; in irq_pipe_empty() local
1140 for (pipenum = 1; pipenum < R8A66597_MAX_NUM_PIPE; pipenum++) { in irq_pipe_empty()
1141 check = 1 << pipenum; in irq_pipe_empty()
1144 tmp = control_reg_get(r8a66597, pipenum); in irq_pipe_empty()
1146 disable_irq_empty(r8a66597, pipenum); in irq_pipe_empty()
1147 pipe_irq_disable(r8a66597, pipenum); in irq_pipe_empty()
1148 pipe_stop(r8a66597, pipenum); in irq_pipe_empty()
1149 ep = r8a66597->pipenum2ep[pipenum]; in irq_pipe_empty()
1177 pid = control_reg_get_pid(r8a66597, ep->pipenum); in get_status()
1214 pipe_stop(r8a66597, ep->pipenum); in clear_feature()
1215 control_reg_sqclr(r8a66597, ep->pipenum); in clear_feature()
1230 pipe_start(r8a66597, ep->pipenum); in clear_feature()
1273 pipe_stall(r8a66597, ep->pipenum); in set_feature()
1402 u16 pipenum; in sudmac_finish() local
1407 pipenum = ep->pipenum; in sudmac_finish()
1408 pipe_change(r8a66597, pipenum); in sudmac_finish()
1415 __func__, pipenum); in sudmac_finish()
1434 disable_irq_ready(r8a66597, pipenum); in sudmac_finish()
1435 enable_irq_empty(r8a66597, pipenum); in sudmac_finish()
1438 r8a66597_write(r8a66597, ~(1 << pipenum), BRDYSTS); in sudmac_finish()
1448 u16 pipenum; in r8a66597_sudmac_irq() local
1453 pipenum = (r8a66597_read(r8a66597, D0FIFOSEL) & CURPIPE); in r8a66597_sudmac_irq()
1454 ep = r8a66597->pipenum2ep[pipenum]; in r8a66597_sudmac_irq()
1574 pipe_irq_disable(ep->r8a66597, ep->pipenum); in r8a66597_disable()
1663 pipe_stall(ep->r8a66597, ep->pipenum); in r8a66597_set_halt()
1667 pipe_stop(ep->r8a66597, ep->pipenum); in r8a66597_set_halt()
1698 pipe_stop(ep->r8a66597, ep->pipenum); in r8a66597_fifo_flush()
1932 r8a66597->ep[0].pipenum = 0; in r8a66597_probe()