From patchwork Mon Nov 11 00:47:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 13870092 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 41E4FD12D5C for ; Mon, 11 Nov 2024 00:51: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: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:In-Reply-To:References:List-Owner; bh=38NnZ2EarcDv6FFhhXaHRg7picMMQozPz05s5IjUNV0=; b=RykLQjK13ufJy+08J42ojkMRSh a+gojqgxDPRziboNGW++ebrZBLMe2vVsQ+V9KHC0oODV7gf33XG3GLlBdb2iCZegexwS0UNNK56ei CemeNb5YF3Vox/jiEMDWFHqE0tidL9zkoZZYsL0efEaRgVzyj320Euvw0OQ9ffpxbH8F1g+W4kWLP iMWuGfpkTybVPCpua7Hu3nCaperzzz4Wr3+56t1YJlj6KXgxfkM28JKtge4DDTmFz3Y1dOVaEb9zt Re/RtV9swdQ6/78hi641Luq80LqlNwbBWziXLU32mUlIOn+bpNiTWBCKW6WQLCq2cep6dNUXezOWE f65t0cqg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tAIeF-0000000FxRL-2UTd; Mon, 11 Nov 2024 00:51:19 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tAIaf-0000000FwtS-0Jk4 for linux-arm-kernel@lists.infradead.org; Mon, 11 Nov 2024 00:47:40 +0000 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 66DB113D5; Sun, 10 Nov 2024 16:48:02 -0800 (PST) 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 796333F66E; Sun, 10 Nov 2024 16:47:30 -0800 (PST) From: Andre Przywara To: Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland Cc: Philipp Zabel , Icenowy Zheng , linux-clk@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 0/7] clk: sunxi-ng: add A523 clock support Date: Mon, 11 Nov 2024 00:47:15 +0000 Message-ID: <20241111004722.10130-1-andre.przywara@arm.com> X-Mailer: git-send-email 2.46.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241110_164737_346757_911C3AA3 X-CRM114-Status: GOOD ( 22.01 ) 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 Hi, this series introduces basic clock support for the Allwinner A523 family of SoCs (comprising A523, A527, T527). [1] The SoC contains *four* CCU components, aside from the usual main clock device and the PRCM clock (in the always-on-domain), there is an MCU clock and a DSP clock. This series just adds support for the first two, the other two don't seem to be required for the basic functionality. The clock tree of each SoC has always been individual, even though the main clock *types* mostly remain the same. This time we see two slight variations: There is an MP clock without the P (shift) part, and there is one with two dividers instead of one divider and one shift field. The first three patches add support for these new clock types. The remaining four patches then add the DT bindings documentation and describe all the clocks and their relationship in gory detail. I split the binding patches up, since they contain the header files naming the clocks, let me know if they should be in one patch instead. Interestingly the Allwinner BSP has switched to using the existing sunxi CCU framework for modelling the clocks (they had their own way before), so we could theoretically use their code. However when I started working on this about a year ago, their files had a GPL-3.0-only license header, which, according to my research, makes them incompatible for mainline inclusion. I thus started from "scratch" (adjusting the D1 driver, really). Meanwhile they seem to have changed the license, and a quick comparison turned up some differences, some of which seem to be bugs on their, some on my side, probably. I hope having such a "reference" helps the mainline code quality, as people can help the review by comparing code. Also we only have a user manual for the A523, but its siblings introduce more clocks (HDMI, NPU, etc.). I tried to close the gaps by looking at some BSP code, and also by probing registers on actual hardware, to see which clocks implement which bits. Given the level of detail required in CCU drivers, I am certain there are many bugs in there, also many things that can be improved. But after starring and editing this for weeks, I feel like it's time for the community to have a look, so please help with the review, and also test. Based on v6.12-rc1. Cheers, Andre [1] https://linux-sunxi.org/A523#Family_of_sun55iw3 Andre Przywara (7): clk: sunxi-ng: mp: Add SUNXI_CCU_P_DATA_WITH_MUX_GATE wrapper clk: sunxi-ng: mp: introduce dual-divider clock clk: sunxi-ng: mp: provide wrapper for setting feature flags dt-bindings: clk: sunxi-ng: add compatible for the A523 CCU dt-bindings: clk: sunxi-ng: add compatible for the A523 PRCM-CCU clk: sunxi-ng: Add support for the A523/T527 CCU clk: sunxi-ng: add support for the A523/T527 PRCM CCU .../clock/allwinner,sun4i-a10-ccu.yaml | 76 +- drivers/clk/sunxi-ng/Kconfig | 10 + drivers/clk/sunxi-ng/Makefile | 4 + drivers/clk/sunxi-ng/ccu-sun55i-a523-r.c | 245 +++ drivers/clk/sunxi-ng/ccu-sun55i-a523-r.h | 14 + drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 1628 +++++++++++++++++ drivers/clk/sunxi-ng/ccu-sun55i-a523.h | 14 + drivers/clk/sunxi-ng/ccu_common.h | 1 + drivers/clk/sunxi-ng/ccu_mp.c | 51 +- drivers/clk/sunxi-ng/ccu_mp.h | 39 +- include/dt-bindings/clock/sun55i-a523-ccu.h | 187 ++ include/dt-bindings/clock/sun55i-a523-r-ccu.h | 36 + include/dt-bindings/reset/sun55i-a523-ccu.h | 87 + include/dt-bindings/reset/sun55i-a523-r-ccu.h | 25 + 14 files changed, 2377 insertions(+), 40 deletions(-) create mode 100644 drivers/clk/sunxi-ng/ccu-sun55i-a523-r.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun55i-a523-r.h create mode 100644 drivers/clk/sunxi-ng/ccu-sun55i-a523.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun55i-a523.h create mode 100644 include/dt-bindings/clock/sun55i-a523-ccu.h create mode 100644 include/dt-bindings/clock/sun55i-a523-r-ccu.h create mode 100644 include/dt-bindings/reset/sun55i-a523-ccu.h create mode 100644 include/dt-bindings/reset/sun55i-a523-r-ccu.h