board/ti/am62x-sk/patches/linux: backport linux clock fix

With newer versions of DM or DMSC firmware (>v09.02.07) invalid clock
requests will be NAKed and generate a warning in the kernel logs rather
than being ignored like in previous versions of firmware. This, together
with the linux clk driver assuming that all clock IDs are contiguous,
can generate a significant amount of warnings during boot when many
drivers are being probed.

A fix for this has been merged into Linux (commit: ad3ac13c6ec31)
however the backport to older kernels was missed which unfortunately
affects the current v6.8 kernel.

Manually backport this fix while we're using the v6.8 kernel

Signed-off-by: Bryan Brattlof <bb@ti.com>
Tested-by: Gero Schwäricke <gero.schwaericke@grandcentrix.net>
[Arnout: add Upsream tag]
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
Bryan Brattlof 2024-05-09 09:49:28 -05:00 committed by Arnout Vandecappelle
parent 9755de9336
commit 4fb7eb8285

View File

@ -0,0 +1,75 @@
From 750cdf4cb6791c45d479ed73a97728100394fb32 Mon Sep 17 00:00:00 2001
From: Udit Kumar <u-kumar1@ti.com>
Date: Tue, 13 Feb 2024 13:56:40 +0530
Subject: [PATCH] clk: keystone: sci-clk: Adding support for non contiguous
clocks
X-Developer-Signature: v=1; a=openpgp-sha256; l=1876; i=bb@ti.com;
h=from:subject; bh=CKSvD6FpqwRzx8blynhoCEc3XUR5TlwjFJdcgjQwpgg=;
b=owNCWmg5MUFZJlNZHYzOLwAAZP/////7puP/r7v/9q9s+8t7wa8/97UZO//d+XvPsvfv2/+wA
RsYHaQAAAAAAAAGg09IPUGmgAaAANBoAAAGmnqAPU9Q0DQ0HqMQDQ8ptTeqeogaABoPU0NAPUAA
0GgDJ6gANAAMg0GmgNGgDEGh6jR6h6hp6mgepoPU2oDTIGho0IaHqA00yDQNBoGTRoDTRkAZNAD
AmTIBkGjIGmQyAZDRkAaANAYIxBk0DQAAHODcFn1CAGBsJeG8ZtU3FQCBdLH7LjDIouHeAszY1j
AFkqjaWIFXEVi8NV3giRplb1JjCYunXimTaK06SgQRYsUGRSbKOVQP2t1LlAYS93QjOMWF6CHXK
69KzHyBDpXR2mHAAkHcHX0X3SAYJkxPElwJ1ZnHK1RfDKRfJcRQKzxnryM+4x2mCxpIFIIjpVLk
nItd1Vl1SEF2QiWZIYV4b0lawcUqLGgTQZ0+qpJ5QORYrvPXE4DR89JlJYBU4DjxAoyACH6KN0o
AiaknqZTfMwmF8iREpU4SgDEVun3X3OFlkBp3hBO+Ynb12GJoLSFBSz9IWE2ooLKFalh5XJMZfl
+GthEEOnlrMQHOF8qCr+JAKqXEqSrwLGuEIMFbnGEjJYruo4ENGOmGVlkvW+kLRp5ibCXAAcDMM
TPOUZ/i7kinChIDsZnF4A==
X-Developer-Key: i=bb@ti.com; a=openpgp;
fpr=D3D177E40A38DF4D1853FEEF41B90D5D71D56CE0
Most of clocks and their parents are defined in contiguous range,
But in few cases, there is gap in clock numbers[0].
Driver assumes clocks to be in contiguous range, and add their clock
ids incrementally.
New firmware started returning error while calling get_freq and is_on
API for non-available clock ids.
In this fix, driver checks and adds only valid clock ids.
[0] https://software-dl.ti.com/tisci/esd/latest/5_soc_doc/j7200/clocks.html
Section Clocks for NAVSS0_CPTS_0 Device, clock id 12-15 not present.
Fixes: 3c13933c6033 ("clk: keystone: sci-clk: add support for dynamically probing clocks")
Signed-off-by: Udit Kumar <u-kumar1@ti.com>
Reviewed-by: Nishanth Menon <nm@ti.com>
Upstream: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ad3ac13c6ec318b43e769cc9ffde67528e58e555
Signed-off-by: Bryan Brattlof <bb@ti.com>
---
drivers/clk/keystone/sci-clk.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/clk/keystone/sci-clk.c b/drivers/clk/keystone/sci-clk.c
index 35fe197dd303c..eb2ef44869b23 100644
--- a/drivers/clk/keystone/sci-clk.c
+++ b/drivers/clk/keystone/sci-clk.c
@@ -516,6 +516,7 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider)
struct sci_clk *sci_clk, *prev;
int num_clks = 0;
int num_parents;
+ bool state;
int clk_id;
const char * const clk_names[] = {
"clocks", "assigned-clocks", "assigned-clock-parents", NULL
@@ -586,6 +587,15 @@ static int ti_sci_scan_clocks_from_dt(struct sci_clk_provider *provider)
clk_id = args.args[1] + 1;
while (num_parents--) {
+ /* Check if this clock id is valid */
+ ret = provider->ops->is_auto(provider->sci,
+ sci_clk->dev_id, clk_id, &state);
+
+ if (ret) {
+ clk_id++;
+ continue;
+ }
+
sci_clk = devm_kzalloc(dev,
sizeof(*sci_clk),
GFP_KERNEL);
base-commit: 9fbb5fcb41e7e96fb8769a9f5a12a35a984c23bd
--
2.43.2