Received: by 2002:a05:6a10:6d25:0:0:0:0 with SMTP id gq37csp2044668pxb; Mon, 13 Sep 2021 10:42:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFveKPPzmKG/C9pjFq1xqc2051gHvsgMDWKJV73X83GLxikOMpzI38Mfwhw7q7oA2sJjTK X-Received: by 2002:a17:906:7a09:: with SMTP id d9mr7944234ejo.116.1631554941037; Mon, 13 Sep 2021 10:42:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631554941; cv=none; d=google.com; s=arc-20160816; b=gme0FOoemq5dpX8ju/8Fuf6TSMppAke6IV4LeBugsm9DTIDBpdr2h7Y0mxVXHt0XT9 ecXGRu0StSv1jb5+lvq8Vfc+eTnMaqEQ175tkgfScWXhFttLL31gah0vXyjEUL+kcRC2 HCLK+fpDNZspluVEpavYKjiD/uGB+RZsrbVIATcbDYN9YWpKoiY08fr0JvmiSWSnbN+w pWGPGvmThBQCRJ6A1cgo+TuaErbv6i4Y47BFUaWFSn8A6/8/3zKWsDzlfl6qBWkPbNAR k4MFLIMAhBjf28qz5IyMkF9z3IKOHzwyvTvqrda625Wx74QOfsNbwX//9YIQnjz7AYWy 0RnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=sJ1ZI5pbg200UoYKhBVa+Ol918TFrfKZmLVEAwXkQyI=; b=thers0x7UfUxoUnAyQb9Yt/zxY+Ubxahbc9bGqyvdcr96+1NzXyDLSWdNVMd1guxG1 f6q++uWSs/4rE9hZq0lHCvKVmud40kVirQuxwJTZ44InKdsSt/bxZrslaPHxDOlIrkvt 9LMO13iX4wiompoTZgkJTs17sDt8hhRubcAV6+mkvSmdBgr7rI3HP52PuVpwy3iZJHy9 adnrOChqHotU6L4jkbvIKj/4sDtEEYqFHOvPuEuAwp0E+hlOwMSTrmgGbBeDWDgfZ60L 4kOjDttj9Auon0P59hMrd22CanJkOg2hIn6Y9+5GoPPsTZofSffHoGr1zqapo4f/QAk/ vnFA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 2si7598849ejh.749.2021.09.13.10.41.56; Mon, 13 Sep 2021 10:42:21 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346386AbhIMRkr (ORCPT + 99 others); Mon, 13 Sep 2021 13:40:47 -0400 Received: from inva021.nxp.com ([92.121.34.21]:59214 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245000AbhIMRjy (ORCPT ); Mon, 13 Sep 2021 13:39:54 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 674092005AC; Mon, 13 Sep 2021 19:38:37 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 4F5EE2005E6; Mon, 13 Sep 2021 19:38:37 +0200 (CEST) Received: from fsr-ub1664-175.ea.freescale.net (fsr-ub1664-175.ea.freescale.net [10.171.82.40]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 80C6820363; Mon, 13 Sep 2021 19:38:36 +0200 (CEST) From: Abel Vesa To: Rob Herring , Dong Aisheng , Shawn Guo , Sascha Hauer , Fabio Estevam , "catalin.marinas@arm.com" , Will Deacon , MyungJoo Ham , Kyungmin Park , Chanwoo Choi , Georgi Djakov , Adrian Hunter , Ulf Hansson , Ahmad Fatoum Cc: Pengutronix Kernel Team , linux-serial@vger.kernel.org, NXP Linux Team , Linux Kernel Mailing List , devicetree@vger.kernel.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Abel Vesa Subject: [RFC 17/19] net: ethernet: fec_main: Add interconnect support Date: Mon, 13 Sep 2021 20:38:12 +0300 Message-Id: <1631554694-9599-18-git-send-email-abel.vesa@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1631554694-9599-1-git-send-email-abel.vesa@nxp.com> References: <1631554694-9599-1-git-send-email-abel.vesa@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On probe, if the dts node contains a valid icc path, then look for the fsl,icc-rate property and get the rate. Also set the icc bandwidth for that path to the nominal rate needed for fec to function right. Then enable and disable the path every time the fec is used or not. This will result in reducing the clock speeds along the icc path for each pl301 and NoC, but still meet the requirements for all the other icc consumers. Signed-off-by: Abel Vesa --- drivers/net/ethernet/freescale/fec.h | 3 +++ drivers/net/ethernet/freescale/fec_main.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h index 7b4961daa254..2c5784febbeb 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -558,6 +558,9 @@ struct fec_enet_private { unsigned int num_tx_queues; unsigned int num_rx_queues; + struct icc_path *bus_path; + unsigned int bus_rate; + /* The saved address of a sent-in-place packet/buffer, for skfree(). */ struct fec_enet_priv_tx_q *tx_queue[FEC_ENET_MAX_TX_QS]; struct fec_enet_priv_rx_q *rx_queue[FEC_ENET_MAX_RX_QS]; diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 80bd5c629fa0..67374d436e73 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -3805,6 +3806,18 @@ fec_probe(struct platform_device *pdev) fep->pdev = pdev; fep->dev_id = dev_id++; + fep->bus_path = devm_of_icc_get(&pdev->dev, "path"); + if (IS_ERR(fep->bus_path)) { + return PTR_ERR(fep->bus_path); + } else if (fep->bus_path) { + if (of_property_read_u32(np, "fsl,icc-rate", &fep->bus_rate)) { + dev_err(&pdev->dev, "icc-rate missing\n"); + return -EINVAL; + } + + icc_set_bw(fep->bus_path, 0, fep->bus_rate); + } + platform_set_drvdata(pdev, ndev); if ((of_machine_is_compatible("fsl,imx6q") || @@ -4075,6 +4088,8 @@ static int __maybe_unused fec_suspend(struct device *dev) if (fep->clk_enet_out || fep->reg_phy) fep->link = 0; + icc_disable(fep->bus_path); + return 0; } @@ -4085,6 +4100,8 @@ static int __maybe_unused fec_resume(struct device *dev) int ret; int val; + icc_enable(fep->bus_path); + if (fep->reg_phy && !(fep->wol_flag & FEC_WOL_FLAG_ENABLE)) { ret = regulator_enable(fep->reg_phy); if (ret) @@ -4134,6 +4151,7 @@ static int __maybe_unused fec_runtime_suspend(struct device *dev) clk_disable_unprepare(fep->clk_ahb); clk_disable_unprepare(fep->clk_ipg); + icc_disable(fep->bus_path); return 0; } @@ -4143,6 +4161,7 @@ static int __maybe_unused fec_runtime_resume(struct device *dev) struct fec_enet_private *fep = netdev_priv(ndev); int ret; + icc_enable(fep->bus_path); ret = clk_prepare_enable(fep->clk_ahb); if (ret) return ret; -- 2.31.1