From patchwork Wed Dec 13 22:27:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Justin Chen X-Patchwork-Id: 13491944 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="RWf9SEF8" Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D729491 for ; Wed, 13 Dec 2023 14:27:52 -0800 (PST) Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5be30d543c4so4405929a12.2 for ; Wed, 13 Dec 2023 14:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702506472; x=1703111272; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=YOXy1nGoiM3p8tlLmXhiPMpxrpOe0ylsigY0njjI5rI=; b=RWf9SEF82RxTXLM4TcoX8O6uBuFt1x/ufDUGCmu3eOhzUpkMPltW283JE8aSYulLkG WUOWIadLR3FfWRg2XPRtD/PV5Blek7DJwCRTon+6hUmCzFfJzoRDM8WtZQamwFgDL2ch VxJ8UCd19SadJjrM72wgtyNKzmapEWWaSIa68= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702506472; x=1703111272; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YOXy1nGoiM3p8tlLmXhiPMpxrpOe0ylsigY0njjI5rI=; b=r76vGrw/qHBZpKSx7bDQqhfIppdcveVwxshPKS+kNShRG9+3RUO57/m7HZtarP7S2A Ltp8lXUAYXErF/8W/ONkgPr0CzPMzEcoZRCA6mYTp1y3O/k6diNo7oKW9kJzTO61mqYb LHxi5nOIN4t7/Xpsb/5BNJW5QLlBwdq0V6WJqFolTfFIs3YktqptFnd293O08xCp+stV 1wNfu9OueNxvEqJgacX4seg5h21l5xhJyF56BepvnN7z5QeSk9ykejh+lyVJcBlx8Hw3 oRnlwz3cDTl1qZfAhpRBg6qMRqYdhY0nwcTBU0A+pfX22Fk6eKt43l8Q/x581h+vVOJE iXMw== X-Gm-Message-State: AOJu0YyEbq6POeXKzIa9+t+0hOgtYZgYQmdiyQcAs/qGeT4w4ymMWJhl b6k6d2WUuK26p6AB13JgKIZaSZPvwg7FHnj9xhM7REYitQAi+MBsgtH/LnynMVJ6cfDONdz5BTa 687jOtNHNi+BpFFl09XP3qOKPoG4ZC0ZtmxLZHU+gyyImWKEj4HQ/Di+kgB/H3eCtim1iJoKRhj kIYcc7Mw== X-Google-Smtp-Source: AGHT+IHBtWPH4jelDj6Y0Ec63Hqsod/0jXI3J7WAtxlFn+fwMlk9XiDtflvDQU5evXGP0LiMDHgQkw== X-Received: by 2002:a05:6a21:6da1:b0:18f:c6ac:807f with SMTP id wl33-20020a056a216da100b0018fc6ac807fmr5367400pzb.51.1702506471898; Wed, 13 Dec 2023 14:27:51 -0800 (PST) Received: from stbirv-lnx-1.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id nc4-20020a17090b37c400b00285545ac9d2sm11432515pjb.47.2023.12.13.14.27.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 14:27:51 -0800 (PST) From: Justin Chen To: netdev@vger.kernel.org Cc: opendmb@gmail.com, florian.fainelli@broadcom.com, bcm-kernel-feedback-list@broadcom.com, andrew@lunn.ch, hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, Justin Chen Subject: [PATCH net v2 1/2] net: mdio: mdio-bcm-unimac: Delay before first poll Date: Wed, 13 Dec 2023 14:27:43 -0800 Message-Id: <20231213222744.2891184-2-justin.chen@broadcom.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231213222744.2891184-1-justin.chen@broadcom.com> References: <20231213222744.2891184-1-justin.chen@broadcom.com> 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 Reviewed-by: Andrew Lunn --- v2 - Add comment to address absense of C45 support drivers/net/mdio/mdio-bcm-unimac.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c index e8cd8eef319b..297ea4a58d79 100644 --- a/drivers/net/mdio/mdio-bcm-unimac.c +++ b/drivers/net/mdio/mdio-bcm-unimac.c @@ -81,7 +81,13 @@ 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; + + /* + * C22 transactions should take ~25 usec, will need to adjust + * if C45 support is added. + */ + udelay(30); do { if (!unimac_mdio_busy(priv))