Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp8131531pxb; Fri, 19 Feb 2021 08:08:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJzn4bHVSzmG5kQz6x5lm8uQsXqHIZvsZjll2UOlApUo/uiJOcjIVNTU7+xFk/TMvBj49tqi X-Received: by 2002:aa7:c90f:: with SMTP id b15mr1624079edt.51.1613750925299; Fri, 19 Feb 2021 08:08:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613750925; cv=none; d=google.com; s=arc-20160816; b=K2G9QC/+QNkJxtvZrQeiOCwQ7JeE1XHYxTWmaK28Y/sFIffibLA2tIe6fbiBK7ncW/ +qv4DXqvg9tZec6GOkwRJ27/1O4WlhIzLE7jzRU4ba82y+5X9D9oaHV4IgnQInbPShYp dpY6LFG7Re31fKlN2hVPlXWDW3L2Cehxkh1YTiJ6esawxJmjivkCQ2rf/gvWFxNZcEIZ 8HS7wXtTDG2Es3U7rknbDGqPcdS90mcDTqsA4vtwsNpvuQmdqjoeJCqMmO7yO8RhuT4M hUPBakz1m6/5zTZ3nILwOXzY/79yomoQfYoDlHQWQigpr4YWnI442PECoBZlY2tTxlFA uTiw== 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=n3xbHpNuGqWBlxggX+z8P9JiIorp0RKyTjBl5u6uP2s=; b=fFBVlOfiP1lfVJ9BEBq3IddkpXhFZml4PqRsrS3ln12MEIWhRMZgGoXKZ/DrHTRVUV XpEldixTKzkeFfOKxSHF1vNqY0tnoefZcsEsKw4L/U6hqcc1jeK7MJeScnmpVEgNcxJk SnZhJRDaMYZwBzGt2KayF1tL7t6/HYAw+DjCbgdgaZTPPCLeO+lV62s6ZhigL4nUY7x4 qS/d5QL/NUMXN4s4f8IwyBPV8hGp5kP5Rp3+Q5fsseJBhaTDSv7B6+7BaR6/DHsUJRSR V83hRhlmCBtnTSsdiOMonssW6QzsO6KwpBV5G5NLkee3L9mn/HPHhwa2+4OikI5TAiAd 644Q== 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 e2si5949136ejh.579.2021.02.19.08.08.13; Fri, 19 Feb 2021 08:08:45 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbhBSQHC (ORCPT + 99 others); Fri, 19 Feb 2021 11:07:02 -0500 Received: from inva020.nxp.com ([92.121.34.13]:36942 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230004AbhBSQCh (ORCPT ); Fri, 19 Feb 2021 11:02:37 -0500 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id B91411A01B9; Fri, 19 Feb 2021 17:01:09 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id AB3CF1A00BD; Fri, 19 Feb 2021 17:01:09 +0100 (CET) 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 17C002042F; Fri, 19 Feb 2021 17:01:09 +0100 (CET) From: Abel Vesa To: Rob Herring , Shawn Guo , Sascha Hauer , Lucas Stach , Fabio Estevam , Chanwoo Choi , Georgi Djakov , Dong Aisheng , Peng Fan , Martin Kepplinger , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, Linux Kernel Mailing List Cc: NXP Linux Team , Abel Vesa Subject: [RFC 18/19] net: ethernet: fec_main: Add interconnect support Date: Fri, 19 Feb 2021 18:00:15 +0200 Message-Id: <1613750416-11901-19-git-send-email-abel.vesa@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1613750416-11901-1-git-send-email-abel.vesa@nxp.com> References: <1613750416-11901-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 0602d5d5d2ee..7611492cb800 100644 --- a/drivers/net/ethernet/freescale/fec.h +++ b/drivers/net/ethernet/freescale/fec.h @@ -529,6 +529,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 3db882322b2b..0ed78b390098 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -3572,6 +3573,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") || @@ -3826,6 +3839,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; } @@ -3836,6 +3851,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) @@ -3884,6 +3901,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; } @@ -3893,6 +3911,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.29.2