tmu.c (a28ec0e165ba2f90568828a2578aaa8540e13bc5) | tmu.c (23ccd21ccb56fbfd32cb9016dcb1ccb08c662396) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Thunderbolt Time Management Unit (TMU) support 4 * 5 * Copyright (C) 2019, Intel Corporation 6 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> 7 * Rajmohan Mani <rajmohan.mani@intel.com> 8 */ --- 138 unchanged lines hidden (view full) --- 147 148static int tb_port_tmu_time_sync_enable(struct tb_port *port) 149{ 150 return tb_port_tmu_time_sync(port, false); 151} 152 153static int tb_switch_tmu_set_time_disruption(struct tb_switch *sw, bool set) 154{ | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * Thunderbolt Time Management Unit (TMU) support 4 * 5 * Copyright (C) 2019, Intel Corporation 6 * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> 7 * Rajmohan Mani <rajmohan.mani@intel.com> 8 */ --- 138 unchanged lines hidden (view full) --- 147 148static int tb_port_tmu_time_sync_enable(struct tb_port *port) 149{ 150 return tb_port_tmu_time_sync(port, false); 151} 152 153static int tb_switch_tmu_set_time_disruption(struct tb_switch *sw, bool set) 154{ |
155 u32 val, offset, bit; |
|
155 int ret; | 156 int ret; |
156 u32 val; | |
157 | 157 |
158 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, 159 sw->tmu.cap + TMU_RTR_CS_0, 1); | 158 if (tb_switch_is_usb4(sw)) { 159 offset = sw->tmu.cap + TMU_RTR_CS_0; 160 bit = TMU_RTR_CS_0_TD; 161 } else { 162 offset = sw->cap_vsec_tmu + TB_TIME_VSEC_3_CS_26; 163 bit = TB_TIME_VSEC_3_CS_26_TD; 164 } 165 166 ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, offset, 1); |
160 if (ret) 161 return ret; 162 163 if (set) | 167 if (ret) 168 return ret; 169 170 if (set) |
164 val |= TMU_RTR_CS_0_TD; | 171 val |= bit; |
165 else | 172 else |
166 val &= ~TMU_RTR_CS_0_TD; | 173 val &= ~bit; |
167 | 174 |
168 return tb_sw_write(sw, &val, TB_CFG_SWITCH, 169 sw->tmu.cap + TMU_RTR_CS_0, 1); | 175 return tb_sw_write(sw, &val, TB_CFG_SWITCH, offset, 1); |
170} 171 172/** 173 * tb_switch_tmu_init() - Initialize switch TMU structures 174 * @sw: Switch to initialized 175 * 176 * This function must be called before other TMU related functions to 177 * makes the internal structures are filled in correctly. Does not --- 388 unchanged lines hidden --- | 176} 177 178/** 179 * tb_switch_tmu_init() - Initialize switch TMU structures 180 * @sw: Switch to initialized 181 * 182 * This function must be called before other TMU related functions to 183 * makes the internal structures are filled in correctly. Does not --- 388 unchanged lines hidden --- |