Lines Matching full:tmu
3 * Thunderbolt Time Management Unit (TMU) support
73 sw->tmu.cap + TMU_RTR_CS_0, 1); in tb_switch_set_tmu_mode_params()
81 sw->tmu.cap + TMU_RTR_CS_0, 1); in tb_switch_set_tmu_mode_params()
86 sw->tmu.cap + TMU_RTR_CS_15, 1); in tb_switch_set_tmu_mode_params()
100 sw->tmu.cap + TMU_RTR_CS_15, 1); in tb_switch_set_tmu_mode_params()
108 sw->tmu.cap + TMU_RTR_CS_18, 1); in tb_switch_set_tmu_mode_params()
116 sw->tmu.cap + TMU_RTR_CS_18, 1); in tb_switch_set_tmu_mode_params()
128 sw->tmu.cap + TMU_RTR_CS_0, 1); in tb_switch_tmu_ucap_is_supported()
141 sw->tmu.cap + TMU_RTR_CS_3, 1); in tb_switch_tmu_rate_read()
155 sw->tmu.cap + TMU_RTR_CS_3, 1); in tb_switch_tmu_rate_write()
163 sw->tmu.cap + TMU_RTR_CS_3, 1); in tb_switch_tmu_rate_write()
188 if (!port->sw->tmu.has_ucap) in tb_port_tmu_set_unidirectional()
338 offset = sw->tmu.cap + TMU_RTR_CS_0; in tb_switch_tmu_set_time_disruption()
364 tb_sw_dbg(sw, "TMU: supports uni-directional mode\n"); in tmu_mode_init()
367 tb_sw_dbg(sw, "TMU: supports enhanced uni-directional mode\n"); in tmu_mode_init()
375 sw->tmu.mode = TB_SWITCH_TMU_MODE_OFF; in tmu_mode_init()
381 sw->tmu.mode = TB_SWITCH_TMU_MODE_MEDRES_ENHANCED_UNI; in tmu_mode_init()
384 sw->tmu.mode = TB_SWITCH_TMU_MODE_LOWRES; in tmu_mode_init()
386 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_UNI; in tmu_mode_init()
388 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_BI; in tmu_mode_init()
391 sw->tmu.mode = TB_SWITCH_TMU_MODE_HIFI_BI; in tmu_mode_init()
395 sw->tmu.mode_request = sw->tmu.mode; in tmu_mode_init()
396 sw->tmu.has_ucap = ucap; in tmu_mode_init()
402 * tb_switch_tmu_init() - Initialize switch TMU structures
405 * This function must be called before other TMU related functions to
419 sw->tmu.cap = ret; in tb_switch_tmu_init()
433 tb_sw_dbg(sw, "TMU: current mode: %s\n", tmu_mode_name(sw->tmu.mode)); in tb_switch_tmu_init()
459 if (!root_switch->tmu.cap) in tb_switch_tmu_post_time()
463 root_switch->tmu.cap + TMU_RTR_CS_1, in tb_switch_tmu_post_time()
469 tb_sw_dbg(root_switch, "TMU: local_time[%d]=0x%08x\n", i, in tb_switch_tmu_post_time()
484 post_local_time_offset = sw->tmu.cap + TMU_RTR_CS_22; in tb_switch_tmu_post_time()
485 post_time_offset = sw->tmu.cap + TMU_RTR_CS_24; in tb_switch_tmu_post_time()
486 post_time_high_offset = sw->tmu.cap + TMU_RTR_CS_25; in tb_switch_tmu_post_time()
529 tb_sw_dbg(sw, "TMU: updated local time to %#llx\n", local_time); in tb_switch_tmu_post_time()
554 * tb_switch_tmu_disable() - Disable TMU of a switch
555 * @sw: Switch whose TMU to disable
557 * Turns off TMU of @sw if it is enabled. If not enabled does nothing.
562 if (sw->tmu.mode == TB_SWITCH_TMU_MODE_OFF) in tb_switch_tmu_disable()
572 * In case of uni-directional time sync, TMU handshake is in tb_switch_tmu_disable()
574 * time sync, TMU handshake is initiated by downstream router. in tb_switch_tmu_disable()
579 * uni-directional mode and we don't want to change it's TMU in tb_switch_tmu_disable()
591 switch (sw->tmu.mode) { in tb_switch_tmu_disable()
614 sw->tmu.mode = TB_SWITCH_TMU_MODE_OFF; in tb_switch_tmu_disable()
616 tb_sw_dbg(sw, "TMU: disabled\n"); in tb_switch_tmu_disable()
630 * bi-directional or uni-directional TMU mode, get back to the TMU in tb_switch_tmu_off()
638 switch (sw->tmu.mode_request) { in tb_switch_tmu_off()
653 tb_switch_set_tmu_mode_params(sw, sw->tmu.mode); in tb_switch_tmu_off()
659 * This function is called when the previous TMU mode was
723 * This function is called when the previous TMU mode was
734 tmu_rates[sw->tmu.mode_request]); 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()
766 * This function is called when the previous TMU mode was
771 unsigned int rate = tmu_rates[sw->tmu.mode_request]; in tb_switch_tmu_enable_enhanced()
776 ret = tb_switch_set_tmu_mode_params(sw, sw->tmu.mode_request); 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()
795 ret = tb_port_set_tmu_mode_params(down, sw->tmu.mode_request); in tb_switch_tmu_enable_enhanced()
816 unsigned int rate = tmu_rates[sw->tmu.mode]; in tb_switch_tmu_change_mode_prev()
823 * get back to the TMU configurations in previous mode. in tb_switch_tmu_change_mode_prev()
827 switch (sw->tmu.mode) { in tb_switch_tmu_change_mode_prev()
843 tb_switch_set_tmu_mode_params(sw, sw->tmu.mode); in tb_switch_tmu_change_mode_prev()
845 switch (sw->tmu.mode) { in tb_switch_tmu_change_mode_prev()
862 unsigned int rate = tmu_rates[sw->tmu.mode_request]; in tb_switch_tmu_change_mode()
870 switch (sw->tmu.mode_request) { 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()
900 switch (sw->tmu.mode_request) { in tb_switch_tmu_change_mode()
935 * tb_switch_tmu_enable() - Enable TMU on a router
936 * @sw: Router whose TMU to enable
938 * Enables TMU of a router to be in uni-directional Normal/HiFi or
950 (sw->tmu.mode_request == TB_SWITCH_TMU_MODE_LOWRES || in tb_switch_tmu_enable()
951 sw->tmu.mode_request == TB_SWITCH_TMU_MODE_HIFI_UNI)) { in tb_switch_tmu_enable()
967 if (sw->tmu.mode == TB_SWITCH_TMU_MODE_OFF) { in tb_switch_tmu_enable()
968 switch (sw->tmu.mode_request) { in tb_switch_tmu_enable()
984 } else if (sw->tmu.mode == TB_SWITCH_TMU_MODE_LOWRES || in tb_switch_tmu_enable()
985 sw->tmu.mode == TB_SWITCH_TMU_MODE_HIFI_UNI || in tb_switch_tmu_enable()
986 sw->tmu.mode == TB_SWITCH_TMU_MODE_HIFI_BI) { in tb_switch_tmu_enable()
998 ret = tb_switch_tmu_rate_write(sw, tmu_rates[sw->tmu.mode_request]); in tb_switch_tmu_enable()
1002 tb_sw_warn(sw, "TMU: failed to enable mode %s: %d\n", in tb_switch_tmu_enable()
1003 tmu_mode_name(sw->tmu.mode_request), ret); in tb_switch_tmu_enable()
1005 sw->tmu.mode = sw->tmu.mode_request; in tb_switch_tmu_enable()
1006 tb_sw_dbg(sw, "TMU: mode set to: %s\n", tmu_mode_name(sw->tmu.mode)); in tb_switch_tmu_enable()
1013 * tb_switch_tmu_configure() - Configure the TMU mode
1017 * Selects the TMU mode that is enabled when tb_switch_tmu_enable() is
1032 if (!sw->tmu.has_ucap) in tb_switch_tmu_configure()
1051 tb_sw_warn(sw, "TMU: unsupported mode %u\n", mode); in tb_switch_tmu_configure()
1055 if (sw->tmu.mode_request != mode) { in tb_switch_tmu_configure()
1056 tb_sw_dbg(sw, "TMU: mode change %s -> %s requested\n", in tb_switch_tmu_configure()
1057 tmu_mode_name(sw->tmu.mode), tmu_mode_name(mode)); in tb_switch_tmu_configure()
1058 sw->tmu.mode_request = mode; in tb_switch_tmu_configure()