Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3323035rwa; Tue, 23 Aug 2022 02:50:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR4V7cDUQXL1dfNGPUXt3hHZGBTqwBqECPwBbWIw/mJKlk/tuB0QR/wehjHoabvtrnjq5mXu X-Received: by 2002:a05:6402:3297:b0:446:3779:a4b8 with SMTP id f23-20020a056402329700b004463779a4b8mr2789263eda.161.1661248204524; Tue, 23 Aug 2022 02:50:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661248204; cv=none; d=google.com; s=arc-20160816; b=p17X3GDIiSlv9/VI2MgIJVb8lZWYhq6lhCP/dEupRqibdC+v+BQ+LyCVx8bv2s3Way UpBUo4ZN3mTmls6Kl2vSTlsXywJNHZ4NjQAdLBR8ZoVlMCbSz6Cop9L4K/g+zfKVSEsp FlefJnKN/6PRN+bGCmM/dWuuiHiVzax5wY1MC8HutW9WjIknglioE3Lgm48hRPI+e5xC 6B7+zh2pBe2WbuQC9nq5ytj03NkWYRBOOP+iVxCj94gPZxijX32vKl5jNHnQ0acrqEtM NK4R+52PWY9QyIxZq+pjbP/w8ZB5tY3kIy8lN8yJgY4j3GYomQM60mOYJa66D2AmPjti p+cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UD5V5QKAbxtSR+WgKuYFYQMeApv7/ebFTy7xcOFMH4A=; b=LxjJUGw04f/u/iF7M0CZSzaJFYclr9eb52VE4odssLd7buv3t+Wyn2k8ILVM9iPtN9 7uvIu0IQRpTHMUNDNPPlrsd+uYLKjQ29QVPHyDYELbS+uRwNTfoQl6+4f0B5i5JJvTl6 QLvcvBFCYzR/7SewAzYgaBNgBmqOO9hq/m58XeS1Wn0FLanPDeRSaQBhVkpJq8T0tabP U+7eipdEvpBM3M8tUGCUi+47kmTyRpgj/8wpYaSxESVKXAN7ZeMseWXaeYBGVQ+STJWQ DRW4bpga2mQrfEFtAxZhRgUYEQgUlAKeR7hSjhUyQTlbUQggvxz2SItCjapVFDMGMu46 SK/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VkZaIoRM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht18-20020a170907609200b0073094ce02casi11475388ejc.791.2022.08.23.02.49.38; Tue, 23 Aug 2022 02:50:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VkZaIoRM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243070AbiHWJM3 (ORCPT + 99 others); Tue, 23 Aug 2022 05:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348448AbiHWJKE (ORCPT ); Tue, 23 Aug 2022 05:10:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60DEF74DFA; Tue, 23 Aug 2022 01:30:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5A791B81C48; Tue, 23 Aug 2022 08:29:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5F18C433C1; Tue, 23 Aug 2022 08:29:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661243376; bh=ebo6kPnfZ6o+Q1fsjAA8jeQY9HT8MUugEfOa0/b02xE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VkZaIoRMmjUMK/JN87Wl8jcjS2Jgx8Aqrb8Em0EM20fpK5I3xeIAdcCDzGP8Jkzm0 r3CPDaoG1yF+wYzkEtl+7Pn7+YguL8pQvWkBx5wijqRnp+ha+uUzsVJpyuc+CHY/0P F92xqy9yRYZ5Ax4Vf5ciKu1Ub/1uPYT3EGmXLfB4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gil Fine , Mika Westerberg , Sasha Levin Subject: [PATCH 5.19 257/365] thunderbolt: Change downstream routers TMU rate in both TMU uni/bidir mode Date: Tue, 23 Aug 2022 10:02:38 +0200 Message-Id: <20220823080128.954306927@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080118.128342613@linuxfoundation.org> References: <20220823080118.128342613@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Gil Fine [ Upstream commit 5fd6b9a5cbe63fea4c490fee8af34144a139a266 ] In case of uni-directional time sync, TMU handshake is initiated by upstream router. In case of bi-directional time sync, TMU handshake is initiated by downstream router. In order to handle correctly the case of uni-directional mode, we avoid changing the upstream router's rate to off, because it might have another downstream router plugged that is set to uni-directional mode (and we don't want to change its mode). Instead, we always change downstream router's rate. Signed-off-by: Gil Fine Signed-off-by: Mika Westerberg Signed-off-by: Sasha Levin --- drivers/thunderbolt/tmu.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/thunderbolt/tmu.c b/drivers/thunderbolt/tmu.c index e4a07a26f693..93ba1d00335b 100644 --- a/drivers/thunderbolt/tmu.c +++ b/drivers/thunderbolt/tmu.c @@ -359,13 +359,14 @@ int tb_switch_tmu_disable(struct tb_switch *sw) * In case of uni-directional time sync, TMU handshake is * initiated by upstream router. In case of bi-directional * time sync, TMU handshake is initiated by downstream router. - * Therefore, we change the rate to off in the respective - * router. + * We change downstream router's rate to off for both uni/bidir + * cases although it is needed only for the bi-directional mode. + * We avoid changing upstream router's mode since it might + * have another downstream router plugged, that is set to + * uni-directional mode and we don't want to change it's TMU + * mode. */ - if (unidirectional) - tb_switch_tmu_rate_write(parent, TB_SWITCH_TMU_RATE_OFF); - else - tb_switch_tmu_rate_write(sw, TB_SWITCH_TMU_RATE_OFF); + 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); -- 2.35.1