From patchwork Mon Jul 22 06:33:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 13738335 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE1AFC3DA5D for ; Mon, 22 Jul 2024 06:33:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=xj+wDOWyCzvjTCTUDA0Y6iSTZh2VAEBUpnU4/tK6YAQ=; b=AuGPhFMIv+KrLCBrMHkuhm7HGJ 0x/wb0EUm//QBo95ypQ07+GDXoI7MbBTM3ArQzsFhIj2LbcSXX9/qvZ7lRd7Sbe7A0qRQhD6Otp3w 3jiFvnkVh9VBSYMmmlcCmrn10Ee9QTLWNM5YfqHb2Z6Xm3fpqVJ93/3fe0nFYu7q9Y/WAKmnlYuo7 D4tT86231BDLbHcw13i/Z5EZBwBXnkJSwAPnlkevnVE9c9m8zXl8/UeKTzLSH46RHTNTGx8YRS4gp EvCuqiSGmqDl34qv+xMV/EmrVNYEUTCPuyZfs09xhFjR182nkkFqkqaxArwI3JCEWFMluHBCuZm6Y kZfp7eBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVmc5-00000008Wmq-3LEL; Mon, 22 Jul 2024 06:33:37 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sVmbj-00000008Wiq-0Ohk for linux-arm-kernel@lists.infradead.org; Mon, 22 Jul 2024 06:33:16 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-595856e2336so4175160a12.1 for ; Sun, 21 Jul 2024 23:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1721629993; x=1722234793; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xj+wDOWyCzvjTCTUDA0Y6iSTZh2VAEBUpnU4/tK6YAQ=; b=GDI6qz6CL2lvqxTeHoSQSz5BqpQ0ACank6KjxlgpDcMBHBAnG12UnWqagBOmXIshYl bQC5yE7+jzvcgP7UnHdyrIvH1bHenjrBaUbdsYvnwiWoYtSccutBynrQDFr6vjSOuSah 625Prd/FJeJBq8r1nOd+IAGTyvLVX7YMoe80jbOQMsbQJAkd6yGrUcPu9Hq/YLd/hhgx 1i7vQCkKqNivWiIpA9PY8JkYZ0wg9vUKUJ/7Yzi8Sc6sb8xzWdtIDyvxc1RyCIBVjWGz H4HZSAk76wYflmiLuQCyXH0Cx7r6jFOvY/5mANfh+LhyQe9ZsX1o15Tgtax44cCEzEwg TqSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721629993; x=1722234793; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xj+wDOWyCzvjTCTUDA0Y6iSTZh2VAEBUpnU4/tK6YAQ=; b=sR62eJG5GdQr5TDCHnmCx9TIy83FDeykPmxSOoKBhCuuT7QA1HqIGey+wmgnbNA7+9 +YZGtEIW/Nvft8UXa1fcpW13hdrcySfZIrZ0ZT3cZUZJbxabW4h971r6UBiTq64PVNAW YNbwqqgL8oqdif+RSVxreKAdkZN9GB5lIeBkY2aD5OwcE7r8HCu0rupnN19JQAQQQxN0 2KnK3rwN3gRq2OlcPh6thAzfi/8hMGp/xq6K+NWYjEcmexRrdabLiKkBuHN/JmpZ53E5 bjBiIVwDNBzo2/XFo0v7tBDrAg+sKCFM9ISM6BMBwuQ282BPmolxAvxSQxhq3hwBR9uF Ansg== X-Forwarded-Encrypted: i=1; AJvYcCUdziaCXfMR3HbGwnSMBxM0mXxscM5nkWGWPWt2EVU5IJkWDZ+s937WBh/zwcqW243ut/hhb64Pmz1upjei8gkajUxTnJCOTlDU0jpCu2whLD2A0DE= X-Gm-Message-State: AOJu0YzJqA41EYc2kArvZ1EYQFYbIZWuXnpSAH5DcV8cHq1GWg+wcCDn MjmcKHsjf5gZ+W+bRUeGaJSyjHRzuMyNK6RxpKBAXQ3cT5rHXF4i3+fWxIoC3oA= X-Google-Smtp-Source: AGHT+IFZgwQ8kBjg7wQirGUAy1IQokyWZyFwi8jSTwEZ3OWVxp38Ndo890Qs2NlTwlbxjDVAmkOW7A== X-Received: by 2002:a50:c05b:0:b0:57d:455:d395 with SMTP id 4fb4d7f45d1cf-5a2caf4e97fmr9818292a12.7.1721629992621; Sun, 21 Jul 2024 23:33:12 -0700 (PDT) Received: from krzk-bin.. ([178.197.219.137]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5a4c7e67af1sm3319217a12.56.2024.07.21.23.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jul 2024 23:33:12 -0700 (PDT) From: Krzysztof Kozlowski To: Krzysztof Kozlowski , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Michael Turquette , Stephen Boyd , Marek Szyprowski , Sam Protsenko , linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Krzysztof Kozlowski , Artur Weber , stable@vger.kernel.org Subject: [PATCH] clk: samsung: fix getting Exynos4 fin_pll rate from external clocks Date: Mon, 22 Jul 2024 08:33:09 +0200 Message-ID: <20240722063309.60054-1-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240721_233315_189958_DBAC61FF X-CRM114-Status: GOOD ( 13.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 0dc83ad8bfc9 ("clk: samsung: Don't register clkdev lookup for the fixed rate clocks") claimed registering clkdev lookup is not necessary anymore, but that was not entirely true: Exynos4210/4212/4412 clock code still relied on it to get the clock rate of xxti or xusbxti external clocks. Drop that requirement by accessing already registered clk_hw when looking up the xxti/xusbxti rate. Reported-by: Artur Weber Closes: https://lore.kernel.org/all/6227c1fb-d769-462a-b79b-abcc15d3db8e@gmail.com/ Fixes: 0dc83ad8bfc9 ("clk: samsung: Don't register clkdev lookup for the fixed rate clocks") Cc: Signed-off-by: Krzysztof Kozlowski Tested-by: Artur Weber # Exynos4212 --- drivers/clk/samsung/clk-exynos4.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/clk/samsung/clk-exynos4.c b/drivers/clk/samsung/clk-exynos4.c index a026ccca7315..28945b6b0ee1 100644 --- a/drivers/clk/samsung/clk-exynos4.c +++ b/drivers/clk/samsung/clk-exynos4.c @@ -1040,19 +1040,20 @@ static unsigned long __init exynos4_get_xom(void) static void __init exynos4_clk_register_finpll(struct samsung_clk_provider *ctx) { struct samsung_fixed_rate_clock fclk; - struct clk *clk; - unsigned long finpll_f = 24000000; + unsigned long finpll_f; + unsigned int parent; char *parent_name; unsigned int xom = exynos4_get_xom(); parent_name = xom & 1 ? "xusbxti" : "xxti"; - clk = clk_get(NULL, parent_name); - if (IS_ERR(clk)) { + parent = xom & 1 ? CLK_XUSBXTI : CLK_XXTI; + + finpll_f = clk_hw_get_rate(ctx->clk_data.hws[parent]); + if (!finpll_f) { pr_err("%s: failed to lookup parent clock %s, assuming " "fin_pll clock frequency is 24MHz\n", __func__, parent_name); - } else { - finpll_f = clk_get_rate(clk); + finpll_f = 24000000; } fclk.id = CLK_FIN_PLL;