Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4024575pxb; Mon, 8 Feb 2021 06:16:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJz56FHslCwDm5WdshSoyYW7E3PGJ7S2ihXPePIc0ikIAOtBD5SuYR8Nr9sppMQs1Qkw/Z+T X-Received: by 2002:a17:906:1bf2:: with SMTP id t18mr17763001ejg.166.1612793815723; Mon, 08 Feb 2021 06:16:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612793815; cv=none; d=google.com; s=arc-20160816; b=ike/wSMBi8ROMhxEK8ZlwWRvpo2Oi7nkL7P7tII5f5RH9AyzP3nNNBYaAnK+f9ZZ9v 1HBKpeUpbTDwWRTUa8nZ8cNSP0gKwW6HKmCwgNess9ar30gdkEtCt1gs59ZunxgMwuIn /C0ItP6Kicp0LyeScwxS5jEH9kM3RA48WTVB99b2xAs6ol3mzb7iM5+3tw3DdtNTw9hH KbVhmSTOxPEuOrHxItQgaCrrcCC9UttCZTmXZJBiGJtuAVhgHl5mVzFWkiWtTROONANx hP2jgJ1+jtCERy96qwvC1vsam0gmGO0j3Ej2vMMF7BJ0PkBZ28FhKaBaltT/fSnaS8ri 0akg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=cgMTeEmrGQEz1ar/B8QGDdcvSQAQx+QB1WHYXLMOg/0=; b=OuGkZNdWkMUJDbNY7LlwNcJ7H1OoYeOTAOFFcZr6d/wysAWq4vyHX2C4/YpF1wzph0 ohBnjLQb2yOQ99r21T2MUSUuBLU3udSUWxmX9l1iegMQSxV80E7mGitKFH58OCl/T2VC 8bANYmmigo9YE+xXMQ/kG6CKfk6fUnBvxtJccEfMs+n5SPn0rmziBHO29y3VtebP+otO 4ox/gACUxvBzH26wkngtuwEgulo31fgpqZHRz3xM0FIFXKYr8ZSvhGAio3J4zGKhaps3 t2gYZ7jv0q+JARLlK5VJ4NtT3U5KbB2YzTeiFlCAMu5twxWRLeMjC+8vhIgWbRTlKajA Vi8g== ARC-Authentication-Results: i=1; mx.google.com; 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 i13si8559610eje.417.2021.02.08.06.16.31; Mon, 08 Feb 2021 06:16:55 -0800 (PST) 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; 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 S232763AbhBHOM5 (ORCPT + 99 others); Mon, 8 Feb 2021 09:12:57 -0500 Received: from mail.baikalelectronics.com ([87.245.175.226]:57068 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232022AbhBHN6K (ORCPT ); Mon, 8 Feb 2021 08:58:10 -0500 From: Serge Semin To: Rob Herring , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Jakub Kicinski , Johan Hovold , Maxime Ripard , Joao Pinto , Lars Persson , Maxime Coquelin CC: Serge Semin , Serge Semin , Alexey Malahov , Pavel Parkhomenko , Vyacheslav Mitrofanov , , , , , Subject: [PATCH v2 24/24] net: stmmac: dwc-qos: Save master/slave clocks in the plat-data Date: Mon, 8 Feb 2021 16:56:08 +0300 Message-ID: <20210208135609.7685-25-Sergey.Semin@baikalelectronics.ru> In-Reply-To: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> References: <20210208135609.7685-1-Sergey.Semin@baikalelectronics.ru> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently the "master_bus" clock of the DW QoS Eth controller isn't preserved in the STMMAC platform data, while the "slave_bus" clock is assigned to the stmmaceth clock pointer. It isn't correct from the platform clock bindings point of view. The "stmmaceth" clock is supposed to be the system clock, which is responsible for clocking the DMA transfers from/to the controller FIFOs to/from the system memory and the CSR interface if the later isn't separately clocked. If it's clocked separately then the STMMAC platform code expects to also have "pclk" specified. So in order to have the STMMAC platform data properly initialized we need to set the "master_bus" clock handler to the "stmmaceth" clock pointer, and the "slave_bus" clock handler to the "pclk" clock pointer. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c index f315ca395e12..bb2297638805 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c @@ -313,6 +313,8 @@ static int tegra_eqos_probe(struct platform_device *pdev, if (err < 0) goto error; + data->stmmac_clk = eqos->clk_master; + eqos->clk_slave = devm_clk_get(&pdev->dev, "slave_bus"); if (IS_ERR(eqos->clk_slave)) { err = PTR_ERR(eqos->clk_slave); @@ -323,7 +325,7 @@ static int tegra_eqos_probe(struct platform_device *pdev, if (err < 0) goto disable_master; - data->stmmac_clk = eqos->clk_slave; + data->pclk = eqos->clk_slave; eqos->reset = devm_gpiod_get(&pdev->dev, "phy-reset", GPIOD_OUT_HIGH); if (IS_ERR(eqos->reset)) { @@ -371,9 +373,10 @@ static int tegra_eqos_probe(struct platform_device *pdev, gpiod_set_value(eqos->reset, 1); disable_slave: clk_disable_unprepare(eqos->clk_slave); - data->stmmac_clk = NULL; + data->pclk = NULL; disable_master: clk_disable_unprepare(eqos->clk_master); + data->stmmac_clk = NULL; error: return err; } @@ -392,6 +395,7 @@ static int tegra_eqos_remove(struct platform_device *pdev) * data so the stmmac_remove_config_dt() method wouldn't have disabled * the clocks too. */ + priv->plat->pclk = NULL; priv->plat->stmmac_clk = NULL; return 0; -- 2.29.2