• Home
  • Raw
  • Download

Lines Matching refs:pipe

42 char *usbhs_pipe_name(struct usbhs_pipe *pipe)  in usbhs_pipe_name()  argument
44 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 val = usbhsp_pipectrl_get(pipe); in usbhsp_pipe_barrier()
271 int usbhs_pipe_is_accessible(struct usbhs_pipe *pipe) in usbhs_pipe_is_accessible() argument
275 val = usbhsp_pipectrl_get(pipe); in usbhs_pipe_is_accessible()
282 bool usbhs_pipe_contains_transmittable_data(struct usbhs_pipe *pipe) in usbhs_pipe_contains_transmittable_data() argument
287 if (usbhs_pipe_is_dcp(pipe)) in usbhs_pipe_contains_transmittable_data()
290 val = usbhsp_pipectrl_get(pipe); in usbhs_pipe_contains_transmittable_data()
300 static void __usbhsp_pid_try_nak_if_stall(struct usbhs_pipe *pipe) in __usbhsp_pid_try_nak_if_stall() argument
302 u16 pid = usbhsp_pipectrl_get(pipe); in __usbhsp_pid_try_nak_if_stall()
312 usbhsp_pipectrl_set(pipe, PID_MASK, PID_STALL10); in __usbhsp_pid_try_nak_if_stall()
315 usbhsp_pipectrl_set(pipe, PID_MASK, PID_NAK); in __usbhsp_pid_try_nak_if_stall()
319 void usbhs_pipe_disable(struct usbhs_pipe *pipe) in usbhs_pipe_disable() argument
325 __usbhsp_pid_try_nak_if_stall(pipe); in usbhs_pipe_disable()
327 usbhsp_pipectrl_set(pipe, PID_MASK, PID_NAK); in usbhs_pipe_disable()
330 val = usbhsp_pipectrl_get(pipe); in usbhs_pipe_disable()
339 void usbhs_pipe_enable(struct usbhs_pipe *pipe) in usbhs_pipe_enable() argument
342 __usbhsp_pid_try_nak_if_stall(pipe); in usbhs_pipe_enable()
344 usbhsp_pipectrl_set(pipe, PID_MASK, PID_BUF); in usbhs_pipe_enable()
347 void usbhs_pipe_stall(struct usbhs_pipe *pipe) in usbhs_pipe_stall() argument
349 u16 pid = usbhsp_pipectrl_get(pipe); in usbhs_pipe_stall()
359 usbhsp_pipectrl_set(pipe, PID_MASK, PID_STALL10); in usbhs_pipe_stall()
362 usbhsp_pipectrl_set(pipe, PID_MASK, PID_STALL11); in usbhs_pipe_stall()
367 int usbhs_pipe_is_stall(struct usbhs_pipe *pipe) in usbhs_pipe_is_stall() argument
369 u16 pid = usbhsp_pipectrl_get(pipe) & PID_MASK; in usbhs_pipe_is_stall()
374 void usbhs_pipe_set_trans_count_if_bulk(struct usbhs_pipe *pipe, int len) in usbhs_pipe_set_trans_count_if_bulk() argument
376 if (!usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) in usbhs_pipe_set_trans_count_if_bulk()
382 usbhsp_pipe_tre_set(pipe, TRCLR | TRENB, TRCLR); in usbhs_pipe_set_trans_count_if_bulk()
390 if (usbhs_pipe_is_dir_in(pipe)) { in usbhs_pipe_set_trans_count_if_bulk()
391 int maxp = usbhs_pipe_get_maxpacket(pipe); in usbhs_pipe_set_trans_count_if_bulk()
393 usbhsp_pipe_trn_set(pipe, 0xffff, DIV_ROUND_UP(len, maxp)); in usbhs_pipe_set_trans_count_if_bulk()
394 usbhsp_pipe_tre_set(pipe, TRENB, TRENB); /* enable */ in usbhs_pipe_set_trans_count_if_bulk()
402 static int usbhsp_possible_double_buffer(struct usbhs_pipe *pipe) in usbhsp_possible_double_buffer() argument
407 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK) || in usbhsp_possible_double_buffer()
408 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC)) in usbhsp_possible_double_buffer()
414 static u16 usbhsp_setup_pipecfg(struct usbhs_pipe *pipe, in usbhsp_setup_pipecfg() argument
430 int is_double = usbhsp_possible_double_buffer(pipe); in usbhsp_setup_pipecfg()
432 if (usbhs_pipe_is_dcp(pipe)) in usbhsp_setup_pipecfg()
445 type = type_array[usbhs_pipe_type(pipe)]; in usbhsp_setup_pipecfg()
448 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC) || in usbhsp_setup_pipecfg()
449 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) in usbhsp_setup_pipecfg()
453 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_ISOC) || in usbhsp_setup_pipecfg()
454 usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) in usbhsp_setup_pipecfg()
458 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK)) in usbhsp_setup_pipecfg()
463 usbhsp_flags_set(pipe, IS_DIR_HOST); in usbhsp_setup_pipecfg()
469 usbhsp_flags_set(pipe, IS_DIR_IN); in usbhsp_setup_pipecfg()
472 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_BULK) && in usbhsp_setup_pipecfg()
488 static u16 usbhsp_setup_pipebuff(struct usbhs_pipe *pipe) in usbhsp_setup_pipebuff() argument
490 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhsp_setup_pipebuff()
493 int pipe_num = usbhs_pipe_number(pipe); in usbhsp_setup_pipebuff()
494 int is_double = usbhsp_possible_double_buffer(pipe); in usbhsp_setup_pipebuff()
532 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_CONTROL)) in usbhsp_setup_pipebuff()
534 else if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT)) in usbhsp_setup_pipebuff()
544 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT)) { in usbhsp_setup_pipebuff()
564 void usbhs_pipe_config_update(struct usbhs_pipe *pipe, u16 devsel, in usbhs_pipe_config_update() argument
568 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhs_pipe_config_update()
576 usbhsp_pipe_barrier(pipe); in usbhs_pipe_config_update()
578 pipe->maxp = maxp; in usbhs_pipe_config_update()
580 usbhsp_pipe_select(pipe); in usbhs_pipe_config_update()
581 usbhsp_pipe_maxp_set(pipe, 0xFFFF, in usbhs_pipe_config_update()
585 if (!usbhs_pipe_is_dcp(pipe)) in usbhs_pipe_config_update()
586 usbhsp_pipe_cfg_set(pipe, 0x000F, epnum); in usbhs_pipe_config_update()
592 int usbhs_pipe_get_maxpacket(struct usbhs_pipe *pipe) in usbhs_pipe_get_maxpacket() argument
599 return pipe->maxp; in usbhs_pipe_get_maxpacket()
602 int usbhs_pipe_is_dir_in(struct usbhs_pipe *pipe) in usbhs_pipe_is_dir_in() argument
604 return usbhsp_flags_has(pipe, IS_DIR_IN); in usbhs_pipe_is_dir_in()
607 int usbhs_pipe_is_dir_host(struct usbhs_pipe *pipe) in usbhs_pipe_is_dir_host() argument
609 return usbhsp_flags_has(pipe, IS_DIR_HOST); in usbhs_pipe_is_dir_host()
612 int usbhs_pipe_is_running(struct usbhs_pipe *pipe) in usbhs_pipe_is_running() argument
614 return usbhsp_flags_has(pipe, IS_RUNNING); in usbhs_pipe_is_running()
617 void usbhs_pipe_running(struct usbhs_pipe *pipe, int running) in usbhs_pipe_running() argument
620 usbhsp_flags_set(pipe, IS_RUNNING); in usbhs_pipe_running()
622 usbhsp_flags_clr(pipe, IS_RUNNING); in usbhs_pipe_running()
625 void usbhs_pipe_data_sequence(struct usbhs_pipe *pipe, int sequence) in usbhs_pipe_data_sequence() argument
647 usbhsp_pipectrl_set(pipe, mask, val); in usbhs_pipe_data_sequence()
650 static int usbhs_pipe_get_data_sequence(struct usbhs_pipe *pipe) in usbhs_pipe_get_data_sequence() argument
652 return !!(usbhsp_pipectrl_get(pipe) & SQMON); in usbhs_pipe_get_data_sequence()
655 void usbhs_pipe_clear(struct usbhs_pipe *pipe) in usbhs_pipe_clear() argument
657 if (usbhs_pipe_is_dcp(pipe)) { in usbhs_pipe_clear()
658 usbhs_fifo_clear_dcp(pipe); in usbhs_pipe_clear()
660 usbhsp_pipectrl_set(pipe, ACLRM, ACLRM); in usbhs_pipe_clear()
661 usbhsp_pipectrl_set(pipe, ACLRM, 0); in usbhs_pipe_clear()
665 void usbhs_pipe_config_change_bfre(struct usbhs_pipe *pipe, int enable) in usbhs_pipe_config_change_bfre() argument
669 if (usbhs_pipe_is_dcp(pipe)) in usbhs_pipe_config_change_bfre()
672 usbhsp_pipe_select(pipe); in usbhs_pipe_config_change_bfre()
674 if (!(enable ^ !!(usbhsp_pipe_cfg_get(pipe) & BFRE))) in usbhs_pipe_config_change_bfre()
677 sequence = usbhs_pipe_get_data_sequence(pipe); in usbhs_pipe_config_change_bfre()
678 usbhsp_pipe_cfg_set(pipe, BFRE, enable ? BFRE : 0); in usbhs_pipe_config_change_bfre()
679 usbhs_pipe_clear(pipe); in usbhs_pipe_config_change_bfre()
680 usbhs_pipe_data_sequence(pipe, sequence); in usbhs_pipe_config_change_bfre()
685 struct usbhs_pipe *pos, *pipe; in usbhsp_get_pipe() local
691 pipe = NULL; in usbhsp_get_pipe()
698 pipe = pos; in usbhsp_get_pipe()
702 if (!pipe) in usbhsp_get_pipe()
708 usbhsp_flags_init(pipe); in usbhsp_get_pipe()
709 usbhsp_flags_set(pipe, IS_USED); in usbhsp_get_pipe()
711 return pipe; in usbhsp_get_pipe()
714 static void usbhsp_put_pipe(struct usbhs_pipe *pipe) in usbhsp_put_pipe() argument
716 usbhsp_flags_init(pipe); in usbhsp_put_pipe()
723 struct usbhs_pipe *pipe; in usbhs_pipe_init() local
739 usbhs_for_each_pipe_with_dcp(pipe, priv, i) { in usbhs_pipe_init()
740 if (usbhs_pipe_type_is(pipe, USB_ENDPOINT_XFER_INT)) in usbhs_pipe_init()
743 usbhsp_flags_init(pipe); in usbhs_pipe_init()
744 pipe->fifo = NULL; in usbhs_pipe_init()
745 pipe->mod_private = NULL; in usbhs_pipe_init()
746 INIT_LIST_HEAD(&pipe->list); in usbhs_pipe_init()
749 usbhs_pipe_clear(pipe); in usbhs_pipe_init()
760 struct usbhs_pipe *pipe; in usbhs_pipe_malloc() local
765 pipe = usbhsp_get_pipe(priv, endpoint_type); in usbhs_pipe_malloc()
766 if (!pipe) { in usbhs_pipe_malloc()
772 INIT_LIST_HEAD(&pipe->list); in usbhs_pipe_malloc()
774 usbhs_pipe_disable(pipe); in usbhs_pipe_malloc()
777 ret = usbhsp_pipe_barrier(pipe); in usbhs_pipe_malloc()
779 dev_err(dev, "pipe setup failed %d\n", usbhs_pipe_number(pipe)); in usbhs_pipe_malloc()
783 pipecfg = usbhsp_setup_pipecfg(pipe, is_host, dir_in); in usbhs_pipe_malloc()
784 pipebuf = usbhsp_setup_pipebuff(pipe); in usbhs_pipe_malloc()
786 usbhsp_pipe_select(pipe); in usbhs_pipe_malloc()
787 usbhsp_pipe_cfg_set(pipe, 0xFFFF, pipecfg); in usbhs_pipe_malloc()
788 usbhsp_pipe_buf_set(pipe, 0xFFFF, pipebuf); in usbhs_pipe_malloc()
789 usbhs_pipe_clear(pipe); in usbhs_pipe_malloc()
791 usbhs_pipe_sequence_data0(pipe); in usbhs_pipe_malloc()
794 usbhs_pipe_number(pipe), in usbhs_pipe_malloc()
795 usbhs_pipe_name(pipe), in usbhs_pipe_malloc()
796 usbhs_pipe_is_dir_in(pipe) ? "in" : "out"); in usbhs_pipe_malloc()
803 return pipe; in usbhs_pipe_malloc()
806 void usbhs_pipe_free(struct usbhs_pipe *pipe) in usbhs_pipe_free() argument
808 usbhsp_pipe_select(pipe); in usbhs_pipe_free()
809 usbhsp_pipe_cfg_set(pipe, 0xFFFF, 0); in usbhs_pipe_free()
810 usbhsp_put_pipe(pipe); in usbhs_pipe_free()
813 void usbhs_pipe_select_fifo(struct usbhs_pipe *pipe, struct usbhs_fifo *fifo) in usbhs_pipe_select_fifo() argument
815 if (pipe->fifo) in usbhs_pipe_select_fifo()
816 pipe->fifo->pipe = NULL; in usbhs_pipe_select_fifo()
818 pipe->fifo = fifo; in usbhs_pipe_select_fifo()
821 fifo->pipe = pipe; in usbhs_pipe_select_fifo()
830 struct usbhs_pipe *pipe; in usbhs_dcp_malloc() local
832 pipe = usbhsp_get_pipe(priv, USB_ENDPOINT_XFER_CONTROL); in usbhs_dcp_malloc()
833 if (!pipe) in usbhs_dcp_malloc()
836 INIT_LIST_HEAD(&pipe->list); in usbhs_dcp_malloc()
842 return pipe; in usbhs_dcp_malloc()
845 void usbhs_dcp_control_transfer_done(struct usbhs_pipe *pipe) in usbhs_dcp_control_transfer_done() argument
847 struct usbhs_priv *priv = usbhs_pipe_to_priv(pipe); in usbhs_dcp_control_transfer_done()
849 WARN_ON(!usbhs_pipe_is_dcp(pipe)); in usbhs_dcp_control_transfer_done()
851 usbhs_pipe_enable(pipe); in usbhs_dcp_control_transfer_done()
854 usbhsp_pipectrl_set(pipe, CCPL, CCPL); in usbhs_dcp_control_transfer_done()
857 void usbhs_dcp_dir_for_host(struct usbhs_pipe *pipe, int dir_out) in usbhs_dcp_dir_for_host() argument
859 usbhsp_pipe_cfg_set(pipe, DIR_OUT, in usbhs_dcp_dir_for_host()
869 struct usbhs_pipe *pipe; in usbhs_pipe_probe() local
881 info->pipe = kzalloc(sizeof(struct usbhs_pipe) * pipe_size, GFP_KERNEL); in usbhs_pipe_probe()
882 if (!info->pipe) { in usbhs_pipe_probe()
892 usbhs_for_each_pipe_with_dcp(pipe, priv, i) { in usbhs_pipe_probe()
893 pipe->priv = priv; in usbhs_pipe_probe()
895 usbhs_pipe_type(pipe) = in usbhs_pipe_probe()
909 kfree(info->pipe); in usbhs_pipe_remove()