From mboxrd@z Thu Jan 1 00:00:00 1970 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 40602CA0FED for ; Fri, 5 Sep 2025 19:27:11 +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: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TxtwaIgK/ilGaevgS/QXu33JA08nGUlHSkbxZZNR1RA=; b=iqrf7eRAv1W7SIda+LmQQQ6wNL puoPtotT+EGIKPTzDYEDaKXJXXxd2Eu4U2jqBswL51xzuzrPF0GqIuqE1UMQn7//kLCHGjRdHbIxx nMtn8vr8iChWcyJ6mY5A6E6e6dUl8whZL2d54DxCci9RANJUzGeJZu14Hu31GvPeR1ZC1o5vl1AI4 NBtMqhH4Jd8NLhTmA1fBiO4ufhhXUDlMK9zwHwk+DuNOTJuDhZp+h3WKfyGbudEHVh5xY41wE74I7 QfZIpWcc98oT6SOV7NFYfBppj3pb2T8Q6QBJmolevraL6vzqqNtAvMYryI0pIBx6MUB75j0dLO70p 4ZOfsXMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uuc5O-000000047Mz-49lt; Fri, 05 Sep 2025 19:27:02 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uuY8s-00000002f3O-3ELr for linux-arm-kernel@lists.infradead.org; Fri, 05 Sep 2025 15:14:23 +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 E228F152B; Fri, 5 Sep 2025 08:14:13 -0700 (PDT) Received: from donnerap (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9D9693F6A8; Fri, 5 Sep 2025 08:14:20 -0700 (PDT) Date: Fri, 5 Sep 2025 16:14:18 +0100 From: Andre Przywara To: Chen-Yu Tsai Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Stephen Boyd , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , linux-sunxi@lists.linux.dev, linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/8] clk: sunxi-ng: sun55i-a523-ccu: Add missing NPU module clock Message-ID: <20250905161418.30562637@donnerap> In-Reply-To: <20250830170901.1996227-5-wens@kernel.org> References: <20250830170901.1996227-1-wens@kernel.org> <20250830170901.1996227-5-wens@kernel.org> Organization: ARM X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.32; aarch64-unknown-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250905_081422_892725_E0BADED0 X-CRM114-Status: GOOD ( 28.62 ) 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 On Sun, 31 Aug 2025 01:08:57 +0800 Chen-Yu Tsai wrote: Hi, > From: Chen-Yu Tsai > > The main clock controller on the A523/T527 has the NPU's module clock. > It was missing from the original submission, likely because that was > based on the A523 user manual; the A523 is marketed without the NPU. Ah, sorry, I missed that one. I think I spotted writable bits in that register, but didn't find a clue what this clock was about. Anyway, checked the bits against the T527 manual, they match up. > Also, merge the private header back into the driver code itself. The > header only contains a macro containing the total number of clocks. > This has to be updated every time a missing clock gets added. Having > it in a separate file doesn't help the process. Instead just drop the > macro, and thus the header no longer has any reason to exist. Interesting, looks nice, and solves Krzysztof's complaint the other day about the binding header inclusion missing from the driver as well. Just one thought: > Signed-off-by: Chen-Yu Tsai > --- > drivers/clk/sunxi-ng/ccu-sun55i-a523.c | 21 ++++++++++++++++++--- > drivers/clk/sunxi-ng/ccu-sun55i-a523.h | 14 -------------- > 2 files changed, 18 insertions(+), 17 deletions(-) > delete mode 100644 drivers/clk/sunxi-ng/ccu-sun55i-a523.h > > diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c > index 1a9a1cb869e2..88405b624dc5 100644 > --- a/drivers/clk/sunxi-ng/ccu-sun55i-a523.c > +++ b/drivers/clk/sunxi-ng/ccu-sun55i-a523.c > @@ -11,6 +11,9 @@ > #include > #include > > +#include > +#include > + Should we have the number #define here, at a more central location? Seems a bit buried down in there. And then use a plural name while at it: #define NUM_CLOCKS CLK_NPU + 1 Alternatively, put .num behind .hws below, so that the last clock and the number definition are close together? Cheers, Andre > #include "../clk.h" > > #include "ccu_common.h" > @@ -25,8 +28,6 @@ > #include "ccu_nkmp.h" > #include "ccu_nm.h" > > -#include "ccu-sun55i-a523.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 > @@ -486,6 +487,18 @@ static SUNXI_CCU_M_HW_WITH_MUX_GATE(ve_clk, "ve", ve_parents, 0x690, > > static SUNXI_CCU_GATE_HWS(bus_ve_clk, "bus-ve", ahb_hws, 0x69c, BIT(0), 0); > > +static const struct clk_hw *npu_parents[] = { > + &pll_periph0_480M_clk.common.hw, > + &pll_periph0_600M_clk.hw, > + &pll_periph0_800M_clk.common.hw, > + &pll_npu_2x_clk.hw, > +}; > +static SUNXI_CCU_M_HW_WITH_MUX_GATE(npu_clk, "npu", npu_parents, 0x6e0, > + 0, 5, /* M */ > + 24, 3, /* mux */ > + BIT(31), /* gate */ > + CLK_SET_RATE_PARENT); > + > static SUNXI_CCU_GATE_HWS(bus_dma_clk, "bus-dma", ahb_hws, 0x70c, BIT(0), 0); > > static SUNXI_CCU_GATE_HWS(bus_msgbox_clk, "bus-msgbox", ahb_hws, 0x71c, > @@ -1217,6 +1230,7 @@ static struct ccu_common *sun55i_a523_ccu_clks[] = { > &bus_ce_sys_clk.common, > &ve_clk.common, > &bus_ve_clk.common, > + &npu_clk.common, > &bus_dma_clk.common, > &bus_msgbox_clk.common, > &bus_spinlock_clk.common, > @@ -1343,7 +1357,7 @@ static struct ccu_common *sun55i_a523_ccu_clks[] = { > }; > > static struct clk_hw_onecell_data sun55i_a523_hw_clks = { > - .num = CLK_NUMBER, > + .num = CLK_NPU + 1, > .hws = { > [CLK_PLL_DDR0] = &pll_ddr_clk.common.hw, > [CLK_PLL_PERIPH0_4X] = &pll_periph0_4x_clk.common.hw, > @@ -1524,6 +1538,7 @@ static struct clk_hw_onecell_data sun55i_a523_hw_clks = { > [CLK_FANOUT0] = &fanout0_clk.common.hw, > [CLK_FANOUT1] = &fanout1_clk.common.hw, > [CLK_FANOUT2] = &fanout2_clk.common.hw, > + [CLK_NPU] = &npu_clk.common.hw, > }, > }; > > diff --git a/drivers/clk/sunxi-ng/ccu-sun55i-a523.h b/drivers/clk/sunxi-ng/ccu-sun55i-a523.h > deleted file mode 100644 > index fc8dd42f1b47..000000000000 > --- a/drivers/clk/sunxi-ng/ccu-sun55i-a523.h > +++ /dev/null > @@ -1,14 +0,0 @@ > -/* SPDX-License-Identifier: GPL-2.0 */ > -/* > - * Copyright 2024 Arm Ltd. > - */ > - > -#ifndef _CCU_SUN55I_A523_H > -#define _CCU_SUN55I_A523_H > - > -#include > -#include > - > -#define CLK_NUMBER (CLK_FANOUT2 + 1) > - > -#endif /* _CCU_SUN55I_A523_H */