From patchwork Thu Jul 27 15:25:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 127046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1210325vqo; Thu, 27 Jul 2023 09:15:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlHm1gVdve9RNoDhNRzGPIm21aSV2zy98xRNQ6IidwAvZKcx+wUrllkC1gykhwBaE0gUS1iK X-Received: by 2002:a05:6a00:2482:b0:67b:2eba:bed4 with SMTP id c2-20020a056a00248200b0067b2ebabed4mr7197697pfv.14.1690474523850; Thu, 27 Jul 2023 09:15:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690474523; cv=pass; d=google.com; s=arc-20160816; b=YfjWzOhvYhNQpbLtJgRE4EhnErLCbeu7Pz/L4E53jjnX0uXx6fjQAFHi3en7fg4g8N u8JS+qM1avvPf4qPuq0TtNLY0oxzW5B2ZjW7wR7mcJOoHnmBJqe2q5r4TVcPTl6G4y6+ S8xOv2tyR8qTwgf1FZvwqDLFu8DGJmuRb8Gbvs66ytrXYjTTi7nqcMC/jc6sYc+UQ/Na +jPGtY3mQ+/V4jri9PecQDNk49PPLletJjtOsVQUocApcTmpzJ3AnXG6FSBUfcxsqf4y K8fnNvnq+6gGnzkHIh8rvrzjyTlIUUbAQDwRpcWmt1DeAcoNLq/++kouZq5fHi910PQA tAfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gP8K4U0XbheJwOOt6iLmL15KMT5JTdY6p6SMOhAbBT0=; fh=KRX/stkHHd/uhbQHZRv9YEDGJRXCPYJTMbLTMapZ4Hw=; b=0QGUOq0eT4NFBJX8o/97e9c9/MkbtnYL06IxCuLmyCdSgoZAkRRLI+Y2kHQ6SfJCJj UpoESIcnsmmOxhVUEJScxJV7eSIhmIWLG5GZvKXHWRNJdfFgbUmMr1ecw3TeNIfy9/F+ jn6NqhxXfER+uou62aqu14LW9v6pZu3OoC3D5VALHI9Zgo6ch2JFy8AmOSD2fbhitu9Q NIl+87FbzS2Swq5Kgs7yqszDndGyOkWU1F8xF58KZasB1xpSG4bSrYBcv6O4H7y2aF79 WGn/0Moj4vFk5zU+SjvptQq3a/YukpBU9HMiE0CRoHvuLHbeLGt31mNBYz2Mz8nTZqAV v9sA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Ft0uXvd1; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y12-20020a056a00190c00b00668718e54c6si1610869pfi.202.2023.07.27.09.15.09; Thu, 27 Jul 2023 09:15:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=Ft0uXvd1; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234594AbjG0PZr (ORCPT + 99 others); Thu, 27 Jul 2023 11:25:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234590AbjG0PZh (ORCPT ); Thu, 27 Jul 2023 11:25:37 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2075.outbound.protection.outlook.com [40.107.22.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21F1E1FF2; Thu, 27 Jul 2023 08:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kU6mrGjnWhAIbfKemAP6vF1HuHRZSo1BpqgtMkscIcz4nRZqVffEWPjylkl9FtVXuFZDVUnyU7wyFWmT05n2DmC99YVszij5WGlywaK9/nn2+iFD2E4d5y8GMfocOUtkWbdURFQdT6KXYnh1FAuGVyfh0AkDYPnC3Hy7YbHvO35vL9QZJwZLT2R8KfdN4gVUHj1e+kaFJh3CZyfJbgbKfOL8VOPn29lHrGOsoZ0TObPUqJUy6lDwThOSmCteyEHou+zNts4uexLSkO8R2lwwDeya46kgPWncYfubx53QabSwNk4K62ykg6TaJDxKm6CE+cIzLtgrX3riGKH7eILIiQ== 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=gP8K4U0XbheJwOOt6iLmL15KMT5JTdY6p6SMOhAbBT0=; b=MA+AX8h0zND73/j7bcfAnGhHzDSggZFqN5THK88SwxK9kCC3xMxZ99BSTkYLDyOK+/V+mWuslpTQxb3P0MqgFAAsxnaK/l+0MrchwItvbI3ZWq8q1CLybZYDwkZsApLebASmyrDGlPWBVYJ9UfF82MQpk7fAJ3mRkVK2Tsnhg5x9u5NhvH+U2rdG0ekbis5wyHGPJ0m6Ubu5a+/a0onkrY5PPz4e48F4Is2puaaQgk0pqEPDqZi9pl7Do984/SYxVwBuDmW4u3AIpM5aZLWlj6St7fm6kJQvkG0JTcrwTBzeOO3jBJVnTjPEbFQka4jZd8Uy5UCawfoVM0qwnD+2Fw== 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=gP8K4U0XbheJwOOt6iLmL15KMT5JTdY6p6SMOhAbBT0=; b=Ft0uXvd1D2h3Q5r2dI2kfnrWE9EGoxY7LMCyA6HcSv75Hx1ovcN8clmhnizvvBqVo8YCmuRgGNzZyUhYxg38NYBPU2wLelUfOp3iaOpP7NbLpxWXVo3eVF1m1ve+fKFBcvoyBeC6GZG1HmtWTgxl8/T3d7Na9G8zQJjRhGlUFA0= 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 AM9PR04MB8257.eurprd04.prod.outlook.com (2603:10a6:20b:3b6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 15:25:32 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::d4ee:8daa:92f4:9671]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::d4ee:8daa:92f4:9671%3]) with mapi id 15.20.6631.026; Thu, 27 Jul 2023 15:25:32 +0000 From: Shenwei Wang To: Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Shawn Guo , Sascha Hauer , Neil Armstrong , Kevin Hilman , Vinod Koul , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jerome Brunet , Martin Blumenstingl , Bhupesh Sharma , Nobuhiro Iwamatsu , Simon Horman , Andrew Halaney , Bartosz Golaszewski , Shenwei Wang , Wong Vee Khee , Revanth Kumar Uppala , Jochen Henneberg , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, imx@lists.linux.dev Subject: [PATCH v2 net 1/2] net: stmmac: add new mode parameter for fix_mac_speed Date: Thu, 27 Jul 2023 10:25:02 -0500 Message-Id: <20230727152503.2199550-2-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230727152503.2199550-1-shenwei.wang@nxp.com> References: <20230727152503.2199550-1-shenwei.wang@nxp.com> X-ClientProxiedBy: BYAPR02CA0006.namprd02.prod.outlook.com (2603:10b6:a02:ee::19) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AM9PR04MB8257:EE_ X-MS-Office365-Filtering-Correlation-Id: 3ed44756-42ad-4472-114c-08db8eb5b74d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x8N+qRk4ONEGgwOC3wRqttqa+cpBCIwYvKxWh52WTOoj8NWSTeO3joqlq7E8QpijgkDplSGly8qv+WYuOgioGGfpCb5N4TEktWuQvPQgOmjckV95hKdb3rCt/zIPttpnuzRyzGAHPrQPg79gAFmdE4h4ELfE7LmtTfiagD6zjKyzSXyWZKD4ejPThcMF1J6R0B1gijOaKonyy+nLwGmH95JBxoFQE3+DtcV3n+csqAFFVqPHmmhoalkIp7FlxpPkxCpzpHambenw3ZwIy7zZ8qRaNYQO45OEBdC/d22D084XUGxvM2hRJwxvIsAPtXHkMuqPiH/YOc76fQQTOxUTeaMdklGzyAQawlbbL/qQ2BodxLyY9qrbfoq9OutQnupzQ+8sXkfblTuTWHDqQQmKxdpYptisrzduZkW16Zf6r6PkZ7LPbYZGHfBxjh4nQb5yESMUJ6esQR71yQvACypkH26oUHmmVQu9UD+KhA+rbzmpoHHYLIhi6MHI/LV4eYo9fMGnlUSRL6/NCbX+DylfbqAiqGAvB5PPqvA/im9T1OnJt7UffAm2TSC2gmBYoNkJrNIT25ZR4SHMH/ht2NeTVLSP12+CW8yNHfxGBxhtpAbNRI9l613cmZ8wj7nML023xTcmaJ6UmZUwraZkPjSZoQ== 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:(13230028)(4636009)(39860400002)(376002)(366004)(346002)(396003)(136003)(451199021)(316002)(2906002)(8676002)(8936002)(7416002)(7406005)(5660300002)(41300700001)(44832011)(36756003)(86362001)(6506007)(26005)(6512007)(1076003)(55236004)(6666004)(921005)(478600001)(52116002)(6486002)(83380400001)(186003)(2616005)(4326008)(66476007)(38350700002)(66556008)(38100700002)(54906003)(110136005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O+waNRqJApWxCkmk92lFN0+Vutj72GHr2AuzS3FPGzTfpVHOMP2MEGgMDGmPU7RxZR0IbTD1b9IW2yxIji02xg0vP3WmzMEWyJw6LUNmW5WbpruXaTwNcDWHdt8hTDMCuGmL7wyfsSVpEVYZyIGjej2Hm7dYs7pEsgwZ3ApKCMQKL5nPynSRY01say1068bVOWZbgpk4fE41wtOBLBqKCig2G9d3EJNg6CazERBxxO2Ar66PFSMNEp684hQuUQDppiuW5GHz+qBnQQZLzxBY06nL18Qx4zyj2ypQDKT8De2bPNXdPR4UTx0JiG9ghPgYgvurEolrnaPPG23Ok0E8EBgudLSOvCCPqF5pKYYZO2O0sdxE8+MmFgNg3iFz5WGK+3nV3XfupdoUku70FZllz52L+RMgmHj6LORM3UgoETtiLB09744nUWSyBCGJTs4zkLJP3D8m/iaOObzHusj62IGta4f9MgD5b6HMcm2SNzLnQRAatUM7+owy12I8jss3SEIUlSNEN7cnvGJO7Z2t8de8WxQWWBLuXJPEJZ+j2x18/sWOn2zfYveqAU8TbrjHBuJKrBLIFwU8om9PCHEuUpgkZQzZNqsbURJE0yuDpoAe3hBrgj9lSA2HoUa/pMStib9LcsT8oVlkccSvm6APKblPRCNsdBwaRP0/baIZ9I95lPuGfr/mPMzhrGXYltS6xcm+FppNgEkHI1NNEfIuem+ceftTwY5du0ydphIyqFmbTwnsNCI6GZPZplGSuIM80T8P9qbkCrZnSzr8BDCAq6nXu9ZUWmthv3njZ2oG1oaL7rDxosrnmGet7Qb2QmccqUlxWgiSqvjPYpxgIIa4W1tg8ShrlCoyegWUhPBxp5JVMN9hRgCxGt3vd+xRzy0mInbMeQVa3bQu9XEPTB81tYyVznzBzoVg3SdAkM8p32xBgbBP02nmrOyjhiwOzMZk6c3OWki3iPJ8CV5DZKCVuM4fl11of11Ebty5PgJeei/vFwxQXCkjC7yKqS7Zhw3xepqBFrWmtiazy9pBWDLad0RoGwdr4LF+97SB5bgyAHCncxS2sqbsGrTa8Wsn/p70g4Hk2T5oZLWt1MgkRS7HLtRsOxYSL01PT/v3Y2jBDMZ819pq6NqCHNs5neIWjHhJCOEyT7brYeb24PwIS9ajmJIqrwW0iOW2CMLQf++dUMRS9q03NPOBDv0RdTWAqKCk+4LS8IevMYFwYtHKOxnrRMhemSURi6zp+YdmIKd76u1hWcFO9+QGD6nUeu8oE0/bwo9BW7hNfW/5dDAdINpMZIJy1iKErco8xxoAwh3HIF5uK0P4zy+5F/jH95K3R3AbMhFOJbToPma+v9OKohXyyHL/OiL1XM3VU58jdtghf/WIpYnvaUpKOvB4HEeCx/Rdp/aNb7JtrTu2pOoAE3z+fYTPdoReRPBo0IlB1uSylZNYLpsMQmf3mHvmV+v5mXKpmUkAnFE5WUiqyP7JDz8FZRaGynBvoTDT7oGuLjfjHRb1OZhHMu7Ymsj2MkvWNNWSqJcX/oW/qmNQii4LUZ7L5divwsBeBTyaiFM/YLvVTXvUZHzwh/yxNXi0PuZ11aYC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3ed44756-42ad-4472-114c-08db8eb5b74d X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 15:25:32.0434 (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: qK8dvVbn180E1T82XiUJ88oo8Vd6EwcjNjkGnPI5oL8Z7iyY2tOTv47w75dhqAfZoAoE8N/VeO6SlFnMzFRuLA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8257 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772591014406505609 X-GMAIL-MSGID: 1772591014406505609 A mode parameter has been added to the callback function of fix_mac_speed to indicate the physical layer type. The mode can be one the following: MLO_AN_PHY - Conventional PHY MLO_AN_FIXED - Fixed-link mode MLO_AN_INBAND - In-band protocol Also use short version of 'uint' to replace the 'unsigned int' in the function definitions. Signed-off-by: Shenwei Wang --- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c | 2 +- drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c | 2 +- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 2 +- include/linux/stmmac.h | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index b9378a63f0e8..53ee5a42c071 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -178,7 +178,7 @@ static void imx_dwmac_exit(struct platform_device *pdev, void *priv) /* nothing to do now */ } -static void imx_dwmac_fix_speed(void *priv, unsigned int speed) +static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode) { struct plat_stmmacenet_data *plat_dat; struct imx_priv_data *dwmac = priv; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index e39406df8516..8070352844e3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -257,7 +257,7 @@ static int ipq806x_gmac_of_parse(struct ipq806x_gmac *gmac) return PTR_ERR_OR_ZERO(gmac->qsgmii_csr); } -static void ipq806x_gmac_fix_mac_speed(void *priv, unsigned int speed) +static void ipq806x_gmac_fix_mac_speed(void *priv, uint speed, uint mode) { struct ipq806x_gmac *gmac = priv; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c index 7aa5e6bc04eb..612551c09ad9 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c @@ -22,7 +22,7 @@ struct meson_dwmac { void __iomem *reg; }; -static void meson6_dwmac_fix_mac_speed(void *priv, unsigned int speed) +static void meson6_dwmac_fix_mac_speed(void *priv, uint speed, uint mode) { struct meson_dwmac *dwmac = priv; unsigned int val; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index 735525ba8b93..c32549d2fc5a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -631,7 +631,7 @@ static int ethqos_configure(struct qcom_ethqos *ethqos) return ethqos->configure_func(ethqos); } -static void ethqos_fix_mac_speed(void *priv, unsigned int speed) +static void ethqos_fix_mac_speed(void *priv, uint speed, uint mode) { struct qcom_ethqos *ethqos = priv; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c index d81591b470a2..2fb24c7e1b44 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c @@ -1785,7 +1785,7 @@ static void rk_gmac_powerdown(struct rk_priv_data *gmac) gmac_clk_enable(gmac, false); } -static void rk_fix_speed(void *priv, unsigned int speed) +static void rk_fix_speed(void *priv, uint speed, uint mode) { struct rk_priv_data *bsp_priv = priv; struct device *dev = &bsp_priv->pdev->dev; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c index 6267bcb60206..ef3be5a3e7b5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-socfpga.c @@ -61,7 +61,7 @@ struct socfpga_dwmac { struct mdio_device *pcs_mdiodev; }; -static void socfpga_dwmac_fix_mac_speed(void *priv, unsigned int speed) +static void socfpga_dwmac_fix_mac_speed(void *priv, uint speed, uint mode) { struct socfpga_dwmac *dwmac = (struct socfpga_dwmac *)priv; void __iomem *splitter_base = dwmac->splitter_base; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c index 50963e91c347..4bbc9d6888f1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sunxi.c @@ -72,7 +72,7 @@ static void sun7i_gmac_exit(struct platform_device *pdev, void *priv) regulator_disable(gmac->regulator); } -static void sun7i_fix_speed(void *priv, unsigned int speed) +static void sun7i_fix_speed(void *priv, uint speed, uint mode) { struct sunxi_priv_data *gmac = priv; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c index acbb284be174..5c50cebe9a17 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c @@ -53,7 +53,7 @@ struct visconti_eth { spinlock_t lock; /* lock to protect register update */ }; -static void visconti_eth_fix_mac_speed(void *priv, unsigned int speed) +static void visconti_eth_fix_mac_speed(void *priv, uint speed, uint mode) { struct visconti_eth *dwmac = priv; struct net_device *netdev = dev_get_drvdata(dwmac->dev); diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e1f1c034d325..1c26d60886be 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1060,7 +1060,7 @@ static void stmmac_mac_link_up(struct phylink_config *config, priv->speed = speed; if (priv->plat->fix_mac_speed) - priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed); + priv->plat->fix_mac_speed(priv->plat->bsp_priv, speed, mode); if (!duplex) ctrl &= ~priv->hw->link.duplex; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index ef67dba775d0..7d5e178574be 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -253,7 +253,7 @@ struct plat_stmmacenet_data { u8 tx_sched_algorithm; struct stmmac_rxq_cfg rx_queues_cfg[MTL_MAX_RX_QUEUES]; struct stmmac_txq_cfg tx_queues_cfg[MTL_MAX_TX_QUEUES]; - void (*fix_mac_speed)(void *priv, unsigned int speed); + void (*fix_mac_speed)(void *priv, uint speed, uint mode); int (*fix_soc_reset)(void *priv, void __iomem *ioaddr); int (*serdes_powerup)(struct net_device *ndev, void *priv); void (*serdes_powerdown)(struct net_device *ndev, void *priv); From patchwork Thu Jul 27 15:25:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shenwei Wang X-Patchwork-Id: 127061 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1230051vqo; Thu, 27 Jul 2023 09:50:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlHnDUWyoDOzIEx/pIjI1P8X+u2Gucg8ThM0HpjyCRcEd2Ze74G5jEl64J4XI/yRbj3XqpIs X-Received: by 2002:a17:906:3158:b0:96f:e5af:ac5f with SMTP id e24-20020a170906315800b0096fe5afac5fmr2449222eje.47.1690476616767; Thu, 27 Jul 2023 09:50:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1690476616; cv=pass; d=google.com; s=arc-20160816; b=QyDIAW/qrh5Nuyyo8EaF5Q3fUVDQG4d3gEyy8e+aZLA838yFSiWwgaa5EXLVe0OKOL MFbwQLlYYlJCCDKauwkJD0Z14wA4VgBc9ExpiRKcgBPmytignQcJKjXHH+oIHASrwc3Y 5g6Uj62uIYtb3LaSCzL0JsSihmnnCOigxincqXY7ZTUmGNJUKIPf7rwbIifjujn2C2G1 F8tZAcDyQihUav10viB+uyOujFNqYra2rtL+r6NwLblq9HrqAhZOaKNwy4SIVFEO9hb/ G0wKUnwiSCuPKwwLDaTRwEYBA3m+wZ1rw9vkO/qC44CnNKx/xJ8Sts4i883wpeiQNm/8 3VIA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DnGeXiHXIDBm7s0zSh+ex4FGI2w1k84IOe+fdQrfUQc=; fh=drcBRNXGLVyYi82lAEwRI1s3R9HHNWdJ4DXnLVZ8cic=; b=uPa53j8H2/8Lud74mMFp02Vo9WwqtV7IDGs/4t5VBcU4lC/TQByjJ3qyYd6Xkvxw0E jae+0AYeyyad49qshVwZj9TIzCUOnHFhWM/8q/5KPkwci/4yCx5ND/rx6gHRCPLLRGsU BQIrJVuua0sfr1egQmoM1wDB0BOkymKKyFR07WvfoixHnZWNXTU9QleeBfPR7xKCMDIm 4WAoBMHDnmoHK+4wnSG7RpVB+5/UVayikXIcbLPnGWr941nXd2wxPPyLQ3K3tqAKfOyP SLBJeoUoVV7yNP5Axj8Q2ZeJpEMKHiiOrDL66VID73jUMMgwrj6mJXLqlnzFFURXlry9 d5rw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=d9vYQWTt; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z23-20020a170906435700b00982c5ee4393si1192587ejm.828.2023.07.27.09.49.52; Thu, 27 Jul 2023 09:50:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=d9vYQWTt; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232537AbjG0P0C (ORCPT + 99 others); Thu, 27 Jul 2023 11:26:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234610AbjG0PZq (ORCPT ); Thu, 27 Jul 2023 11:25:46 -0400 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2047.outbound.protection.outlook.com [40.107.20.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 979A530DE; Thu, 27 Jul 2023 08:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ACnDVclZpu3PdlECoxLgg0d/OUaNUMULAMnObIwE9GJ5B3DvdIXxDm8d/WbEWplRI09hLQQW2r+BERzJW0OVNF9u4PH4Ecs19acK38tXywfh9eZ3wqZKwiykESVHs7STbaTsTOGnVNqdn6EAGYCeELfWDZ4tv+yUO05UyfZrgN/Lvv9pPvrx55HVklUz/Aks9CQEzL+8vsWY13SVYvzcWs5a7JkG28kPXa5fWSKznYZaRiZIBWATQp4ykRRB+RJdVXtXrEKuotkDF5xFJm9zFnnJnD3/p7+70d5FjtfuVxk9YAY1umZnXzw8IORPu/AjBfYzDqcrRaGn9M70sQOdBQ== 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=DnGeXiHXIDBm7s0zSh+ex4FGI2w1k84IOe+fdQrfUQc=; b=cbnGmkzgve2FUitgBvD8AdS3aak4+91PnRIE3x4dIzE9rkATVpCLZVkkdD3GefVS9fCspF2huNoFpVV47wbjZQYrvn12kq60IGfXCviAOIlD/+p16FnVc+NrTGVa0j6GW5eKNOaxToKaeagbZdfOZpqH8P/TPnR4c8YaJZPOmYmSlOO01Vdhp0LfPwNKcQv5BGhrymN/njddRqh30OLEZfzUrbkd1HDn2AFGSdpnvShp1aUmF6BtgvAm2cDm+vHu683ECv2wRTEIze3hqOqluqrTutb4anDHpAuZj4nl7wsKfY5BSV6erE1XD1j5s9ARrDgr6lOYG2SXoVNnGXOi5A== 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=DnGeXiHXIDBm7s0zSh+ex4FGI2w1k84IOe+fdQrfUQc=; b=d9vYQWTtuSUvJ3Cc+ToihoGfgttG1ppFD+9pKfp7IW4zlxzR3pZvTpS6sLqezLxk+MmMJ6ywv7lzzBvs/0RLyAuN8WsE/xZCgUD4z6BnNvNMKV/JInkgRdlyg1VEqoDDCF5I78TzYBgpdEph5V6TqML0QH7ApFvcjw8L/NQHe/Y= 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 AM9PR04MB8257.eurprd04.prod.outlook.com (2603:10a6:20b:3b6::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6631.29; Thu, 27 Jul 2023 15:25:39 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::d4ee:8daa:92f4:9671]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::d4ee:8daa:92f4:9671%3]) with mapi id 15.20.6631.026; Thu, 27 Jul 2023 15:25:39 +0000 From: Shenwei Wang To: Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Shawn Guo , Sascha Hauer , Neil Armstrong , Kevin Hilman , Vinod Koul , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Jerome Brunet , Martin Blumenstingl , Bhupesh Sharma , Nobuhiro Iwamatsu , Simon Horman , Andrew Halaney , Bartosz Golaszewski , Shenwei Wang , Wong Vee Khee , Revanth Kumar Uppala , Jochen Henneberg , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amlogic@lists.infradead.org, imx@lists.linux.dev, Frank Li Subject: [PATCH v2 net 2/2] net: stmmac: dwmac-imx: pause the TXC clock in fixed-link Date: Thu, 27 Jul 2023 10:25:03 -0500 Message-Id: <20230727152503.2199550-3-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230727152503.2199550-1-shenwei.wang@nxp.com> References: <20230727152503.2199550-1-shenwei.wang@nxp.com> X-ClientProxiedBy: SJ0PR03CA0284.namprd03.prod.outlook.com (2603:10b6:a03:39e::19) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|AM9PR04MB8257:EE_ X-MS-Office365-Filtering-Correlation-Id: 2406c8b9-6464-4d13-73b7-08db8eb5bb6f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1HzAltImfwT2KWSEyKjTvWw93tLTtwwvGXKhw0yyubT6Fh4A3EP/pofhnHUqpifCqw2SE/+Z1osEhJmBLKZVrl4GTJrabRWkUzv9asLUilS3n9bJNoT5n9+3G54GPkYTFl2OUiGhzN3198xTGipXHD2kT++CrEganp+t3hyoaeMEjs5H842P7qHS5lRXa89LveH+wYLANUoQ1Ivtv8TtMW68yapKeW82n8Qo8nRf79XK2aU9xX6QwAUFdxRA1qE+ghvCg4iroXl7qoKVg8o7ycacGosi+s0mR+mNmL6V0SHjdRy54xV2ble2ezq+5VSERhqtsT74e8LbHJe/81b9iBOKZx8y7zFvPvyRpIvju7dk3pXUXJgyWm6za+/XKTJkkMAr57NDEBYuQ6Sq0ZGl4pcNSqKfQcPK6/nJ5JLia/FB0jkds3G7HmmJSahUP1yvd+HgxIq8uiuvjO4kkRpaotMH2D3kXHi0gFk+zEYOdzhF8GxsAZju9yxMp1U9ksUMIn46rLxMB4u/LhVMXYop2bEOuPV721iTkjP/+hghttSwGhW1nxaTMY6FlzYVXIEuTUtYqzA/gEwjYjOx9bwTA1U7Ag91uTm1lxIce7xmz42Nfw95QczzwdDwAxrgcP8X2Uzyrw5lP8cC6kiZwSGTtQ== 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:(13230028)(4636009)(39860400002)(376002)(366004)(346002)(396003)(136003)(451199021)(316002)(2906002)(8676002)(8936002)(7416002)(7406005)(5660300002)(41300700001)(44832011)(36756003)(86362001)(6506007)(26005)(6512007)(1076003)(55236004)(6666004)(921005)(478600001)(52116002)(6486002)(83380400001)(186003)(2616005)(4326008)(66476007)(38350700002)(66556008)(38100700002)(54906003)(110136005)(66946007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qiWK1I4S9TV3jFnT3UlhNIfhqxYTgRO2uJ32epQdKzr7vdvJi8Tzik2CmV4Yl/24b600tFS0AF5RNGYkMM/pyq+gp81CTSKYwlWfr6t+aO+asRMxw/mow+amJVt5fpmWBtZPCiK+pTYTsNR8eRa1zE/Uig2Kl4iqh7iamZrxIq3t917T5nXlo/tCUhGGVZnAX6RKbl0xFy22bl60tw9J1Z1jakt0AaEoji97aBREHIjfQkIAqCRW7okx1nKajS6unHddfvsbp8Ur6zdhGXG06zrhaJfSJ6OmjSHKQ5Ucu+0Oxoszgjxz7JAnLaINg+kUIDU/oZxjF6X6j++a9Jl8llLfCK0kwsT14u6W3EvHLGMJn5JS9qxG5kZvVmMHQcHHVPguVtwz5RCDwxyUpB+3cfy6pGyjgrsaSHmTAUirMm0brqifcrhghaKo6MmZ0s26tP0ZrOIubHHr3bf/j+w/od+IPK619kvTGCDUHLRoefa4VAhjRmG+WcbCYYrWR9QL8sm0waAUZJa0IGpCtYTTNTcmFOsw/bj7AreVVG1jW9/Lwt9CPKTmlVzCdBdYS14yo1av/7/7XocHVAGRFyZp2NhJteUdWQwgEo+z/iJvj3+UTs0+I+MY/BFEqf5Yd9l7AJ2FhEVUe3dEA2DxLulEmumdDFbrYNvF29SgWQzZ2/W9PQMu0DDvF/3c5V0KkLkQuSnHeEwR+ZD8+oo7/RzQGCsywabElxLjE0NKufKDWmKgiGCAfvWqqwVOsx87m12uqFLUgOZaDItLl9TNMJkjE84lzIZyWVZKBMYi6+j9veX+bMZKjaqudU2I/n7MUfVOW6BFnWE4gSQpPtOI+n3cY0OUuXr78ee9XHnqHeWhmq/cD0zfJ8mzcB9RLzyooKi/ow1cz75ADkslTVZPmH/C2ig1ME7WPuZTKnUYBxMGoXsjuigQIxYn82qxLNFZo8XYp7KdIET06HlQ5WLsJ9QHmOiQ7TLrJKrDK0I6H+1aA1oWlnPqeNHG+v82p2TjNi4DrA4ioHaDF3mKK0Z2TF5jMGZLSFjoIqOKx32/S8+j/FfsKEj/uYxj+7PwaQsK/lupW4b/CY3sIQSzskzvb1+cDgVehS3UBVtJcW3XGIR5R6nuUD2RJS+x7WprR1yFAxyBNBXrRkFoPB3YxDMJLY7ecnJYzQvR6xAQoquTJMNcMBO+fAtLCymIz6DejAgvr9wjmESuHybjKrpB/bgt+tW7efetA3PkHHI4MQHFN9D+DIGZMPPXzeDNZJjxrPGpGjeAfFxo4qVyTUgdMipp68nhergjmKbbzI53wfh9QL/ahNRJBgYoYRXu9Bk3W2E8mqPAAiAg0ED0F3Ra2FOQS0TxUwauADp1OlnABjxeMtbkmQSCW4SCLlra369WeJkQkJ0I3/pyPryIcdMT6O0A0cPUgUvM3D8IUIjcQqb0uU2GzpZXZUwfMZkvosGQUI3soUOC6A6igJvxCor43EcWNzrRlZZEi+hxGVLCrV5FnRreDb85d3OmouGO/CUSI41fVLLp113anLbYG5uiuauB2keQkrIj6GxQeN4F3IrVGBqgS7LW+oketmrhEJSoyM7Qyy1D X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2406c8b9-6464-4d13-73b7-08db8eb5bb6f X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jul 2023 15:25:38.9832 (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: oZqQqDflAO/+LocWExD9G9Fnw5JoKJCmrjMOtwBNuNVYSovyGQDgMJcLuhHNkafG8j7VQhNzYaE3ArNfiN4Z+Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8257 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772593209237276848 X-GMAIL-MSGID: 1772593209237276848 When using a fixed-link setup, certain devices like the SJA1105 require a small pause in the TXC clock line to enable their internal tunable delay line (TDL). To satisfy this requirement, this patch temporarily disables the TX clock, and restarts it after a required period. This provides the required silent interval on the clock line for SJA1105 to complete the frequency transition and enable the internal TDLs. So far we have only enabled this feature on the i.MX93 platform. Signed-off-by: Shenwei Wang Reviewed-by: Frank Li --- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 53ee5a42c071..e7819960128e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -40,6 +40,9 @@ #define DMA_BUS_MODE 0x00001000 #define DMA_BUS_MODE_SFT_RESET (0x1 << 0) #define RMII_RESET_SPEED (0x3 << 14) +#define MII_RESET_SPEED (0x2 << 14) +#define RGMII_RESET_SPEED (0x0 << 14) +#define CTRL_SPEED_MASK (0x3 << 14) struct imx_dwmac_ops { u32 addr_width; @@ -56,6 +59,7 @@ struct imx_priv_data { struct regmap *intf_regmap; u32 intf_reg_off; bool rmii_refclk_ext; + void __iomem *base_addr; const struct imx_dwmac_ops *ops; struct plat_stmmacenet_data *plat_dat; @@ -212,6 +216,44 @@ static void imx_dwmac_fix_speed(void *priv, uint speed, uint mode) dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); } +static void imx_dwmac_fix_speed_mx93(void *priv, uint speed, uint mode) +{ + struct imx_priv_data *dwmac = priv; + int ctrl, old_ctrl, iface; + + imx_dwmac_fix_speed(priv, speed, mode); + + if (!dwmac || mode != MLO_AN_FIXED) + return; + + if (regmap_read(dwmac->intf_regmap, dwmac->intf_reg_off, &iface)) + return; + + iface &= MX93_GPR_ENET_QOS_INTF_MODE_MASK; + old_ctrl = readl(dwmac->base_addr + MAC_CTRL_REG); + ctrl = old_ctrl & ~CTRL_SPEED_MASK; + + /* by default ctrl will be RGMII */ + if (iface == MX93_GPR_ENET_QOS_INTF_SEL_RMII) + ctrl |= RMII_RESET_SPEED; + if (iface == MX93_GPR_ENET_QOS_INTF_SEL_MII) + ctrl |= MII_RESET_SPEED; + + writel(ctrl, dwmac->base_addr + MAC_CTRL_REG); + + /* Ensure the settings for CTRL are applied */ + wmb(); + + regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off, + MX93_GPR_ENET_QOS_INTF_MODE_MASK, 0); + usleep_range(50, 100); + iface |= MX93_GPR_ENET_QOS_CLK_GEN_EN; + regmap_update_bits(dwmac->intf_regmap, dwmac->intf_reg_off, + MX93_GPR_ENET_QOS_INTF_MODE_MASK, iface); + + writel(old_ctrl, dwmac->base_addr + MAC_CTRL_REG); +} + static int imx_dwmac_mx93_reset(void *priv, void __iomem *ioaddr) { struct plat_stmmacenet_data *plat_dat = priv; @@ -317,8 +359,11 @@ static int imx_dwmac_probe(struct platform_device *pdev) plat_dat->exit = imx_dwmac_exit; plat_dat->clks_config = imx_dwmac_clks_config; plat_dat->fix_mac_speed = imx_dwmac_fix_speed; + if (of_machine_is_compatible("fsl,imx93")) + plat_dat->fix_mac_speed = imx_dwmac_fix_speed_mx93; plat_dat->bsp_priv = dwmac; dwmac->plat_dat = plat_dat; + dwmac->base_addr = stmmac_res.addr; ret = imx_dwmac_clks_config(dwmac, true); if (ret)