Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp42435rdb; Mon, 15 Jan 2024 11:21:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IHquOOXvWRRHaiWGxWPo12RWJfiNjNupho+DmSRA7cEO+BJ8s/V03VRfKtKMK8Al2RpuKmG X-Received: by 2002:a17:903:2444:b0:1d4:4e13:6b59 with SMTP id l4-20020a170903244400b001d44e136b59mr4076064pls.45.1705346463093; Mon, 15 Jan 2024 11:21:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705346463; cv=pass; d=google.com; s=arc-20160816; b=Gl0NAvOh7EtahaFAGqT08uGzh/YAaKoxW0X/wXmSHGZ8M26bqgQBIBR2yyBh6rGtpU 7HUuzX4Ve3Oetu28TrNWcakjK/ND/S5jA3CPCMC0Q0uzxfO7ykUad0UBvLXmybGXr48g AXh7RgsNH+XlD3GiWAon+HjZxQRsyt1/cyTdB8b27gIX0csSEqfcfddmtm2lNvG2Nfqv khopLF5VXHEO+jQptaR04jiQ+xWfWuhC32wB6zN7/4bYXpHB17bFtjPKOMqGfFAG6ljA An+tL4Rol8MNaQ9FqVaoxVG67eKQ2jED8DGgeqUTT4ttzqADrOdoQtvhGPLlzQq9c/xl l3dg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:in-reply-to:content-language:references :to:subject:from:user-agent:date:message-id; bh=6jPTxL5OpRVaxkWWCXA1XtnX6eQpMGzPtpdmv9RgZlE=; fh=AIRyXsJ1slN37rDrtWHk9RtShg/Wl7EfxRn56IBOQZI=; b=hXZa4fStjaz1m6IG4hYi3/jQQ+M1coCiobfBWEJI59Ls3U7WgAgOz+F0hElL7H+R5g Q8zvk3f8x+Vn4xPWDRz+j8KzdvwLQvdXlX+MCitgZZ7ytcuJjbOE2WqaPpSdhGo3Xf// WOyb/PMUBYzobbRAOWMOkUcgGnvp7+3jCxZfFCrlXRgkF88gvm0PctOyd86Hy7oM03fy /GE81oxkYcKmWlTK5hez8d8//sKIyQ24XBE3HQ2A/Lb8clntICch6duI2McSssUHVklQ Dfv4IIQ3qPAloklNNPBR5DMip3osAlQI5Xh4NLVvlNXD+4qXd3yNmWrctiPHQ5EzE6EI URPg== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-26433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26433-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id b11-20020a170902a9cb00b001d3ff189f4csi9531672plr.515.2024.01.15.11.21.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 11:21:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-26433-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26433-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=hotmail.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B2962282C0C for ; Mon, 15 Jan 2024 19:21:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFC2618C24; Mon, 15 Jan 2024 19:20:51 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2054.outbound.protection.outlook.com [40.92.89.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9822118AF0; Mon, 15 Jan 2024 19:20:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=hotmail.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hotmail.de ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aA9R9IyJcCA8L/e9I7Yq8HzHbTJqqVya+ZFVDT+XK9Q49+60GuI1MBxzf5cIZdAmjXF+MPSmwlZar7DRCCPP2rKab07FGwC9zG4Y8DhekGavVKBv6wVXm7h0LAY/BfFpb9+GiP6nznZP0jllvi1QusoU5ZgXDmlbIG8OdRNw/euRt3pyhV6NLelNqBD9J4FtUuhRB6HD5Dqm7RzYe1nkoIfkIFl1iTahdn7buPph1o8YXB07K8zJ+mK6MSI1mfPUYMkdMQ8lVG+1EJc7Sa7041+xl1Gan3QWiv94u/4nUqWt0O8fd5lYUfurvFI5kkXHIbJ6PNUMCPYQ5hD/0VUPTg== 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=6jPTxL5OpRVaxkWWCXA1XtnX6eQpMGzPtpdmv9RgZlE=; b=FkwJJvY3hLmylshszJzoF7PO3aMg8wQjOG+G8eFhHBiBFsxhhOHyH/hFySpGz7P2uSLMGIOVJq3pP4EAJC9QSF/Yrp1AQeePLgQ+j0aQV86Ztvj6E2bp/wRNiejsjPfeW/O/Jjr9z7VN+ChALa7lsHR3ekkjslJywNAVFEA+3Dz75WM2yF23O7ERCyoy880CiCh7eXie+9UucRgPB+t1xxTeyeG8V39UWeAQWVyIVh+bvyY9+wKf0in+IuAo5M4JdziXt7Q0jcCqUvShFCMQPZhDfH5h4dZd0j6Y6gGkUd/SCC/tQN2ZWMxDQcK/4kcdl9/+HFzV3oO65X+dW3CWSw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) by AM0P193MB0769.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:16d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.23; Mon, 15 Jan 2024 19:20:47 +0000 Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::897e:cfd5:b29b:c611]) by AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::897e:cfd5:b29b:c611%6]) with mapi id 15.20.7181.019; Mon, 15 Jan 2024 19:20:46 +0000 Message-ID: Date: Mon, 15 Jan 2024 20:21:42 +0100 User-Agent: Mozilla Thunderbird From: Bernd Edlinger Subject: [PATCH v2] net: stmmac: Wait a bit for the reset to take effect To: Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, "linux-kernel@vger.kernel.org" , Jiri Pirko , Andrew Morton References: Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TMN: [awWvB8M45afXTdq0zJngE/LO/0atHbZDLwB6sZo2A9pBAuJIjOQOuTWYzCpl2Dq8] X-ClientProxiedBy: FR3P281CA0205.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a5::17) To AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) X-Microsoft-Original-Message-ID: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P193MB1285:EE_|AM0P193MB0769:EE_ X-MS-Office365-Filtering-Correlation-Id: cbe21b6d-df57-428c-057b-08dc15ff1340 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FAOybPWN+qdlZCcWoVUxF0Q7xokWhTgkX+1Kdolkck1Q9Dt7P0peyR/WSz/cE73SGgq3Cn0w/RoYKrXjDIHUv5JFQVHeCiOsfffLh0+O29P8wybyco3hyWUGV2dE1X8dtwUju+psuM7DFe+SzbfTy+pAh5dk3cYMEMHACFvH8ISLvX9mMT8Ah5tZIqbR75rT7HRCuASiMhwBz7rAP3uuSSGZP3GrQ9V9Ajw6UAbZyWcjnQ+5iBJ6EEDmps2L2iv944v7zaeAu8vLAPNWpUd0PCR71FY5kTXMAHovK65GL2Uur10/vS0SjYRNXH/Bv0X6zOH1B6YfeolFvbR8l7SGtT8Raj/gBPFHI1JtUdr9vGu7MCHq0u7J8T9MYxMku0YrvnIql8izDV3cHy3u/bdX/Pt/Lix0rN0EES0wIr73kuvbm864qN5zmmnD1lu1z1I85oDIHWNzQuEfGUw9PVK9a00LbfzT6XrE+qAuM1Om6JY1MweRuyDJhadiQBN6J7HK9qGEbuQZTk1pZWBKW6RexNU7joFhG9CvX8nhyMwjLbzPaI36a3olzOWjjPyf+Oxkduo94WBOgg1wzkIDdAcSgAJIZgY9fB1KX5lTCpE2F48= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?KzVrSmFyK2k3VWRiaUpaNzN4MW1za3RMM0hs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X-MS-Exchange-CrossTenant-Network-Message-Id: cbe21b6d-df57-428c-057b-08dc15ff1340 X-MS-Exchange-CrossTenant-AuthSource: AS8P193MB1285.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 19:20:46.8394 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0P193MB0769 otherwise the synopsys_id value may be read out wrong, because the GMAC_VERSION register might still be in reset state, for at least 1 us after the reset is de-asserted. Add a wait for 10 us before continuing to be on the safe side. > From what have you got that delay value? Just try and error, with very old linux versions and old gcc versions the synopsys_id was read out correctly most of the time (but not always), with recent linux versions and recnet gcc versions it was read out wrongly most of the time, but again not always. I don't have access to the VHDL code in question, so I cannot tell why it takes so long to get the correct values, I also do not have more than a few hardware samples, so I cannot tell how long this timeout must be in worst case. Experimentally I can tell that the register is read several times as zero immediately after the reset is de-asserted, also adding several no-ops is not enough, adding a printk is enough, also udelay(1) seems to be enough but I tried that not very often, and I have not access to many hardware samples to be 100% sure about the necessary delay. And since the udelay here is only executed once per device instance, it seems acceptable to delay the boot for 10 us. BTW: my hardware's synopsys id is 0x37. Signed-off-by: Bernd Edlinger Reviewed-by: Jiri Pirko --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 3 +++ 1 file changed, 3 insertions(+) v2: rebased to v6.7, retested and updated the commit message as suggested Serge Semins review comment: https://lore.kernel.org/lkml/b4mpa62b2juln47374x6xxnbozb7fcfgztrc5ounk4tvscs3wg@mixnvsoqno7j/ and retained Jiri Pirkos Reviwed-by from: https://lore.kernel.org/lkml/ZT+Zq4j9iQj1+Xai@nanopsycho/ Thanks Bernd. diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 37e64283f910..b8e8f6e963f2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7440,6 +7440,9 @@ int stmmac_dvr_probe(struct device *device, dev_err(priv->device, "unable to bring out of ahb reset: %pe\n", ERR_PTR(ret)); + /* Wait a bit for the reset to take effect */ + udelay(10); + /* Init MAC and get the capabilities */ ret = stmmac_hw_init(priv); if (ret) -- 2.39.2