Lines Matching refs:ret

67 	int ret;  in tb_switch_set_tmu_mode_params()  local
72 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_set_tmu_mode_params()
74 if (ret) in tb_switch_set_tmu_mode_params()
75 return ret; in tb_switch_set_tmu_mode_params()
80 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, in tb_switch_set_tmu_mode_params()
82 if (ret) in tb_switch_set_tmu_mode_params()
83 return ret; in tb_switch_set_tmu_mode_params()
85 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_set_tmu_mode_params()
87 if (ret) in tb_switch_set_tmu_mode_params()
88 return ret; in tb_switch_set_tmu_mode_params()
99 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, in tb_switch_set_tmu_mode_params()
101 if (ret) in tb_switch_set_tmu_mode_params()
102 return ret; in tb_switch_set_tmu_mode_params()
107 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_set_tmu_mode_params()
109 if (ret) in tb_switch_set_tmu_mode_params()
110 return ret; in tb_switch_set_tmu_mode_params()
115 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, in tb_switch_set_tmu_mode_params()
119 return ret; in tb_switch_set_tmu_mode_params()
124 int ret; in tb_switch_tmu_ucap_is_supported() local
127 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_tmu_ucap_is_supported()
129 if (ret) in tb_switch_tmu_ucap_is_supported()
137 int ret; in tb_switch_tmu_rate_read() local
140 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_tmu_rate_read()
142 if (ret) in tb_switch_tmu_rate_read()
143 return ret; in tb_switch_tmu_rate_read()
151 int ret; in tb_switch_tmu_rate_write() local
154 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_tmu_rate_write()
156 if (ret) in tb_switch_tmu_rate_write()
157 return ret; in tb_switch_tmu_rate_write()
170 int ret; in tb_port_tmu_write() local
172 ret = tb_port_read(port, &data, TB_CFG_PORT, port->cap_tmu + offset, 1); in tb_port_tmu_write()
173 if (ret) in tb_port_tmu_write()
174 return ret; in tb_port_tmu_write()
207 int ret; in tb_port_tmu_is_unidirectional() local
210 ret = tb_port_read(port, &val, TB_CFG_PORT, in tb_port_tmu_is_unidirectional()
212 if (ret) in tb_port_tmu_is_unidirectional()
220 int ret; in tb_port_tmu_is_enhanced() local
223 ret = tb_port_read(port, &val, TB_CFG_PORT, in tb_port_tmu_is_enhanced()
225 if (ret) in tb_port_tmu_is_enhanced()
234 int ret; in tb_port_tmu_enhanced_enable() local
240 ret = tb_port_read(port, &val, TB_CFG_PORT, in tb_port_tmu_enhanced_enable()
242 if (ret) in tb_port_tmu_enhanced_enable()
243 return ret; in tb_port_tmu_enhanced_enable()
258 int ret; in tb_port_set_tmu_mode_params() local
265 ret = tb_port_read(port, &val, TB_CFG_PORT, in tb_port_set_tmu_mode_params()
267 if (ret) in tb_port_set_tmu_mode_params()
268 return ret; in tb_port_set_tmu_mode_params()
275 ret = tb_port_write(port, &val, TB_CFG_PORT, in tb_port_set_tmu_mode_params()
277 if (ret) in tb_port_set_tmu_mode_params()
278 return ret; in tb_port_set_tmu_mode_params()
280 ret = tb_port_read(port, &val, TB_CFG_PORT, in tb_port_set_tmu_mode_params()
282 if (ret) in tb_port_set_tmu_mode_params()
283 return ret; in tb_port_set_tmu_mode_params()
297 int ret; in tb_port_tmu_rate_write() local
303 ret = tb_port_read(port, &val, TB_CFG_PORT, in tb_port_tmu_rate_write()
305 if (ret) in tb_port_tmu_rate_write()
306 return ret; in tb_port_tmu_rate_write()
335 int ret; in tb_switch_tmu_set_time_disruption() local
345 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, offset, 1); in tb_switch_tmu_set_time_disruption()
346 if (ret) in tb_switch_tmu_set_time_disruption()
347 return ret; in tb_switch_tmu_set_time_disruption()
360 int ret, rate; in tmu_mode_init() local
369 ret = tb_switch_tmu_rate_read(sw); in tmu_mode_init()
370 if (ret < 0) in tmu_mode_init()
371 return ret; in tmu_mode_init()
372 rate = ret; in tmu_mode_init()
412 int ret; in tb_switch_tmu_init() local
417 ret = tb_switch_find_cap(sw, TB_SWITCH_CAP_TMU); in tb_switch_tmu_init()
418 if (ret > 0) in tb_switch_tmu_init()
419 sw->tmu.cap = ret; in tb_switch_tmu_init()
429 ret = tmu_mode_init(sw); in tb_switch_tmu_init()
430 if (ret) in tb_switch_tmu_init()
431 return ret; in tb_switch_tmu_init()
449 int i, ret, retries = 100; in tb_switch_tmu_post_time() local
462 ret = tb_sw_read(root_switch, gm_local_time, TB_CFG_SWITCH, in tb_switch_tmu_post_time()
465 if (ret) in tb_switch_tmu_post_time()
466 return ret; in tb_switch_tmu_post_time()
480 ret = tb_switch_tmu_set_time_disruption(sw, true); in tb_switch_tmu_post_time()
481 if (ret) in tb_switch_tmu_post_time()
482 return ret; in tb_switch_tmu_post_time()
492 ret = tb_sw_write(sw, &local_time, TB_CFG_SWITCH, in tb_switch_tmu_post_time()
494 if (ret) in tb_switch_tmu_post_time()
507 ret = tb_sw_write(sw, &post_time, TB_CFG_SWITCH, post_time_offset, 2); in tb_switch_tmu_post_time()
508 if (ret) in tb_switch_tmu_post_time()
511 ret = tb_sw_write(sw, &post_time_high, TB_CFG_SWITCH, in tb_switch_tmu_post_time()
513 if (ret) in tb_switch_tmu_post_time()
518 ret = tb_sw_read(sw, &post_time, TB_CFG_SWITCH, in tb_switch_tmu_post_time()
520 if (ret) in tb_switch_tmu_post_time()
525 ret = -ETIMEDOUT; in tb_switch_tmu_post_time()
533 return ret; in tb_switch_tmu_post_time()
538 int ret; in disable_enhanced() local
547 ret = tb_port_tmu_rate_write(down, 0); in disable_enhanced()
548 if (ret) in disable_enhanced()
549 return ret; in disable_enhanced()
567 int ret; in tb_switch_tmu_disable() local
582 ret = tb_switch_tmu_rate_write(sw, tmu_rates[TB_SWITCH_TMU_MODE_OFF]); in tb_switch_tmu_disable()
583 if (ret) in tb_switch_tmu_disable()
584 return ret; in tb_switch_tmu_disable()
587 ret = tb_port_tmu_time_sync_disable(down); in tb_switch_tmu_disable()
588 if (ret) in tb_switch_tmu_disable()
589 return ret; in tb_switch_tmu_disable()
596 ret = tb_port_tmu_unidirectional_disable(down); in tb_switch_tmu_disable()
597 if (ret) in tb_switch_tmu_disable()
598 return ret; in tb_switch_tmu_disable()
602 ret = disable_enhanced(up, down); in tb_switch_tmu_disable()
603 if (ret) in tb_switch_tmu_disable()
604 return ret; in tb_switch_tmu_disable()
665 int ret; in tb_switch_tmu_enable_bidirectional() local
670 ret = tb_port_tmu_unidirectional_disable(up); in tb_switch_tmu_enable_bidirectional()
671 if (ret) in tb_switch_tmu_enable_bidirectional()
672 return ret; in tb_switch_tmu_enable_bidirectional()
674 ret = tb_port_tmu_unidirectional_disable(down); in tb_switch_tmu_enable_bidirectional()
675 if (ret) in tb_switch_tmu_enable_bidirectional()
678 ret = tb_switch_tmu_rate_write(sw, tmu_rates[TB_SWITCH_TMU_MODE_HIFI_BI]); in tb_switch_tmu_enable_bidirectional()
679 if (ret) in tb_switch_tmu_enable_bidirectional()
682 ret = tb_port_tmu_time_sync_enable(up); in tb_switch_tmu_enable_bidirectional()
683 if (ret) in tb_switch_tmu_enable_bidirectional()
686 ret = tb_port_tmu_time_sync_enable(down); in tb_switch_tmu_enable_bidirectional()
687 if (ret) in tb_switch_tmu_enable_bidirectional()
694 return ret; in tb_switch_tmu_enable_bidirectional()
702 int ret; in tb_switch_tmu_disable_objections() local
704 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, in tb_switch_tmu_disable_objections()
706 if (ret) in tb_switch_tmu_disable_objections()
707 return ret; in tb_switch_tmu_disable_objections()
711 ret = tb_sw_write(sw, &val, TB_CFG_SWITCH, in tb_switch_tmu_disable_objections()
713 if (ret) in tb_switch_tmu_disable_objections()
714 return ret; in tb_switch_tmu_disable_objections()
729 int ret; in tb_switch_tmu_enable_unidirectional() local
733 ret = tb_switch_tmu_rate_write(tb_switch_parent(sw), in tb_switch_tmu_enable_unidirectional()
735 if (ret) in tb_switch_tmu_enable_unidirectional()
736 return ret; in tb_switch_tmu_enable_unidirectional()
738 ret = tb_switch_set_tmu_mode_params(sw, sw->tmu.mode_request); in tb_switch_tmu_enable_unidirectional()
739 if (ret) in tb_switch_tmu_enable_unidirectional()
740 return ret; in tb_switch_tmu_enable_unidirectional()
742 ret = tb_port_tmu_unidirectional_enable(up); in tb_switch_tmu_enable_unidirectional()
743 if (ret) in tb_switch_tmu_enable_unidirectional()
746 ret = tb_port_tmu_time_sync_enable(up); in tb_switch_tmu_enable_unidirectional()
747 if (ret) in tb_switch_tmu_enable_unidirectional()
750 ret = tb_port_tmu_unidirectional_enable(down); in tb_switch_tmu_enable_unidirectional()
751 if (ret) in tb_switch_tmu_enable_unidirectional()
754 ret = tb_port_tmu_time_sync_enable(down); in tb_switch_tmu_enable_unidirectional()
755 if (ret) in tb_switch_tmu_enable_unidirectional()
762 return ret; in tb_switch_tmu_enable_unidirectional()
773 int ret; in tb_switch_tmu_enable_enhanced() local
776 ret = tb_switch_set_tmu_mode_params(sw, sw->tmu.mode_request); in tb_switch_tmu_enable_enhanced()
777 if (ret) in tb_switch_tmu_enable_enhanced()
778 return ret; in tb_switch_tmu_enable_enhanced()
783 ret = tb_port_set_tmu_mode_params(up, sw->tmu.mode_request); in tb_switch_tmu_enable_enhanced()
784 if (ret) in tb_switch_tmu_enable_enhanced()
787 ret = tb_port_tmu_rate_write(up, rate); in tb_switch_tmu_enable_enhanced()
788 if (ret) in tb_switch_tmu_enable_enhanced()
791 ret = tb_port_tmu_enhanced_enable(up, true); in tb_switch_tmu_enable_enhanced()
792 if (ret) in tb_switch_tmu_enable_enhanced()
795 ret = tb_port_set_tmu_mode_params(down, sw->tmu.mode_request); in tb_switch_tmu_enable_enhanced()
796 if (ret) in tb_switch_tmu_enable_enhanced()
799 ret = tb_port_tmu_rate_write(down, rate); in tb_switch_tmu_enable_enhanced()
800 if (ret) in tb_switch_tmu_enable_enhanced()
803 ret = tb_port_tmu_enhanced_enable(down, true); in tb_switch_tmu_enable_enhanced()
804 if (ret) in tb_switch_tmu_enable_enhanced()
811 return ret; in tb_switch_tmu_enable_enhanced()
864 int ret; in tb_switch_tmu_change_mode() local
873 ret = tb_port_tmu_set_unidirectional(down, true); in tb_switch_tmu_change_mode()
874 if (ret) in tb_switch_tmu_change_mode()
876 ret = tb_switch_tmu_rate_write(tb_switch_parent(sw), rate); in tb_switch_tmu_change_mode()
877 if (ret) in tb_switch_tmu_change_mode()
882 ret = tb_port_tmu_set_unidirectional(down, false); in tb_switch_tmu_change_mode()
883 if (ret) in tb_switch_tmu_change_mode()
885 ret = tb_switch_tmu_rate_write(sw, rate); in tb_switch_tmu_change_mode()
886 if (ret) in tb_switch_tmu_change_mode()
895 ret = tb_switch_set_tmu_mode_params(sw, sw->tmu.mode_request); in tb_switch_tmu_change_mode()
896 if (ret) in tb_switch_tmu_change_mode()
897 return ret; in tb_switch_tmu_change_mode()
903 ret = tb_port_tmu_set_unidirectional(up, true); in tb_switch_tmu_change_mode()
904 if (ret) in tb_switch_tmu_change_mode()
909 ret = tb_port_tmu_set_unidirectional(up, false); in tb_switch_tmu_change_mode()
910 if (ret) in tb_switch_tmu_change_mode()
919 ret = tb_port_tmu_time_sync_enable(down); in tb_switch_tmu_change_mode()
920 if (ret) in tb_switch_tmu_change_mode()
923 ret = tb_port_tmu_time_sync_enable(up); in tb_switch_tmu_change_mode()
924 if (ret) in tb_switch_tmu_change_mode()
931 return ret; in tb_switch_tmu_change_mode()
944 int ret; in tb_switch_tmu_enable() local
952 ret = tb_switch_tmu_disable_objections(sw); in tb_switch_tmu_enable()
953 if (ret) in tb_switch_tmu_enable()
954 return ret; in tb_switch_tmu_enable()
957 ret = tb_switch_tmu_set_time_disruption(sw, true); in tb_switch_tmu_enable()
958 if (ret) in tb_switch_tmu_enable()
959 return ret; in tb_switch_tmu_enable()
971 ret = tb_switch_tmu_enable_unidirectional(sw); in tb_switch_tmu_enable()
975 ret = tb_switch_tmu_enable_bidirectional(sw); in tb_switch_tmu_enable()
978 ret = tb_switch_tmu_enable_enhanced(sw); in tb_switch_tmu_enable()
981 ret = -EINVAL; in tb_switch_tmu_enable()
987 ret = tb_switch_tmu_change_mode(sw); in tb_switch_tmu_enable()
989 ret = -EINVAL; in tb_switch_tmu_enable()
998 ret = tb_switch_tmu_rate_write(sw, tmu_rates[sw->tmu.mode_request]); in tb_switch_tmu_enable()
1001 if (ret) { in tb_switch_tmu_enable()
1003 tmu_mode_name(sw->tmu.mode_request), ret); in tb_switch_tmu_enable()