From patchwork Mon Oct 26 07:46:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4896 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 96D163F0F8 for ; Mon, 26 Oct 2026 08:47:06 +0100 (CET) Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-4a204ac318asf14129865e9.2 for ; Mon, 26 Oct 2026 00:47:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1793000826; cv=pass; d=google.com; s=arc-20260327; b=FaW0Qh2sIBH2ooja/1sqdzKqwWNQYHfil/n8RyLRpdqLCUk5sphxHXh3Y/Q+x8PUG3 7L1SX2npbtYjOWcXIrZbdh1HC0N8pu1lgbdizf6dsSQ0/SnJbDcE345O+ordaJPPIflQ 5fzeoPvjuidP+KwinW7NZM9OZEfuD6dT4CDwReWydKksZB+5FQe6J2++NXS3WnfTQs4k llfiObVgiEDBWvZ9b4XfGOEktOnqK9gAqW1zDvv8A0hiAXjRTx5ELMlCDYuvwshCy2u5 7s8ZqUsTryYRX98PVXrTaIk/CZ+sk/Hn/jB4Gnf0EqIt7wQm3EYCmvLDxlJygJ5eSQMT 7leA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+3mTw6UMxYxJOXb4DMiuFwLT/ctOBjpVLxLq4/J2yoM=; fh=No9wQuh9hvKervvkJGNMvMtOm6xfRZvOwWd+6yQ+04c=; b=rts5KE+RtRcU9nPlHDh01iQd2kyhgl5rR6cm+PE9O4tTq6UjoUO83e8eBSIirg/+k4 308+vsItzGWKKPjlwq9tvFQrfiDQ9Ytza384WEUgQftYZoLXdHOd6DylrQXTlyWkiLur m7QRNpfnX1enpql2VADe0UpP3/eGP1spvMJ/XNv3IdiIZ1pKLvm3CTO1qA+6pyPYV4Nr c6FQuG8+MGd6MtuzizQwJ994R2a483ubeODA57S9/+SB1RRVtTV0bfThScDt5QlZMDHk bAi9P6td712W93ERqJGRC0AGz9Aay+A0/IBJEsaCbfuRlmZh19SStGBs3pAMYskHI7l7 Pg8g==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eM4XIOyE; 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=1793000826; x=1793605626; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-type :x-original-authentication-results:x-original-sender: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=+3mTw6UMxYxJOXb4DMiuFwLT/ctOBjpVLxLq4/J2yoM=; b=cykVaURVIJHKZDHGV6B19MTsUHt5IcBc0vlavAIkWYA8K3dzE+3Oy/lguXbz3vixCh iAtUoWdC4RDaf/qP5ZUyQumy4MyDlJY5IQwyjV6uXdF0oJwNSCIPpy7M+0BI+m8ZhiHD WqrTRC1JijGJEj5ChXELdfGQkv/N9bjgutmjg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793000826; x=1793605626; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :content-type:x-original-authentication-results:x-original-sender :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-gg:x-beenthere:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=+3mTw6UMxYxJOXb4DMiuFwLT/ctOBjpVLxLq4/J2yoM=; b=CrX6BCq9zLfRYYktR2Vb6gRZpolG8/SdNQmAE5j/azjCzroaMdjUBC4j0UiEKeF/cK lcBSJ/q4hAvls+Gs6b/6GU8mgex6mB8JetjjJujWznqdWllGsuqsW003hNaymtCYJ/gL HIdg+g55aMkzF9bXMBDz6OShEvsUU5QNk/v3KdrDrZU9fmgL2+jaAdcK32zG70fFt9zV bcnR6DKK3cMDfhnpu0gIvzIumkoeNnGcykpmui+qSD08W+XYKppDOUnPBk0d976fX6D/ v9Cl2woBWecgF7nZSY0r5GcMg21zg/7l2qcrD364OHH6afy5/MGRqxdmZ9IqvEpLIbld UWlg== X-Forwarded-Encrypted: i=2; AKwUvBydTZD7rKC8N1sqKNxIvIema1lymfCljusdMQq1Eq0H0gIlZX1IbAdZe1DI7ijh4Mulr6HcxKp8KbyJVpr6@patchwork.amarulasolutions.com X-Gm-Message-State: AFq9FYI4YR+UtSwuzOpbjH1WipQjmP6a7ICWU7ScZpRuNjUBfEHOKnSl 4sX+S5+JTu/4fYvagpGNtkLLsz5wj+VKNyP917/kfS0Dw5Ofx4G+48EIEzXQnH4xxzXdxA== X-Received: by 2002:a05:600c:a45:b0:4a1:e11f:b2e1 with SMTP id 5b1f17b1804b1-4a35aca4bbbmr116307525e9.15.1793000826022; Mon, 26 Oct 2026 00:47:06 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com; h="ATskLdcluXz5R/QIQ4QqjbkiTbOimfgzflpIgSv3L1FkPw1epw==" Received: by 2002:a05:600c:1c1b:b0:4a1:dae5:1dd with SMTP id 5b1f17b1804b1-4a211601b62ls33771145e9.2.-pod-prod-06-eu; Mon, 26 Oct 2026 00:47:04 -0700 (PDT) X-Received: by 2002:a05:6000:188b:b0:48d:f6d2:9c8d with SMTP id ffacd0b85a97d-48e3eba1212mr11798852f8f.46.1793000824338; Mon, 26 Oct 2026 00:47:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793000824; cv=none; d=google.com; s=arc-20260327; b=dVUUiB5/iOVw8OXGqmigLus/z2TQl0vnKJQmc6Dx9yVI74IL56mxuh0ErFrcj9MotG IkJ+M/h4sEo434Q5MTOakvQYr3AL50YNJM4040pvfKI8NROD28/KXvD3Ndtymy5KYikl hY7oO/EmSx8vsgN3Cdgp4LD5LTikYUSLQYkNDnuDXHiY0aFK2IvmzbS6uOuIXbDsgWsv MzMYlWuE5radt3796ARVRbczUJBnle0AccjFL7roBVJsLNep3xge++3VNaEws7HOo1D4 rcguc4H+veow3SasyY159j9MiTKfE1b+VoRcNJZaFxeLZqmjDnHfUXRiYAja/RKAsrYi Bmrw== 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=y/fMNupjmUFDA4Fs7jz5eM8c/pdIIe9SGMOk6RgTsFc=; fh=PbD9/XAkGeXOdmhINiq9gVEkmozRqhY0cRjgzaGu/Os=; b=bCTnXuhW7axo4Fu8TtXpWxwq/579DEe3xWyg0htSjEjapfZTSCdwHycvMpa5ez9L1F kqPMLdsNtPqESXKYq0Iv44hVQ+eJcfSvNKTMoHr6ja73yY4l0iVpICn2q2Ed2eHCMEEE rvhNZJJvxwDPtQ//gcntTgMHBeRsdsnIQuvb2sB9VqSy1rxyhAmwYnNLHpNUDJTNG6xO TKzjnsnPs6x315EUzcnQlTkmu25IujeWM6tFDp579udmHshxgXLs76dd0hcAvUwDq4Bf 4/ngSD1wxDi2zot7haYQ6fAnMZeFT2nYBVK630U0c2JfrPiiudC3wLXcElI6/v7qvJb/ kMEQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eM4XIOyE; 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 Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ffacd0b85a97d-48e3ebc91c7sor674834f8f.4.2026.10.26.00.47.04 for (Google Transport Security); Mon, 26 Oct 2026 00:47:04 -0700 (PDT) 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; X-Gm-Gg: AYBFou2Trq7a8hb+jF4eQ5l/zp9OBa9tLovYRTS2f0Caj9MbKVo+njUPfGyqy1j0p4o 6SXG7LKnHw9eC36RPzHsmVdUkopKBzgZYc0kLEAMxtU65JdKzRrZiDZ/VTGqfmBZ5zwaR9+No4z NFqn4SYHEKw57/VeuZPAWbFLFKnUX5RDooTNR4rDzjeAwZKWbmZRPhVXR3TXcmbAZXfmLxbIokP Bu2k1Jux5L3Ra5rPf+vj+R3Qio0/o8CBWXLF+OqJ9YXjEYSsoqFrsFeruEkD12nI8hU66iaH7M8 v4z05UPRlgWddEktdcehJnR+so8+FjJ6CUue9m+sQ+eBlk4eGFVnaUV3S5pXoix9Ne5CiswJNK8 A0aIxBGtUqa5ZzTiRRdLeZlY0CJVjhiJZ+C3N9EPrViyOQmzSj+fCuiK+pwa7suyylbHV/W2Fu7 upqQvPNFnIlN2l1vxcgmQPHlByzRF2/HWqJI2/Mz2n4oP3CyZtPWog3nDkC1HRgZ0h0P58Fi20R 3XND89R0ojJtp4rcSQ0s3m/HWyrSjprW7IjX31NuID9JoA9YF3WzJyYBEby2WdjiIMEurSCuQkD q5Z7ShmJHGpHuSR/BAlzjHuXhTRJ4R8E/7E9r5QEFCFSWsai+zXfXWyZT6TdmTf1XG2Vu2ICGJw xmYRurtxf6S5592JQk228TesGv2/S0DBGcKjEThhl/OD7havMFZHkig== X-Received: by 2002:a05:6000:1185:b0:487:106f:ee31 with SMTP id ffacd0b85a97d-48e3eb8bd5cmr7348794f8f.27.1793000823908; Mon, 26 Oct 2026 00:47:03 -0700 (PDT) Received: from dario-ThinkPad-P14s-Gen-5.homenet.telecomitalia.it (host-79-14-29-58.business.telecomitalia.it. [79.14.29.58]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e412cc164sm13731353f8f.7.2026.10.26.00.47.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Oct 2026 00:47:03 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, michael@amarulasolutions.com, Dario Binacchi , Brian Masney , Jerome Brunet , Stephen Boyd , Tero Kristo , linux-clk@vger.kernel.org, linux-omap@vger.kernel.org Subject: [PATCH v2 3/3] clk: ti: dpll: apply the spread spectrum configuration right away Date: Mon, 26 Oct 2026 08:46:29 +0100 Message-ID: <20261026074654.3997494-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261026074654.3997494-1-dario.binacchi@amarulasolutions.com> References: <20261026074654.3997494-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=eM4XIOyE; 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 Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 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 | 46 ++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c index 634fe0a1f9fd..16da86fbb25d 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; + int ret; + u32 ctrl; if (!dd || !dd->ssc_enable_mask) return -EOPNOTSUPP; @@ -718,9 +723,38 @@ int omap3_noncore_dpll_set_spread_spectrum(struct clk_hw *hw, return -EINVAL; } + if (!memcmp(ss_conf, &dd->ssc_conf, sizeof(*ss_conf))) + 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 */ + ctrl = ti_clk_ll_ops->clk_readl(&dd->control_reg); + 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; } /**