From patchwork Wed Sep 3 00:09:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 1094 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C1B8A1114 for ; Wed, 3 Sep 2025 00:09:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858183; cv=none; b=gTdlLU6DBuPBLzTjsvKOUEWZIAJYnbP7JLhzB3Lq0TVSWikGVQkQ0QvMsPyhF2C0arAtiUWvTxAQlqvrUXJubzaFFow7BQ/8USPHisPJXMhKxlV+9YEUxKT/OA38NzwPKQ9tDvNd/YF0pAoqvDOEZNAllFzaoSWp/sB11oBz3AE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858183; c=relaxed/simple; bh=Y16uXCeoPpg0llX8yL3WzRcM9w6S487+udgkmb4ThNk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cOx1BG346i01L39A2zQhPXz9jHIsBMEReCZAnB1NKKPLi5yazeMzKh6YSHiw/6vaVFyqG1Sp7ZHEqurNHsrCMAaJBryqbZn6inZj/1o6+5oOzh7DWuvHaNNGN/1xJkxdGLt8FBi0OcDObkA/HibyXhmlsL1mMZtQOGtC5/UyHpM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7DC51176A; Tue, 2 Sep 2025 17:09:32 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 168A43F63F; Tue, 2 Sep 2025 17:09:38 -0700 (PDT) From: Andre Przywara To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Mikhail Kalashnikov Subject: [PATCH 1/5] dt-bindings: clock: sun55i-a523-ccu: Add A523 CPU CCU clock controller Date: Wed, 3 Sep 2025 01:09:06 +0100 Message-ID: <20250903000910.4860-2-andre.przywara@arm.com> X-Mailer: git-send-email 2.46.3 In-Reply-To: <20250903000910.4860-1-andre.przywara@arm.com> References: <20250903000910.4860-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O There are four clock controllers in the A523 SoC, but only three are described in the DT binding so far. Add a description for the CPU CCU, which provides separate clocks for the two CPU clusters and the DSU interconnect. Signed-off-by: Andre Przywara --- .../clock/allwinner,sun55i-a523-ccu.yaml | 25 +++++++++++++++++++ .../dt-bindings/clock/sun55i-a523-cpu-ccu.h | 13 ++++++++++ 2 files changed, 38 insertions(+) create mode 100644 include/dt-bindings/clock/sun55i-a523-cpu-ccu.h diff --git a/Documentation/devicetree/bindings/clock/allwinner,sun55i-a523-ccu.yaml b/Documentation/devicetree/bindings/clock/allwinner,sun55i-a523-ccu.yaml index 1dbd92febc471..367d26800fd0d 100644 --- a/Documentation/devicetree/bindings/clock/allwinner,sun55i-a523-ccu.yaml +++ b/Documentation/devicetree/bindings/clock/allwinner,sun55i-a523-ccu.yaml @@ -19,6 +19,7 @@ properties: compatible: enum: - allwinner,sun55i-a523-ccu + - allwinner,sun55i-a523-cpu-ccu - allwinner,sun55i-a523-mcu-ccu - allwinner,sun55i-a523-r-ccu @@ -64,6 +65,30 @@ allOf: - const: iosc - const: losc-fanout + - if: + properties: + compatible: + enum: + - allwinner,sun55i-a523-cpu-ccu + + then: + properties: + clocks: + items: + - description: High Frequency Oscillator (usually at 24MHz) + - description: Low Frequency Oscillator (usually at 32kHz) + - description: Internal Oscillator + - description: Peripherals PLL 0 (1200 MHz output) + - description: Peripherals PLL 0 (600 MHz output) + + clock-names: + items: + - const: hosc + - const: losc + - const: iosc + - const: pll-periph0-2x + - const: pll-periph0-600m + - if: properties: compatible: diff --git a/include/dt-bindings/clock/sun55i-a523-cpu-ccu.h b/include/dt-bindings/clock/sun55i-a523-cpu-ccu.h new file mode 100644 index 0000000000000..042f2310f64de --- /dev/null +++ b/include/dt-bindings/clock/sun55i-a523-cpu-ccu.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR MIT) */ +/* + * Copyright 2025 Arm Ltd. + */ + +#ifndef _DT_BINDINGS_CLK_SUN55I_A523_CPU_CCU_H_ +#define _DT_BINDINGS_CLK_SUN55I_A523_CPU_CCU_H_ + +#define CLK_CPU_L 7 +#define CLK_CPU_DSU 8 +#define CLK_CPU_B 9 + +#endif /* _DT_BINDINGS_CLK_SUN55I_A523_CPU_CCU_H_ */ From patchwork Wed Sep 3 00:09:07 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 1093 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 49F1218C31 for ; Wed, 3 Sep 2025 00:09:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858185; cv=none; b=M9rNYnJ+qaV7kVmAXHJzhbk8C/POfmiBweEojGK57XkTm6gQ4du7ylfwmF23Lzew3zd37IjC6nEnLLOv0gQfMN5LnlhhlQLKeNDvMJH2cc7lf0I2Ar4bALFTOqFNWEDdQEnhLug9xc9pjxs538V1KqMnXPdG6/tTZGWoKIi9sbM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858185; c=relaxed/simple; bh=7JPCPMlWGthZH0KOSRZQjMkWUESEryL+gfstKj3r1eU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XlaLEqCIKTlBcmIQOvBcbM8TGcVJVyAuo4jno8Fjq9+6wYppF1uNWVYrkXbol9unnxSXkivKRu3h1dth+p3RTQxzcA+mwzbPgBwbP92feKh/8R+cxba6UD0M7gOnrU3YweRF9hxkjrEk1oGTk5hkkJoC0g3jlJqfl4s1ET8n3s0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 804B41764; Tue, 2 Sep 2025 17:09:34 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1A6363F63F; Tue, 2 Sep 2025 17:09:40 -0700 (PDT) From: Andre Przywara To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Mikhail Kalashnikov Subject: [PATCH 2/5] clk: sunxi-ng: generalise update bit Date: Wed, 3 Sep 2025 01:09:07 +0100 Message-ID: <20250903000910.4860-3-andre.przywara@arm.com> X-Mailer: git-send-email 2.46.3 In-Reply-To: <20250903000910.4860-1-andre.przywara@arm.com> References: <20250903000910.4860-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O A few of the Allwinner A523 CCU clock registers introduced an "update" bit, which must be set for changes to the other bits to take effect. Of the three clocks where this was used, it was always bit 27, so we just encoded this as a single bit feature flag. Now the CPU PLL also features the update bit, but puts it at bit 26, so this flag trick won't work anymore. Add an "update_bit" field to the common sunxi clock struct, which takes a bitmask, so we can encode any bit to use, even potentially multiple of them. As uninitialised fields are set to 0, we can use this as a default bitmask to set, so can OR this in unconditionally. Change the existing update bit users to use this new encoding, and add support for the ccu_nm clock on the way, since we will need it there shortly. Signed-off-by: Andre Przywara --- drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 12 ++++++------ drivers/clk/sunxi-ng/ccu_common.h | 5 +---- drivers/clk/sunxi-ng/ccu_div.c | 3 +-- drivers/clk/sunxi-ng/ccu_gate.c | 6 ++---- drivers/clk/sunxi-ng/ccu_mp.h | 8 +++++--- drivers/clk/sunxi-ng/ccu_mux.c | 3 +-- drivers/clk/sunxi-ng/ccu_nm.c | 1 + 7 files changed, 17 insertions(+), 21 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c index 1a9a1cb869e23..736144f9e1833 100644 --- a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c @@ -385,8 +385,8 @@ static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(mbus_clk, "mbus", mbus_parents, 0, 0, /* no P */ 24, 3, /* mux */ BIT(31), /* gate */ - CLK_IS_CRITICAL, - CCU_FEATURE_UPDATE_BIT); + BIT(27), /* update*/ + CLK_IS_CRITICAL, 0); static const struct clk_hw *mbus_hws[] = { &mbus_clk.common.hw }; @@ -577,8 +577,8 @@ static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(iommu_clk, "iommu", iommu_parents, 0, 0, /* no P */ 24, 3, /* mux */ BIT(31), /* gate */ - CLK_SET_RATE_PARENT, - CCU_FEATURE_UPDATE_BIT); + BIT(27), /* update */ + CLK_SET_RATE_PARENT, 0); static SUNXI_CCU_GATE_HWS(bus_iommu_clk, "bus-iommu", apb0_hws, 0x7bc, BIT(0), 0); @@ -596,8 +596,8 @@ static SUNXI_CCU_MP_DATA_WITH_MUX_GATE_FEAT(dram_clk, "dram", dram_parents, 0, 0, /* no P */ 24, 3, /* mux */ BIT(31), /* gate */ - CLK_IS_CRITICAL, - CCU_FEATURE_UPDATE_BIT); + BIT(27), /* update*/ + CLK_IS_CRITICAL, 0); static SUNXI_CCU_GATE_HWS(mbus_dma_clk, "mbus-dma", mbus_hws, 0x804, BIT(0), 0); diff --git a/drivers/clk/sunxi-ng/ccu_common.h b/drivers/clk/sunxi-ng/ccu_common.h index bbec283b9d993..e4caad2d8cef6 100644 --- a/drivers/clk/sunxi-ng/ccu_common.h +++ b/drivers/clk/sunxi-ng/ccu_common.h @@ -20,14 +20,10 @@ #define CCU_FEATURE_KEY_FIELD BIT(8) #define CCU_FEATURE_CLOSEST_RATE BIT(9) #define CCU_FEATURE_DUAL_DIV BIT(10) -#define CCU_FEATURE_UPDATE_BIT BIT(11) /* MMC timing mode switch bit */ #define CCU_MMC_NEW_TIMING_MODE BIT(30) -/* Some clocks need this bit to actually apply register changes */ -#define CCU_SUNXI_UPDATE_BIT BIT(27) - struct device_node; struct ccu_common { @@ -35,6 +31,7 @@ struct ccu_common { u16 reg; u16 lock_reg; u32 prediv; + u32 update_bit; unsigned long min_rate; unsigned long max_rate; diff --git a/drivers/clk/sunxi-ng/ccu_div.c b/drivers/clk/sunxi-ng/ccu_div.c index 916d6da6d8a3b..fe97875f7c82d 100644 --- a/drivers/clk/sunxi-ng/ccu_div.c +++ b/drivers/clk/sunxi-ng/ccu_div.c @@ -106,8 +106,7 @@ static int ccu_div_set_rate(struct clk_hw *hw, unsigned long rate, reg = readl(cd->common.base + cd->common.reg); reg &= ~GENMASK(cd->div.width + cd->div.shift - 1, cd->div.shift); - if (cd->common.features & CCU_FEATURE_UPDATE_BIT) - reg |= CCU_SUNXI_UPDATE_BIT; + reg |= cd->common.update_bit; writel(reg | (val << cd->div.shift), cd->common.base + cd->common.reg); diff --git a/drivers/clk/sunxi-ng/ccu_gate.c b/drivers/clk/sunxi-ng/ccu_gate.c index 30673fe4e3c2c..729d711c73fe7 100644 --- a/drivers/clk/sunxi-ng/ccu_gate.c +++ b/drivers/clk/sunxi-ng/ccu_gate.c @@ -20,8 +20,7 @@ void ccu_gate_helper_disable(struct ccu_common *common, u32 gate) spin_lock_irqsave(common->lock, flags); reg = readl(common->base + common->reg); - if (common->features & CCU_FEATURE_UPDATE_BIT) - reg |= CCU_SUNXI_UPDATE_BIT; + reg |= common->update_bit; writel(reg & ~gate, common->base + common->reg); spin_unlock_irqrestore(common->lock, flags); @@ -46,8 +45,7 @@ int ccu_gate_helper_enable(struct ccu_common *common, u32 gate) spin_lock_irqsave(common->lock, flags); reg = readl(common->base + common->reg); - if (common->features & CCU_FEATURE_UPDATE_BIT) - reg |= CCU_SUNXI_UPDATE_BIT; + reg |= common->update_bit; writel(reg | gate, common->base + common->reg); spin_unlock_irqrestore(common->lock, flags); diff --git a/drivers/clk/sunxi-ng/ccu_mp.h b/drivers/clk/sunxi-ng/ccu_mp.h index bb09c649bfa35..37d3128875194 100644 --- a/drivers/clk/sunxi-ng/ccu_mp.h +++ b/drivers/clk/sunxi-ng/ccu_mp.h @@ -131,7 +131,8 @@ struct ccu_mp { _mshift, _mwidth, \ _pshift, _pwidth, \ _muxshift, _muxwidth, \ - _gate, _flags, _features) \ + _gate, _update, \ + _flags, _features) \ struct ccu_mp _struct = { \ .enable = _gate, \ .m = _SUNXI_CCU_DIV(_mshift, _mwidth), \ @@ -140,6 +141,7 @@ struct ccu_mp { .common = { \ .reg = _reg, \ .features = _features, \ + .update_bit = _update, \ .hw.init = CLK_HW_INIT_PARENTS_DATA(_name, \ _parents, \ &ccu_mp_ops, \ @@ -156,7 +158,7 @@ struct ccu_mp { _reg, _mshift, _mwidth, \ _pshift, _pwidth, \ _muxshift, _muxwidth, \ - _gate, _flags, 0) + _gate, 0, _flags, 0) #define SUNXI_CCU_DUALDIV_MUX_GATE(_struct, _name, _parents, _reg, \ _mshift, _mwidth, \ @@ -167,7 +169,7 @@ struct ccu_mp { _reg, _mshift, _mwidth, \ _pshift, _pwidth, \ _muxshift, _muxwidth, \ - _gate, _flags, \ + _gate, 0, _flags, \ CCU_FEATURE_DUAL_DIV) #define SUNXI_CCU_MP_DATA_WITH_MUX(_struct, _name, _parents, _reg, \ diff --git a/drivers/clk/sunxi-ng/ccu_mux.c b/drivers/clk/sunxi-ng/ccu_mux.c index 74f9e98a5d355..8ff9f15bab0bd 100644 --- a/drivers/clk/sunxi-ng/ccu_mux.c +++ b/drivers/clk/sunxi-ng/ccu_mux.c @@ -197,8 +197,7 @@ int ccu_mux_helper_set_parent(struct ccu_common *common, /* The key field always reads as zero. */ if (common->features & CCU_FEATURE_KEY_FIELD) reg |= CCU_MUX_KEY_VALUE; - if (common->features & CCU_FEATURE_UPDATE_BIT) - reg |= CCU_SUNXI_UPDATE_BIT; + reg |= common->update_bit; reg &= ~GENMASK(cm->width + cm->shift - 1, cm->shift); writel(reg | (index << cm->shift), common->base + common->reg); diff --git a/drivers/clk/sunxi-ng/ccu_nm.c b/drivers/clk/sunxi-ng/ccu_nm.c index df01ed3b37a6b..e502b9c78c1b1 100644 --- a/drivers/clk/sunxi-ng/ccu_nm.c +++ b/drivers/clk/sunxi-ng/ccu_nm.c @@ -219,6 +219,7 @@ static int ccu_nm_set_rate(struct clk_hw *hw, unsigned long rate, reg |= (_nm.n - nm->n.offset) << nm->n.shift; reg |= (_nm.m - nm->m.offset) << nm->m.shift; + reg |= nm->common.update_bit; writel(reg, nm->common.base + nm->common.reg); spin_unlock_irqrestore(nm->common.lock, flags); From patchwork Wed Sep 3 00:09:08 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 1092 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C7291F19A for ; Wed, 3 Sep 2025 00:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858187; cv=none; b=h+f652YAqtw9uqxQd3qy/Gby+MG8UvzPpmhq9HHDgrqVvIHzm2OemOgOa1RuhwxZaHXK5JycGiTQoXEBT+G3voNoswg5TCBU+uq65nFJcq6IrQFotEhYq7ZZ04dQbu849v5hGmmkTFjFpACAXVpE/YkHG69l82pg67k/CiPmPm0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858187; c=relaxed/simple; bh=hE8113scdICHsShBG8oBmXxWQNEp+INYIGDYfDvYDC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YJ5wHbZuP7d18kJsKTIJVuv2WEgScqxpb9Lpc7wNsg81SIvaS4wLi0BiTL7rDB/T76EBYaBZw2r7FIBO/HCMbGRs2trxCg/G7PAMGwwi+ycP0W3cUhuS2ljA4Dbfk6rp7qtSSKmoQk1vhyVgoGfaN0IG1oykvf8dfxoDu+7r66k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 85081176A; Tue, 2 Sep 2025 17:09:36 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1E3DB3F63F; Tue, 2 Sep 2025 17:09:43 -0700 (PDT) From: Andre Przywara To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Mikhail Kalashnikov Subject: [PATCH 3/5] clk: sunxi-ng: mp: support clocks with just a shift register Date: Wed, 3 Sep 2025 01:09:08 +0100 Message-ID: <20250903000910.4860-4-andre.przywara@arm.com> X-Mailer: git-send-email 2.46.3 In-Reply-To: <20250903000910.4860-1-andre.przywara@arm.com> References: <20250903000910.4860-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O The "mp" clock models a mod clock with divider and a shift field. At least one clock in the Allwinner A523 features just a power-of-2 divider field, so support an initialisation of the clock without providing an actual divider field. Add a check whether the "width" field is 0, and skip the divider handling in this case, as the GENMASK macro will not work with a zero length. Signed-off-by: Andre Przywara --- drivers/clk/sunxi-ng/ccu_mp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/sunxi-ng/ccu_mp.c b/drivers/clk/sunxi-ng/ccu_mp.c index 354c981943b6f..a03dac294d048 100644 --- a/drivers/clk/sunxi-ng/ccu_mp.c +++ b/drivers/clk/sunxi-ng/ccu_mp.c @@ -236,9 +236,11 @@ static int ccu_mp_set_rate(struct clk_hw *hw, unsigned long rate, spin_lock_irqsave(cmp->common.lock, flags); reg = readl(cmp->common.base + cmp->common.reg); - reg &= ~GENMASK(cmp->m.width + cmp->m.shift - 1, cmp->m.shift); + if (cmp->m.width) + reg &= ~GENMASK(cmp->m.width + cmp->m.shift - 1, cmp->m.shift); reg &= ~GENMASK(cmp->p.width + cmp->p.shift - 1, cmp->p.shift); - reg |= (m - cmp->m.offset) << cmp->m.shift; + if (cmp->m.width) + reg |= (m - cmp->m.offset) << cmp->m.shift; if (shift) reg |= ilog2(p) << cmp->p.shift; else From patchwork Wed Sep 3 00:09:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 1091 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C69292F56 for ; Wed, 3 Sep 2025 00:09:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858189; cv=none; b=ORarnLdROmbLv/YOaSjVYIjX82aqkrcTgHAWg937DvT5vtq3Pko8PVCQmK1w5TdtsPKJ7+wqNSQEccSOV6ISRO+WFg6JhlQ2QB+GxVReghIwkBivvuglULmgUtw7IEqTAnZfc7aVkHq27l/zs763flwgQJQteZrSoZIZX2w+io8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858189; c=relaxed/simple; bh=ivwsGsC4Xy/MVx5t1K9jIMDCQCntyHLYN8Kq4z/lue8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=utWY93n+A6wlhGDTJjsHEs1Qoo+AUfMgM+k9i4B6RMsmvDddu+7WLdi9VDuE37i9ux4TRDoBnCNBOMe1SdKl4NDHpt97/7UjTfrpKn4j6+Aa1TsPsP/gwUG28pmZhgqDFvvUiCNQQV1CN5JsFSm2URm2TrgwQfmi8xnvRcRtra4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A828F1764; Tue, 2 Sep 2025 17:09:38 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 21FE03F63F; Tue, 2 Sep 2025 17:09:45 -0700 (PDT) From: Andre Przywara To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Mikhail Kalashnikov Subject: [PATCH 4/5] clk: sunxi-ng: add support for the A523/T527 CPU CCU Date: Wed, 3 Sep 2025 01:09:09 +0100 Message-ID: <20250903000910.4860-5-andre.przywara@arm.com> X-Mailer: git-send-email 2.46.3 In-Reply-To: <20250903000910.4860-1-andre.przywara@arm.com> References: <20250903000910.4860-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O The A523 contains a separate CCU block for the CPU PLLs. This includes one CPU clock per cluster, plus the DSU PLL, which clocks the part that connects the two clusters, and in particular the L3 cache. There is also an undocumented PLL0, which is a simper model that can apparently be used as an interim clock while re-locking the original PLLs. Add the PLL clocks for the CPU PLLs. This particular clock tree is a bit weird, as there is a divider field for the just the PLL, but inside the mux clock. The ASCII art should explain this better. Model those as three separate clocks, and expose just the final mux clock for both clusters and the DSU. Signed-off-by: Andre Przywara --- drivers/clk/sunxi-ng/Kconfig | 5 + drivers/clk/sunxi-ng/Makefile | 2 + drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c | 338 +++++++++++++++++++++ drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.h | 24 ++ 4 files changed, 369 insertions(+) create mode 100644 drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.h diff --git a/drivers/clk/sunxi-ng/Kconfig b/drivers/clk/sunxi-ng/Kconfig index 8896fd052ef17..24902287efc88 100644 --- a/drivers/clk/sunxi-ng/Kconfig +++ b/drivers/clk/sunxi-ng/Kconfig @@ -62,6 +62,11 @@ config SUN55I_A523_R_CCU default ARCH_SUNXI depends on ARM64 || COMPILE_TEST +config SUN55I_A523_CPU_CCU + tristate "Support for the Allwinner A523/T527 CPU CCU" + default y + depends on ARM64 || COMPILE_TEST + config SUN4I_A10_CCU tristate "Support for the Allwinner A10/A20 CCU" default ARCH_SUNXI diff --git a/drivers/clk/sunxi-ng/Makefile b/drivers/clk/sunxi-ng/Makefile index 82e471036de69..d0db2991a8673 100644 --- a/drivers/clk/sunxi-ng/Makefile +++ b/drivers/clk/sunxi-ng/Makefile @@ -35,6 +35,7 @@ obj-$(CONFIG_SUN50I_H6_R_CCU) += sun50i-h6-r-ccu.o obj-$(CONFIG_SUN50I_H616_CCU) += sun50i-h616-ccu.o obj-$(CONFIG_SUN55I_A523_CCU) += sun55i-a523-ccu.o obj-$(CONFIG_SUN55I_A523_R_CCU) += sun55i-a523-r-ccu.o +obj-$(CONFIG_SUN55I_A523_CPU_CCU) += sun55i-a523-cpu-ccu.o obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o obj-$(CONFIG_SUN5I_CCU) += sun5i-ccu.o obj-$(CONFIG_SUN6I_A31_CCU) += sun6i-a31-ccu.o @@ -62,6 +63,7 @@ sun50i-h6-r-ccu-y += ccu-sun50i-h6-r.o sun50i-h616-ccu-y += ccu-sun50i-h616.o sun55i-a523-ccu-y += ccu-sun55i-a523.o sun55i-a523-r-ccu-y += ccu-sun55i-a523-r.o +sun55i-a523-cpu-ccu-y += ccu-sun55i-a523-cpu.o sun4i-a10-ccu-y += ccu-sun4i-a10.o sun5i-ccu-y += ccu-sun5i.o sun6i-a31-ccu-y += ccu-sun6i-a31.o diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c b/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c new file mode 100644 index 0000000000000..b17a830b42477 --- /dev/null +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.c @@ -0,0 +1,338 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2023-2025 Arm Ltd. + * + * There are four PLLs: one for the little cluster (cores 0-3: PLL1), one for + * the "big" cluster (cores 4-7: PLL3), one for the DSU interconnect (probably + * its SCLK, driving the L3 cache: PLL2), and one undocumented "backup" PLL0, + * which can be used to drive either or both clusters, while the original PLLs + * are re-programmed (and re-lock). + * PLL[123] are the same, with a multiplier, a predivider, and two separate + * divider fields. For PLL1 and PLL3 there is an additional shift field, in + * the mux clock - although that applies only to the PLL, not the other sources. + * The two clusters and the DSU are connected to a mux clock each, selecting + * from various sources, including the PLL-PERIPH0-600M clock, again useful + * during DVFS operations: + * + * PLL-PERI0-600M (from the main CCU) + * | + * +-------+-----------+ + * / \ \ + * +------+ / +------+ \ +------+ \ +------+ + * | PLL1 | | | PLL0 | | | PLL3 | | | PLL2 | + * +------+ | +------+ | +------+ | +------+ + * \ | ^ | / | / + * DIV | / \ | DIV | / (plus 24MHz, + * \ | / \ | / | | 32KHz, + * +---------+ +---------+ +---------+ 16MHz, + * \ CPU-L / \ CPU-B / \ DSU / for each mux) + * \ / \ / \ / + * +---+ +---+ +---+ + * | | | + * +-------+-----------+-----DSU-----+----+ + * | +---+---+ +---+---+ | + * | | cores | | cores | | + * | | 0-3 | | 4-7 | +------------+ + * | +-------+ +-------+ | L3 cache | + * +-------------------------+------------+ + */ + +#include +#include +#include +#include +#include + +#include "ccu_common.h" +#include "ccu_reset.h" + +#include "ccu_div.h" +#include "ccu_gate.h" +#include "ccu_mp.h" +#include "ccu_nm.h" +#include "ccu_mult.h" + +#include "ccu-sun55i-a523-cpu.h" + +/* + * The 24 MHz oscillator, the root of most of the clock tree. + * .fw_name is the string used in the DT "clock-names" property, used to + * identify the corresponding clock in the "clocks" property. + */ +static const struct clk_parent_data osc24M[] = { + { .fw_name = "hosc" } +}; + +/* + * Undocumented PLL, mux-able to both clusters, usable as an interim PLL + * during DVFS clock rate changes. Bits [23:16] and [4:2] are RAZ/WI, which + * looks like the DDR or VIDEO PLLs, and not like the other CPU PLLs. + * Bits [1:0] are not dividers, as they don't have any effect on the frequency. + */ +#define SUN55I_A523_PLL_CPU_0_REG 0x00 + +static struct ccu_mult pll_cpu_0_clk = { + .enable = BIT(27), + .lock = BIT(28), + .mult = _SUNXI_CCU_MULT(8, 8), + .common = { + .reg = 0x00, + .hw.init = CLK_HW_INIT_PARENTS_DATA("pll-cpu-0", osc24M, + &ccu_mult_ops, + CLK_SET_RATE_UNGATE), + }, +}; +static const struct clk_parent_data pll_cpu_0_hws[] = { + { .hw = &pll_cpu_0_clk.common.hw }, +}; + +/* + * The PLLs are input * N / P / (M0 * M1). Model them as NM, by ignoring the + * predivider P and the only 2-bit wide M0, and fixing them to 1 in probe(). + * Using NKMP wouldn't be better, because the "P" in there is a shift. + * The actual enable bit is bit 31, which we set once in probe, along with + * some other control bits, as the manual recommends to not touch them + * during runtime. + */ +#define SUN55I_A523_PLL_CPU_L_REG 0x04 +static struct ccu_nm pll_cpu_l_clk = { + .enable = BIT(27), + .lock = BIT(28), + .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 20, 108), + .m = _SUNXI_CCU_DIV(0, 3), /* M1 */ + .common = { + .reg = 0x04, + .update_bit = BIT(26), + .hw.init = CLK_HW_INIT_PARENTS_DATA("pll-cpu-l", osc24M, + &ccu_nm_ops, + CLK_SET_RATE_UNGATE | + CLK_IS_CRITICAL), + }, +}; +static const struct clk_parent_data pll_cpu_l_hws[] = { + { .hw = &pll_cpu_l_clk.common.hw }, +}; + +#define SUN55I_A523_PLL_CPU_DSU_REG 0x08 +static struct ccu_nm pll_cpu_dsu_clk = { + .enable = BIT(27), + .lock = BIT(28), + .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 20, 108), + .m = _SUNXI_CCU_DIV(0, 3), /* M1 */ + .common = { + .reg = 0x08, + .update_bit = BIT(26), + .hw.init = CLK_HW_INIT_PARENTS_DATA("pll-cpu-dsu", osc24M, + &ccu_nm_ops, + CLK_SET_RATE_UNGATE | + CLK_IS_CRITICAL), + }, +}; +static const struct clk_parent_data pll_cpu_dsu_hws[] = { + { .hw = &pll_cpu_dsu_clk.common.hw }, +}; + + +#define SUN55I_A523_PLL_CPU_B_REG 0x0c +static struct ccu_nm pll_cpu_b_clk = { + .enable = BIT(27), + .lock = BIT(28), + .n = _SUNXI_CCU_MULT_OFFSET_MIN_MAX(8, 8, 0, 20, 108), + .m = _SUNXI_CCU_DIV(0, 3), /* M1 */ + .common = { + .reg = 0x0c, + .update_bit = BIT(26), + .hw.init = CLK_HW_INIT_PARENTS_DATA("pll-cpu-b", osc24M, + &ccu_nm_ops, + CLK_SET_RATE_UNGATE | + CLK_IS_CRITICAL), + }, +}; +static const struct clk_parent_data pll_cpu_b_hws[] = { + { .hw = &pll_cpu_b_clk.common.hw }, +}; + +static SUNXI_CCU_MP_DATA_WITH_MUX(pll_cpu_l_div_clk, "pll-cpu-l-div", + pll_cpu_l_hws, 0x060, + 0, 0, /* no M */ + 16, 2, /* P */ + 0, 0, /* no mux */ + CLK_SET_RATE_PARENT); /* flags */ +static SUNXI_CCU_MP_DATA_WITH_MUX(pll_cpu_b_div_clk, "pll-cpu-b-div", + pll_cpu_b_hws, 0x064, + 0, 0, /* no M */ + 16, 2, /* P */ + 0, 0, /* no mux */ + CLK_SET_RATE_PARENT); /* flags */ +static SUNXI_CCU_MP_DATA_WITH_MUX(pll_cpu_dsu_div_clk, "pll-cpu-dsu-div", + pll_cpu_dsu_hws, 0x06c, + 0, 0, /* no M */ + 16, 2, /* P */ + 0, 0, /* no mux */ + CLK_SET_RATE_PARENT); /* flags */ + +static const struct clk_parent_data cpu_l_parents[] = { + { .fw_name = "hosc" }, + { .fw_name = "losc" }, + { .fw_name = "iosc" }, + { .hw = &pll_cpu_l_div_clk.common.hw }, + { .fw_name = "pll-periph0-600M" }, + { .hw = &pll_cpu_0_clk.common.hw }, +}; +static SUNXI_CCU_MUX_DATA(cpu_l_clk, "cpu-l", cpu_l_parents, 0x60, + 24, 3, /* mux */ + CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); + + +static const struct clk_parent_data cpu_b_parents[] = { + { .fw_name = "hosc" }, + { .fw_name = "losc" }, + { .fw_name = "iosc" }, + { .hw = &pll_cpu_b_div_clk.common.hw }, + { .fw_name = "pll-periph0-600M" }, + { .hw = &pll_cpu_0_clk.common.hw }, +}; +static SUNXI_CCU_MUX_DATA(cpu_b_clk, "cpu-b", cpu_b_parents, 0x64, + 24, 3, /* mux */ + CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); + +/* + * Register 0x68 holds gate bits for the two cluster clocks and the DSU. + * We leave them alone in the kernel, that's something for TF-A or the SCP. + */ + +static const struct clk_parent_data cpu_dsu_parents[] = { + { .fw_name = "hosc" }, + { .fw_name = "losc" }, + { .fw_name = "iosc" }, + { .hw = &pll_cpu_dsu_div_clk.common.hw }, + { .fw_name = "pll-periph0-2x" }, + { .fw_name = "pll-periph0-600M" }, +}; +static SUNXI_CCU_MUX_DATA(cpu_dsu_clk, "cpu-dsu", cpu_dsu_parents, 0x6c, + 24, 3, /* mux */ + CLK_SET_RATE_PARENT | CLK_IS_CRITICAL); + +static struct ccu_common *sun55i_a523_cpu_ccu_clks[] = { + &pll_cpu_0_clk.common, + &pll_cpu_l_clk.common, + &pll_cpu_b_clk.common, + &pll_cpu_dsu_clk.common, + &pll_cpu_l_div_clk.common, + &pll_cpu_b_div_clk.common, + &pll_cpu_dsu_div_clk.common, + &cpu_l_clk.common, + &cpu_b_clk.common, + &cpu_dsu_clk.common, +}; + +static struct clk_hw_onecell_data sun55i_a523_cpu_hw_clks = { + .hws = { + [CLK_PLL_CPU_0] = &pll_cpu_0_clk.common.hw, + [CLK_PLL_CPU_L] = &pll_cpu_l_clk.common.hw, + [CLK_PLL_CPU_DSU] = &pll_cpu_dsu_clk.common.hw, + [CLK_PLL_CPU_B] = &pll_cpu_b_clk.common.hw, + [CLK_DIV_CPU_L] = &pll_cpu_l_div_clk.common.hw, + [CLK_DIV_CPU_DSU] = &pll_cpu_dsu_div_clk.common.hw, + [CLK_DIV_CPU_B] = &pll_cpu_b_div_clk.common.hw, + [CLK_CPU_L] = &cpu_l_clk.common.hw, + [CLK_CPU_DSU] = &cpu_dsu_clk.common.hw, + [CLK_CPU_B] = &cpu_b_clk.common.hw, + }, + .num = CLK_NUMBER, +}; + +static const struct sunxi_ccu_desc sun55i_a523_cpu_ccu_desc = { + .ccu_clks = sun55i_a523_cpu_ccu_clks, + .num_ccu_clks = ARRAY_SIZE(sun55i_a523_cpu_ccu_clks), + + .hw_clks = &sun55i_a523_cpu_hw_clks, +}; + +static const u32 pll_regs[] = { + SUN55I_A523_PLL_CPU_0_REG, + SUN55I_A523_PLL_CPU_L_REG, + SUN55I_A523_PLL_CPU_DSU_REG, + SUN55I_A523_PLL_CPU_B_REG, +}; + +static struct ccu_mux_nb sun55i_a523_cpu_l_nb = { + .common = &cpu_l_clk.common, + .cm = &cpu_l_clk.mux, + .delay_us = 1, /* manual doesn't really say */ + .bypass_index = 4, /* PLL_PERI0@600MHz, as recommended by manual */ +}; +static struct ccu_mux_nb sun55i_a523_cpu_b_nb = { + .common = &cpu_b_clk.common, + .cm = &cpu_b_clk.mux, + .delay_us = 1, /* manual doesn't really say */ + .bypass_index = 4, /* PLL_PERI0@600MHz, as recommended by manual */ +}; + +static int sun55i_a523_cpu_ccu_probe(struct platform_device *pdev) +{ + const struct sunxi_ccu_desc *desc; + void __iomem *reg; + int i, ret; + u32 val; + + desc = of_device_get_match_data(&pdev->dev); + if (!desc) + return -EINVAL; + + reg = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(reg)) + return PTR_ERR(reg); + + /* + * The user manual recommends to keep the PLLs running, and just + * gate their output if they are not needed, to avoid interference + * with other PLLs, since they share a power domain. + * To comply with this, we use this output gate as the CCF enable bit, + * so we need to enable all PLLs here. Chances are the bootloader has + * already enabled at least one PLL, so check if it's already running + * and locked, before touching it. + * We set the enable, the LDO and the lock bits, and clear dividers. + */ + for (i = 0; i < ARRAY_SIZE(pll_regs); i++) { + val = readl(reg + pll_regs[i]); + if ((val & GENMASK(31, 28)) != GENMASK(31, 28)) { + val |= BIT(31) | BIT(30) | BIT(29) | BIT(26); + val &= ~GENMASK(21, 16); /* covering PLL_P and PLL_M0 */ + writel(val, reg + pll_regs[i]); + } + } + + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, desc); + if (ret) + return ret; + + /* Reparent CPU during CPU PLL rate changes */ + ccu_mux_notifier_register(pll_cpu_l_clk.common.hw.clk, + &sun55i_a523_cpu_l_nb); + ccu_mux_notifier_register(pll_cpu_b_clk.common.hw.clk, + &sun55i_a523_cpu_b_nb); + + return ret; +} + +static const struct of_device_id sun55i_a523_cpu_ccu_ids[] = { + { + .compatible = "allwinner,sun55i-a523-cpu-ccu", + .data = &sun55i_a523_cpu_ccu_desc, + }, + { } +}; + +static struct platform_driver sun55i_a523_cpu_ccu_driver = { + .probe = sun55i_a523_cpu_ccu_probe, + .driver = { + .name = "sun55i-a523-cpu-ccu", + .suppress_bind_attrs = true, + .of_match_table = sun55i_a523_cpu_ccu_ids, + }, +}; +module_platform_driver(sun55i_a523_cpu_ccu_driver); + +MODULE_IMPORT_NS("SUNXI_CCU"); +MODULE_LICENSE("GPL"); diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.h b/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.h new file mode 100644 index 0000000000000..484343b2c4fa6 --- /dev/null +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523-cpu.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright 2025 Arm Ltd. + */ + +#ifndef _CCU_SUN55I_A523_CPU_H +#define _CCU_SUN55I_A523_CPU_H + +#include + +/* The PLL clocks itself and the pure divider clocks are not exported. */ + +#define CLK_PLL_CPU_0 0 +#define CLK_PLL_CPU_L 1 +#define CLK_PLL_CPU_DSU 2 +#define CLK_PLL_CPU_B 3 + +#define CLK_DIV_CPU_L 4 +#define CLK_DIV_CPU_DSU 5 +#define CLK_DIV_CPU_B 6 + +#define CLK_NUMBER (CLK_CPU_B + 1) + +#endif /* _CCU_SUN55I_A523_CPU_H */ From patchwork Wed Sep 3 00:09:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 1090 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2C1933993 for ; Wed, 3 Sep 2025 00:09:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858191; cv=none; b=jl7ZJ7fVLz+mir4Te8VwL+JkFnbx9kzFSXF/698ruwmpu2bLSm5XJVN8zTrvW24PemcDP2Rs5Bzt2hIb5TjVwGFYrJf29k0I6PrP6Vw2VAKi/pa66h675eSjTo11wkqO0+nTC5M+Mh+V/wV3GluuKHaYOFZt+IParR/wdUxeqbw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756858191; c=relaxed/simple; bh=7jaBhKP6aquj0QdiYHOsMLmAdxNIil2qtgUj/DA20FA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IQilRhnLHsPycI77hFK29iYRRMWLod3omrVLNO4479eLT2qNPfFbqNWhgrW3h5KcsxPo6ImVAbIajvnFjr3lquUXsFxO3RVT+6Z9s2g7adIZXsG7lEzaZdCpXfGwM4dI5HNJCZlpvpvhcwity/PIXTk3X6YYyom1jWAGM4fR6Xs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A7548176A; Tue, 2 Sep 2025 17:09:40 -0700 (PDT) Received: from localhost.localdomain (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 411363F63F; Tue, 2 Sep 2025 17:09:47 -0700 (PDT) From: Andre Przywara To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jernej Skrabec , Chen-Yu Tsai , Samuel Holland Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, Mikhail Kalashnikov Subject: [PATCH 5/5] arm64: dts: allwinner: a523: add CPU clocks Date: Wed, 3 Sep 2025 01:09:10 +0100 Message-ID: <20250903000910.4860-6-andre.przywara@arm.com> X-Mailer: git-send-email 2.46.3 In-Reply-To: <20250903000910.4860-1-andre.przywara@arm.com> References: <20250903000910.4860-1-andre.przywara@arm.com> Precedence: bulk X-Mailing-List: linux-sunxi@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Status: O The Allwinner A523 family of SoCs feature a separate clock unit for the CPU PLLs and muxes, including one for the DSU interconnect. Add a DT node for the CPU clock controller, and list all the clocks from the other CCUs that this controller needs. Also list the clock source for each CPU: there is one clock for each cluster of four cores, suffixed L and B, for little and big (although all cores are of the same Cortex-A55 type). Signed-off-by: Andre Przywara --- .../arm64/boot/dts/allwinner/sun55i-a523.dtsi | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi index 6b6f2296bdff6..98a59d324bfeb 100644 --- a/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi +++ b/arch/arm64/boot/dts/allwinner/sun55i-a523.dtsi @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -24,6 +25,7 @@ cpu0: cpu@0 { device_type = "cpu"; reg = <0x000>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_L>; }; cpu1: cpu@100 { @@ -31,6 +33,7 @@ cpu1: cpu@100 { device_type = "cpu"; reg = <0x100>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_L>; }; cpu2: cpu@200 { @@ -38,6 +41,7 @@ cpu2: cpu@200 { device_type = "cpu"; reg = <0x200>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_L>; }; cpu3: cpu@300 { @@ -45,6 +49,7 @@ cpu3: cpu@300 { device_type = "cpu"; reg = <0x300>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_L>; }; cpu4: cpu@400 { @@ -52,6 +57,7 @@ cpu4: cpu@400 { device_type = "cpu"; reg = <0x400>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_B>; }; cpu5: cpu@500 { @@ -59,6 +65,7 @@ cpu5: cpu@500 { device_type = "cpu"; reg = <0x500>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_B>; }; cpu6: cpu@600 { @@ -66,6 +73,7 @@ cpu6: cpu@600 { device_type = "cpu"; reg = <0x600>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_B>; }; cpu7: cpu@700 { @@ -73,6 +81,7 @@ cpu7: cpu@700 { device_type = "cpu"; reg = <0x700>; enable-method = "psci"; + clocks = <&cpu_ccu CLK_CPU_B>; }; }; @@ -690,5 +699,18 @@ rtc: rtc@7090000 { clock-names = "bus", "hosc", "ahb"; #clock-cells = <1>; }; + + cpu_ccu: clock-controller@8817000 { + compatible = "allwinner,sun55i-a523-cpu-ccu"; + reg = <0x08817000 0x80>; + clocks = <&osc24M>, <&rtc CLK_OSC32K>, + <&rtc CLK_IOSC>, <&ccu CLK_PLL_PERIPH0_2X>, + <&ccu CLK_PLL_PERIPH0_600M>; + clock-names = "hosc", "losc", + "iosc", "pll-periph0-2x", + "pll-periph0-600M"; + #clock-cells = <1>; + #reset-cells = <1>; + }; }; };