From patchwork Wed Dec 13 00:02:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13490151 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Kxh6CzE3" Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 122F192 for ; Tue, 12 Dec 2023 16:02:55 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-28acd29cab3so847531a91.1 for ; Tue, 12 Dec 2023 16:02:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702425774; x=1703030574; darn=vger.kernel.org; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=c3WmxKUkwwZob9+wdQg62dqieqm4bxmV5dJUwhuZkiQ=; b=Kxh6CzE34nxU/rNq4ymD5z7w671YwpqyRYEj3+IiVUz56q7PWt8aMSHj4b6+KOMw/d DmP+5wqPqhe21nNtJPLKFYsYOBvu0o1zw/r4bnH5Jnl6O3mAKoz0VJn49qpjiu7kETiN KteR/28eoUT1ZNnlx7kaHEOck6pquW33XvKhw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702425774; x=1703030574; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=c3WmxKUkwwZob9+wdQg62dqieqm4bxmV5dJUwhuZkiQ=; b=Sp/9aU2tenPotYaJo040Zd/Z2lR2nHvKCF3pzyF3HkvxceH6jeN6OKvhE/RsbCT//O BZUv0JlctUA8QRlkoC8497XvgiDLxWOmW27fH4drAcDRh0xXef+EacFIFln+bRT1xj+t YTy0xhmh4RqMFuXIpWegNY3aTItiX6NBFyL6efykcoaA5FItSzj/s6x0Vk+hdY6W93NI neB5hu4CmPIrQVn6um7cS186pZS4YGgi9vm9OJp6KElxH031j+M3zF6qZgzK/X6WpZjZ aDdJrnflF6h9l2ofhvQsaYDixrU7A97Kf4dmAdFus5pCH7FqchmzdLSDTLGX2QiO6mzb sIJw== X-Gm-Message-State: AOJu0YyxohSOu51UmUqiQieb8CxDVQD0zIVIIxOKijYp0FBBm8APFKb+ SaBkLAXnF7LnHcOyqGJysGGGOsLEvpacNxjrMaZDZWYznNyglztrszDfVoSfqwYB+DII0qtNA1f vAqvNpctQsvYYpDdDWyyKsT4Dv4qLu1utxmI1D03xI5Kd/3mSBD7ZBN8NW6BDprsRNwR7NqiN6i O7pPlkIT1U X-Google-Smtp-Source: AGHT+IFb/m7F3QXnHVjY8Ev2sk+BIm7rR7qISjk4YANTuvhoKX3wMsLM7AsVS2ByK44TEBviRiI4fQ== X-Received: by 2002:a17:903:64e:b0:1d0:cd9e:424c with SMTP id kh14-20020a170903064e00b001d0cd9e424cmr3464483plb.78.1702425774049; Tue, 12 Dec 2023 16:02:54 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id n16-20020a170903111000b001d3320f6143sm2336460plh.269.2023.12.12.16.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 16:02:53 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: Justin Chen , Doug Berger , Florian Fainelli , Broadcom internal kernel review list , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-kernel@vger.kernel.org (open list) Subject: [PATCH] net: mdio: mdio-bcm-unimac: Delay before first poll Date: Tue, 12 Dec 2023 16:02:49 -0800 Message-Id: <20231213000249.2020835-1-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org With a clock interval of 400 nsec and a 64 bit transactions (32 bit preamble & 16 bit control & 16 bit data), it is reasonable to assume the mdio transaction will take 25.6 usec. Add a 30 usec delay before the first poll to reduce the chance of a 1000-2000 usec sleep. Reduce the timeout from 1000ms to 100ms as it is unlikely for the bus to take this long. Signed-off-by: Justin Chen Acked-by: Florian Fainelli --- drivers/net/mdio/mdio-bcm-unimac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c index e8cd8eef319b..1f89b1bdb90f 100644 --- a/drivers/net/mdio/mdio-bcm-unimac.c +++ b/drivers/net/mdio/mdio-bcm-unimac.c @@ -81,7 +81,9 @@ static inline unsigned int unimac_mdio_busy(struct unimac_mdio_priv *priv) static int unimac_mdio_poll(void *wait_func_data) { struct unimac_mdio_priv *priv = wait_func_data; - unsigned int timeout = 1000; + unsigned int timeout = 100; + + udelay(30); do { if (!unimac_mdio_busy(priv))