Lines Matching refs:pipe

33 char *usbhs_pipe_name(struct usbhs_pipe *pipe)  in usbhs_pipe_name()  argument
35 return usbhsp_pipe_name[usbhs_pipe_type(pipe)]; in usbhs_pipe_name()
50 static void usbhsp_pipectrl_set(struct usbhs_pipe *pipe, u16 mask, u16 val) in usbhsp_pipectrl_set() argument
52 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_pipectrl_set()
53 int offset = usbhsp_addr_offset(pipe); in usbhsp_pipectrl_set()
55 if (usbhs_pipe_is_dcp(pipe)) in usbhsp_pipectrl_set()
61 static u16 usbhsp_pipectrl_get(struct usbhs_pipe *pipe) in usbhsp_pipectrl_get() argument
63 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_pipectrl_get()
64 int offset = usbhsp_addr_offset(pipe); in usbhsp_pipectrl_get()
66 if (usbhs_pipe_is_dcp(pipe)) in usbhsp_pipectrl_get()
75 static void __usbhsp_pipe_xxx_set(struct usbhs_pipe *pipe, in __usbhsp_pipe_xxx_set() argument
79 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in __usbhsp_pipe_xxx_set()
81 if (usbhs_pipe_is_dcp(pipe)) in __usbhsp_pipe_xxx_set()
87 static u16 __usbhsp_pipe_xxx_get(struct usbhs_pipe *pipe, in __usbhsp_pipe_xxx_get() argument
90 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in __usbhsp_pipe_xxx_get()
92 if (usbhs_pipe_is_dcp(pipe)) in __usbhsp_pipe_xxx_get()
101 static void usbhsp_pipe_cfg_set(struct usbhs_pipe *pipe, u16 mask, u16 val) in usbhsp_pipe_cfg_set() argument
103 __usbhsp_pipe_xxx_set(pipe, DCPCFG, PIPECFG, mask, val); in usbhsp_pipe_cfg_set()
106 static u16 usbhsp_pipe_cfg_get(struct usbhs_pipe *pipe) in usbhsp_pipe_cfg_get() argument
108 return __usbhsp_pipe_xxx_get(pipe, DCPCFG, PIPECFG); in usbhsp_pipe_cfg_get()
114 static void usbhsp_pipe_trn_set(struct usbhs_pipe *pipe, u16 mask, u16 val) in usbhsp_pipe_trn_set() argument
116 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_pipe_trn_set()
118 int num = usbhs_pipe_number(pipe); in usbhsp_pipe_trn_set()
147 __usbhsp_pipe_xxx_set(pipe, 0, reg, mask, val); in usbhsp_pipe_trn_set()
150 static void usbhsp_pipe_tre_set(struct usbhs_pipe *pipe, u16 mask, u16 val) in usbhsp_pipe_tre_set() argument
152 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_pipe_tre_set()
154 int num = usbhs_pipe_number(pipe); in usbhsp_pipe_tre_set()
184 __usbhsp_pipe_xxx_set(pipe, 0, reg, mask, val); in usbhsp_pipe_tre_set()
190 static void usbhsp_pipe_buf_set(struct usbhs_pipe *pipe, u16 mask, u16 val) in usbhsp_pipe_buf_set() argument
192 if (usbhs_pipe_is_dcp(pipe)) in usbhsp_pipe_buf_set()
195 __usbhsp_pipe_xxx_set(pipe, 0, PIPEBUF, mask, val); in usbhsp_pipe_buf_set()
201 static void usbhsp_pipe_maxp_set(struct usbhs_pipe *pipe, u16 mask, u16 val) in usbhsp_pipe_maxp_set() argument
203 __usbhsp_pipe_xxx_set(pipe, DCPMAXP, PIPEMAXP, mask, val); in usbhsp_pipe_maxp_set()
209 static void usbhsp_pipe_select(struct usbhs_pipe *pipe) in usbhsp_pipe_select() argument
211 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_pipe_select()
228 usbhs_write(priv, PIPESEL, 0xF & usbhs_pipe_number(pipe)); in usbhsp_pipe_select()
231 static int usbhsp_pipe_barrier(struct usbhs_pipe *pipe) in usbhsp_pipe_barrier() argument
233 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_pipe_barrier()
256 usbhs_pipe_disable(pipe); in usbhsp_pipe_barrier()
259 if (!(usbhsp_pipectrl_get(pipe) & mask)) in usbhsp_pipe_barrier()
269 int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe) in usbhs_pipe_is_accessible() argument
273 val = usbhsp_pipectrl_get(pipe); in usbhs_pipe_is_accessible()
280 bool usbhs_pipe_contains_transmittable_data(struct usbhs_pipe *pipe) in usbhs_pipe_contains_transmittable_data() argument
285 if (usbhs_pipe_is_dcp(pipe)) in usbhs_pipe_contains_transmittable_data()
288 val = usbhsp_pipectrl_get(pipe); in usbhs_pipe_contains_transmittable_data()
298 static void __usbhsp_pid_try_nak_if_stall(struct usbhs_pipe *pipe) in __usbhsp_pid_try_nak_if_stall() argument
300 u16 pid = usbhsp_pipectrl_get(pipe); in __usbhsp_pid_try_nak_if_stall()
310 usbhsp_pipectrl_set(pipe, PID_MASK, PID_STALL10); in __usbhsp_pid_try_nak_if_stall()
313 usbhsp_pipectrl_set(pipe, PID_MASK, PID_NAK); in __usbhsp_pid_try_nak_if_stall()
317 void usbhs_pipe_disable(struct usbhs_pipe *pipe) in usbhs_pipe_disable() argument
323 __usbhsp_pid_try_nak_if_stall(pipe); in usbhs_pipe_disable()
325 usbhsp_pipectrl_set(pipe, PID_MASK, PID_NAK); in usbhs_pipe_disable()
328 val = usbhsp_pipectrl_get(pipe); in usbhs_pipe_disable()
337 void usbhs_pipe_enable(struct usbhs_pipe *pipe) in usbhs_pipe_enable() argument
340 __usbhsp_pid_try_nak_if_stall(pipe); in usbhs_pipe_enable()
342 usbhsp_pipectrl_set(pipe, PID_MASK, PID_BUF); in usbhs_pipe_enable()
345 void usbhs_pipe_stall(struct usbhs_pipe *pipe) in usbhs_pipe_stall() argument
347 u16 pid = usbhsp_pipectrl_get(pipe); in usbhs_pipe_stall()
357 usbhsp_pipectrl_set(pipe, PID_MASK, PID_STALL10); in usbhs_pipe_stall()
360 usbhsp_pipectrl_set(pipe, PID_MASK, PID_STALL11); in usbhs_pipe_stall()
365 int usbhs_pipe_is_stall(struct usbhs_pipe *pipe) in usbhs_pipe_is_stall() argument
367 u16 pid = usbhsp_pipectrl_get(pipe) & PID_MASK; in usbhs_pipe_is_stall()
372 void usbhs_pipe_set_trans_count_if_bulk(struct usbhs_pipe *pipe, int len) in usbhs_pipe_set_trans_count_if_bulk() argument
374 if (!usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) in usbhs_pipe_set_trans_count_if_bulk()
380 usbhsp_pipe_tre_set(pipe, TRCLR | TRENB, TRCLR); in usbhs_pipe_set_trans_count_if_bulk()
388 if (usbhs_pipe_is_dir_in(pipe)) { in usbhs_pipe_set_trans_count_if_bulk()
389 int maxp = usbhs_pipe_get_maxpacket(pipe); in usbhs_pipe_set_trans_count_if_bulk()
391 usbhsp_pipe_trn_set(pipe, 0xffff, DIV_ROUND_UP(len, maxp)); in usbhs_pipe_set_trans_count_if_bulk()
392 usbhsp_pipe_tre_set(pipe, TRENB, TRENB); /* enable */ in usbhs_pipe_set_trans_count_if_bulk()
400 static int usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, int is_host, in usbhsp_setup_pipecfg() argument
416 if (usbhs_pipe_is_dcp(pipe)) in usbhsp_setup_pipecfg()
429 type = type_array[usbhs_pipe_type(pipe)]; in usbhsp_setup_pipecfg()
432 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC) || in usbhsp_setup_pipecfg()
433 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) in usbhsp_setup_pipecfg()
439 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) in usbhsp_setup_pipecfg()
444 usbhsp_flags_set(pipe, IS_DIR_HOST); in usbhsp_setup_pipecfg()
450 usbhsp_flags_set(pipe, IS_DIR_IN); in usbhsp_setup_pipecfg()
453 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK) && in usbhsp_setup_pipecfg()
469 static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe) in usbhsp_setup_pipebuff() argument
471 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_setup_pipebuff()
473 int pipe_num = usbhs_pipe_number(pipe); in usbhsp_setup_pipebuff()
502 void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel, in usbhs_pipe_config_update() argument
505 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhs_pipe_config_update()
506 int pipe_num = usbhs_pipe_number(pipe); in usbhs_pipe_config_update()
519 usbhsp_pipe_barrier(pipe); in usbhs_pipe_config_update()
521 pipe->maxp = maxp; in usbhs_pipe_config_update()
523 usbhsp_pipe_select(pipe); in usbhs_pipe_config_update()
524 usbhsp_pipe_maxp_set(pipe, 0xFFFF, in usbhs_pipe_config_update()
528 if (!usbhs_pipe_is_dcp(pipe)) in usbhs_pipe_config_update()
529 usbhsp_pipe_cfg_set(pipe, 0x000F | DBLB, epnum | dblb); in usbhs_pipe_config_update()
535 int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe) in usbhs_pipe_get_maxpacket() argument
542 return pipe->maxp; in usbhs_pipe_get_maxpacket()
545 int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe) in usbhs_pipe_is_dir_in() argument
547 return usbhsp_flags_has(pipe, IS_DIR_IN); in usbhs_pipe_is_dir_in()
550 int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe) in usbhs_pipe_is_dir_host() argument
552 return usbhsp_flags_has(pipe, IS_DIR_HOST); in usbhs_pipe_is_dir_host()
555 int usbhs_pipe_is_running(struct usbhs_pipe *pipe) in usbhs_pipe_is_running() argument
557 return usbhsp_flags_has(pipe, IS_RUNNING); in usbhs_pipe_is_running()
560 void usbhs_pipe_running(struct usbhs_pipe *pipe, int running) in usbhs_pipe_running() argument
563 usbhsp_flags_set(pipe, IS_RUNNING); in usbhs_pipe_running()
565 usbhsp_flags_clr(pipe, IS_RUNNING); in usbhs_pipe_running()
568 void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) in usbhs_pipe_data_sequence() argument
590 usbhsp_pipectrl_set(pipe, mask, val); in usbhs_pipe_data_sequence()
593 static int usbhs_pipe_get_data_sequence(struct usbhs_pipe *pipe) in usbhs_pipe_get_data_sequence() argument
595 return !!(usbhsp_pipectrl_get(pipe) & SQMON); in usbhs_pipe_get_data_sequence()
598 void usbhs_pipe_clear(struct usbhs_pipe *pipe) in usbhs_pipe_clear() argument
600 if (usbhs_pipe_is_dcp(pipe)) { in usbhs_pipe_clear()
601 usbhs_fifo_clear_dcp(pipe); in usbhs_pipe_clear()
603 usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); in usbhs_pipe_clear()
604 usbhsp_pipectrl_set(pipe, ACLRM, 0); in usbhs_pipe_clear()
609 void usbhs_pipe_clear_without_sequence(struct usbhs_pipe *pipe, in usbhs_pipe_clear_without_sequence() argument
614 usbhsp_pipe_select(pipe); in usbhs_pipe_clear_without_sequence()
615 sequence = usbhs_pipe_get_data_sequence(pipe); in usbhs_pipe_clear_without_sequence()
617 usbhsp_pipe_cfg_set(pipe, BFRE, bfre_enable ? BFRE : 0); in usbhs_pipe_clear_without_sequence()
618 usbhs_pipe_clear(pipe); in usbhs_pipe_clear_without_sequence()
619 usbhs_pipe_data_sequence(pipe, sequence); in usbhs_pipe_clear_without_sequence()
622 void usbhs_pipe_config_change_bfre(struct usbhs_pipe *pipe, int enable) in usbhs_pipe_config_change_bfre() argument
624 if (usbhs_pipe_is_dcp(pipe)) in usbhs_pipe_config_change_bfre()
627 usbhsp_pipe_select(pipe); in usbhs_pipe_config_change_bfre()
629 if (!(enable ^ !!(usbhsp_pipe_cfg_get(pipe) & BFRE))) in usbhs_pipe_config_change_bfre()
632 usbhs_pipe_clear_without_sequence(pipe, 1, enable); in usbhs_pipe_config_change_bfre()
637 struct usbhs_pipe *pos, *pipe; in usbhsp_get_pipe() local
643 pipe = NULL; in usbhsp_get_pipe()
650 pipe = pos; in usbhsp_get_pipe()
654 if (!pipe) in usbhsp_get_pipe()
660 usbhsp_flags_init(pipe); in usbhsp_get_pipe()
661 usbhsp_flags_set(pipe, IS_USED); in usbhsp_get_pipe()
663 return pipe; in usbhsp_get_pipe()
666 static void usbhsp_put_pipe(struct usbhs_pipe *pipe) in usbhsp_put_pipe() argument
668 usbhsp_flags_init(pipe); in usbhsp_put_pipe()
676 struct usbhs_pipe *pipe; in usbhs_pipe_init() local
679 usbhs_for_each_pipe_with_dcp(pipe, priv, i) { in usbhs_pipe_init()
680 usbhsp_flags_init(pipe); in usbhs_pipe_init()
681 pipe->fifo = NULL; in usbhs_pipe_init()
682 pipe->mod_private = NULL; in usbhs_pipe_init()
683 INIT_LIST_HEAD(&pipe->list); in usbhs_pipe_init()
686 usbhs_pipe_clear(pipe); in usbhs_pipe_init()
697 struct usbhs_pipe *pipe; in usbhs_pipe_malloc() local
702 pipe = usbhsp_get_pipe(priv, endpoint_type); in usbhs_pipe_malloc()
703 if (!pipe) { in usbhs_pipe_malloc()
709 INIT_LIST_HEAD(&pipe->list); in usbhs_pipe_malloc()
711 usbhs_pipe_disable(pipe); in usbhs_pipe_malloc()
714 ret = usbhsp_pipe_barrier(pipe); in usbhs_pipe_malloc()
716 dev_err(dev, "pipe setup failed %d\n", usbhs_pipe_number(pipe)); in usbhs_pipe_malloc()
720 if (usbhsp_setup_pipecfg(pipe, is_host, dir_in, &pipecfg)) { in usbhs_pipe_malloc()
725 pipebuf = usbhsp_setup_pipebuff(pipe); in usbhs_pipe_malloc()
727 usbhsp_pipe_select(pipe); in usbhs_pipe_malloc()
728 usbhsp_pipe_cfg_set(pipe, 0xFFFF, pipecfg); in usbhs_pipe_malloc()
729 usbhsp_pipe_buf_set(pipe, 0xFFFF, pipebuf); in usbhs_pipe_malloc()
730 usbhs_pipe_clear(pipe); in usbhs_pipe_malloc()
732 usbhs_pipe_sequence_data0(pipe); in usbhs_pipe_malloc()
735 usbhs_pipe_number(pipe), in usbhs_pipe_malloc()
736 usbhs_pipe_name(pipe), in usbhs_pipe_malloc()
737 usbhs_pipe_is_dir_in(pipe) ? "in" : "out"); in usbhs_pipe_malloc()
744 return pipe; in usbhs_pipe_malloc()
747 void usbhs_pipe_free(struct usbhs_pipe *pipe) in usbhs_pipe_free() argument
749 usbhsp_pipe_select(pipe); in usbhs_pipe_free()
750 usbhsp_pipe_cfg_set(pipe, 0xFFFF, 0); in usbhs_pipe_free()
751 usbhsp_put_pipe(pipe); in usbhs_pipe_free()
754 void usbhs_pipe_select_fifo(struct usbhs_pipe *pipe, struct usbhs_fifo *fifo) in usbhs_pipe_select_fifo() argument
756 if (pipe->fifo) in usbhs_pipe_select_fifo()
757 pipe->fifo->pipe = NULL; in usbhs_pipe_select_fifo()
759 pipe->fifo = fifo; in usbhs_pipe_select_fifo()
762 fifo->pipe = pipe; in usbhs_pipe_select_fifo()
771 struct usbhs_pipe *pipe; in usbhs_dcp_malloc() local
773 pipe = usbhsp_get_pipe(priv, USB_ENDPOINT_XFER_CONTROL); in usbhs_dcp_malloc()
774 if (!pipe) in usbhs_dcp_malloc()
777 INIT_LIST_HEAD(&pipe->list); in usbhs_dcp_malloc()
783 return pipe; in usbhs_dcp_malloc()
786 void usbhs_dcp_control_transfer_done(struct usbhs_pipe *pipe) in usbhs_dcp_control_transfer_done() argument
788 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhs_dcp_control_transfer_done()
790 WARN_ON(!usbhs_pipe_is_dcp(pipe)); in usbhs_dcp_control_transfer_done()
792 usbhs_pipe_enable(pipe); in usbhs_dcp_control_transfer_done()
795 usbhsp_pipectrl_set(pipe, CCPL, CCPL); in usbhs_dcp_control_transfer_done()
798 void usbhs_dcp_dir_for_host(struct usbhs_pipe *pipe, int dir_out) in usbhs_dcp_dir_for_host() argument
800 usbhsp_pipe_cfg_set(pipe, DIR_OUT, in usbhs_dcp_dir_for_host()
810 struct usbhs_pipe *pipe; in usbhs_pipe_probe() local
823 info->pipe = kcalloc(pipe_size, sizeof(struct usbhs_pipe), in usbhs_pipe_probe()
825 if (!info->pipe) in usbhs_pipe_probe()
833 usbhs_for_each_pipe_with_dcp(pipe, priv, i) { in usbhs_pipe_probe()
834 pipe->priv = priv; in usbhs_pipe_probe()
836 usbhs_pipe_type(pipe) = in usbhs_pipe_probe()
850 kfree(info->pipe); in usbhs_pipe_remove()