From patchwork Sun Jan 5 18:14:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13926732 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D5F4E77197 for ; Sun, 5 Jan 2025 18:18:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=+zwadKSgcT3YHRBr470NAxtLB4LzWS9m4NLNCF1dK9k=; b=gtjU+cbcSEVptT+Ibp3HIuX7IW xsqju1VHdxJuurSEvqqE2eEnn3eOmzG6NPpESpZ/18FwUIT4FVBms6uYJSW0sGzYVls2pS5Tl0W9R FoBMQ0O8kwhTIqnCu5KSy4QaJYQ1mg5y1Vf/H7Kj+8C78pUqMAjGTbnDkmygLDiVVYqwCAr+Qwp1P s24a7PgHHX1RitUxPddSRNppjmHl9MgAyoviB/TP1Bzg9VFQoEyNmzCxRYy1zwELywr7W2phsLF25 qSAQ0rajPF/kYQQDoMAqfsFu98z94wsBvUNT2T7vaNVzDDFJrHs6EqvB1eIhQXJ31csMeiR94bZWA GaYnhBFA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUVCI-0000000HFIV-39p6; Sun, 05 Jan 2025 18:17:58 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUV9z-0000000HEvY-0B9F for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 18:15:36 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-aa679ad4265so2692500866b.0 for ; Sun, 05 Jan 2025 10:15:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1736100933; x=1736705733; darn=lists.infradead.org; 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; bh=+zwadKSgcT3YHRBr470NAxtLB4LzWS9m4NLNCF1dK9k=; b=OldpK3gULuQ829IGZ9NXGEv24e2SaFDsrO1CnE4ci0WmYYVx/dcswIEHrEDbixPTHd B5tKiTOke5uMueNLeg19NmungkP1jAykYcRNRWASr9v44RqIQXALMhlhOxIBOHlkzLb0 QYDMRRRZ1AzmwCLLb36WnvrdzSm5P7OCGo7Jo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736100933; x=1736705733; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+zwadKSgcT3YHRBr470NAxtLB4LzWS9m4NLNCF1dK9k=; b=QRsZZsTjvrq7W9uC8l9pmGDNdti6+qounbBWXoME7nW9F1nLJjIofJeXd6TpVVRNYY I3MqLjbRupnVarhH1+/Z8Mem7l8sDM4WSt9oUjwEHNvadYM1Zj9UHmKwfYvyQy9gwQDy 195uj51m9U5uHJAVybYnxTXFKF8l/vJtJrywSxPLJjLE6yHq+NmjWCM0E9Bbcfcvuhod AtTKGK5gAWOurhjrkNQesdZHPaP/iAjXPxXP7lPsbmYiW9RFeXu7R2TdiwnRYgbDmqJj 2wtdONsrSibWAiE8laSIJRiIMZt+lnal/Draipe1N7En1y0T/uDDeIlmTz5jZ+EHVWk7 hBxQ== X-Forwarded-Encrypted: i=1; AJvYcCUajKDwNomSjMTh0mngHcOOFyOrxJAZr6ZVMQVfB9qSncFtMzMr0UR7dSOCjGTTI/ndq4LFAHvp6boMTuZzdTdi@lists.infradead.org X-Gm-Message-State: AOJu0Yy8/TG3+dFzvHrrRT3o7nh/ON7+MRmh317SPLbpIYsBQyhnLAev 7GjIl/H7uJbsJfKhL8q9nZ8AQSIR+oieHGeIkV4c60JqThGvGHJwzJ+MRzApeUI= X-Gm-Gg: ASbGncv5536tkhzGBIwRWw6sydv2T7kCM6R+mgx/zpYgAJEVluCLqUs5lb2F/5E0a49 WQ3OpR0DyhXvlTQc77OupVWrMNnxFGeAr11j7SHd3goclk+ikoo76kVwng1wIW/pnGeugUmJiG/ 0lm+Jp4bZiwqoHtxZcZsKIvSqaD5m+AncqAjFyKwV7ZKLbOVd4uujs11In2A6I+cZ7+zuHAvjU7 cwVmweocoNKziG8/1+0XssBZFNFEe55WvmY8SKIHOXvYvn2nXXAEiKBnckqxu1AB0nQRlsg3X4B xA6WVE8K5qwgZyum1gYNiaMnMWssCTZWlFD1IJiFsyv/DP5QJu06R7e55hm0WIEFzLNP7Tgn8YP HuJPU+1CsxAtUgBZAEg== X-Google-Smtp-Source: AGHT+IHEmlq6VZxXOC/j+3n171+PZx7zCTSoolypdqxYYVg9wTM278dYwsdwGbdufQTiEC+59arKyw== X-Received: by 2002:a17:907:86aa:b0:aae:f029:c2ec with SMTP id a640c23a62f3a-aaef029c69fmr3596149966b.12.1736100933172; Sun, 05 Jan 2025 10:15:33 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-41-6-15.retail.telecomitalia.it. [79.41.6.15]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e82f178sm2138185066b.38.2025.01.05.10.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 10:15:32 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Alexandre Torgue , Conor Dooley , Krzysztof Kozlowski , Maxime Coquelin , Michael Turquette , Rob Herring , Stephen Boyd , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 1/6] dt-bindings: clock: convert stm32 rcc bindings to json-schema Date: Sun, 5 Jan 2025 19:14:13 +0100 Message-ID: <20250105181525.1370822-2-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> References: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250105_101535_086940_E7B8FE56 X-CRM114-Status: GOOD ( 22.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The patch not only performs the conversion according to the JSON-schema but also adds the missing parts: - st,syscfg phandle - st,stm32h743-rcc compatible that were not documented but are still used by the drivers and must therefore be included to ensure the patch submission tests do not fail. Signed-off-by: Dario Binacchi --- .../bindings/clock/st,stm32-rcc.txt | 138 ----------------- .../bindings/clock/st,stm32-rcc.yaml | 143 ++++++++++++++++++ 2 files changed, 143 insertions(+), 138 deletions(-) delete mode 100644 Documentation/devicetree/bindings/clock/st,stm32-rcc.txt create mode 100644 Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml diff --git a/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt b/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt deleted file mode 100644 index cfa04b614d8a..000000000000 --- a/Documentation/devicetree/bindings/clock/st,stm32-rcc.txt +++ /dev/null @@ -1,138 +0,0 @@ -STMicroelectronics STM32 Reset and Clock Controller -=================================================== - -The RCC IP is both a reset and a clock controller. - -Please refer to clock-bindings.txt for common clock controller binding usage. -Please also refer to reset.txt for common reset controller binding usage. - -Required properties: -- compatible: Should be: - "st,stm32f42xx-rcc" - "st,stm32f469-rcc" - "st,stm32f746-rcc" - "st,stm32f769-rcc" - -- reg: should be register base and length as documented in the - datasheet -- #reset-cells: 1, see below -- #clock-cells: 2, device nodes should specify the clock in their "clocks" - property, containing a phandle to the clock device node, an index selecting - between gated clocks and other clocks and an index specifying the clock to - use. -- clocks: External oscillator clock phandle - - high speed external clock signal (HSE) - - external I2S clock (I2S_CKIN) - -Example: - - rcc: rcc@40023800 { - #reset-cells = <1>; - #clock-cells = <2> - compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; - reg = <0x40023800 0x400>; - clocks = <&clk_hse>, <&clk_i2s_ckin>; - }; - -Specifying gated clocks -======================= - -The primary index must be set to 0. - -The secondary index is the bit number within the RCC register bank, starting -from the first RCC clock enable register (RCC_AHB1ENR, address offset 0x30). - -It is calculated as: index = register_offset / 4 * 32 + bit_offset. -Where bit_offset is the bit offset within the register (LSB is 0, MSB is 31). - -To simplify the usage and to share bit definition with the reset and clock -drivers of the RCC IP, macros are available to generate the index in -human-readble format. - -For STM32F4 series, the macro are available here: - - include/dt-bindings/mfd/stm32f4-rcc.h - -Example: - - /* Gated clock, AHB1 bit 0 (GPIOA) */ - ... { - clocks = <&rcc 0 STM32F4_AHB1_CLOCK(GPIOA)> - }; - - /* Gated clock, AHB2 bit 4 (CRYP) */ - ... { - clocks = <&rcc 0 STM32F4_AHB2_CLOCK(CRYP)> - }; - -Specifying other clocks -======================= - -The primary index must be set to 1. - -The secondary index is bound with the following magic numbers: - - 0 SYSTICK - 1 FCLK - 2 CLK_LSI (low-power clock source) - 3 CLK_LSE (generated from a 32.768 kHz low-speed external - crystal or ceramic resonator) - 4 CLK_HSE_RTC (HSE division factor for RTC clock) - 5 CLK_RTC (real-time clock) - 6 PLL_VCO_I2S (vco frequency of I2S pll) - 7 PLL_VCO_SAI (vco frequency of SAI pll) - 8 CLK_LCD (LCD-TFT) - 9 CLK_I2S (I2S clocks) - 10 CLK_SAI1 (audio clocks) - 11 CLK_SAI2 - 12 CLK_I2SQ_PDIV (post divisor of pll i2s q divisor) - 13 CLK_SAIQ_PDIV (post divisor of pll sai q divisor) - - 14 CLK_HSI (Internal ocscillator clock) - 15 CLK_SYSCLK (System Clock) - 16 CLK_HDMI_CEC (HDMI-CEC clock) - 17 CLK_SPDIF (SPDIF-Rx clock) - 18 CLK_USART1 (U(s)arts clocks) - 19 CLK_USART2 - 20 CLK_USART3 - 21 CLK_UART4 - 22 CLK_UART5 - 23 CLK_USART6 - 24 CLK_UART7 - 25 CLK_UART8 - 26 CLK_I2C1 (I2S clocks) - 27 CLK_I2C2 - 28 CLK_I2C3 - 29 CLK_I2C4 - 30 CLK_LPTIMER (LPTimer1 clock) - 31 CLK_PLL_SRC - 32 CLK_DFSDM1 - 33 CLK_ADFSDM1 - 34 CLK_F769_DSI -) - -Example: - - /* Misc clock, FCLK */ - ... { - clocks = <&rcc 1 STM32F4_APB1_CLOCK(TIM2)> - }; - - -Specifying softreset control of devices -======================================= - -Device nodes should specify the reset channel required in their "resets" -property, containing a phandle to the reset device node and an index specifying -which channel to use. -The index is the bit number within the RCC registers bank, starting from RCC -base address. -It is calculated as: index = register_offset / 4 * 32 + bit_offset. -Where bit_offset is the bit offset within the register. -For example, for CRC reset: - crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140 - -example: - - timer2 { - resets = <&rcc STM32F4_APB1_RESET(TIM2)>; - }; diff --git a/Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml b/Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml new file mode 100644 index 000000000000..ae9e5b26d876 --- /dev/null +++ b/Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml @@ -0,0 +1,143 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/st,stm32-rcc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: STMicroelectronics STM32 Reset Clock Controller + +maintainers: + - Dario Binacchi + +description: | + The RCC IP is both a reset and a clock controller. + + This binding uses common clock and reset bindings + Documentation/devicetree/bindings/clock/clock-bindings.txt + Documentation/devicetree/bindings/reset/reset.txt + + Specifying softreset control of devices + ======================================= + + Device nodes should specify the reset channel required in their "resets" + property, containing a phandle to the reset device node and an index specifying + which channel to use. + The index is the bit number within the RCC registers bank, starting from RCC + base address. + It is calculated as: index = register_offset / 4 * 32 + bit_offset. + Where bit_offset is the bit offset within the register. + + For example, for CRC reset: + crc = AHB1RSTR_offset / 4 * 32 + CRCRST_bit_offset = 0x10 / 4 * 32 + 12 = 140 + + The list of valid indices is available in: + - include/dt-bindings/mfd/stm32f4-rcc.h for STM32F4 series + - include/dt-bindings/mfd/stm32f7-rcc.h for STM32F7 series + - include/dt-bindings/mfd/stm32h7-rcc.h for STM32H7 series + +properties: + compatible: + oneOf: + - items: + - const: st,stm32f42xx-rcc + - const: st,stm32-rcc + - items: + - enum: + - st,stm32f469-rcc + - const: st,stm32f42xx-rcc + - const: st,stm32-rcc + - items: + - const: st,stm32f746-rcc + - const: st,stm32-rcc + - items: + - enum: + - st,stm32f769-rcc + - const: st,stm32f746-rcc + - const: st,stm32-rcc + - items: + - const: st,stm32h743-rcc + - const: st,stm32-rcc + + reg: + maxItems: 1 + + '#reset-cells': + const: 1 + + '#clock-cells': + enum: [1, 2] + + clocks: + minItems: 2 + maxItems: 3 + + st,syscfg: + $ref: /schemas/types.yaml#/definitions/phandle + description: + Phandle to system configuration controller. It can be used to control the + power domain circuitry. + +required: + - compatible + - reg + - '#reset-cells' + - '#clock-cells' + - clocks + - st,syscfg + +allOf: + - if: + properties: + compatible: + contains: + const: st,stm32h743-rcc + then: + properties: + '#clock-cells': + const: 1 + description: | + The clock index for the specified type. + else: + properties: + '#clock-cells': + const: 2 + description: | + - The first cell is the clock type, possible values are 0 for + gated clocks and 1 otherwise. + - The second cell is the clock index for the specified type. + +additionalProperties: false + +examples: + # Reset and Clock Control Module node: + - | + rcc@40023800 { + #reset-cells = <1>; + #clock-cells = <2>; + compatible = "st,stm32f42xx-rcc", "st,stm32-rcc"; + reg = <0x40023800 0x400>; + clocks = <&clk_hse>, <&clk_i2s_ckin>; + st,syscfg = <&pwrcfg>; + }; + + - | + rcc@40023800 { + #reset-cells = <1>; + #clock-cells = <2>; + compatible = "st,stm32f746-rcc", "st,stm32-rcc"; + reg = <0x40023800 0x400>; + clocks = <&clk_hse>, <&clk_i2s_ckin>; + st,syscfg = <&pwrcfg>; + }; + + - | + rcc@58024400 { + compatible = "st,stm32h743-rcc", "st,stm32-rcc"; + reg = <0x58024400 0x400>; + #clock-cells = <1>; + #reset-cells = <1>; + clocks = <&clk_hse>, <&clk_lse>, <&clk_i2s>; + st,syscfg = <&pwrcfg>; + }; + +... From patchwork Sun Jan 5 18:14:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13926739 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D42A3E77197 for ; Sun, 5 Jan 2025 18:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UOAsdgxDQEvC5uDcWK+yR25E57Nu26K/3jc3ZbJ9Cg0=; b=b8ip72T7LN8vSAt9aikn01uk+H E/eTbp4T/hdBCIFtj1mq495ccxFlXpcnkizfMJdNqmQzlype2Ul0YzmFQ2wIjAuOaL3PN6z29ce1i Y7gSDBArckfOmqeiDiAsdx0WPtqwfaW5EwtcEA0f5Vrzz+S0b33jW1AK5GY/uNITTH8YLCPBdEGsw O0jh2LVe7BO/vdRlSeWS6XaMDrNUswZJynfgZZRFAACMrLjBTDWNR3euJtCdWjYuZ/txnQPJxeEjH EVIx4J/sHxSEYRjXarF9HoZ6laGQAehPOs+sF7Lbkep5Ik0q00KTOiHfSEDSW4JYwHoU28RXf3ZTC hBjVcDLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUVDR-0000000HFNy-2OoO; Sun, 05 Jan 2025 18:19:09 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUV9z-0000000HEvr-3x4U for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 18:15:37 +0000 Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-aa679ad4265so2692503566b.0 for ; Sun, 05 Jan 2025 10:15:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1736100935; x=1736705735; darn=lists.infradead.org; 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; bh=UOAsdgxDQEvC5uDcWK+yR25E57Nu26K/3jc3ZbJ9Cg0=; b=DrwsrgFHmUjC6AbNA+487CzWOhFc9joDJJndAb9UPix8gSnJE4XXt3xhwMywUbIrhS uZnAU4nVyzYDU7wLCpFvgZjIlgzVjkK41e/HYBZi/bnU5/ri2BzBd4AJBvftEUZL1asz 4E9nST755B8ZVfo/qVKmzsus6DkGyKOO7SoYg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736100935; x=1736705735; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UOAsdgxDQEvC5uDcWK+yR25E57Nu26K/3jc3ZbJ9Cg0=; b=NbmQqpw8G5cRjsDcMfx3W1ApeJz/YvFYy3nvSyfsmMvwbwWHpeyNd2NZn/yGAZv3U9 FOmO0u8JmHltOMKDIo2bVNGbe+R38s6b+p5mlX5lel53N4dUv2j1OmRA8bAUE4+dK7X+ FMJtUw60QsWrqY/3XShVgfgEs9YDw01/CcxDGXF05efaOqAgESJJDP+mEXrZ89RzCOqn 5UZ3L9w/S88ynedr9lzNeAvjn3XmY/cr5s2wFVzGdwOf9vGbm8rKuVGHKRDrvqe5iCa7 +7v9eiVfOTg6J4XPNfIDHsYlsni5Acj2qmClUID5Cli9GPBbSmFKbv8iJQERkiePJTkv fQqw== X-Forwarded-Encrypted: i=1; AJvYcCUkTwa9vn12huDeM+L5ZVOEh7X500d9doFnTexn/aqFY7yhRC0pXJDJD+P1qElBZrT70aLN4E1PMeicWvtWbTjk@lists.infradead.org X-Gm-Message-State: AOJu0YwcKHs/0ehx/fPhxhcoMD1Agu6cmaKhhf5kx0yt7U18tVz8C4fh UyCfYoG9bBsnJ6e3tEx2td5zA50rFMq43iMqze+MI2LsuIY8F3YjLOIs5yd+WcM= X-Gm-Gg: ASbGncumqU+PHsVWuv7RvUz/KFYQxZ7DECZ16wa+nGzQQFYOnm38FnVZ6rq+XxvSxAI QdAmStC1U6dl6Q71kIfxsGCmzQj8TJw7D9QRv6I3Hf6MNMzgnS+QCyN+9dy6n3pZYB+HeoulIgr S2X6hnrAEErhG+wcze4XoEE/RDzN1xSdg0MzljpI281zhlYT3n/ECf0jmjavS8pUsfHRdeixF94 pAWlnfqXzCG8Zz8qFaJO//6JHxk+FCvlhoY75lfqSjwB5VrYXaDyobCu2/FIkVu2FYPZuWvrcpW TxcBCOHQk+JblmPfsDRLgJec6eME5gIzyFLvEwC7kYRCQPZkHtKjmEz8NUz0DVMB31d4Z1lWcpW hHCOqw+2huHIxpMltTg== X-Google-Smtp-Source: AGHT+IGmgVgc6B2TGyiYFDwVaPwnmHLCNND0P6xPziVSDtm7hEJn68GNvTjYVOhO12g7nBOja7hhAw== X-Received: by 2002:a17:906:dc8f:b0:aab:a1a8:92be with SMTP id a640c23a62f3a-aac080feebdmr5370408766b.5.1736100934660; Sun, 05 Jan 2025 10:15:34 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-41-6-15.retail.telecomitalia.it. [79.41.6.15]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e82f178sm2138185066b.38.2025.01.05.10.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 10:15:34 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Alexandre Torgue , Conor Dooley , Krzysztof Kozlowski , Maxime Coquelin , Philipp Zabel , Rob Herring , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 2/6] dt-bindings: reset: st,stm32-rcc: update reference due to rename Date: Sun, 5 Jan 2025 19:14:14 +0100 Message-ID: <20250105181525.1370822-3-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> References: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250105_101536_000448_A554FDFE X-CRM114-Status: GOOD ( 11.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With the conversion of Documentation/devicetree/bindings/clock/st,stm32-rcc.txt to JSON schema, the reference to st,stm32-rcc.txt is now broken. Therefore, let's fix it. Signed-off-by: Dario Binacchi --- Documentation/devicetree/bindings/reset/st,stm32-rcc.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt index 01db34375192..384035e8e60b 100644 --- a/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt +++ b/Documentation/devicetree/bindings/reset/st,stm32-rcc.txt @@ -3,4 +3,4 @@ STMicroelectronics STM32 Peripheral Reset Controller The RCC IP is both a reset and a clock controller. -Please see Documentation/devicetree/bindings/clock/st,stm32-rcc.txt +Please see Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml From patchwork Sun Jan 5 18:14:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13926740 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 973F2E77197 for ; Sun, 5 Jan 2025 18:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ngcCwmTO+RIG/baergO/2VLeRq3P88V5Zllx9oRRwrs=; b=QcRBfPCC8FGkdz9N1Rdguc6ywH SacsVT7VhEN0hofp0jXSVLgNCmSOCCZZLBxbfmNOos0XEql14JWfXL6EOKtifbV6Gz6zW/k5ZORmz JJorRfoG92YzG5FquBR/S7gBe6Wp17CSXELbYDOCOgbaQtIB5SMBZoO2p07f2OM4uAjlV/Z1T0c+I DEiyXQMXRJEZSCXW0DhG/m2wQ4JZAwGM26HAjg3aHe+Qfyem3N7lUcsZCVAyzrHB2QmI7AgSzYGK4 o621W06fNYrwTEOgsPMrHvAaiZa6d+FvnqB5L0tRuzDYhX67HDwTl0+l2/yj5x4/YnoN8tTE/nfIk 4G0+92Bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUVEa-0000000HFVQ-3jx9; Sun, 05 Jan 2025 18:20:20 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUVA3-0000000HEwK-0o8Q for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 18:15:40 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5d84179ef26so21303550a12.3 for ; Sun, 05 Jan 2025 10:15:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1736100937; x=1736705737; darn=lists.infradead.org; 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; bh=ngcCwmTO+RIG/baergO/2VLeRq3P88V5Zllx9oRRwrs=; b=X/IG+FGITeCXqLo/U4pAZxzM/5BVVKd3odL72pM0UODPyke8zDecTQpV1wGEfBffxR Xihz8G5k5U8ZTzMAf8yOtHNd8snjhJxHdhvqCLElywkn78M6IDSocihHJj3DjjkSJMeK fbQgxibvfDKqkXT8CLhKloUxxCIRBHed3Xudk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736100937; x=1736705737; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ngcCwmTO+RIG/baergO/2VLeRq3P88V5Zllx9oRRwrs=; b=UGyrqcS7cjKdkcdHGHnERHjIwfbdoCqecYGBQmqS3huJPlp9biENJ/6D5BhMoU3Fok pYWk0+Nv2nyhKn7eUdj7PnT3xy7H+JRaiFO+YPiSecvdY7h2J2/rrnJtZx9QUpYYx431 oiO8X2m+HxQZdH7vX+trD0JiXTmT1XnnwISj3wy6sVxMHoaQPTRJbYHEcGgnZDh8uGf9 fUIAjAx4ucbrBFANKjCFo0VrZrvcrqTb1DLXIFS91G6qXAeHxl/kl4mlxuJ45uFVPJ9I Qm6VZnecfE/VHXkdFeCREPh/bv1GzJVWnRLbTZd4g0IJrsJv6+a8df2ENb33PXIBRFzF OMGg== X-Forwarded-Encrypted: i=1; AJvYcCX/lTbpRgYMhNgpgBkJIUDxvz95FxzV4kklZ4Xjqq2nmx5lKbab6Gf/065C71DBOmQBN/8KMKnqtT8Kkfexgt/k@lists.infradead.org X-Gm-Message-State: AOJu0Yw4SO0Q4JAmOv61LNavd4+g0x/0vg/JckubkjZTsum6ruG0NqBB 1Kd9Vn3/T01jKCI2YmnnL/mLlzz1/uEQsCmA0Ik7yNYnyQrMDYIk9ZUCm0vqtN4= X-Gm-Gg: ASbGncvHmmWZeBm8Ga63AsvKDaMYC5T7m9TfeZPOXBfVhfy/3XzzxoG82JUEV6/zvRu yx7M5CcnI/b7S7hEmUW5CHP6+JQQpy97kY1qyPuLm6/SwkssPgnpiZmlXqstLLQ2eXTqeKCAzh3 4bcrmwbw8lQs78DzYojpKjFY4Kk3yHbQ/Y6cc1NfpTusI83uzkA+CQYI43dyU6Gnw97YpMmIJ3M YG2q3rUeiRKOsgz5znzS3AKGoR3L6bjci3x5HC5sUdeLljWhqB4qVp7hqUZb3sHVURm3WGnrwdy DhY+Mz8s1xjJUedSwiE45GY2DdgmZOuGDORuA7uFl4vyPMU4jPslq/ngAJRHqM9htcpF+2mRACl lYXPtqN38+pPlRNebhQ== X-Google-Smtp-Source: AGHT+IHxEDK9nG2Mi+Pm0wOh++nf130PTCB6/hhMGClugIlI0HI6FjgJGvhFReNL/vJEU6H89u69cA== X-Received: by 2002:a05:6402:4305:b0:5d0:e014:dee2 with SMTP id 4fb4d7f45d1cf-5d81de160f9mr56356151a12.27.1736100937450; Sun, 05 Jan 2025 10:15:37 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-41-6-15.retail.telecomitalia.it. [79.41.6.15]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e82f178sm2138185066b.38.2025.01.05.10.15.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 10:15:37 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Alexandre Torgue , Conor Dooley , Krzysztof Kozlowski , Maxime Coquelin , Michael Turquette , Rob Herring , Stephen Boyd , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 3/6] dt-bindings: clock: stm32fx: update reference due to rename Date: Sun, 5 Jan 2025 19:14:15 +0100 Message-ID: <20250105181525.1370822-4-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> References: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250105_101539_240507_A8600D17 X-CRM114-Status: GOOD ( 11.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org With the conversion of Documentation/devicetree/bindings/clock/st,stm32-rcc.txt to JSON schema, the reference to st,stm32-rcc.txt is now broken. Therefore, let's fix it. Signed-off-by: Dario Binacchi --- include/dt-bindings/clock/stm32fx-clock.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dt-bindings/clock/stm32fx-clock.h b/include/dt-bindings/clock/stm32fx-clock.h index e5dad050d518..b6ff9c68cb3f 100644 --- a/include/dt-bindings/clock/stm32fx-clock.h +++ b/include/dt-bindings/clock/stm32fx-clock.h @@ -10,7 +10,7 @@ * List of clocks which are not derived from system clock (SYSCLOCK) * * The index of these clocks is the secondary index of DT bindings - * (see Documentation/devicetree/bindings/clock/st,stm32-rcc.txt) + * (see Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml) * * e.g: ; From patchwork Sun Jan 5 18:14:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13926741 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8974BE77197 for ; Sun, 5 Jan 2025 18:21:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=DBSWyldngVnQclvBLd3GqHALlVJ1Kxh3yvgFvrg0xjA=; b=H9GpmeXzWM3c61DOOEIUeu3yb3 ArMFZMncwnohH5XoKmzftJ9PBOUJtkY/MtF4FlWq9LVhbbDfkb9he04YStSeo2Ky+aMV+w6l7oHLG NNIpzyOBcsqzBbRfjxWdpUczd96JLmacO7qwAik+zkE1OdayvjTsIjIldd6GyhmFrYhdR9RXJMf5U /EqYY/fZRWKqTHmRn+vMdNnxQlkyqhXkOjowGWehgomx3OcZcWof1uuIMGdsTgXBhuQn9/AiSfoNX ArdWw4WrVZ5ysLPdD54we8TV6k0Z2X0h/Zb6pwebFu4lOpvNG0dQoLIiyYCU8NwjU2/T07zzok8mM +rs50jaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUVFk-0000000HFcV-2Ytx; Sun, 05 Jan 2025 18:21:32 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUVA4-0000000HEwf-2YAX for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 18:15:41 +0000 Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-aaeecbb7309so1615208466b.0 for ; Sun, 05 Jan 2025 10:15:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1736100939; x=1736705739; darn=lists.infradead.org; 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; bh=DBSWyldngVnQclvBLd3GqHALlVJ1Kxh3yvgFvrg0xjA=; b=mxZGyrtcWKuaihUl2wom5gpp+t2Ts3d4fAQfbOVBOX9akl/9eoMXyZrVQkGpIvFBVZ k2SrzuTnMk4rca0p6Uu1YNfv2MMmrv7/DykShFuWasIv0UGSNREFRPzk/X6W2rVvl8NT 0vgnCs0+S5I0OAdR6YpKMDDEejBW8W/1o8tSQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736100939; x=1736705739; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DBSWyldngVnQclvBLd3GqHALlVJ1Kxh3yvgFvrg0xjA=; b=dg0cp9yGs8w0mV36jM2LE8ai/BNXWoH8rKezWDtE0UoaSD2oJukMNJ+mQfLNN9EaVZ JBeC5j7/z9/BkAJ3YLV7it70Mexs9GuAQclTSb2XXL1aesgZqfmx9o+Q6x8mmAQrrABt 1A1MTX6SEXE0pg8sGFTmfdGMtL07ceYoIt+zNF76SDjmNW2AkRscBDurd+iFKUZRWV6N QHvydIIGCQZzhRM/5jcU5UZzKn3wMT016/eL31wt2qHL45BwLtNSVazHE2zoDABKGvIY sofFTFvucIBHnSarwxuARLsCHI5pGT7B3FOIkTOFcHT2uwcpXTzzj/65lY8q8YROmBYC Gnvw== X-Forwarded-Encrypted: i=1; AJvYcCVq9MmyqN1m6LChzgmDtKqi8KMNUeYqisJ5TpWcJgTvqn22KDGiamI0uQ9zJu9PBlPfIUsBOjlTPmyAlEPW1n5S@lists.infradead.org X-Gm-Message-State: AOJu0Yxlzx8ieosLBgII8duPvn9V+5tNy88Ue6NpagAPxhCOdo/bUT0N MMugNeBEPca4J4M+TRGKiBgWWIkvAQGuDxrHAL2X5HUd0THIZSrtCkA7ABxnR10= X-Gm-Gg: ASbGncsFg+/f90mzLmTdSYWmgjUDEQcN/Dl+zOOG3LnGR6wdID36Y0lLD55Svp3tgZi 3NkxqWRybFosHJTd8/xKnH/HzW+t04CeC0dLEh7hafE+9QexV0gPYMOiWHBBCMYUkwnmAOafEB2 /9SJoVOlmYeFCZwu6kMCiJ9ugKAKfmVR9GZVJdYpHknlWnHx/WJXO17aHa71ZmqIRIlycpsX8zn oGwvgwYBQjPcA2PGw2FPbB6spiDc2OqiCefxNV+FXPkbfFOhLyju/CFqI8j7iNAubdQ5mICntNY 8tm8KYOCr5wTxt6KU/I4yV+9D3fpT5Bo3Mo56JnF1PbPDrFuJqEMz4MQEeoRxtcaa12KQy5abFL aV/sW3cHfEeRUtHzP+g== X-Google-Smtp-Source: AGHT+IEouP5DBWHZTHTQqFEZUf+3uEYRS8Zu6JvRBqEkbBu3GJtaa/Q5Qj6PinpQXdyRMCSrqc9f7w== X-Received: by 2002:a17:907:3e90:b0:aa6:abb2:be12 with SMTP id a640c23a62f3a-aac3354ff4dmr3925314866b.37.1736100938804; Sun, 05 Jan 2025 10:15:38 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-41-6-15.retail.telecomitalia.it. [79.41.6.15]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e82f178sm2138185066b.38.2025.01.05.10.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 10:15:38 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Alexandre Torgue , Conor Dooley , Krzysztof Kozlowski , Maxime Coquelin , Michael Turquette , Rob Herring , Stephen Boyd , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 4/6] dt-bindings: clock: st,stm32-rcc: support spread spectrum clocking Date: Sun, 5 Jan 2025 19:14:16 +0100 Message-ID: <20250105181525.1370822-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> References: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250105_101540_643943_C5670158 X-CRM114-Status: GOOD ( 10.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The addition of DT bindings for enabling and tuning spread spectrum clocking generation is available only for the main PLL. Signed-off-by: Dario Binacchi --- .../bindings/clock/st,stm32-rcc.yaml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml b/Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml index ae9e5b26d876..c345d3ff3fc4 100644 --- a/Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml +++ b/Documentation/devicetree/bindings/clock/st,stm32-rcc.yaml @@ -77,6 +77,26 @@ properties: Phandle to system configuration controller. It can be used to control the power domain circuitry. + st,ssc-modfreq-hz: + description: + The modulation frequency for main PLL (in Hz) + + st,ssc-moddepth-permyriad: + $ref: /schemas/types.yaml#/definitions/uint32 + description: + The modulation rate for main PLL (in permyriad, i.e. 0.01%) + minimum: 25 + maximum: 200 + + st,ssc-modmethod: + $ref: /schemas/types.yaml#/definitions/non-unique-string-array + description: + The modulation techniques for main PLL. + items: + enum: + - center-spread + - down-spread + required: - compatible - reg @@ -97,6 +117,10 @@ allOf: const: 1 description: | The clock index for the specified type. + st,ssc-modfreq-hz: false + st,ssc-moddepth-permyriad: false + st,ssc-modmethod: false + else: properties: '#clock-cells': @@ -118,6 +142,9 @@ examples: reg = <0x40023800 0x400>; clocks = <&clk_hse>, <&clk_i2s_ckin>; st,syscfg = <&pwrcfg>; + st,ssc-modfreq-hz = <10000>; + st,ssc-moddepth-permyriad = <200>; + st,ssc-modmethod = "center-spread"; }; - | From patchwork Sun Jan 5 18:14:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13926742 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 60D89E77197 for ; Sun, 5 Jan 2025 18:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=nCWum8u2aSE0H9NGugk1g+nl+FSObYpFAdsp0A4AhFk=; b=QzpDS8GVueXxFWIaflL0qttyU0 6AlDouKOeMc+gCaYeSVkRh7pUd8CweWNMCUcRZn1NP15KkFJsDn5Pj2IgjlaYTqj4cxJIlNzY3uxt zLqN+AiEXBKztNC6AIGsMEaq3ncO1BjhuJqyKW2J4CG4PNYUi9Vks5CI3ZSpHjwkaiMKnKzTxWYLP FwB0rCCMW6BtzSf/C7pSL0034HedfLLPXC5+Jie1AsbCigRht7mAzMPFtb9uCF4J2CkWWUUN233Xb JGx2brW+RtZ3zXiKzo4OQ/ad/5ewh9OIvbmReucpc8HzrWS902zT5aKIvuLFAJ+XNvsyQ2SPqfGTf /mmMRzTg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUVGt-0000000HFjN-13pO; Sun, 05 Jan 2025 18:22:43 +0000 Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUVA7-0000000HExB-0mNW for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 18:15:44 +0000 Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5d3d479b1e6so19561335a12.2 for ; Sun, 05 Jan 2025 10:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1736100941; x=1736705741; darn=lists.infradead.org; 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; bh=nCWum8u2aSE0H9NGugk1g+nl+FSObYpFAdsp0A4AhFk=; b=XXjKzpUgz9Sv9bFvK2CR/nLUyBaL0UOpGpes+TWK1qcrR4iEkUMI+W78iZ2QXNM4Sp LdOUBxHGvZDoGHJ7DRs+Pp7Kk7Jg+8CXJQKfK/HW1NaqV/EIF5W9zyr2B3sGs2JuWuGp XDzPB7Gla5ldOuJ5TtbEQCTUSeYLQRL7nROcs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736100941; x=1736705741; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nCWum8u2aSE0H9NGugk1g+nl+FSObYpFAdsp0A4AhFk=; b=v9SEHll7kgmOThTRyDQgg+ZkOV+KLRl4lioQpC18P1VH8WVHBJvZ/liXbe9k+m7kao ZOQrf5gD5Jq4MSmihCZsnvnb1el6SIJuZiM4vgFRKCvVmfdMAhhksLf059Wa4GWPTcgH DBWOR/r9D18cbxHIbtOkTGVS3k3Ko9IqhdjjmzhfTrAk4N/zYO/uMmTyj/5Z0DHIr88Z h0+AuGCl9CQvfQmH5glyFF1Fe/ZktsYp51mqPyg9p3Cy8fMLznMFEKzLj+7LaZski2m1 T8qieN4sDQrML0n5z2GecC84DwKJHEJcuW9+QOAWVG4qoD3MQKKly2EfDMXa8gCeiBiQ cT2w== X-Forwarded-Encrypted: i=1; AJvYcCXeX5AMYiIeTPPXtVGlygV8wAxyebyeEq3vxDHQu2HubX+in82+CKeOKjgb+lGEjiiTuUZ6TOU4NZjgXv34xlvx@lists.infradead.org X-Gm-Message-State: AOJu0Yzz+1CkGfkdxp8HgaWE6IxP/nB/JjgNjOOmZWqPDMm8NWyhn0uS 2kGjBk+7AaLV5rRU3k2GlS9FNHRg28Ly+LyY8+GWaY0EB0JbfS/oVNmEEbNNrHo= X-Gm-Gg: ASbGncueTMiGL9L0SZwxGxjSEMrc1i0lrcRhV2HpBl+HRlxFG8kmnVO4weggKE2pGHo B50npT2o/jc7+vEfYk0jt8PpcVWWev6cL8RMX8xIxPrsHWMiLfp/6GU/6GD2G5QQFkayQc4lmsI LE/bliephkqJmmRCZIAYeqr5uBtdngvwHSgMtDQ9delkcNWaQHuRXCfQ/kJ5uhEv9mbM+vWNHOk XY0hlSz5pXt1w0ofNjwGlGK2RsmjpFraRWTv7gEgnJ5ZOLyYwfs1PRhx3EvJFib90rD0QaqwxBv 6bcN8Jr7LZ409MVPeSWJaVWLOTokxjn/tUFZUxIzPyUpK6nU9SOhC38c6bWdrCr6Nw2quBQZyXM dK2B708XzSaZUkWypGw== X-Google-Smtp-Source: AGHT+IFeu46e7LHQ6MyNCXFCxnHyuX7vCIGWrO/EtiZn47VacrN5DdmgWvSrKWY5flVSdhQ2UzUVwg== X-Received: by 2002:a05:6402:540b:b0:5d6:48ef:c19f with SMTP id 4fb4d7f45d1cf-5d81de1c28fmr134000185a12.29.1736100941394; Sun, 05 Jan 2025 10:15:41 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-41-6-15.retail.telecomitalia.it. [79.41.6.15]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e82f178sm2138185066b.38.2025.01.05.10.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 10:15:40 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Alexandre Torgue , Maxime Coquelin , Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 5/6] clk: stm32f4: use FIELD helpers to access the PLLCFGR fields Date: Sun, 5 Jan 2025 19:14:17 +0100 Message-ID: <20250105181525.1370822-6-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> References: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250105_101543_233702_DEE1E24B X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use GENMASK() along with FIELD_GET() and FIELD_PREP() helpers to access the PLLCFGR fields instead of manually masking and shifting. Signed-off-by: Dario Binacchi --- drivers/clk/clk-stm32f4.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index 07c13ebe327d..db1c56c8d54f 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c @@ -5,6 +5,7 @@ * Inspired by clk-asm9260.c . */ +#include #include #include #include @@ -39,6 +40,8 @@ #define STM32F4_RCC_DCKCFGR 0x8c #define STM32F7_RCC_DCKCFGR2 0x90 +#define STM32F4_RCC_PLLCFGR_N_MASK GENMASK(14, 6) + #define NONE -1 #define NO_IDX NONE #define NO_MUX NONE @@ -632,9 +635,11 @@ static unsigned long stm32f4_pll_recalc(struct clk_hw *hw, { struct clk_gate *gate = to_clk_gate(hw); struct stm32f4_pll *pll = to_stm32f4_pll(gate); + unsigned long val; unsigned long n; - n = (readl(base + pll->offset) >> 6) & 0x1ff; + val = readl(base + pll->offset); + n = FIELD_GET(STM32F4_RCC_PLLCFGR_N_MASK, val); return parent_rate * n; } @@ -673,9 +678,10 @@ static int stm32f4_pll_set_rate(struct clk_hw *hw, unsigned long rate, n = rate / parent_rate; - val = readl(base + pll->offset) & ~(0x1ff << 6); + val = readl(base + pll->offset) & ~STM32F4_RCC_PLLCFGR_N_MASK; + val |= FIELD_PREP(STM32F4_RCC_PLLCFGR_N_MASK, n); - writel(val | ((n & 0x1ff) << 6), base + pll->offset); + writel(val, base + pll->offset); if (pll_state) stm32f4_pll_enable(hw); From patchwork Sun Jan 5 18:14:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 13926743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56BABE77197 for ; Sun, 5 Jan 2025 18:24:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=CYt+s6fkrUpxe5XF17lxHByzQRCB3AxfRzKWTwCyBC0=; b=3i6jDE+2TG7p61rkrTxyrkyKXl D2oZjRHY2gvUFNiiruuTD1B+yyIWzYEucPiRKmEubKrCWU4XmT407teLfnbCd7NDwzTQlIHvYWv0O tua5Tn4uo84q18AMMDDMtljzXoAkfx3jiqGbNo+xqQBdfTco2P3boD5cj7Z0RLxuPzfDbEpYdDqiQ MM0B4JccOgdYuAfuHUCBOkB57KjkkLNaUaJCRp9VIHv6sIyWEX/T5LSTvddYaG9SqLHU6ToC/HTfi 616TSeHdCLPEud6kmjMj0sf9QG/fMXHkZ8j2s9wSudQBRyV4jeNgA8AxqReRbq1Qk98aBF9QebUY3 J7ySFyVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tUVI2-0000000HFr7-3mue; Sun, 05 Jan 2025 18:23:54 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tUVA8-0000000HExh-1I9P for linux-arm-kernel@lists.infradead.org; Sun, 05 Jan 2025 18:15:45 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-aaf0f1adef8so1302830766b.3 for ; Sun, 05 Jan 2025 10:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1736100942; x=1736705742; darn=lists.infradead.org; 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; bh=CYt+s6fkrUpxe5XF17lxHByzQRCB3AxfRzKWTwCyBC0=; b=dg1iqYeap4I1/4CwOmLz2wqyXmfxV7ygsKy4PvVtwW2v2z76jTx9PQPExsV5bLLm3g JZvFhQW4ZI7BRhM8dx18RGBspza5usBdRDn9LmDo7sespreFmeKsUMUbMHrOpQMEJvni P0tGzqfe8CWiQU2+wTMQNsXFVLWRR/IdMpFjM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736100942; x=1736705742; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CYt+s6fkrUpxe5XF17lxHByzQRCB3AxfRzKWTwCyBC0=; b=vjbMSI4zYAl8yJf0w20SiAbhFEIU9dBnwIZMs2RBYtJ/O5QJRPzswwxi9dHih/Cl4k zFsKLl9I2Ncw/xQ1V+S9g0LsJ9q/1nDAd0E0RA//kYvtiGcSouDRxqt4tS683qNeEC2C Hut+5GQvWenQR8cX65rCY+AHMDBnZU6xEnVkmB5Z6fIdvse90LYNAYHBW7WN6DI4yyH9 tuBVkee6dajuDV8Ytymu+xP61nFmKmfj+H+m0P2MoekcAKlY6uOVFgYqbs+zx7XNO03Q TOunSovVQMGMA9qbmywi+UzZKmfpz0jDg0usbmF7nk/8RsHDHOgXN0YzM/+1wcJF1P6G njCQ== X-Forwarded-Encrypted: i=1; AJvYcCWPJjDSds9GYh90CVbOWC/I5CpgHK7rLl5v8xhGgdIfuF7OtK6Vkn6zLcqZcfROHPgIZlSqPWm8cFe+kR86m1np@lists.infradead.org X-Gm-Message-State: AOJu0YxwAqmAme8TIwKeU3AalFdu5aqzH83yXc1nIC3/EdpyUxP0FWnW SOFZzXCO9s1Dm486xkuK5cf0Sb9g52ZLwTgHSmkgU2NQGbtb20/EpjxPhPpA+XU= X-Gm-Gg: ASbGncuQyJRaTx1UoNqPG69skijdraCZaA9QcejOD3CqTjpeFETUJn91B87QZA6odVp Y73XxR4vaF32pTTYHhrL+i2ap8pCZZzP4+Jj/ObXBqJvlufYqjtrdwpLBXxjm85iyAuuETNDGKb jRQjTZDZPB7zmwt39S0AzUCAUtCu7Yp77BHXkdV7UAqk38TnzF8OJ2ZpP0slSXAMqVfhYAuVAec 6gGBthNEW2GdcGLLTUTeD5ECKDS5xJrQbfJmHcGNNOsuTBou4QmxCwk3dW/ORJhXXt22tsXrNCi FQOvPs9Ef3VOJVIjkPZky1uySWpgwmPCs3lIeAnnKDocbocKp6xMZhban3cCaBCYsQLXHbHLXGF cOrGX5570NaKgbnle8A== X-Google-Smtp-Source: AGHT+IHKfniWL7KIZr5UBchy8RdTJDMipbRucCKrppnn1VBJEdWfGEKF6uqo/1J4HGrc00eEihpFhA== X-Received: by 2002:a17:907:7e86:b0:aaf:ada2:181e with SMTP id a640c23a62f3a-aafada219d8mr879413566b.26.1736100942566; Sun, 05 Jan 2025 10:15:42 -0800 (PST) Received: from dario-ThinkPad-T14s-Gen-2i.homenet.telecomitalia.it (host-79-41-6-15.retail.telecomitalia.it. [79.41.6.15]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e82f178sm2138185066b.38.2025.01.05.10.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Jan 2025 10:15:42 -0800 (PST) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Alexandre Torgue , Maxime Coquelin , Michael Turquette , Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com Subject: [PATCH 6/6] clk: stm32f4: support spread spectrum clock generation Date: Sun, 5 Jan 2025 19:14:18 +0100 Message-ID: <20250105181525.1370822-7-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> References: <20250105181525.1370822-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250105_101544_347698_A805F4C4 X-CRM114-Status: GOOD ( 17.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Support spread spectrum clock generation for the main PLL, the only one for which this functionality is available. Tested on the STM32F469I-DISCO board. Signed-off-by: Dario Binacchi --- drivers/clk/clk-stm32f4.c | 143 +++++++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 3 deletions(-) diff --git a/drivers/clk/clk-stm32f4.c b/drivers/clk/clk-stm32f4.c index db1c56c8d54f..6c80c0dbb0a3 100644 --- a/drivers/clk/clk-stm32f4.c +++ b/drivers/clk/clk-stm32f4.c @@ -35,6 +35,7 @@ #define STM32F4_RCC_APB2ENR 0x44 #define STM32F4_RCC_BDCR 0x70 #define STM32F4_RCC_CSR 0x74 +#define STM32F4_RCC_SSCGR 0x80 #define STM32F4_RCC_PLLI2SCFGR 0x84 #define STM32F4_RCC_PLLSAICFGR 0x88 #define STM32F4_RCC_DCKCFGR 0x8c @@ -42,6 +43,12 @@ #define STM32F4_RCC_PLLCFGR_N_MASK GENMASK(14, 6) +#define STM32F4_RCC_SSCGR_SSCGEN BIT(31) +#define STM32F4_RCC_SSCGR_SPREADSEL BIT(30) +#define STM32F4_RCC_SSCGR_RESERVED_MASK GENMASK(29, 28) +#define STM32F4_RCC_SSCGR_INCSTEP_MASK GENMASK(27, 13) +#define STM32F4_RCC_SSCGR_MODPER_MASK GENMASK(12, 0) + #define NONE -1 #define NO_IDX NONE #define NO_MUX NONE @@ -512,6 +519,17 @@ static const struct clk_div_table pll_divr_table[] = { { 2, 2 }, { 3, 3 }, { 4, 4 }, { 5, 5 }, { 6, 6 }, { 7, 7 }, { 0 } }; +enum stm32f4_pll_ssc_mod_type { + STM32F4_PLL_SSC_CENTER_SPREAD, + STM32F4_PLL_SSC_DOWN_SPREAD, +}; + +struct stm32f4_pll_ssc { + unsigned int mod_freq; + unsigned int mod_depth; + enum stm32f4_pll_ssc_mod_type mod_type; +}; + struct stm32f4_pll { spinlock_t *lock; struct clk_gate gate; @@ -519,6 +537,8 @@ struct stm32f4_pll { u8 bit_rdy_idx; u8 status; u8 n_start; + bool ssc_enable; + struct stm32f4_pll_ssc ssc_conf; }; #define to_stm32f4_pll(_gate) container_of(_gate, struct stm32f4_pll, gate) @@ -541,6 +561,7 @@ struct stm32f4_vco_data { u8 offset; u8 bit_idx; u8 bit_rdy_idx; + bool sscg; }; static const struct stm32f4_vco_data vco_data[] = { @@ -661,6 +682,34 @@ static long stm32f4_pll_round_rate(struct clk_hw *hw, unsigned long rate, return *prate * n; } +static void stm32f4_pll_set_ssc(struct clk_hw *hw, unsigned long parent_rate, + unsigned int ndiv) +{ + struct clk_gate *gate = to_clk_gate(hw); + struct stm32f4_pll *pll = to_stm32f4_pll(gate); + struct stm32f4_pll_ssc *ssc = &pll->ssc_conf; + u32 modeper, incstep; + u32 sscgr; + + sscgr = readl(base + STM32F4_RCC_SSCGR); + /* reserved field must be kept at reset value */ + sscgr &= STM32F4_RCC_SSCGR_RESERVED_MASK; + + modeper = DIV_ROUND_CLOSEST(parent_rate, 4 * ssc->mod_freq); + incstep = DIV_ROUND_CLOSEST(((1 << 15) - 1) * ssc->mod_depth * ndiv, + 5 * 10000 * modeper); + sscgr |= STM32F4_RCC_SSCGR_SSCGEN | + FIELD_PREP(STM32F4_RCC_SSCGR_INCSTEP_MASK, incstep) | + FIELD_PREP(STM32F4_RCC_SSCGR_MODPER_MASK, modeper); + + if (ssc->mod_type) + sscgr |= STM32F4_RCC_SSCGR_SPREADSEL; + + pr_debug("%s: pll: %s: modeper: %d, incstep: %d, sscgr: 0x%08x\n", + __func__, clk_hw_get_name(hw), modeper, incstep, sscgr); + writel(sscgr, base + STM32F4_RCC_SSCGR); +} + static int stm32f4_pll_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { @@ -683,6 +732,9 @@ static int stm32f4_pll_set_rate(struct clk_hw *hw, unsigned long rate, writel(val, base + pll->offset); + if (pll->ssc_enable) + stm32f4_pll_set_ssc(hw, parent_rate, n); + if (pll_state) stm32f4_pll_enable(hw); @@ -788,6 +840,87 @@ static struct clk_hw *clk_register_pll_div(const char *name, return hw; } +static int stm32f4_pll_init_ssc(struct clk_hw *hw, struct stm32f4_pll_ssc *conf) +{ + struct clk_gate *gate = to_clk_gate(hw); + struct stm32f4_pll *pll = to_stm32f4_pll(gate); + struct clk_hw *parent; + unsigned long parent_rate; + int pll_state; + unsigned long n, val; + + parent = clk_hw_get_parent(hw); + if (!parent) { + pr_err("%s: failed to get clock parent\n", __func__); + return -ENODEV; + } + + parent_rate = clk_hw_get_rate(parent); + + pll->ssc_enable = true; + memcpy(&pll->ssc_conf, conf, sizeof(pll->ssc_conf)); + + pll_state = stm32f4_pll_is_enabled(hw); + + if (pll_state) + stm32f4_pll_disable(hw); + + val = readl(base + pll->offset); + n = FIELD_GET(STM32F4_RCC_PLLCFGR_N_MASK, val); + + pr_debug("%s: pll: %s, parent: %s, parent-rate: %lu, n: %lu\n", + __func__, clk_hw_get_name(hw), clk_hw_get_name(parent), + parent_rate, n); + + stm32f4_pll_set_ssc(hw, parent_rate, n); + + if (pll_state) + stm32f4_pll_enable(hw); + + return 0; +} + +static int stm32f4_pll_ssc_parse_dt(struct device_node *np, + struct stm32f4_pll_ssc *conf) +{ + int ret; + const char *s; + + if (!conf) + return -EINVAL; + + ret = of_property_read_u32(np, "st,ssc-modfreq-hz", &conf->mod_freq); + if (ret) + return ret; + + ret = of_property_read_u32(np, "st,ssc-moddepth-permyriad", + &conf->mod_depth); + if (ret) { + pr_err("%pOF: missing st,ssc-moddepth-permyriad\n", np); + return ret; + } + + ret = of_property_read_string(np, "st,ssc-modmethod", &s); + if (ret) { + pr_err("%pOF: missing st,ssc-modmethod\n", np); + return ret; + } + + if (!strcmp(s, "down-spread")) { + conf->mod_type = STM32F4_PLL_SSC_DOWN_SPREAD; + } else if (!strcmp(s, "center-spread")) { + conf->mod_type = STM32F4_PLL_SSC_CENTER_SPREAD; + } else { + pr_err("%pOF: wrong value (%s) for fsl,ssc-modmethod\n", np, s); + return -EINVAL; + } + + pr_debug("%pOF: SSCG settings: mod_freq: %d, mod_depth: %d mod_method: %s [%d]\n", + np, conf->mod_freq, conf->mod_depth, s, conf->mod_type); + + return 0; +} + static struct clk_hw *stm32f4_rcc_register_pll(const char *pllsrc, const struct stm32f4_pll_data *data, spinlock_t *lock) { @@ -1695,7 +1828,8 @@ static void __init stm32f4_rcc_init(struct device_node *np) const struct of_device_id *match; const struct stm32f4_clk_data *data; unsigned long pllm; - struct clk_hw *pll_src_hw; + struct clk_hw *pll_src_hw, *pll_vco_hw; + struct stm32f4_pll_ssc ssc_conf; base = of_iomap(np, 0); if (!base) { @@ -1754,8 +1888,8 @@ static void __init stm32f4_rcc_init(struct device_node *np) clk_hw_register_fixed_factor(NULL, "vco_in", pll_src, 0, 1, pllm); - stm32f4_rcc_register_pll("vco_in", &data->pll_data[0], - &stm32f4_clk_lock); + pll_vco_hw = stm32f4_rcc_register_pll("vco_in", &data->pll_data[0], + &stm32f4_clk_lock); clks[PLL_VCO_I2S] = stm32f4_rcc_register_pll("vco_in", &data->pll_data[1], &stm32f4_clk_lock); @@ -1900,6 +2034,9 @@ static void __init stm32f4_rcc_init(struct device_node *np) of_clk_add_hw_provider(np, stm32f4_rcc_lookup_clk, NULL); + if (!stm32f4_pll_ssc_parse_dt(np, &ssc_conf)) + stm32f4_pll_init_ssc(pll_vco_hw, &ssc_conf); + return; fail: kfree(clks);