From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 97C5F2DFA3E; Tue, 12 Aug 2025 18:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755022923; cv=none; b=BI8ZleyRQch4zLoUhRcSTONgZhOv3bqZ6gEX4UQkL2k4CmPYim+JvqaE9QTOTUjzP06MDtQ5OpHPyb9xrj6OPeG1iGLhESCBv+m4bfyI2JgnluSa+zX/cCryMJgRhfnEOyPfElbADeCoBzYm9VVgVUmRYIoaU6EXAGfLxkIwvbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755022923; c=relaxed/simple; bh=VIDNyFxpEQWxcq6ctNCzsPeYKM+wkq/IhIk3rKZKuEw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L/WpS2k5FSduHuI7autRu63PoKdpsrnVsS0nzcEqXTcxWewvv36lb5OFfBFhpJmgHsAob6OcX2rV56A0pWb5ty+YO3ba6V6M5buFoSndtooz/tAsVXejvn7ke+Xz8XcX7MSPhla9dubBVjsOPSIl4Oz5qB/XjO/VXMViRYehNSE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=NnMIzXhZ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="NnMIzXhZ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06947C4CEF0; Tue, 12 Aug 2025 18:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755022923; bh=VIDNyFxpEQWxcq6ctNCzsPeYKM+wkq/IhIk3rKZKuEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NnMIzXhZ0P9gaEPNLVxOTjvtewzP3hBrGO8ddg0YlA481yViMI6/+Llu850KJFvPA 18u7ppUCic5WEuYmC12s2dVm59irbN6n4qpG8PRtfHZtBoshsj/wZblgBeN/y/OwEH jOWOsqkkY9nkZ8cuw5de9f685cfqVzx+rT1VpbVQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Florian Fainelli , Andrew Lunn , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 6.12 300/369] net: mdio: mdio-bcm-unimac: Correct rate fallback logic Date: Tue, 12 Aug 2025 19:29:57 +0200 Message-ID: <20250812173028.016381186@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250812173014.736537091@linuxfoundation.org> References: <20250812173014.736537091@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Fainelli [ Upstream commit a81649a4efd382497bf3d34a623360263adc6993 ] When the parent clock is a gated clock which has multiple parents, the clock provider (clk-scmi typically) might return a rate of 0 since there is not one of those particular parent clocks that should be chosen for returning a rate. Prior to ee975351cf0c ("net: mdio: mdio-bcm-unimac: Manage clock around I/O accesses"), we would not always be passing a clock reference depending upon how mdio-bcm-unimac was instantiated. In that case, we would take the fallback path where the rate is hard coded to 250MHz. Make sure that we still fallback to using a fixed rate for the divider calculation, otherwise we simply ignore the desired MDIO bus clock frequency which can prevent us from interfacing with Ethernet PHYs properly. Fixes: ee975351cf0c ("net: mdio: mdio-bcm-unimac: Manage clock around I/O accesses") Signed-off-by: Florian Fainelli Reviewed-by: Andrew Lunn Reviewed-by: Simon Horman Link: https://patch.msgid.link/20250730202533.3463529-1-florian.fainelli@broadcom.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/mdio/mdio-bcm-unimac.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/mdio/mdio-bcm-unimac.c b/drivers/net/mdio/mdio-bcm-unimac.c index b7bc70586ee0..369540b43ada 100644 --- a/drivers/net/mdio/mdio-bcm-unimac.c +++ b/drivers/net/mdio/mdio-bcm-unimac.c @@ -209,10 +209,9 @@ static int unimac_mdio_clk_set(struct unimac_mdio_priv *priv) if (ret) return ret; - if (!priv->clk) + rate = clk_get_rate(priv->clk); + if (!rate) rate = 250000000; - else - rate = clk_get_rate(priv->clk); div = (rate / (2 * priv->clk_freq)) - 1; if (div & ~MDIO_CLK_DIV_MASK) { -- 2.39.5