From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (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 C1DF32DF717 for ; Wed, 29 Jul 2026 09:30:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785317411; cv=none; b=ZCYMJjXj8/moeHeRnYtwznihYHxwrX6Ju79+PwqATcjQwwTSN6Vr5THZ0Ml8KXF/wr5R54+kJsfYg5Zdf9FGuVJ7okC+r2npKC1er6y4Q+VSPHaEZHFokdJxLY0QxJzIQOsKJ88EeBhGKifMg+DSpOOBq7Z8bwdg0TepJDUp3aI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785317411; c=relaxed/simple; bh=dvw3MF1oe9cf3LSM5fCbMKX+z0cddrl+WdyxQmCcBCQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=uYkbF1/ydUi6U3E6huWgH2pq0eFyTBtFrhO5F4C8SQNzbnzyEbHOpES3tqb7Z6cJd52ocKSZa+ypRSPnrmQW5//Q9XXA46lZlgDnJcSkX4ZrCE6VpiofDZ63SR+CKPfih+zfyTAZNq9mNvRNGReSuF0/1l5oYabCvbzi7JSMs2Q= 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=CBY1HcsU; arc=none smtp.client-ip=209.85.128.51 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="CBY1HcsU" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4956d1d9fb2so959395e9.0 for ; Wed, 29 Jul 2026 02:30:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785317408; x=1785922208; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=gz5V2n93NOL3hYSU9xeOl7rpcn8sNAuGMXkKaTZlLvM=; b=CBY1HcsUple+f8cbO9Vbi5zke67pFbBnEAQU3EdyUNsUWa/PiSmhxPoYCKXJDNzEWL UEmPAi1Qlc0s7DE0Zmt6tmVm4XMLvRENOsw2+ODnRQm0TMsDRRKDuW2S04bIOyLBp32q dmY+OSlwoyg6RFbhuzsJp2sf/M1U25iljpapfrfcPN3ss3wSCzRiFKGl1+3LMeZMHB3A tc5GANaPOZum5sMRd1KrZt0u3Z/fAkoobjTUU2jET2nHCp1Xo3ASfRRw7UDgQwfttxk9 zjr0tqq+sZsSKWJlYiKIrqAasOyAMXgxoIR3gw9DpGuwOXiDHsNRguc4COuy0qb8LXB7 dwkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785317408; x=1785922208; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=gz5V2n93NOL3hYSU9xeOl7rpcn8sNAuGMXkKaTZlLvM=; b=k99Mqd8ir1/7wveT9XhLqa9R2NtKgpkd1K0vXI+vr5Fo7y8NZiDRWKZ5dYtPDYxtj4 jF3VMxnkZvoO6xHpumjfR3IeOZcDqTy5WqoBUb1h7MeHlY7ujwtI0Ka2Yxg+LinazZJo Ntn3ImCUJ417+D8Y2I86SncIoP2WOH5orC0CJ6T3RDkhX9BPmvwlXNRy0c+6m5IhkB9i oAAzHlNyqy147I1FEGKmrjhlzKYx7xf+Ec4Kp/fhSn6enFDbhIhbS9hIuy05JvIss2vF ya8rL2MH9ElMGf9Qjti5Rt9eQ4lx1kBG+vjJ7gvUUubYKy78m1z+LGkd/vNRAb06Q8LW m8Hw== X-Forwarded-Encrypted: i=1; AHgh+RpAbwjBHDGXILSPlV3gaWfCU6TkmMJ5gRo5UyWrAw5RZ2cL1RLBGMns3QcB0iHL2oZX/q/1yThuofRwj6U=@vger.kernel.org X-Gm-Message-State: AOJu0YwYmmZdsrk5EunaRga+iSkrk//rjpDIshl0gN0Pa1F4Smaf/vnE sZuVLJZ/rEO56RATzxwS9Kl2Cwv5Gz49o7shjhkrDAcHQoKMZFkjw4T2Gyb8Bw== X-Gm-Gg: AR+sD12dEOlssa8opthBAsqFvmSTZBai8kWp3a/NNYi7ajyqwy3vgCR3z9XOZKiC6lJ JJqhNZqXZE3QNCuhJ2K0h8dLPlKYEgmmCeA9lwWbuZDXwcPQ8BANwcLVTu5UHTde4TOCuBp6soa ifxB9GcmLyDg9Lf3EOHmWKdS421PQRfxgTOk8i2h6KEe209cycfwKaLcar9f6GR35Yd4C4QO7/b nPwgi1GTVSspuRyqnuckFbxHuWTTB4EVM/3jChFpOVZQpdcWurMcf5sx52kc2Erw4c/QpyxTSbO rrhi8TkwkQBeuoefVn7VCyxhTJuGLuSrs9CGSpRGoKF88EEmBP/jHiMP6THQFaprx2B07XAI/vb sjMgDAyycaU5jGN8RW7l30S46rcmqbga5qLQadPZ2+nRg62CtGqQZNSLjxA86uS2fPM9uvSum+k hi0Inp+hMz/3zNx+4mpiXph/Zcm0Zp8/pYQNM39Tnf/rkPk+URy2DhPwKhDdilEbIjREEm+qPmA uhpB8F1+S8Kh4WTh66kw8q7nWTfAY/ZLQ1aw/NtlY1doiC7I61+/HMbKFB5OySC7fxZiw== X-Received: by 2002:a05:600c:c48f:b0:495:71ff:598d with SMTP id 5b1f17b1804b1-496c6415627mr45324345e9.1.1785317407675; Wed, 29 Jul 2026 02:30:07 -0700 (PDT) Received: from OrangePi5-Plus.BB-HOME (20014C4E1B886F0027B74C8463513DA4.dsl.pool.telekom.hu. [2001:4c4e:1b88:6f00:27b7:4c84:6351:3da4]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49764d8e826sm49682835e9.8.2026.07.29.02.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Jul 2026 02:30:07 -0700 (PDT) From: Igor Paunovic To: Tomeu Vizoso Cc: Oded Gabbay , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, Jiaxing Hu , Igor Paunovic Subject: [PATCH] accel/rocket: request the core clocks by name Date: Wed, 29 Jul 2026 11:29:39 +0200 Message-ID: <20260729092939.118779-1-royalnet026@gmail.com> X-Mailer: git-send-email 2.53.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit rocket_core_init() hands core->clks to devm_clk_bulk_get() without ever setting the .id members. The rocket_core array is allocated with devm_kcalloc() in rocket_device_init(), and rocket_probe() only fills in .rdev, .dev and .index, so all four clk_bulk_data entries are requested with a NULL con_id (unlike core->resets, whose ids are set a few lines above). clk_get(dev, NULL) ends up in of_clk_get_hw(np, 0, NULL), and of_parse_clkspec() only consults "clock-names" when a name was passed, so the index stays 0 for all four entries. Every entry therefore ends up holding a handle to the *first* clock of the DT "clocks" property, i.e. ACLK_NPUn. Nothing fails: probe succeeds and the driver believes it owns four different clocks. The consequence is that rocket_device_runtime_resume() prepares and enables the AXI clock four times, while hclk, pclk and - most importantly - the NPU compute clock ("npu", SCMI_CLK_NPU on RK3588) are never prepared or enabled by this driver at all. The NPU still works only because the Rockchip power-domain driver sets GENPD_FLAG_PM_CLK and its attach_dev() callback walks the device node with of_clk_get() and adds every clock to the pm_clk list, so genpd happens to keep the remaining clocks running. The bug is therefore latent today, but it means the driver holds no reference to the clock that actually feeds the NPU, which stands in the way of any future frequency scaling (OPP/devfreq) work. Found on an Orange Pi 5 Plus (RK3588) by reading the live clock tree: /sys/kernel/debug/clk/clk_summary shows four "fdab0000.npu" consumer handles on aclk_npu0 (and likewise on aclk_npu1/aclk_npu2 for the other two cores), while hclk_npu0, pclk_npu_root and scmi_clk_npu have no "fdab0000.npu" consumer at all - their only consumers are the "npu@fdab0000" handles created by the power-domain driver via of_clk_get(). Set the ids explicitly, in the order mandated by the binding (Documentation/devicetree/bindings/npu/rockchip,rk3588-rknn-core.yaml): aclk, hclk, npu, pclk. After the change the driver holds one handle per distinct clock and clk_bulk_prepare_enable() covers all four. Fixes: ed98261b4168 ("accel/rocket: Add a new driver for Rockchip's NPU") Signed-off-by: Igor Paunovic --- Sent following Tomeu's request to send fixes upfront. Jiaxing Hu's RK3576 enablement series carries the same id assignments inside [RFC PATCH v2 6/8] accel/rocket: add RK3576 NPU (RKNN) support (Message-Id: <20260718031146.3368811-7-gahing@gahingwoo.com>), together with new per-SoC match data. This standalone fix is intentionally minimal - ARRAY_SIZE(core->clks) and the clks[4] array are left untouched - so it rebases trivially under both the RK3576 v3 and the RK3568 series, and can be backported. Verified on RK3588 (Orange Pi 5 Plus): after the change clk_summary shows one consumer handle per clock instead of four handles on aclk, the NPU still powers up and down cleanly through runtime PM, and a MobileNetV1 inference run via the Teflon TFLite delegate produces bit-identical output tensors to the unpatched driver. drivers/accel/rocket/rocket_core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/accel/rocket/rocket_core.c b/drivers/accel/rocket/rocket_core.c index b3b2fa9..5dd260b 100644 --- a/drivers/accel/rocket/rocket_core.c +++ b/drivers/accel/rocket/rocket_core.c @@ -28,6 +28,10 @@ int rocket_core_init(struct rocket_core *core) if (err) return dev_err_probe(dev, err, "failed to get resets for core %d\n", core->index); + core->clks[0].id = "aclk"; + core->clks[1].id = "hclk"; + core->clks[2].id = "npu"; + core->clks[3].id = "pclk"; err = devm_clk_bulk_get(dev, ARRAY_SIZE(core->clks), core->clks); if (err) return dev_err_probe(dev, err, "failed to get clocks for core %d\n", core->index);