From patchwork Wed Oct 4 19:54:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 13409422 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46C8BE7C4F0 for ; Wed, 4 Oct 2023 19:55:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=s5yKKdBMSoUU5pKEloXzduQPkpj/4USr4hBMx8eCCuI=; b=H8xw+pZXKMWF3/ VTpAnUyb9krnJGXARCWPF1BTZMD48RxUICaKSWIhqilpH8dFGxhetHiUTjF9h0XKfZQ/0o/YeqBHE B06CspR4lua2f3cC32YBA2nBvplUMChtXix5oPfoXl85xDY6p8FVLxHkyzJSkHxtplkD6W0dupvnz OiOHUhZdtZeFtJo5m68XC4XjSzPZ5WsDQsdgiybresJ/3tz8e/iv6kk+hnW1lxEeGal8q11fIn8zr O5C7MeXic1bNPgb3Dj909j0+Of27OGri3lDO3cs1/3qdkSFsE4hSIlOlocX6uFWjYNeuMW3rA0LMC /CG0QYxukDs3jZT5roRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qo7xq-000pQz-2h; Wed, 04 Oct 2023 19:55:22 +0000 Received: from mail-am0eur02on2062e.outbound.protection.outlook.com ([2a01:111:f400:fe13::62e] helo=EUR02-AM0-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qo7xm-000pQD-0e for linux-arm-kernel@lists.infradead.org; Wed, 04 Oct 2023 19:55:20 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mhtpBHs3T377txvhPPMcJ8Exd0hJJ+GUdlikM7r32cngNFXZd9kRHonbfVJMU3biS/6r5JTY3Kkzlc7VuUC0im/7dJ7u1mEkkm+fnQOdp8NjD9F8t/jeex7QwYfGdojdqCAvuRUI8mxu704u8qP82Q77R1ofWAeT4KaZaQHUGo4YM1TcR60v1gdpKpeD77EsMtViM0XFS7RAcnKx3IOXWNQ98vlnUbdcieaFnhTRBiKsZa9uRipT74tkIXd3LHRQI4yI2LMATacBRjPzLmNNEmHVln4hC50Ef8j5m+bGZAVtVhcoeKBegdZ3f+9LbWlPlmdsyVKHsoFTa/SERfkd8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1URsWvGChyd1WJuUyEE9pd0O0npw4hIbvFI4BwkEAjk=; b=Fw+p3KJAgsk1gzP4zAJxIisK4FgZ4o1owQxuLEUsC1PCS2zcuPSPkIyaUK0pXTj4hxmfQbrMH74jRuI45U/L+wPF9cTB6lJLFPUz0T5ibA+vrHCDDdIacZ5gI+Qg7vMWVpmX7VEoZx2GMKgpqrYieLZQAKRNBINczTa1rGfJy/iC5+boyNk0XOqylFCk09DmWErqxLbNDE6Z4KEzzFYlGeeeuwWVhxmQXLq5/pHRJRhsDRE4N3e9GeEDJ5Lr247HL7iYy1KFO/oXVk+4+XQAkGv1s3Lobzdip4f8oO/tENS0eM8bXGvGnA+imGWb4LfGBbaLzryVqwy9NmiMUHJtVA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1URsWvGChyd1WJuUyEE9pd0O0npw4hIbvFI4BwkEAjk=; b=q9wl8KHAhLEN4S/6EVo7ubv9+wm0oMLw+08Gb23Yojh6UfKXj9q7I7Bk6ww9Hm5Q9UfvJZrInnO/XQPBM1eXdDb/ugp1ffsdt+7gsNSRNDlDEYkMAVVKg5Hg9XX16fTUzP7qvByf4/sJkHZlXOJz2yueAKehqbR67JDu4ux/zfQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) by DBAPR04MB7238.eurprd04.prod.outlook.com (2603:10a6:10:1aa::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.35; Wed, 4 Oct 2023 19:55:07 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::6f63:8268:88c3:2ea]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::6f63:8268:88c3:2ea%7]) with mapi id 15.20.6838.029; Wed, 4 Oct 2023 19:55:07 +0000 From: Shenwei Wang To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shawn Guo , Sascha Hauer , Maxime Coquelin Cc: Alexandre Torgue , Jose Abreu , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, imx@lists.linux.dev, Shenwei Wang , Mario Castaneda Subject: [PATCH net] net: stmmac: dwmac-imx: request high frequency mode Date: Wed, 4 Oct 2023 14:54:42 -0500 Message-Id: <20231004195442.414766-1-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR05CA0100.namprd05.prod.outlook.com (2603:10b6:a03:334::15) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|DBAPR04MB7238:EE_ X-MS-Office365-Filtering-Correlation-Id: 9232489a-497a-4990-5a35-08dbc513cf03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ucFObtZ68oavqQycXM+QH4M9uln+DtW9XwG8nbvSUprMDgKT9Cv4cIagHnV0zWxu9YRCFe58uNEcpBi/n+aDQXXCG/+f9Cj9RJz0k0W4yjQsr2v+X01hV7u6B+BAS7JpJaRRWwWduOVgABY2eA3kih4EOkuxKfCeFXmkNA68LDojBhMHYvt+mrRQTwk7OHAwDldb2XJUFZrvOfWL3YoEa4lzZ/0uQsWggZqHO4n8ZFXakwY8xyT2DtvZz3lqZt5NJj7xOwosD114Gme2TtoumApbqs+z8aDOjEV7rSn2o9td9+QViDhnY2wdtSN2DpEaKrZprbmBu9loWHXBDa/fXDqRYbmB4SxflPIHIk+jkaGXDXwSf92xZMz656F0N9j7DslHDjWBltWyVdwNIKZs5yB3HUCUmkpEht9/BCPaEFPEQQTkeoQn4YJbuK8t1CcRjFH+eVN9M2TUKl8IPaVnNI86xKRrREPxwqPYnVYDMWq7WubGgZuwHMhnX0aIStrMyvzxAzO4eyBan9bf48/VdsrU+n/Wf8q9wIQnvcwOL0mO1itrLE8oroEr+xWdYIksIeCDU6NgMuRhiCD3f16oz/eilgYb/6gFFO9/gRJjK58MGuNx0CfWtrBewL2mDlXF X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9185.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(136003)(376002)(396003)(39860400002)(366004)(230922051799003)(451199024)(64100799003)(1800799009)(186009)(26005)(1076003)(2616005)(83380400001)(110136005)(4326008)(66946007)(54906003)(66476007)(66556008)(7416002)(2906002)(8936002)(316002)(6666004)(44832011)(8676002)(6512007)(6506007)(5660300002)(6486002)(41300700001)(52116002)(36756003)(86362001)(478600001)(38100700002)(38350700002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TJDalEUHYf5V30JfIlHFA5874m5Tys1EdxYYTLvINw8BhISfIZ0RrIRA9KyEDoJ5JqrU9bY7BtG2Mio5l3iAeG5POnM1d5Khs++s4ZPepBxy0yLXftbyd5OFgGmFg0pfqv6sEXIR9bt5pbVFq4HOLqmrm/pjfj/2AI1DDS75FOjG04ETCljtcb9Fv4DSffWROUJZjriOj1xSw1F54AoUj0exjKzQR0kgYUWBTW1WPaUGMhensOAhFlrTYNowXWi219380e+qoz7/TDPrLWoQYrKuLyDQUkDypL7slTlLVY1d1656avx5eIoyBFuJedBtwMwA3Prkhhz4Pmft1YlnAFB7zsZLnD5gYYL/IwNzmXXItIpuFOf3+XQ8PYZnoKAvmGwmDHKRmr6hdkEG/hna5bkIWlbIbe50iIqk+a2tpcqE8LCHIGBZIhZG7z354xlRtdp6gDszgjxyP7nZrghIAaykSY2IsO7UBTazhFRZLbHt+WFW9hdbC8KYMyYYIY6dKWIzV4gn0Ysd15GhuPc2/23L60SZ8ZRfc1cLQPDntC05GwXJxQdEij6FT4p0nJeIRPidhcR53hVi9bjSTCtB06ke1riNLai6YfSmTL9/XVsY23n2Wv6OS4UkQQAbh/Leo5ZTK+yQtEPZRKaT6v14MfDTR8rlIfsjqS0ggpQhpv1LpZ+uJcPLwiOivqIzbiOXseWxA+b/upBAzCdSPiUxl085NZehm647olKuPCJ5aUFwFflL7pqDDvdnkFgi94XmTGaZEAL5+KYlBT++dfTXe9dkh71BdhAjnT2knlyi2aUWL+qrHXoqb/QUYCdBKUdshIqr72RtOPdxi63ax8LBJfXEc50yPMsB09VbX2HnNw4Brtk6gTRKMXCe/rf7zikNfSuZiVNawenYB2oNP19e7FXG2rLhNlx+r68gEB5E5h2lxhlLbb3Uf9VQm0vZW+0kIDTcMPCWSPUXtkwBsmCR1x3HFfbanJF8wCa20NuWUtyrb1gpwTbvmfYQ/yEwJ/vFQyhVhJS/wRCaa1W7kfhmeJVo+IV9zsnDpUIzSgVWAuPZv9A9WHKXOe2gB4AowIxG/WW/0oCbWgIO1MxmHxrMndTTBN76/38BRQVrnJhl9aTSYDVDMwTI/YVMm9t1geci07p7jQNewTsxjFXWeNkJDL5AbpQ6FI7m5wOPZ81VAZ6qJ3xbe944WsFWUB4c1lIskmzae5KKy4CLBiwPHophP+CLDRhNVMb0HUruKczX11stG1HWZGwTABsToZWu16sRYHOYEfbUACJQrG8ehIGyzOgeIy88E2/SGqFtqtGzEL3ruPB1Qk4Io/YfSgQgviG9nFuzbdh+20Uv6pAwzMpLuLf9PS/40d7VQUfIGtDdJiigpkR95cnDj5G8xHl056+z+/QlNGgYbzlA8yjX7P449KUHXAzeexPUdT/gTntAxJ71M6HXFelc7P8yThU5P9usiwxEt8bTMLO1PxGFsa1UK7IAgkfq8zH/TmLz13nAElyqYRK98M9iZPWcftVj8PkvKEj4WpEiIxJQx9iuxEHrp0O2fNCG1ZIqHtYDM1rF4AjLpnOgdewzBUsRz9EV+d8+ X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9232489a-497a-4990-5a35-08dbc513cf03 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Oct 2023 19:55:07.2388 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: AiI6061+aFGNLNoyt/v2JjK3RQPrMpvPGuoCa99ugBkjySdU5OCFGnvYUkVS2czQ9W5bNblUNR4HTAIKFJAfSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7238 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231004_125518_322534_AE24CBA5 X-CRM114-Status: GOOD ( 13.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Some i.MX SoCs like the i.mx8mq support adjusting the frequency of the DDR, AHB, and AXI buses based on system loading. If the dwmac interface in the driver does not request a HIGH frequency, it can significantly degrade performance when the system switches to a lower frequency to conserve power. For example, on an i.MX8MQ EVK board, the throughput dropped to around 100Mbit/s on a 1Gbit connection: [ ID] Interval Transfer Bitrate [ 5] 0.00-10.00 sec 117 MBytes 97.9 Mbits/sec However, throughput can return to expected levels after its driver requests the high frequency mode. Requesting high frequency in the dwmac driver is essential to maintain full throughput when the i.MX SoC adjusts bus speeds for power savings. Signed-off-by: Mario Castaneda Signed-off-by: Shenwei Wang Tested-by: Mario Castaneda Reviewed-by: Florian Fainelli --- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 8f730ada71f91..ba6ae0465ecaa 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -6,6 +6,7 @@ * */ +#include #include #include #include @@ -152,7 +153,9 @@ static int imx_dwmac_clks_config(void *priv, bool enabled) clk_disable_unprepare(dwmac->clk_mem); return ret; } + request_bus_freq(BUS_FREQ_HIGH); } else { + release_bus_freq(BUS_FREQ_HIGH); clk_disable_unprepare(dwmac->clk_tx); clk_disable_unprepare(dwmac->clk_mem); }