Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1338458rwl; Fri, 31 Mar 2023 09:42:04 -0700 (PDT) X-Google-Smtp-Source: AKy350b5S5xjD5jUzbWsKJZVy0LZ9oelq7pbLs6e/N0T0wEiKGcVU6If6SCE1EUXuvsPC0RyIX8X X-Received: by 2002:a17:906:74ca:b0:932:efa8:28fa with SMTP id z10-20020a17090674ca00b00932efa828famr24222601ejl.2.1680280924362; Fri, 31 Mar 2023 09:42:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1680280924; cv=pass; d=google.com; s=arc-20160816; b=Bax0y84dNYP0JRRi5PvdJqS0Wbwz/UAkd0WhLDZh18wHGYYC+Eeswq13txGGvNNoCo +nBigo+h5Vc2vZMN/VDrYr4Q71WoqmH26Va9/dFp0b/YenyP6OvXstzUn8kezQkbdiLP UINowrnzKqvEuEcyTayIUgqq/5aldwPzI9VfzfACwBgQ05Y0jFp+F10fu2dxBQDdqxfI mKNE9xFC3Y0jX9wNIPy/9DyI8FHPcBH26LGs2GROa0BdUrQdQtN/9k+PbaNrJPgHxn0U 7CZVJt0M+nvScAA6arvokahN9gyoFmqXBn3LCbey3A0NTzinT7IM73/WItkK/p+Oy7au eerQ== 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=yl/Nal0PpgBFmmyQJ3enEWiLymBs3mGdmq4D2SJEd18=; b=QjcVxdJ4Bu1VVVgGQpietl9X6ROl5GA2pu7nytedbqfFHWT1VbUbXMi5ZMvf/yuPCX Rl44cBc1vfm+t3xZuQmLvbeqz3+6hzMKI0gCaN947cOdMVFN1g3CjwknQnygpT6J90sT vJNUr87N29wpB1RsEdyzHWbFW760KK1S2sOa3lLXxdGifZjiRSELFohuG0RLzXEPqF0E LqPzUZKfV/+RSlgzWTP5XXluJxb3QekQ95bpCZ96lsGmD8RNspbz0Frn8fY1aZoga3fy kRFrdpI3XGnKiiR8vQAkGE1qFxQRk97tRMP2Tn7vUYAw7CmGcTHh88Jsj3mr1gnkTbHG S/QA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=cPPzTDKn; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g11-20020a170906348b00b00930f5ecbd94si2063715ejb.346.2023.03.31.09.41.39; Fri, 31 Mar 2023 09:42:04 -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=cPPzTDKn; 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 S232330AbjCaQgP (ORCPT + 99 others); Fri, 31 Mar 2023 12:36:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232396AbjCaQfq (ORCPT ); Fri, 31 Mar 2023 12:35:46 -0400 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2045.outbound.protection.outlook.com [40.107.104.45]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 372032B0D9; Fri, 31 Mar 2023 09:32:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XC+bWzJheY6fLsXN3i/jkUoWhFh/c2e62lvwGqbR1VOJqJ9Rc6dKlF06Bv55JBpZJKoN7djF4W18THQZqWaxScMQOwXRXrKCe0mA26xSWR0lAcCHJtAv9aziGzPQKbM6QLS5finOdc38RXiH/gHp46+0iF5viQylASidcISmZ12FJi71wYOoBsOWMYMlpVeQQjTLlB4IqebUEOdaHmgeEo72pwTvdDjrCa5iYwTrL5lsyBt8ULTpyeBDOmZF27ZNFjYHEI9Fd941K7jqxJ9oiApBxEq9Z7DNRy1X/j5vXgbvEyKNCF9B/R7CiAyvWt8WOe+lyeGAWU7/XkHN1ElrEg== 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=yl/Nal0PpgBFmmyQJ3enEWiLymBs3mGdmq4D2SJEd18=; b=EWtmecqJNQTDIpGphJpj/71iR/WW4kzCFY18Cm3caERuN5JyIYon2bc53by/BXAwwYGJdBqGttl75r122HFiHKNzAn4uEJamSzq3mrQnVsgUo5ycOFEp9u/hHYhTTinizzqGkQlfZyHQa7ZxvCqUfxh5jbFD1+ffdh6SSWCClmg2AgyxUynlSnJ6Ve3uS1m/cyBttpo7ZGgi1Ct9igrohsiFHu1OhI00C3E4MDl6xlce154WXPMWL1TkeBvOrGAULJKS2CnCVJjMv7xD1JY7d3CjCrJPt01JeRfm0IbUC3CYynYdNwXV/W3cLku6vEoYUIf2M4v7yDB0T5zglkVhEQ== 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=yl/Nal0PpgBFmmyQJ3enEWiLymBs3mGdmq4D2SJEd18=; b=cPPzTDKn0S3T9h3wN2rPPZ/5YMB68EoUUHPhDRjA+M7Kob/5wKUI4XQV+tLu7EXkBkiO6bXgOVDkCoSQzYaPT7FlFF1dE1vetQAOkT8xqlfNAeYACHm1nysF/0ov712eNzlQtFkNeTwdxoMytBHb4+vp3wN/+3hIzpBKGN5xBaY= 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 VE1PR04MB7213.eurprd04.prod.outlook.com (2603:10a6:800:1b3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.23; Fri, 31 Mar 2023 16:32:15 +0000 Received: from PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::28fb:82ec:7a6:62f3]) by PAXPR04MB9185.eurprd04.prod.outlook.com ([fe80::28fb:82ec:7a6:62f3%3]) with mapi id 15.20.6254.023; Fri, 31 Mar 2023 16:32:15 +0000 From: Shenwei Wang To: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Fabio Estevam , NXP Linux Team , Maxime Coquelin , Wong Vee Khee , Andrey Konovalov , Revanth Kumar Uppala , Tan Tee Min , Shenwei Wang , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-kernel@vger.kernel.org, imx@lists.linux.dev Subject: [PATCH v2 2/2] net: stmmac: dwmac-imx: use platform specific reset for imx93 SoCs Date: Fri, 31 Mar 2023 11:31:43 -0500 Message-Id: <20230331163143.52506-2-shenwei.wang@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230331163143.52506-1-shenwei.wang@nxp.com> References: <20230331163143.52506-1-shenwei.wang@nxp.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SJ0PR03CA0072.namprd03.prod.outlook.com (2603:10b6:a03:331::17) To PAXPR04MB9185.eurprd04.prod.outlook.com (2603:10a6:102:231::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9185:EE_|VE1PR04MB7213:EE_ X-MS-Office365-Filtering-Correlation-Id: 6085b80a-0fc0-42f9-5485-08db32057cb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KSngqAfrtdTNPxEGLcOv6rJjVinEGuUlZQwej9l4RgDEmE0MhD7F8bV02jtRZmTcRzWvZ1LSBt34c1lBOnM9aPlv/Lu9BPm4us23M7VSPl/RA+bgvzA9jPXmf1UHM6fa69GxLJhBxLJge1xFmRil29SCJzWeqy7DMAeRnDpuObPZJ2FLpf7PGdY0tYu/jYYLSehD+0o7wiuXFgyqC6QhjUgCq6mYGM+yOD/TP6gblvqLWUjOCxMUc6Fsrik0uWo6/4r2AtD+2WHohQlzW3YEyoVjwoNZWAA7/7hekKQHwvzvxVfeK5xWHtNtXI8UY4fMSa08g5+IhqtR7pIiK/dLc/NXzp9qqM3dQ4A8MI3LS1kTX0fJ4+LE7QTG2/j0ml5c80+buw+Z0RfbifdayuvKzbOfnaa2u95G5zyiEQEmUitsR+xGQQFlnRT7uMM34AMlSDjHsd2y1+OcbQFRyjKgtzlhqO5Qax5qrpdl5iXCXPDvO6DlytejyZB70e4beOUhiltnbtyAq8q/X5HnoSsr99JunrfqB+sHuvPuKMSnSsM3DVKINXr3U44nn776ldC5HMEGycJ54BA+mYg2sr/+DMMSngfw8c3o6SLOdK7HdCTJsKF2rANbjI/mXPAjBVae 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)(6029001)(4636009)(136003)(396003)(346002)(366004)(376002)(39860400002)(451199021)(7416002)(44832011)(1076003)(2616005)(83380400001)(6666004)(86362001)(55236004)(6506007)(26005)(6512007)(38100700002)(38350700002)(186003)(8936002)(5660300002)(478600001)(41300700001)(66946007)(54906003)(6486002)(36756003)(8676002)(66476007)(110136005)(4326008)(52116002)(66556008)(316002)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ctEejenVZTfXBszv3jfNayeF+9GK52tYGydXY7fSet3KMP1/YZU5bVIRrV6r?= =?us-ascii?Q?5n8oW0Ugvb+CAfzE7VPqTxbU5UIXJOVuM3DyVoi2MIJgxRj0rCmhHfszS2wz?= =?us-ascii?Q?Za4YH2ViSS5RJ2QD8WeT9XN392RQ1DaB1tjqyWaKAPDs8DEZ6PfuisSF04kS?= =?us-ascii?Q?m85CHpGoSqIQwWdhuDM7ZrESOlzufCAlngUQL9Yde3lEArTpdqexJ/ihTUvV?= =?us-ascii?Q?MqVdi6SFiRwVnpWULFP3odu0uSnWeTmgkFIEcE3TzxuzaEbiMbLLOJuSJltl?= =?us-ascii?Q?voGH5TMu1817MXVJx7ChvYgPGTWR9HBGx+G52yEjcRmmoxTN3ZwJqYjsBcvW?= =?us-ascii?Q?7ffElldWzN3znmHBii7JzoOji/xQ+W8mOcyr5kEh6jsBPWjmDlmMeS2z4kIn?= =?us-ascii?Q?EWK/pzbNmfw62pmlNNo2XW1sm4OzDukt+uoFP8PEfymn3eBam2hi1grG3CuJ?= =?us-ascii?Q?Vii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JkavW?= =?us-ascii?Q?+bk/Jj+6T1IiJ7aDCtY99vFctOQYtrhbZkn1DcTqQfXQfF/Vp7G2m1zszx/7?= =?us-ascii?Q?mcgsfLzOIhyjLAw0Crq4EdTY3FMHHiOIRE3Hl3Kdwq8ViBZf0UqNE5mXW7x4?= =?us-ascii?Q?4nfbJb7zQrf8c3Px+/Wc1z3KCLaUlsCsu0Fb4wp7ZMN/7gepOtaPSvYEZ2im?= =?us-ascii?Q?tfqDfIWq+ex1nAzueVVOUdcskwKUEx19hrzLfwZE?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6085b80a-0fc0-42f9-5485-08db32057cb7 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9185.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2023 16:32:15.8120 (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: a260/fwpc5w+ble64BZURkjSbqKqiAo8Ol76SpVZQKDRgNsVMlt6biV2E0cnfJpV0Y8Bu3DYGKVtH51f6A2pqQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR04MB7213 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 The patch addresses an issue with the reset logic on the i.MX93 SoC, which requires configuration of the correct interface speed under RMII mode to complete the reset. The patch implements a fix_soc_reset function and uses it specifically for the i.MX93 SoCs. Signed-off-by: Shenwei Wang --- .../net/ethernet/stmicro/stmmac/dwmac-imx.c | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index ac8580f501e2..3329150010ce 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -19,9 +19,9 @@ #include #include #include -#include #include "stmmac_platform.h" +#include "common.h" #define GPR_ENET_QOS_INTF_MODE_MASK GENMASK(21, 16) #define GPR_ENET_QOS_INTF_SEL_MII (0x0 << 16) @@ -37,6 +37,10 @@ #define MX93_GPR_ENET_QOS_INTF_SEL_RGMII (0x1 << 1) #define MX93_GPR_ENET_QOS_CLK_GEN_EN (0x1 << 0) +#define DMA_BUS_MODE 0x00001000 +#define DMA_BUS_MODE_SFT_RESET (0x1 << 0) +#define RMII_RESET_SPEED (0x3 << 14) + struct imx_dwmac_ops { u32 addr_width; bool mac_rgmii_txclk_auto_adj; @@ -207,6 +211,24 @@ static void imx_dwmac_fix_speed(void *priv, unsigned int speed) dev_err(dwmac->dev, "failed to set tx rate %lu\n", rate); } +static int imx_dwmac_mx93_reset(void *priv, void __iomem *ioaddr) +{ + struct plat_stmmacenet_data *plat_dat = priv; + u32 value = readl(ioaddr + DMA_BUS_MODE); + + /* DMA SW reset */ + value |= DMA_BUS_MODE_SFT_RESET; + writel(value, ioaddr + DMA_BUS_MODE); + + usleep_range(100, 200); + if (plat_dat->interface == PHY_INTERFACE_MODE_RMII) + writel(RMII_RESET_SPEED, ioaddr + MAC_CTRL_REG); + + return readl_poll_timeout(ioaddr + DMA_BUS_MODE, value, + !(value & DMA_BUS_MODE_SFT_RESET), + 10000, 1000000); +} + static int imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev) { @@ -305,6 +327,9 @@ static int imx_dwmac_probe(struct platform_device *pdev) if (ret) goto err_dwmac_init; + if (of_machine_is_compatible("fsl,imx93")) + dwmac->plat_dat->fix_soc_reset = imx_dwmac_mx93_reset; + ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) goto err_drv_probe; -- 2.34.1