Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1117871rdb; Wed, 24 Jan 2024 05:34:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IHqRLKOD54c/3fOyDtMhOWsJ4vmS78ijxoIgOWiBTykaka7BXy2MoXOZi66hTLND6E93I7g X-Received: by 2002:a05:6a20:8921:b0:19a:63:70dd with SMTP id i33-20020a056a20892100b0019a006370ddmr554748pzg.36.1706103248048; Wed, 24 Jan 2024 05:34:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706103248; cv=pass; d=google.com; s=arc-20160816; b=JWzU+ritgs+UZT7LsDUhT/ghW+iJqgJHZx4QwHs7w4THWMpqHj6KJ6TqmQhO/sYGjs VM4vfP9v00A0oCA0FYADQV+S7fOZjq/tYxjCmfytxhaTYJ6SKqcPZomukWwok7d+iALY w7arBLfAvCoUkhASmRWng6OiVEAooPRDz4dcaIRwxpbr+/MQHw39GNPZ1Xasm5tjReUp qfCCBx1GpCKlNlaRZI/Guobg45h9i0WLoYWosSoglNzeUjJWn/vuySV3NwwSsy9VIyVA zeQIkVtiA0mrvhgIYVjTA2Kv+QkqIRZbQYMzozDdrbCJRJv900Hb+uzhIFC2KX2gff0D D0cQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=yh0FSpthPEg0z6Y9MyFNxP4OPN7yLXd22973nZlpFgs=; fh=KEQaCYtWYMKkYAhHxBHJzXFoh9klLLmHCkdP7pqEgaw=; b=pAUO5gtj+ZdGEBvzFd/pRedl8vTUq+ftzC7FE02BPaVS3/MuoKQPNrfuLZdtGKISXL vDbmnWgu9FPXN7SsUPPxhOoFd/prjU9yOya170shD2SqxrLfYEBOkwQvxtIlwjE+5wLg X9SMUuVzmnvtQd1gIbQE1gtvpgCFJCFkZ16irsYgqa+2EIWjQogh/ZAEzqoxtr3s0wVT AVECkFLRqFfBeauX/eU0JIbYBKycw+E7NEfGlCAHFptBt77x+fQjH6/mPML4ATjzozwM C9jjfWBjEFxnmaBxx23Cz0yMlvZ/hha6cQGvhBDemaAvI3uaW9OyQ8yAoUlckJtwqCRU 8W7w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Q+R78qre; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-37068-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37068-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i11-20020a17090ad34b00b00290f750dc65si845835pjx.140.2024.01.24.05.34.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 05:34:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37068-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; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Q+R78qre; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-37068-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37068-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 F2DDE291C62 for ; Wed, 24 Jan 2024 13:31:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8839A77F24; Wed, 24 Jan 2024 13:31:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Q+R78qre" Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE1C977F0D; Wed, 24 Jan 2024 13:31:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706103098; cv=none; b=hgAbmOhUHGJJKC5m+DNnR/tjCjKTSw8KPYDaSxzRawWaunsEmSFcMPUtM7PnVy7M4Ksht4nmxeFZzdkVTaePn+FKw/f14mhLgQf3nLsFBMnS4jb3+WdegmDBfSGKmLNj+iIxkQRNanf1oDwyPBVnXrP3zqtVvnUMlUFTRHh+pko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706103098; c=relaxed/simple; bh=vTeFrkOg9VeXj0cMMVSOTlbnmK4O1Tdyk176shwolH0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PcBlkO40l9faC4axd3ER3HpeaV1AKCqjEbrF876OIhMd5sr+FvEy/xbw/eeCLYF3HbLu+CeyekMzZmPIH6e6bZtfenXpQjoT1s1TMjVOtoMmMHgrHaegi4MSxxsgxyFi3ndO4O7fqrPrkoFECDmjqGK2jiJgf2pJz5bfwaASAP4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Q+R78qre; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2cf108f6a2dso21443861fa.3; Wed, 24 Jan 2024 05:31:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706103095; x=1706707895; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=yh0FSpthPEg0z6Y9MyFNxP4OPN7yLXd22973nZlpFgs=; b=Q+R78qrezgwnW1kOUcm2wn7EiSCIWzueEdRGt945JDCNif07NgXY0nHXDYtN1y6LDi FjE5/tzIL0ssxcZAGfgqLsUfXGrmiaO/hEJ952oB8tLFDhz8BYDiHL0W8N6ZOYBjKBdO pJUN3u5qZyqtQ2mA5s8xknvzsh22Bx1UzJ89oQO9rq8sMk9PVNDy3f3KUssDlDoWyyJq CqTTwpqrkrnm6aEDOjCLiw3/7UNnUNg8s6eKbguuqp7GDCmxfhKaVsdKt4AoNGth6XmM 1+1HtpdCoPbtVQ6fFlIzrooCPnDCIIokoZ9URrKonYsEEisieb9lFQDxfvwEyBlfd+RH 19Ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706103095; x=1706707895; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yh0FSpthPEg0z6Y9MyFNxP4OPN7yLXd22973nZlpFgs=; b=DfwGQqqeJJ4IdnBXXWGalx5zd9vLXLde5UNVkVVNYNdf410J7EP/E1cy3ianFi8gdf SQ6qfB5BW26f3PYQMBJgLmqH5kbJqe19EKH3bNrTcVzIn/O8FpYU00nSr9x9gTJ1NUGd Yc7ndnNqOZa4civSXAxPJ0JBOlHFNMG7xYpp6pWcbwQwnvZvEajEgnIwgYUg419KFlg6 r/Hqq0mnO3Y1uU74sCv2KMSTImrrvSVYvDRoN0dMu+98jUFY/gcueSsK9vm3T7oySERq 7cTdUoWSjPnB5W5FvhhQJhkMM4thV1bs9bEp8n+zeUzFED+OSWt2KKRBLUZ3RtxBLAWc X09w== X-Gm-Message-State: AOJu0Yy4iRut40HflRnp7rrZBxcFfhv6iWLV+zKwQ3+T18R5M4llNj/c qiEPfcX9jI/7ZF+Ca/IfmTVLR4IflAsbaGN80v0PjNDgWMZLuDks X-Received: by 2002:a2e:8691:0:b0:2cc:7157:4e7f with SMTP id l17-20020a2e8691000000b002cc71574e7fmr726122lji.57.1706103094620; Wed, 24 Jan 2024 05:31:34 -0800 (PST) Received: from mobilestation ([178.176.56.174]) by smtp.gmail.com with ESMTPSA id k4-20020a2ea284000000b002cca7ee7375sm2555389lja.136.2024.01.24.05.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 05:31:33 -0800 (PST) Date: Wed, 24 Jan 2024 16:31:31 +0300 From: Serge Semin To: Bernd Edlinger Cc: 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 Subject: Re: [PATCH net v3] net: stmmac: Wait a bit for the reset to take effect Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Jan 22, 2024 at 07:19:09PM +0100, Bernd Edlinger wrote: > 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. > > Fixes: c5e4ddbdfa11 ("net: stmmac: Add support for optional reset control") > Signed-off-by: Bernd Edlinger > Reviewed-by: Jiri Pirko Thanks for taking all the notes into account. No objections from my side: Reviewed-by: Serge Semin -Serge(y) > --- > 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/ > > v3: addressed review comments. > > > Thanks > Bernd. > > diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > index a0e46369ae15..b334eb16da23 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c > @@ -7542,6 +7542,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