From patchwork Wed Nov 4 10:16:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4976 Delivered-To: michael@amarulasolutions.com Received: by 2002:a05:7301:5407:b0:36a:3487:1c26 with SMTP id aa7csp35396dyc; Wed, 4 Nov 2026 02:17:45 -0800 (PST) X-Received: by 2002:a05:6000:420c:b0:48d:f855:d1e0 with SMTP id ffacd0b85a97d-48e6e50b9ddmr35536837f8f.57.1793787465360; Wed, 04 Nov 2026 02:17:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793787465; cv=none; d=google.com; s=arc-20260327; b=gGQCzUVBfD6zJjtFmZ64m1DAv/j3M1kl11430V4xW8oFWCFCrIrnBY17pb8P6ep81f RyH8XQ+CQhMdvSwvHVXBSfDh8LC1P5cU5qgiU1xDuI14DjTMksffgACTDOLjovdbbXXV PVjbKyUhLS2lO7JRFBJ8uNjndloF3D8La9yPr9AN+XZxcrp+0cOeMQCR2wL2U7QuHcUL NXNJ5Mf2rFsxB98IiWi/O4qqN0odOJxm0OM6qYPjoxsfY/Q1qq77yUqGPAsnNZH52sf9 /PTLdkB1GaSakZcRuT9x+LTu0mFFGklWm28ILVCXsqIqeV1ezZCclLuevXxUXiOMMs2I 9otQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=nafaEA1OVG7CjcE+9vFCf00bZY6KpgzCNwfvKtVMnW4=; fh=336r+1OU09ZyIurAO2H12n3WjToz+tBgmXLZnFXh/Z8=; b=kRvSDsGmqyKNFfBxX3/FDs1FhjQqGHPlZEmEs+0ktOambUikdGjCoi9/N+Zp+VkioG ljhM+DwuixLpEuecerDGw+1vEmD75f4z0uHFV9xkstHP5eINiTp3mIidNNIMtj2x/Flq xJWjNsiBkfS71cyXqiVIr8qTotJkpEq+ftB++J7/e3lHTT65gPq83CRatqyU1MJh4Xn+ fyDyPwbZXBJ2asBheMT+FETs02Jn0hm5ytgdt7Mag8PMCLX4rfqyTtGMTOPmnU/Bh/zE Q8aTmehG9vXS31U8oSQg0e2itBbhHfNdDy6PJ/nExEh+hWUJ1uP3dLUPhtYGBqNvCCIQ Y8sA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XwIqm6dD; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-48fe718a2e0sor228480f8f.0.2026.11.04.02.17.45 for (Google Transport Security); Wed, 04 Nov 2026 02:17:45 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=XwIqm6dD; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1793787465; x=1794392265; darn=amarulasolutions.com; 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:content-type; bh=nafaEA1OVG7CjcE+9vFCf00bZY6KpgzCNwfvKtVMnW4=; b=XwIqm6dDesHQ2mjGSrkmC1BtT8V7HIjUl4A0PPJZLz80cN/DxXfNNsbGX+Qcxg8RxG xeQK+IrN0SVFRNLbueVFVByiPHpzD8k4fMXZW/yA/DMTWgOLbqlP18DQuHD88m3BxO53 f5+Yh+7whR3+GziGr+Fy6OLmwzsgJLFfngayo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793787465; x=1794392265; h=content-transfer-encoding:mime-version:references:in-reply-to :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=nafaEA1OVG7CjcE+9vFCf00bZY6KpgzCNwfvKtVMnW4=; b=uEjT8TNbNUnSnUZpph80hbD6giFrrjcTgnrW4s9xY2xVIwnvJdWymY85buf4KbdOwj 3PRrV+cWzzMnnzb8QmHUsC08ILDj82mNVa13Qo8yymXVcoK6VRr3hs3cZx0nQn1ucJFj tp5JTBe89JuFxgpJf6EAcZgWmpI4bT+PQG2cDS8sDpkofJYbfNoOZY/Y69WEica3YoPD NgrO2FSKj3U4L/nGchS/xclaO9ojzD3NAXqfc7H8RhQrQ2hTXikvCzExGsTnSTH7lYHI 8VnLaNxXhrM8JTfgVAB0f5Zk7vdzND2y9G3uQZ2RAS74FtbJdIlgAvUsUXM0Gq7iH97u GVjg== X-Gm-Message-State: APuU4Z+1EZhemE/gw7Z4V0tjpH8Uz7zSyDVfooiI6tDoFXqaZWjbxJGp 8ZRWB+YXpqIT+WbVckZJxz3f7kyuBkox0AeffCsAz8N0wldRX5YgLJlumPqhLt03ZX7ZLQ== X-Gm-Gg: AYBFou3IztEGih9AUR3a1S7IwtTq4jvrtE1lTPpr/w905hQNZ3fGSKaZqs3ZZUEfVQP KLVZpoUwQ4qSN8VSmcdMylxiYg+8HOaijQtjtnX1wBGuQEeeo0HswqdLnCv5fzMmYHXnH5QvTHz emZEJKgAXfiC5ZCPKVLhg5IA794ijuao1gjPfPfLExIjNXtnZzNI8AxLFLv12JK0EbUy3KFN8Iw HcZYmsz40euQGDsLQc8qX4KLR8hkky7d4ES+3R10pSBzlRedeWqUjiUyDyu0723FalBDrvTIXPt WYMsZGTWeseHV2/hcPNMPTJ7Z54/Fry0EvoprLurCslxohDasbM9VkU+NI7m1eyHOoYsGXty+gM Tsh6X27/XuCQvWWqZRf3ze991DTtw3ZHsxBzdWtt2TtsCUmlMZdQrQOFOqXJNXUt0iDpaXp/KI4 lOeMsSZuk5/eopn96Z3DBrcLbEZ40MRxXODknz14zWfw8yanupKvOXc/nvBeiW2agh7UgBB+AgK EM0f9E/LRUPB3Q8vrQk8vc/H5EoSNyAzTdFMpAOWTy2xrDfwt8nw8Z930VrQLevMbXRWdBFZPQT uUNGhCrmqPGG0bpbkg4LzuCND61zPbf8lz1BzDXF/n6raLT6iWfKF35PCjxsYq7AfkRan8EQYAq Aduim6bBYMxvxyx4umEl7aZdVregpYVhN4oNLqcAWAJ6R9krg1Ncl X-Received: by 2002:a5d:5d06:0:b0:48d:ef7a:e59f with SMTP id ffacd0b85a97d-48e6e2fa482mr34138879f8f.17.1793787464715; Wed, 04 Nov 2026 02:17:44 -0800 (PST) Return-Path: Received: from dario-ThinkPad-P14s-Gen-5.amarulasolutions.com ([217.201.213.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48feeb51a9csm3035105f8f.59.2026.11.04.02.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2026 02:17:44 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, Dario Binacchi , Krzysztof Kozlowski , Brian Masney , Conor Dooley , Jerome Brunet , Krzysztof Kozlowski , Rob Herring , Stephen Boyd , devicetree@vger.kernel.org, linux-clk@vger.kernel.org Subject: [PATCH v4 1/3] dt-bindings: clock: ti: dpll: deprecate the ti,ssc-* properties Date: Wed, 4 Nov 2026 11:16:55 +0100 Message-ID: <20261104101732.4043372-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261104101732.4043372-1-dario.binacchi@amarulasolutions.com> References: <20261104101732.4043372-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 The common clock binding provides assigned-clock-sscs to configure spread spectrum clocking (SSC), supported by the clock core since commit a7f16660af39 ("clk: conf: Support assigned-clock-sscs"). Deprecate the vendor specific ti,ssc-deltam, ti,ssc-modfreq-hz and ti,ssc-downspread properties in favor of it, so that new DTs use a single way to describe the same thing. Signed-off-by: Dario Binacchi Reviewed-by: Krzysztof Kozlowski --- Changes in v4: - Add Reviewed-by tag of Krzysztof Kozlowski Changes in v3: - Deprecate the properties instead of dropping them Documentation/devicetree/bindings/clock/ti/dpll.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) -- 2.43.0 diff --git a/Documentation/devicetree/bindings/clock/ti/dpll.txt b/Documentation/devicetree/bindings/clock/ti/dpll.txt index 14a1b72c2e71..8759c328e841 100644 --- a/Documentation/devicetree/bindings/clock/ti/dpll.txt +++ b/Documentation/devicetree/bindings/clock/ti/dpll.txt @@ -57,11 +57,14 @@ Optional properties: - ti,min-div : the minimum divisor to start from to round the DPLL target rate - ti,ssc-deltam : DPLL supports spread spectrum clocking, frequency - spreading in permille (10th of a percent) + spreading in permille (10th of a percent). + Deprecated, use assigned-clock-sscs instead. - ti,ssc-modfreq-hz : DPLL supports spread spectrum clocking, spread - spectrum modulation frequency + spectrum modulation frequency. + Deprecated, use assigned-clock-sscs instead. - ti,ssc-downspread : DPLL supports spread spectrum clocking, boolean - to enable the downspread feature + to enable the downspread feature. + Deprecated, use assigned-clock-sscs instead. Examples: dpll_core_ck: dpll_core_ck@44e00490 { From patchwork Wed Nov 4 10:16:56 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4977 Delivered-To: michael@amarulasolutions.com Received: by 2002:a05:7301:5407:b0:36a:3487:1c26 with SMTP id aa7csp35440dyc; Wed, 4 Nov 2026 02:17:47 -0800 (PST) X-Received: by 2002:a05:6000:4810:b0:48b:2a2:31dc with SMTP id ffacd0b85a97d-48e6e5267c4mr36199683f8f.49.1793787467612; Wed, 04 Nov 2026 02:17:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793787467; cv=none; d=google.com; s=arc-20260327; b=BeLX2CjY0jDLC8U9vNegdkAde0dv4YXWCO85LKAWi+n7CQI1+W2XNj833abxxughdp +eBlkkPg7zG/7YH8laYLXi17sc0pJN/6qs27qWKlAja/AfVsnDbkINVdMMUcym7kfzRd nDl2F8Pmill97TTCjiugzYwdW5EXw6oUG98cduj84x7S/yxlEP5XR4ucXYc1qT/go7Ve 8TCQNNsOcDOYRzZqisVbCcgEEFyuNh8/oTskKqrCT2WsJcSFTTmnF42NwTL2CQqOgPOj +J/OpaNRmWI8h6v8ReUWgYFAYCpTBA4NQLkKKpi6xL+2h56Zjiu4K681IR0mtWsocIAs KkGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=xtoytOhDAraaCDXzQjcwaANupRV+STFp2/XgbK9TFAs=; fh=4KgKzUt+w1/nYxpJAYO/ECudv3fO5brOvX+6sjW+qV0=; b=c/esu136/9X/SBAF5ZjXru5ujicLCbSTo5ujx1qnqL/EwfZI+xC5uVaokbtrAzyx6F XL2ZGSoCaJyWjGqqD9Xpwgl2vmjPPMRlwL291a0zQDVm/j6bXHfvE32OvLL7fVItQ9/E GJKrOjYi+y4dfFyWWu185swreej2P3HJtsNvpS5lFV4TH/kYFfLuFt0gDY3PvtbnrCfP DI1Y8MpCWHNo610KoUvDxivAkTX9bFzRrWijQ5npEez6/ditJtpk6ZdgpXMsKDtnxodr K9La5RI0UJEfxl+IcJ++en46lm78pXOmCSJN6teqG0OPeyv4w5Ug7IC78cuiaI7RM1Or QNwg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Lyxf/uVA"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-48fed17a222sor255463f8f.14.2026.11.04.02.17.47 for (Google Transport Security); Wed, 04 Nov 2026 02:17:47 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="Lyxf/uVA"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1793787467; x=1794392267; darn=amarulasolutions.com; 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:content-type; bh=xtoytOhDAraaCDXzQjcwaANupRV+STFp2/XgbK9TFAs=; b=Lyxf/uVAYVqe6xvnAmmF/HqNWEaYIH0uqCODJInbResCgAK3mEcYxKV6qGgu0l06hl ZxT2cAcx60NDR5F4hdXW+52QDXSJiedfKUc+l9ueUVWp8tbV3nCudUDcVN9i9UXRqrL0 qxylTpET8oJxKtuAPM0kXrq9AYqXKr5q53NhQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793787467; x=1794392267; h=content-transfer-encoding:mime-version:references:in-reply-to :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=xtoytOhDAraaCDXzQjcwaANupRV+STFp2/XgbK9TFAs=; b=JmhTBbpW+5FQacttK0s7wbnV1FjgZYq4BZf5K4h1Mb/OOmM36HBwIzxHPFx/qe6SW7 mrtGK9wwsl2eT5RhTMy4r9wg78kS2i3aWBnlVh4u+/Go/X0mZ4tXP6GBHqhSGuM1KI8q L/D8bplvirj2JpJGk0rxt2G5ZZj6B6bpJ5NyuKWxz2gmBcT3ex6AxGI/6YZEqE7iEc4N TnL2LdrpKszuWl9+gpoI1rP8slw1HF5CThha73xRFlvl0eYL6s/uqRJAVvlvI5X5Ud8R 9BmNOFiNrqSv0SpYBwqwU2N0AmEWdqaxnzw/uJ4+Qw6UC1iHNhxtcnEn6mGWGygoZ7eW VRMg== X-Gm-Message-State: APuU4Z+Usu/kUi/L4kBllxI3Y1clcG6if3pYKylDKHQabqJAl2KR4wVd gneN2YQCf9zX0qgfMMZ+ksCy42Spztt/LxxAvnejVw2eE7wKiE7kSfLl0fe0wCgnoOnFFw== X-Gm-Gg: AYBFou1Das/y3PhhocfmmtxPpLO3xUFWJRqOVD15xqvQODA/jCmayP0fooHtbq0FYM6 yBgD/mRpBQkW64Togr+3o2vwLBtvyL/qL45LwOjxvkb+t+fgPqVO8VBx4HRNcuug1UNl4lU5j70 Thw/hTaRQgmByrX2QXatqdQcT+DmEwm6tKWIbj6zaaciadc3mjNzI+Js8r4PkgMdIroG1oVazMs /wOkrF4EGEhrcrCO0BwuU4NuvE1QqmFmBf9NJV8JTOIsE60vV60CbMu0kN/9wReUuqHqn9ECEsm s7lshjoRLMbdU1hvcrNHEyv2k5t/S6nUMcbCR2WQCNW/djOM7PwbNUibuAfU0GDRkY+ZoBQeW48 710EZ5nJP+Rvy45OVD9aj+dhe3zs2Ua7uuRsopBp7O5O97N8YGTR7mTKi/4SxfgKZmL4crBjMD4 ouJZPUlTXvqPpPJMez8TPBvqSmEXk5bb6tnPkyCrohVvQEtlh20scLH5+RPHb78bIJYZTeNW+W2 XEKOe5nxR9QZiIlzzFhUBC87AgdOIBbpMX4wOPy+ugchd8+gBFyzDijA5ZgLvoGi6H4tPQHd+1N cNFwafi15aOBtFYZgGjEZ2rRhEIv/UFbE/+ViePbSFVJ5rEgHkukgzHLwnK0fj8ItfynFw9JnrV gMpp0mE8XtKOt4Qo5CRhAwalAWtehyzigKCNPnSr2kZwFoclu0G6Q X-Received: by 2002:a05:6000:2310:b0:490:a3e7:8af3 with SMTP id ffacd0b85a97d-490a3e78cd2mr400000f8f.35.1793787466939; Wed, 04 Nov 2026 02:17:46 -0800 (PST) Return-Path: Received: from dario-ThinkPad-P14s-Gen-5.amarulasolutions.com ([217.201.213.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48feeb51a9csm3035105f8f.59.2026.11.04.02.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2026 02:17:46 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, Dario Binacchi , Brian Masney , Jerome Brunet , Stephen Boyd , Tero Kristo , linux-clk@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH v4 2/3] clk: ti: dpll: use the generic spread spectrum configuration Date: Wed, 4 Nov 2026 11:16:56 +0100 Message-ID: <20261104101732.4043372-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261104101732.4043372-1-dario.binacchi@amarulasolutions.com> References: <20261104101732.4043372-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 The clock framework provides a generic API and DT property for spread spectrum clocking (SSC) since commit c86814e70390 ("clk: Introduce clk_hw_set_spread_spectrum"). Implement the set_spread_spectrum callback and convert the deprecated vendor specific properties to the generic configuration, so that existing DTs keep working. The SSC registers are programmed at the next rate change, as with the vendor specific properties. The generic framework expresses the spread in permyriad rather than permille, hence the change in the deltaM step computation, and also supports up-spread, which is rejected as the hardware does not support it. Signed-off-by: Dario Binacchi --- Changes in v4: - Keep the reverse Christmas tree order for the variables list - Check the range of the deprecated ti,ssc-deltam property - Drop the checks already done by the clock framework Changes in v3: - Keep parsing the deprecated vendor specific properties drivers/clk/ti/clock.h | 2 ++ drivers/clk/ti/dpll.c | 21 ++++++++++++---- drivers/clk/ti/dpll3xxx.c | 52 +++++++++++++++++++++++++++++++-------- include/linux/clk/ti.h | 9 ++----- 4 files changed, 62 insertions(+), 22 deletions(-) -- 2.43.0 diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h index d5e24fe4ae3a..83225e506314 100644 --- a/drivers/clk/ti/clock.h +++ b/drivers/clk/ti/clock.h @@ -271,6 +271,8 @@ int omap3_noncore_dpll_set_rate_and_parent(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate, u8 index); +int omap3_noncore_dpll_set_spread_spectrum(struct clk_hw *hw, + const struct clk_spread_spectrum *ss_conf); int omap3_noncore_dpll_determine_rate(struct clk_hw *hw, struct clk_rate_request *req); int omap2_dpll_determine_rate(struct clk_hw *hw, struct clk_rate_request *req); diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c index e01272cd628d..60150006ee0b 100644 --- a/drivers/clk/ti/dpll.c +++ b/drivers/clk/ti/dpll.c @@ -51,6 +51,7 @@ static const struct clk_ops dpll_ck_ops = { .set_parent = &omap3_noncore_dpll_set_parent, .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent, .determine_rate = &omap3_noncore_dpll_determine_rate, + .set_spread_spectrum = &omap3_noncore_dpll_set_spread_spectrum, .get_parent = &omap2_init_dpll_parent, .save_context = &omap3_noncore_dpll_save_context, .restore_context = &omap3_noncore_dpll_restore_context, @@ -63,6 +64,7 @@ static const struct clk_ops dpll_no_gate_ck_ops = { .set_parent = &omap3_noncore_dpll_set_parent, .set_rate_and_parent = &omap3_noncore_dpll_set_rate_and_parent, .determine_rate = &omap3_noncore_dpll_determine_rate, + .set_spread_spectrum = &omap3_noncore_dpll_set_spread_spectrum, .save_context = &omap3_noncore_dpll_save_context, .restore_context = &omap3_noncore_dpll_restore_context }; @@ -276,6 +278,8 @@ static void __init of_ti_dpll_setup(struct device_node *node, struct clk_init_data *init = NULL; const char **parent_names = NULL; struct dpll_data *dd = NULL; + u32 ssc_modfreq = 0; + u32 ssc_deltam = 0; int ssc_clk_index; u8 dpll_mode = 0; u32 min_div; @@ -349,11 +353,18 @@ static void __init of_ti_dpll_setup(struct device_node *node, &dd->ssc_modfreq_reg)) goto cleanup; - of_property_read_u32(node, "ti,ssc-modfreq-hz", - &dd->ssc_modfreq); - of_property_read_u32(node, "ti,ssc-deltam", &dd->ssc_deltam); - dd->ssc_downspread = - of_property_read_bool(node, "ti,ssc-downspread"); + /* Deprecated, superseded by assigned-clock-sscs */ + of_property_read_u32(node, "ti,ssc-modfreq-hz", &ssc_modfreq); + of_property_read_u32(node, "ti,ssc-deltam", &ssc_deltam); + if (ssc_modfreq && ssc_deltam && ssc_deltam <= 1000) { + dd->ssc_conf.modfreq_hz = ssc_modfreq; + /* permille to permyriad */ + dd->ssc_conf.spread_bp = ssc_deltam * 10; + if (of_property_read_bool(node, "ti,ssc-downspread")) + dd->ssc_conf.method = CLK_SPREAD_DOWN; + else + dd->ssc_conf.method = CLK_SPREAD_CENTER; + } } if (of_property_read_bool(node, "ti,low-power-stop")) diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c index 8c51b988a04f..052233f2e12b 100644 --- a/drivers/clk/ti/dpll3xxx.c +++ b/drivers/clk/ti/dpll3xxx.c @@ -295,30 +295,32 @@ static void _lookup_sddiv(struct clk_hw_omap *clk, u8 *sd_div, u16 m, u8 n) * omap3_noncore_dpll_ssc_program - set spread-spectrum clocking registers * @clk: struct clk * of DPLL to set * - * Enable the DPLL spread spectrum clocking if frequency modulation and - * frequency spreading have been set, otherwise disable it. + * Enable the DPLL spread spectrum clocking according to the configuration + * set by omap3_noncore_dpll_set_spread_spectrum(), otherwise disable it. */ static void omap3_noncore_dpll_ssc_program(struct clk_hw_omap *clk) { struct dpll_data *dd = clk->dpll_data; + const struct clk_spread_spectrum *conf = &dd->ssc_conf; + bool downspread = conf->method == CLK_SPREAD_DOWN; unsigned long ref_rate; u32 v, ctrl, mod_freq_divider, exponent, mantissa; u32 deltam_step, deltam_ceil; ctrl = ti_clk_ll_ops->clk_readl(&dd->control_reg); - if (dd->ssc_modfreq && dd->ssc_deltam) { + if (conf->method != CLK_SPREAD_NO) { ctrl |= dd->ssc_enable_mask; - if (dd->ssc_downspread) + if (downspread) ctrl |= dd->ssc_downspread_mask; else ctrl &= ~dd->ssc_downspread_mask; ref_rate = clk_hw_get_rate(dd->clk_ref); mod_freq_divider = - (ref_rate / dd->last_rounded_n) / (4 * dd->ssc_modfreq); - if (dd->ssc_modfreq > (ref_rate / 70)) + (ref_rate / dd->last_rounded_n) / (4 * conf->modfreq_hz); + if (conf->modfreq_hz > (ref_rate / 70)) pr_warn("clock: SSC modulation frequency of DPLL %s greater than %ld\n", __clk_get_name(clk->hw.clk), ref_rate / 70); @@ -337,9 +339,10 @@ static void omap3_noncore_dpll_ssc_program(struct clk_hw_omap *clk) v |= exponent << __ffs(dd->ssc_modfreq_exp_mask); ti_clk_ll_ops->clk_writel(v, &dd->ssc_modfreq_reg); - deltam_step = dd->last_rounded_m * dd->ssc_deltam; - deltam_step /= 10; - if (dd->ssc_downspread) + /* spread_bp is in permyriad, convert to percent first */ + deltam_step = dd->last_rounded_m * conf->spread_bp; + deltam_step /= 100; + if (downspread) deltam_step /= 2; deltam_step <<= __ffs(dd->ssc_deltam_int_mask); @@ -353,7 +356,7 @@ static void omap3_noncore_dpll_ssc_program(struct clk_hw_omap *clk) if (deltam_step & dd->ssc_deltam_frac_mask) deltam_ceil++; - if ((dd->ssc_downspread && + if ((downspread && ((dd->last_rounded_m - (2 * deltam_ceil)) < 20 || dd->last_rounded_m > 2045)) || ((dd->last_rounded_m - deltam_ceil) < 20 || @@ -682,6 +685,35 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, return ret; } +/** + * omap3_noncore_dpll_set_spread_spectrum - set the DPLL SSC configuration + * @hw: pointer to the clock to set the spread spectrum configuration for + * @ss_conf: spread spectrum configuration + * + * Stores the spread spectrum clocking (SSC) configuration of the DPLL. The + * configuration is programmed along with the DPLL multiplier and divider + * at the next rate change. The hardware supports center-spread and + * down-spread only. Returns 0 on success, or a negative error value on + * failure. + */ +int omap3_noncore_dpll_set_spread_spectrum(struct clk_hw *hw, + const struct clk_spread_spectrum *ss_conf) +{ + struct clk_hw_omap *clk = to_clk_hw_omap(hw); + struct dpll_data *dd = clk->dpll_data; + + if (!dd || !dd->ssc_enable_mask) + return -EOPNOTSUPP; + + /* Up-spread is not supported by the hardware */ + if (ss_conf->method == CLK_SPREAD_UP) + return -EINVAL; + + dd->ssc_conf = *ss_conf; + + return 0; +} + /** * omap3_noncore_dpll_set_rate_and_parent - set rate and parent for a DPLL clock * @hw: pointer to the clock to set rate and parent for diff --git a/include/linux/clk/ti.h b/include/linux/clk/ti.h index 61c4abf19995..8b29cd7db15c 100644 --- a/include/linux/clk/ti.h +++ b/include/linux/clk/ti.h @@ -65,10 +65,7 @@ struct clk_omap_reg { * @ssc_enable_mask: mask of the DPLL SSC enable bit in @control_reg * @ssc_downspread_mask: mask of the DPLL SSC low frequency only bit in * @control_reg - * @ssc_modfreq: the DPLL SSC frequency modulation in kHz - * @ssc_deltam: the DPLL SSC frequency spreading in permille (10th of percent) - * @ssc_downspread: require the only low frequency spread of the DPLL in SSC - * mode + * @ssc_conf: the DPLL SSC configuration * @flags: DPLL type/features (see below) * * Possible values for @flags: @@ -124,9 +121,7 @@ struct dpll_data { u32 ssc_modfreq_exp_mask; u32 ssc_enable_mask; u32 ssc_downspread_mask; - u32 ssc_modfreq; - u32 ssc_deltam; - bool ssc_downspread; + struct clk_spread_spectrum ssc_conf; u8 flags; }; From patchwork Wed Nov 4 10:16:57 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4978 Delivered-To: michael@amarulasolutions.com Received: by 2002:a05:7301:5407:b0:36a:3487:1c26 with SMTP id aa7csp35482dyc; Wed, 4 Nov 2026 02:17:49 -0800 (PST) X-Received: by 2002:a05:600c:a4e:b0:4a7:76fa:87e9 with SMTP id 5b1f17b1804b1-4ac187a766bmr355556005e9.21.1793787469666; Wed, 04 Nov 2026 02:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1793787469; cv=none; d=google.com; s=arc-20260327; b=jmpNqkyzNidGdr5ZSVfShTRltyCxpRerNFOCKpTN46TxM8+fz6UI3RP140dLYXvTRg wJxla0KhZ8MqbljnHIscyhuTX67nGV+9UuBbEjAr72j1jv/0VVnWVUQwoKe4eEnDN5PQ A4adWN+kt5FtI0y6zDOz+ii7vP/m3OZuwyzFsp0S+2VmkzIbSYZvL84Wk1QfUoLFtio8 ur0GUgdSpZyCYa9pBG6JAEoMjic+X5keK8GL0MMJIcPhJXcH1ySPnk9eaA/wX63mogPr NPL/2izhYzjM1iGpRNekT90P2ZkR02wsIGwci6nURxZ5GHC67Fox1Bru2JI/YIkz8SG9 aOVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=jbuhfSlfgFZ1tnBuSoCDBMKfZMfXYTX6enIbhL3dWk8=; fh=4KgKzUt+w1/nYxpJAYO/ECudv3fO5brOvX+6sjW+qV0=; b=ZKfIL6TeeKcNk9N5WI2cKMcF8E1vmyc31mPibMmY8dzoNb2GNAfUcO7aXro0I1C9SV TY+6zNAfRP2IdXM5aIZgClRwyu3oGrQ3oXrjp0OQriY7z/cNQ30VnaOy1uUvPVW9afCY x38xudsyPQxLcMDp3mMZTBzDiAYnaIn0/iRZXoxiq+SgniRZD1cOcYuAql+r9ishDyLw rGFKUEi4i0WjhVgsZwNFeOKu1wB5vFFL5WJIFUjL8oNcu9h3gZ+yHCXcJIWWaFRtOvAa OBiPWPEUfTlEBjtlOzsEIEVelhO7rYkxiPzm3bNMwq7P0A+nuYBHWuUKYy1Hmxo3pAIf xefA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="fxm9Iz/t"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id 5b1f17b1804b1-4b437f1f20esor3734565e9.0.2026.11.04.02.17.49 for (Google Transport Security); Wed, 04 Nov 2026 02:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="fxm9Iz/t"; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=neutral header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1793787469; x=1794392269; darn=amarulasolutions.com; 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:content-type; bh=jbuhfSlfgFZ1tnBuSoCDBMKfZMfXYTX6enIbhL3dWk8=; b=fxm9Iz/t4/W5dWVXSGiQEU3Gl3to+eOq5FUHqtNsYH+H1JeboEMqUf54+SdVzGQX3F xMDGCluka7LZRa/hYCFm0Peltatfph0JIU6JSqlw/HDAQbRdZmiJwFPJerleWEmQII5D s5dQ3Ey+TC4SepGPZrBqgJe+JAflRpzLKmkA0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793787469; x=1794392269; h=content-transfer-encoding:mime-version:references:in-reply-to :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=jbuhfSlfgFZ1tnBuSoCDBMKfZMfXYTX6enIbhL3dWk8=; b=CPWqv+/7TMaB2NelwnsZb42RLSLlDsT+zmfid6QG8Pvvpp6kzzBkj0Ro0ocTzJSe6+ XigP6Z5kfqR3Osu93DV761v7sUNEBj5F4OONQh8iyduOJGAUDzCh0Yr5EZRvgFx4LGB/ 7haBJgAtwHLWqconPPGvnw7MU9q1hLnPEQAHBlop/JJSZY3PtTV0z8tDO2ww324upCvY PLNAO/dBYwHd+Edq/nTSwvvWGLCFQyx5duk9s+/XTh1iPYyBETPC5wFB2b4qxDOSOLqH x5hEe0i6KIUoIBJkj76UQbzINy7NjGRZLCNuJqCV1SQGXeLYgfRuMrMYQzubQui8vqvz rHcg== X-Gm-Message-State: APuU4Z89zaH4gzs/trfMBXPeaeLYqXVUtZjaLyc1+JMFSoP1pvLZSWCZ +5OQ3RUe50QSvnle4Yl0sATU5wau2zVERumnmFkc/n/kGrdg8IxEuhZKsmo72Sg86tgJvg== X-Gm-Gg: AYBFou1u0rRNEV9HYJwn6oAbqOs/rKLH1D6m4/J+CahlQ0RzPm+EStn5Pa8mjr8yiAg d+qLxy/vaALagVpJw2OSAGWvlCCufUtK4HQDcmmzNHQL/Srq2umqAw5Kq3ExO0cVST/vxhpd62F Vnrgf7116NxN6QkZTLQFlVlS8VkuwIfN797az/B5GrRAs+4+5ES85/PZFyO0D4xLrArD4hJPRLc WO4RSFa5t01OlbmLJ2P3KnQUIcB+ON2HFLd+d76gibxYO3hfczGtBoI4vTispSvChNAYeAFu0Zg G42BbmMU7WJUVNJR0R02kTZ9sTr5u1tX4sMJwe8HyHqdTQKVYLNkDzqjNMskgNX4+Mx9kYkZ9tj zuAd1VqUtPe3tilk/+7w4eWgAEEphvlW3TH7KxsErH8CrLkXVPUwBTg3eqjOvkyNT+2RtYCulVf USOHllECc9fbgwB9OtuGIavZDrOM9Qvouyj0PtUEn0HByLo5Sfjhi2C+j/nVCOuyNlGbc/dmlnm YPAL0tMVaRVxa5csuEp6yO1KXy1El12ncHbNziCHQ5mM6YI/GKuDryzTpLz0lw8TGnwKnRLvRrH i+0zNROteR7ul8FNX2/Lvh0oROQ2K7oAywZnNmDoP/Mw+Musq/d4KM9oQgjb1h1u0ocqX8X1C3G 1wBN/Kc8yZOATpbawkokACggoyOnjn8T4Jj7mMZjj+d0gO6Xx4mFH X-Received: by 2002:a05:600c:1f93:b0:4a1:7e76:d02f with SMTP id 5b1f17b1804b1-4ac180f299emr332117065e9.14.1793787469058; Wed, 04 Nov 2026 02:17:49 -0800 (PST) Return-Path: Received: from dario-ThinkPad-P14s-Gen-5.amarulasolutions.com ([217.201.213.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48feeb51a9csm3035105f8f.59.2026.11.04.02.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Nov 2026 02:17:48 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: michael@amarulasolutions.com, linux-amarula@amarulasolutions.com, Dario Binacchi , Brian Masney , Jerome Brunet , Stephen Boyd , Tero Kristo , linux-clk@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH v4 3/3] clk: ti: dpll: apply the spread spectrum configuration right away Date: Wed, 4 Nov 2026 11:16:57 +0100 Message-ID: <20261104101732.4043372-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261104101732.4043372-1-dario.binacchi@amarulasolutions.com> References: <20261104101732.4043372-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 The spread spectrum clocking (SSC) registers are only programmed by set_rate(), which the clock core skips when the requested rate is already the current one, e.g. when the bootloader has set it up. As a result, the SSC configuration is not applied, as it was with the vendor specific properties. Apply it from set_spread_spectrum() instead, reprogramming the DPLL at its current rate. Signed-off-by: Dario Binacchi --- Changes in v4: - Split the already applied check into the disabled and enabled cases - Keep the reverse Christmas tree order for the variables list Changes in v3: - Skip reprogramming only if the configuration is already applied to the hardware Changes in v2: - Check the DPLL lock state instead of its parent, as the reference and bypass clocks can be the same clock drivers/clk/ti/dpll3xxx.c | 56 ++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 6 deletions(-) -- 2.43.0 diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c index 052233f2e12b..b48ea0492378 100644 --- a/drivers/clk/ti/dpll3xxx.c +++ b/drivers/clk/ti/dpll3xxx.c @@ -690,17 +690,22 @@ int omap3_noncore_dpll_set_rate(struct clk_hw *hw, unsigned long rate, * @hw: pointer to the clock to set the spread spectrum configuration for * @ss_conf: spread spectrum configuration * - * Stores the spread spectrum clocking (SSC) configuration of the DPLL. The - * configuration is programmed along with the DPLL multiplier and divider - * at the next rate change. The hardware supports center-spread and - * down-spread only. Returns 0 on success, or a negative error value on - * failure. + * Stores the spread spectrum clocking (SSC) configuration of the DPLL and, + * if the DPLL is locked, reprograms it at its current rate to apply it. + * Otherwise the configuration is applied at the next rate change. The + * hardware supports center-spread and down-spread only. Returns 0 on + * success, negative error value otherwise. */ int omap3_noncore_dpll_set_spread_spectrum(struct clk_hw *hw, const struct clk_spread_spectrum *ss_conf) { struct clk_hw_omap *clk = to_clk_hw_omap(hw); struct dpll_data *dd = clk->dpll_data; + struct clk_spread_spectrum old_conf; + struct clk_rate_request req; + unsigned long rate; + u32 ctrl; + int ret; if (!dd || !dd->ssc_enable_mask) return -EOPNOTSUPP; @@ -709,9 +714,48 @@ int omap3_noncore_dpll_set_spread_spectrum(struct clk_hw *hw, if (ss_conf->method == CLK_SPREAD_UP) return -EINVAL; + ctrl = ti_clk_ll_ops->clk_readl(&dd->control_reg); + + if (!memcmp(ss_conf, &dd->ssc_conf, sizeof(*ss_conf))) { + /* Already disabled */ + if (ss_conf->method == CLK_SPREAD_NO && + !(ctrl & dd->ssc_enable_mask)) + return 0; + + /* Already enabled */ + if (ss_conf->method != CLK_SPREAD_NO && + (ctrl & dd->ssc_enable_mask)) + return 0; + } + + old_conf = dd->ssc_conf; dd->ssc_conf = *ss_conf; - return 0; + /* Disabling SSC does not need to reprogram the DPLL */ + if (ss_conf->method == CLK_SPREAD_NO) { + omap3_noncore_dpll_ssc_program(clk); + return 0; + } + + /* Not locked: SSC is programmed along with the next rate change */ + if (((ctrl & dd->enable_mask) >> __ffs(dd->enable_mask)) != DPLL_LOCKED) + return 0; + + rate = clk_hw_get_rate(hw); + clk_hw_init_rate_request(hw, &req, rate); + ret = omap2_dpll_determine_rate(hw, &req); + if (!ret && req.rate != rate) + ret = -EINVAL; + if (!ret) + ret = omap3_noncore_dpll_set_rate(hw, rate, + clk_hw_get_rate(dd->clk_ref)); + if (ret) { + pr_warn("clock: %s: rate %lu can't be kept with SSC enabled\n", + clk_hw_get_name(hw), rate); + dd->ssc_conf = old_conf; + } + + return ret; } /**