Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp557658lqr; Wed, 5 Jun 2024 14:01:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUBzXaz542bisF1+nSxsXCxMwUN1m9s7GxYQVZayllNVAgGHWYPJvew0vDjh1wD82S7uysJz/j02AwLwj9zrUthIT/Vk8G2qjTGjTdqoA== X-Google-Smtp-Source: AGHT+IHhb8i16Tq+VPWe0ZUouq0rKroGJ0nlbTTJejKwdlDMJhdAqd/z6bLvo5nW6N27fXGlM8/6 X-Received: by 2002:a67:f1cb:0:b0:48c:19d7:eb83 with SMTP id ada2fe7eead31-48c19d7edaemr78018137.34.1717621269318; Wed, 05 Jun 2024 14:01:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717621269; cv=pass; d=google.com; s=arc-20160816; b=lrCjmQvi49Yxqm7nz1IfB4IZFZtUdrvvRk5KSvWciqwFVM6Y25SleWK0P+YD5eH2pM 0HxdNhen0btqx5TVQd5XqMCORSkkIfar0Iq8bNue5S5LFuDwif5fqpBkBHPU2JRjtVnQ 4yU+AA/v6C7wNfpxgL/YdKDjNRdnRg29/eQAvlDEIafc6kAlUPAH75t5Ogf9xu4Xc53J 40fFUwX55dnCSg+MbJBykv04CjM/QK9Beju54Bgu68h3fIWyV3jJO6cmrIFNxVKxN0GC SkgQN1aDVTOxU2kU53O5eRlWjBV6nloyHX3kr0gnpbjUG8DJluVyUd4J/hFKfSMhy5hy W7DQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SwbtZSg+KieEl718DTPhm+GILj3m52AXbprU8PF/yug=; fh=OgNmdWC68qRPVXDPp+vUwPzkOPaII2GyziamIPDS01Y=; b=iEmEucocMyReSXY269bdZqJ0V3gTe2+kPV+jxjWdl+hv13g7ZrUQlJJkKKXdUrz94M 9XpdLy6UFnokVOsu4GJIvEThAoF2nAw3da68ErQM2gYq++eVG0ywCcrTI3Rj3FNUUdPJ nUMg/YWiyICegOSlbIeP5qUmKkyDh4RWebAxiV8LoKGfhvNF8YFFzoMWrBfZ7H513Bzn 1XxFwH7/sjoE1b2fXRQXYU4/R+UKfIBwasrvVHotsaD3gsrfuM8YDoHpKekXtCpVyoTG u/eBRbqs07mGbFLwgnZakezMqM0CZDKKdUlQ3mGSN/MGPJWjbJ7XLIrplfl3Ll2iSIyX CkAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SACEtrH4; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-203220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ada2fe7eead31-48c1a24c019si1827137.695.2024.06.05.14.01.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:01:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SACEtrH4; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-203220-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203220-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 0B43F1C239AC for ; Wed, 5 Jun 2024 21:01:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3E5715F412; Wed, 5 Jun 2024 21:00:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SACEtrH4" Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 456254965B; Wed, 5 Jun 2024 21:00:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717621254; cv=none; b=b8lKPCjB+O5SvwNRexWRoSMRvnS+dy+LfimGlP1Vt0auqH+EcgxykYGG9GITbFvdltS1QfBr9ttfbyWIdR9dZXPP2i59O6UZmSYU921n9ox3o2aQz2z1CvjeKZacfy3pKr6ONbkxBgunoOxUXQRmfGdYVPbOPSOXMBa8x95ur7A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717621254; c=relaxed/simple; bh=V9iuBXE3RCPxqipBIYq+2imZhquQ1wdIjv+HQgtM/dk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=CJLwvKgnnHDpbFhki3tYzo+8MXLbMIVwYyJM5MfwXzuazAF5uhTJbjUtiMEGfy8YOuAD3urE2JYB+5X3nPTdxCnQHUJ7vB/P6PgJCRPj8rSlMB99h7auKDXxZIAATc42XA06yLjtkFcheKOw2V66quc6sDgQov6KPmHXho67YCc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=SACEtrH4; arc=none smtp.client-ip=209.85.128.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4215afa33b7so3026085e9.2; Wed, 05 Jun 2024 14:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1717621251; x=1718226051; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SwbtZSg+KieEl718DTPhm+GILj3m52AXbprU8PF/yug=; b=SACEtrH41nZpDxN7QON61tORyWFn5dHuwygegc7csrK+1U9eNU3y+pjx1s2AtQhEDn zTV0LTOkl74Qo6MKH1QTZFANECsLKdLNaCxXfxDTcuW3gPpdT+Z7pt04xGDjBSpJT8qE WHwNmE3mlg1AovAm0IfQqSyUfm49EXsMN4YMFIfeOai+H5xZyCkIw0POWY4qSN2FNkDO 2+MViKo8uBB6Zkg2KEvQ0+JKk0G+sQ2y/aWxrilYLRwXqzl7joHwcuOEQSpz35SuGxQS RSLKi+BjK4BBRgXIYfnfeREqbN8bCjNGBH5GceK5ZXMoEPA0dplqlrnRXOhf6TOD+8rI /gWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717621251; x=1718226051; h=content-transfer-encoding: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=SwbtZSg+KieEl718DTPhm+GILj3m52AXbprU8PF/yug=; b=VHntkoHXZbi6DDGDQbXe/g5JY5FU8BFxFqKfQSmuN0R7rALZ1eolXL82JnrvChjNKP 1NjMw9cU6m5NJXbMlU6XquF4ahKNIsvYlCV/WBAexftOYgRSw2SbnBCdrwViDSYje4nX aCIMdt70wkLfWDjmCBeuabDCsdZJSRfjgbTMSDxBRKeq4fBnR9LQdsSsyrMhHCzBKyic bK4055u3cdjbxWqd/pGG+WB+G//PjSth+7gQleuC6p4ysHTgVYa+Dpnq320CbG9Kf73w /HOwYCAPmNeQVCPBR8OgTgf4Qx8JIK51REBeN0QR8PyLtgyk+FyrCoffY9J6YOG+fOHL ++VQ== X-Forwarded-Encrypted: i=1; AJvYcCUeFHSAEc5r90Pdnl9W2Vl26U0lMeexHZU2t5fq58I05Dv7ITph4A/hVolhGRbKg2wiYdEtUQ9sv3xkASd4eXVYeyEoglPaUzN6d47X5R3eXVm9Q0gf3KFnha/Rvs5nMoTBQ/Jf2x05x7kI77xOdC1bCOs+rq4/9NyltOGk1iABKcWa3w== X-Gm-Message-State: AOJu0YxRERS+q6U7cC8kZr1gwttieoTtOKQgZEnZAZglCJplyJhDOcYC mqpXUdteSZDgzQvF8E3T7APEXKeyVroK2vBNrf7rjHa6u+LbcDg= X-Received: by 2002:adf:fe0d:0:b0:35e:60e6:c8a8 with SMTP id ffacd0b85a97d-35e8405dd0emr2592276f8f.10.1717621251632; Wed, 05 Jun 2024 14:00:51 -0700 (PDT) Received: from U4.lan ([2a02:810b:f40:4600:5211:58fe:dfef:c48c]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35dd04c0d77sm15955721f8f.5.2024.06.05.14.00.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 14:00:51 -0700 (PDT) From: Alex Bee To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Heiko Stuebner Cc: Michael Turquette , Stephen Boyd , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, Alex Bee Subject: [PATCH v2 1/5 RESEND] clk: rockchip: rk3128: Drop CLK_NR_CLKS usage Date: Wed, 5 Jun 2024 23:00:45 +0200 Message-ID: <20240605210049.232284-2-knaerzche@gmail.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240605210049.232284-1-knaerzche@gmail.com> References: <20240605210049.232284-1-knaerzche@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit In order to get rid of CLK_NR_CLKS and be able to drop it from the bindings, use rockchip_clk_find_max_clk_id helper to find the highest clock id. Signed-off-by: Alex Bee --- changes since v1: - new patch drivers/clk/rockchip/clk-rk3128.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/clk/rockchip/clk-rk3128.c b/drivers/clk/rockchip/clk-rk3128.c index d076b7971f33..40e0e4556d59 100644 --- a/drivers/clk/rockchip/clk-rk3128.c +++ b/drivers/clk/rockchip/clk-rk3128.c @@ -569,18 +569,22 @@ static const char *const rk3128_critical_clocks[] __initconst = { "sclk_timer5", }; -static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np) +static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device_node *np, + unsigned long soc_nr_clks) { struct rockchip_clk_provider *ctx; + unsigned long common_nr_clks; void __iomem *reg_base; + common_nr_clks = rockchip_clk_find_max_clk_id(common_clk_branches, + ARRAY_SIZE(common_clk_branches)) + 1; reg_base = of_iomap(np, 0); if (!reg_base) { pr_err("%s: could not map cru region\n", __func__); return ERR_PTR(-ENOMEM); } - ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS); + ctx = rockchip_clk_init(np, reg_base, max(common_nr_clks, soc_nr_clks)); if (IS_ERR(ctx)) { pr_err("%s: rockchip clk init failed\n", __func__); iounmap(reg_base); @@ -609,8 +613,12 @@ static struct rockchip_clk_provider *__init rk3128_common_clk_init(struct device static void __init rk3126_clk_init(struct device_node *np) { struct rockchip_clk_provider *ctx; + unsigned long soc_nr_clks; - ctx = rk3128_common_clk_init(np); + soc_nr_clks = rockchip_clk_find_max_clk_id(rk3126_clk_branches, + ARRAY_SIZE(rk3126_clk_branches)) + 1; + + ctx = rk3128_common_clk_init(np, soc_nr_clks); if (IS_ERR(ctx)) return; @@ -627,8 +635,12 @@ CLK_OF_DECLARE(rk3126_cru, "rockchip,rk3126-cru", rk3126_clk_init); static void __init rk3128_clk_init(struct device_node *np) { struct rockchip_clk_provider *ctx; + unsigned long soc_nr_clks; + + soc_nr_clks = rockchip_clk_find_max_clk_id(rk3128_clk_branches, + ARRAY_SIZE(rk3128_clk_branches)) + 1; - ctx = rk3128_common_clk_init(np); + ctx = rk3128_common_clk_init(np, soc_nr_clks); if (IS_ERR(ctx)) return; -- 2.45.2