On Thu, Jul 06, 2023 at 07:18:38PM +0530, Sanjay R Mehta wrote: > > Agree. we will have to see what is going wrong in this case. > > Hi Mika, Hi, > When an unplug event occurs, the TMU is disabled by configuring the > TSPacketInterval bits in TMU_RTR_CS_3 to 0 using the > tb_switch_tmu_rate_write() API, followed by disabling the Time > Synchronization Handshake using the DTS bit in TMU_ADP_CS_6. The code > snippet for this functionality is present in the tb_switch_tmu_disable() > function, as shown below: > > ``` > tb_switch_tmu_rate_write(sw, TB_SWITCH_TMU_RATE_OFF); > tb_port_tmu_time_sync_disable(up); > ret = tb_port_tmu_time_sync_disable(down); > if (ret) > return ret; > ``` > > However, we have observed that the tb_switch_tmu_rate_write() function > fails to disable the TMU rate, and the code proceeds with disabling the > Time Synchronization Handshake. To address this issue, we have modified > the code to check the return value of the tb_switch_tmu_rate_write() > function and only proceed with disabling the Time Synchronization > Handshake if the TMU rate disabling succeeds. The updated code is as > follows: > > ``` > ret = tb_switch_tmu_rate_write(sw, tmu_rates[TB_SWITCH_TMU_MODE_OFF]); > if (ret) > return ret; > tb_port_tmu_time_sync_disable(up); > ret = tb_port_tmu_time_sync_disable(down); > if (ret) > return ret; > ``` > > Please let us know your thoughts on this solution. Makes sense to me.