Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4418516pxa; Mon, 10 Aug 2020 08:38:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZDIun+kYJvo65O+t52TF3eCB18bzO99IafH4iR0A0hudzg6Bty6Z+IxM12Et0KDG8anAo X-Received: by 2002:a17:906:d102:: with SMTP id b2mr21067600ejz.465.1597073881689; Mon, 10 Aug 2020 08:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073881; cv=none; d=google.com; s=arc-20160816; b=NX8rxCPIWloqs9JbEnAvo1gqgowBMC2xWf0OVWEJ06sNNWS/envi2/U81qKlL5G4p9 3194DD4I1ktXxkqmG7Kz/rtY6H6WJV6skDNmw913xVjqvnRN0T7J1c0oAhS/CDnZZuMP OE4XW3md1/kVd2vIQOBRQ3WbOXAOHyGOi97EAFRVHA1k+9ZzsLJuuBF8lm5hfhC2rHnZ nH+I4WW+JXui0UyPxAzOwybleJ2F6KiOACLg/B84bbwdMUxVbcKQbC+bUyGcmfFZeTcy YTxgXPVPDfzFwFyiib+xE9rxKoCtrNErRpv4wFDdnIZdrGwtxUMM/UPkpHOmiAWB1xnF NDrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=AL6SGG5yIHdfZ+Xj3yrKgFa3ihVQobn4dMOzZghUI04=; b=SdkmV0RvqgtvjNM6gyMvZuROpMEa5ejvjtHnDnV0DHjjiU6HmYH0ofgQzzHDBjKW/f CoGp/7t2T2oZCGLBbihv8WFqZXGLVgnf8W95ldFEuEEEL+CLxrJkn727GndXFYX51QFP urCZ/ZH8Od6kESP35JtIQEk4mZmxReDFzSA0SvaJX0k8is3pVTiYZz6ldgvWTJ5fpwlc RpoOpM0XdsavotvaSIV5pcQdW8dgl510svJNau121agJTst/nyC3tz8nmMnCRRS9E8/0 bG86jpkpLXnxmmAeNxKJkGoBo/KNUeTPmY14vJIetffaCBuuICEAoUKGBtk/j6VghcUM hpXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0Rdtb8YB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p21si12329688eds.193.2020.08.10.08.37.37; Mon, 10 Aug 2020 08:38:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0Rdtb8YB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727964AbgHJP1d (ORCPT + 99 others); Mon, 10 Aug 2020 11:27:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:33400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727821AbgHJP1a (ORCPT ); Mon, 10 Aug 2020 11:27:30 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1FA9922B47; Mon, 10 Aug 2020 15:27:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073249; bh=uxoQtPfN28/+cTLXSlYzNdbe8bpEfzHVnhTtZgL1ynI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Rdtb8YBVrKmNhytRfhcQsj2SBVB7seghlbjWRSy7i4acMeJVuFytWi7X1lRVd9DN aITWy45tw6v+wfMdCKhb/Y2gqfU9sKG1k6gFB+3qSbMQgXC3OE6WNC2SwhuO7PVmyK gRAHStitklEAoj9XP7Vx5RG/c+LpungVdUGiDRWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= , David Woodhouse , Frank Wunderlich , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 39/67] net: ethernet: mtk_eth_soc: Always call mtk_gmac0_rgmii_adjust() for mt7623 Date: Mon, 10 Aug 2020 17:21:26 +0200 Message-Id: <20200810151811.364767874@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151809.438685785@linuxfoundation.org> References: <20200810151809.438685785@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: René van Dorst [ Upstream commit 19016d93bfc335f0c158c0d9e3b9d06c4dd53d39 ] Modify mtk_gmac0_rgmii_adjust() so it can always be called. mtk_gmac0_rgmii_adjust() sets-up the TRGMII clocks. Signed-off-by: René van Dorst Signed-off-By: David Woodhouse Tested-by: Frank Wunderlich Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 997dc811382a4..be390c7e43b2f 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -171,11 +171,21 @@ static int mt7621_gmac0_rgmii_adjust(struct mtk_eth *eth, return 0; } -static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, int speed) +static void mtk_gmac0_rgmii_adjust(struct mtk_eth *eth, + phy_interface_t interface, int speed) { u32 val; int ret; + if (interface == PHY_INTERFACE_MODE_TRGMII) { + mtk_w32(eth, TRGMII_MODE, INTF_MODE); + val = 500000000; + ret = clk_set_rate(eth->clks[MTK_CLK_TRGPLL], val); + if (ret) + dev_err(eth->dev, "Failed to set trgmii pll: %d\n", ret); + return; + } + val = (speed == SPEED_1000) ? INTF_MODE_RGMII_1000 : INTF_MODE_RGMII_10_100; mtk_w32(eth, val, INTF_MODE); @@ -262,10 +272,9 @@ static void mtk_mac_config(struct phylink_config *config, unsigned int mode, state->interface)) goto err_phy; } else { - if (state->interface != - PHY_INTERFACE_MODE_TRGMII) - mtk_gmac0_rgmii_adjust(mac->hw, - state->speed); + mtk_gmac0_rgmii_adjust(mac->hw, + state->interface, + state->speed); /* mt7623_pad_clk_setup */ for (i = 0 ; i < NUM_TRGMII_CTRL; i++) -- 2.25.1