From patchwork Wed Oct 28 07:44:09 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 4899 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 147AB3F34E for ; Wed, 28 Oct 2026 08:44:47 +0100 (CET) Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-48c46582442sf369253f8f.0 for ; Wed, 28 Oct 2026 00:44:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1793173486; cv=pass; d=google.com; s=arc-20260327; b=E7z06XGbILLG6cxMeiQ+RzRSVahR7PvsKJBHoNEvfJnvDgJO42zcF4m/lDihum+3Cd Pum/9trrUdSrLtKhx31viuoVa+tNVrBd79u2CPOtRz/flzl4yRmB4QQFKxEGgpKFrDUe zpCkuM/8+vFmCGE1LGMU65JTdl13LJwG08+cQeodDPOL1tYNmSNBIDEzl6n0zbI27o2K EbBTo0/wZy1434IJVnCOiBLFRNYgMyclmjuqjLYhiMsfHZ4Qz838Y59YweI0NFY8Vuja awdhqvwpQBSYaOU05sd0fVLqGlqgs2mN5uYyXWfF/NAIo3K9OG2VaD2MHNNupnOyKsho bRJA== 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=+2Io9EZrkj211GNnzBEdK/1L7q3D7Gkb2u4Hi5VtP4g=; fh=VjmO9PTTEph2cFNDLupFYPvFc3kZU310t7BONnCCs3g=; b=LD+QSmEimsdULOCTVZjIWprG/sKfrHR7BmMSQVsuODfwu7pHpt1D4u+N2YftPcdy9y 2w57TKmoh+zlDlsV5p2qHtaI97EA4WeCheiSSr/FC/FwrtpCxVf7c8BsP/h/c2PAUL9h LOKkhkqcAAB224fgCeQ0w34L96K0P07HiW53EiNpd7AGW85BkKZkHZ8uQ38jMuKLFxjQ NTojxqsOrCyi/TDCyymDGvEmg8YLPvBi9gQRPfl9LWUg8frG+G4vEGa8wdDNUFLgWaE9 mg7rtVfEKwre4MP2WJJ8uwVeiQI4uZWI7g0sLSt9PyskxMoGKUzfEGIHNoLHHX9q3iMJ r0fw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ryh66lrQ; 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=1793173486; x=1793778286; 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=+2Io9EZrkj211GNnzBEdK/1L7q3D7Gkb2u4Hi5VtP4g=; b=Ux/UuA4XW7zZSniFSdsmtH/Q9QqIIy7+JZr40QzIFfnJUhg+HEnO/2KVubP958PmPc g1WZJI4L63F4FH8HlKCNg4Tjy6An1VBT0Uyit+pWcLtGKepONptf4ROh79I9y2vXfKJ2 lFwIatZ6M+mZBj815ZmdWT19i+SzkCk5+xD9s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1793173486; x=1793778286; 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=+2Io9EZrkj211GNnzBEdK/1L7q3D7Gkb2u4Hi5VtP4g=; b=ldQ9FdIik2M+FBxtt0Yb6HK4/Dd/pL3+NP2NFahT0pe3XfiZd0yuJ8OalrMQMn/5LW WwjPzUujhddxJYlonSH4Z2+PKhxbkToEk+i8oTXL2fLBgV/s6XPaloun1qxm4/0Ttqag 9rKTLUzYBOgLXnjdgz/ER0tI3MQeKf65gSk4SrioaNUmMX7mSW72DtyKpKQSmp3wxInM DU+lHaRCCKYajiPtBNyc1opTAvQ9840tFiFWKAFNiqfNYSz7CIk+uoDJj3lwlUgGkJrV ftmrK+7HdZ3C+Uef+I9jTRJ7c5nPVj0NNy3f4phZnSwLC56NVgcwbaSDqMLDrsowwGfy o4HQ== X-Forwarded-Encrypted: i=2; AKwUvBxIX5c0QchVYW985PYsku3mvuBLC5jnCfw8brmCMpKa9CE2I/GYYE0Xyx/VZgn8Cwc5f1twqEa4KkY1ki5A@patchwork.amarulasolutions.com X-Gm-Message-State: AFq9FYK2/F65/BPDp8+GiCI03v4Eagrz9hn6Fe2++orBOwjpY5y7htwp d0UILV1PFbHaDtCOoWe34qn9/vlgHnpUf57llDGdUZN/+rBN9x7MD1gs/jPS4anL5183Eg== X-Received: by 2002:a05:600c:1f87:b0:4a5:1cf1:b7bd with SMTP id 5b1f17b1804b1-4a966a563ebmr27134455e9.16.1793173486740; Wed, 28 Oct 2026 00:44:46 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com; h="ATskLdeyvmW5DvOGeYo0XmTHOY7tPLOKZ3RAvdmKZLQm6A0Izg==" Received: by 2002:a5d:6b8b:0:b0:48d:db77:d138 with SMTP id ffacd0b85a97d-48e5c9bf658ls440455f8f.0.-pod-prod-08-eu; Wed, 28 Oct 2026 00:44:45 -0700 (PDT) X-Received: by 2002:a5d:64c3:0:b0:48c:7d67:8ee5 with SMTP id ffacd0b85a97d-48e5d5c8faamr3923613f8f.43.1793173485239; Wed, 28 Oct 2026 00:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1793173485; cv=none; d=google.com; s=arc-20260327; b=gP4EeyGanGtEio5I9ehhHhy+pVaNgniEl8ZhcS58UL2jfy3bSmQtIFD+vq1tQpHFws z7lExyG/oSDkYpB1kJK81N6x3Ooir1bRMzbZ62RyA7O/KOMuGlO5ZZb7//Hmtt5FZxXE 3hTVbyAEm+y0UzBdkNIxnAPI5eTOBtc2ECGBcJITp9M35SX6LBeUzX/e2n8ybtOdE0R5 OoGxvEu8l2LAca1Uix+MuZILdt6lHw2KbiI05nFTaGEAElcmmV0KDh8A8BCfbApMMSl6 xN5JyB8KsEI8BG3O8rQyfUb9ArLsjOH0N5xBREx4g2oicff+ND6ggGQrsGwNODFfmZaT FGfg== 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=QgCBPMZCOQV3dhf3hMT8g1VGDheFKuoWsIpy3UHh9yk=; fh=PbD9/XAkGeXOdmhINiq9gVEkmozRqhY0cRjgzaGu/Os=; b=Sbr19bPTCzlX9mMK97YZN4t9R56zkpLsG75MRb2e1FAjI8yhnWLrVRncOvBgNc7sBn J/dbJYaJDyuRCRfUTpMy1rEBkl6QpgDIjjxah9cJXDDjs5+v14ZpLOgGJB8Tq3SBXnwi DJMvfGLoT12PCeRkv+1q9VzBJ7tHjftgkne5qF0Y+geE/iLZq+gB85fdDDwFV+Zpg0oC Vnbh9hAwBG2UTsgtSxpuWa+q5a5+T/7Vl4bM4UVsHtk0BzFornCCdFtMS6WdRXu58LOT bjSZ5oi+F6yJMMNt++t4otPT9sh8YqhFMEo7GEBWJjpJALm+hKrFxVhMt3IiJDhUDUMJ bHCw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ryh66lrQ; 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-48e3eba31dasor1934193f8f.2.2026.10.28.00.44.45 for (Google Transport Security); Wed, 28 Oct 2026 00:44:45 -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: AYBFou2ztYbvxzqFXKoRtAUHDEc02MASSwep8LQlHcyHvHZdKZ3N2QjonRkOCgpvRs0 T5jxjdkL/+DniefszXPQdbH0vafDbjSfmwZQTlSmmMR79W5HBFYKnnyovPUj/MNgnvj+F21Y5BG H/8Jp5/idueBQjBWJeYiwedqttKdE49pISWhyHckZWzpaxS1++4wURtr9CPpi/woo/93IcY//6L ikLIFV6d2gBDYvP65NKwKLyDYI37K38Juh+PulgJY4Cjh7ayArbIrrG9BQcp/l1jw7DfozqNivU EGAMJOEhtJ8j+Is1jY6ncpbDPYnzYJhoLoYb8s3l5fbOO+YHSE//sHCfsrkIg/lrVyJu5EWxPcx NR3GHvwrlntp/goTBrRC1JTi/cseixl2N/0tyvL9EEN4lFnsAG0NpOfU5dLjzo3tcyVjekJZcB2 sT+18M3t11M+y9wOUuhvRtxumV6F2RFF4muK3mLb5tRqwf3r8UX6fLjkuPqCI2hFe/7g/hQYxzj s3gtij8J/qePBtQHXsXO8zBybs5d3BquxAIIYvhcoQCmZYGB87pG48l/Mr6v6FUbIVlijl/VRsJ PfXasMQ17R8HhM0UILmWgYsUK9n/xPLIBgd5TiwZmrzjJGpwjjKvDtv8Mm2WByMW5SEuAHgzFEY SEMWmq578A6eU152P3rz2YlzDbwImJH+re8dpd0pkYs4NpnH+I9BJh2VqVc0l4HoibUSZXVY9EC QvlP6RpzGC5M4G0HOAHsYAzIJPNQ== X-Received: by 2002:a05:6000:29d7:b0:48d:f6d2:9c88 with SMTP id ffacd0b85a97d-48e5d5cb889mr2331992f8f.47.1793173484835; Wed, 28 Oct 2026 00:44:44 -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-48e412cc164sm25324882f8f.7.2026.10.28.00.44.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Oct 2026 00:44:44 -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 v3 3/3] clk: ti: dpll: apply the spread spectrum configuration right away Date: Wed, 28 Oct 2026 08:44:09 +0100 Message-ID: <20261028074436.1958132-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261028074436.1958132-1-dario.binacchi@amarulasolutions.com> References: <20261028074436.1958132-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=ryh66lrQ; 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 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 | 49 ++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/drivers/clk/ti/dpll3xxx.c b/drivers/clk/ti/dpll3xxx.c index 634fe0a1f9fd..d32d81a27bfe 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,41 @@ int omap3_noncore_dpll_set_spread_spectrum(struct clk_hw *hw, return -EINVAL; } + ctrl = ti_clk_ll_ops->clk_readl(&dd->control_reg); + + /* Already applied */ + if (!memcmp(ss_conf, &dd->ssc_conf, sizeof(*ss_conf)) && + !!(ctrl & dd->ssc_enable_mask) == (ss_conf->method != CLK_SPREAD_NO)) + 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; } /**