Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp3111768pxm; Mon, 28 Feb 2022 12:15:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwi+xQdLc0ehYV2eFt6Ja8iyySVkWbiNVUKGCcFbktgLztAMstNkQ3UBqvXaz0RAvkguhFf X-Received: by 2002:a63:e24e:0:b0:33e:9849:526e with SMTP id y14-20020a63e24e000000b0033e9849526emr18849452pgj.468.1646079305495; Mon, 28 Feb 2022 12:15:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646079305; cv=none; d=google.com; s=arc-20160816; b=ufnzIb38GEt4QiW+GnuK7E++zH1oLc/GBrAVRFd+5AJLABWQXajb2OlYqeTyaau79e O/IYMme+DNLOZ1CF8ziu31mz7/7gqAdnwi+n9QW4u6MH5bKteP2zoTkMdZnD+Ke9RfyS eNnDz5GfhQa2t0hzbWEoPQYOsCJ9AeycMGg5Q3HF4VIFYRU3q9kPGV99K7VDZL57U79t IIo/YBfmR10sKIVeWbGle1tL1YAQztX9DaMXy0YlxxEUywirxUbenDuTec9X31rR9OUl KM1Fd6A9odcOcWIWFZZZ5soRRgl36U9+D/Wc597gNgowG4ZJuO+418zLCUHX9onNUYlo ZkvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WpL0aZoXAoOv+kfSt8BG5jAdC/Ats2X4EgEFx1d3M8E=; b=ZTwqOFgJaR3ELKLw+rT5Ttdhk5BzQRZaoGAPrh2+EH32dhCw/19Iog0k61nt5FYA/q Y2wZOKPdHvXaBOmlJYmcOlzAI4XToAko+m+gOvPxxMJy0Y1wWSjV5dHbNGrsEHxHGNIJ ZU1S5MD6QWS8pka+W6sGXcIcoHGtAOcEaFAV/ub89my41XyiUk0idsN2lEfVN7waznk/ eYkpCT9Om98/HcgNafLS6EGULvebInoZ4HY0BwwkzjPXT9qoFsF8ctzVSAiRw67LVXNi sNjYPT1N+yFOpKq029ilXQCegn1y+l0bornSpvWK6a9e/ApV0HrFv09pqmA/UffXCqvS Kkkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="u/Ng2NZu"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i8-20020a63b308000000b00362c6ae8763si11056143pgf.30.2022.02.28.12.15.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 12:15:05 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="u/Ng2NZu"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 149A516F942; Mon, 28 Feb 2022 11:37:18 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239737AbiB1SHQ (ORCPT + 99 others); Mon, 28 Feb 2022 13:07:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240117AbiB1SDA (ORCPT ); Mon, 28 Feb 2022 13:03:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C4A9EB9E; Mon, 28 Feb 2022 09:46:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE1F26098A; Mon, 28 Feb 2022 17:46:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D19F4C340E7; Mon, 28 Feb 2022 17:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646070369; bh=x3Ks4l3oF8qlXekP7bV+zF2mkX7O9rC2XCw9cam+juA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u/Ng2NZuM5++r29GcUXuXTWta2c1kyucUBt15F2yz9dqJFO0Xy3L2PmhDKF8r5H/3 cQwYuG4/4gpqP2topTdI72XcjIM/VvwaUCO5Tr1xmxsrIa+E9pUBfRQI7skd8Qj8yC kFKEK2ujhUGcsxcHqlCNYRUTHIWYsNi0isBlzuoM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baruch Siach , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.16 083/164] net: mdio-ipq4019: add delay after clock enable Date: Mon, 28 Feb 2022 18:24:05 +0100 Message-Id: <20220228172407.471992966@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220228172359.567256961@linuxfoundation.org> References: <20220228172359.567256961@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 From: Baruch Siach commit b6ad6261d27708567b309fdb3102b12c42a070cc upstream. Experimentation shows that PHY detect might fail when the code attempts MDIO bus read immediately after clock enable. Add delay to stabilize the clock before bus access. PHY detect failure started to show after commit 7590fc6f80ac ("net: mdio: Demote probed message to debug print") that removed coincidental delay between clock enable and bus access. 10ms is meant to match the time it take to send the probed message over UART at 115200 bps. This might be a far overshoot. Fixes: 23a890d493e3 ("net: mdio: Add the reset function for IPQ MDIO driver") Signed-off-by: Baruch Siach Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/mdio/mdio-ipq4019.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/net/mdio/mdio-ipq4019.c +++ b/drivers/net/mdio/mdio-ipq4019.c @@ -200,7 +200,11 @@ static int ipq_mdio_reset(struct mii_bus if (ret) return ret; - return clk_prepare_enable(priv->mdio_clk); + ret = clk_prepare_enable(priv->mdio_clk); + if (ret == 0) + mdelay(10); + + return ret; } static int ipq4019_mdio_probe(struct platform_device *pdev)