Skip to content

Commit 828dea3

Browse files
committed
clk: sunxi-ng: sun55i-a523-ccu: Add missing NPU module clock
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. 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. Also move the .num value to after the list of clks to make it obvious that it should be updated when new clks are added. Reviewed-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://patch.msgid.link/20250911174710.3149589-4-wens@kernel.org Signed-off-by: Chen-Yu Tsai <wens@csie.org>
1 parent 391aa26 commit 828dea3

2 files changed

Lines changed: 18 additions & 17 deletions

File tree

drivers/clk/sunxi-ng/ccu-sun55i-a523.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
#include <linux/module.h>
1212
#include <linux/platform_device.h>
1313

14+
#include <dt-bindings/clock/sun55i-a523-ccu.h>
15+
#include <dt-bindings/reset/sun55i-a523-ccu.h>
16+
1417
#include "../clk.h"
1518

1619
#include "ccu_common.h"
@@ -25,8 +28,6 @@
2528
#include "ccu_nkmp.h"
2629
#include "ccu_nm.h"
2730

28-
#include "ccu-sun55i-a523.h"
29-
3031
/*
3132
* The 24 MHz oscillator, the root of most of the clock tree.
3233
* .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,
486487

487488
static SUNXI_CCU_GATE_HWS(bus_ve_clk, "bus-ve", ahb_hws, 0x69c, BIT(0), 0);
488489

490+
static const struct clk_hw *npu_parents[] = {
491+
&pll_periph0_480M_clk.common.hw,
492+
&pll_periph0_600M_clk.hw,
493+
&pll_periph0_800M_clk.common.hw,
494+
&pll_npu_2x_clk.hw,
495+
};
496+
static SUNXI_CCU_M_HW_WITH_MUX_GATE(npu_clk, "npu", npu_parents, 0x6e0,
497+
0, 5, /* M */
498+
24, 3, /* mux */
499+
BIT(31), /* gate */
500+
CLK_SET_RATE_PARENT);
501+
489502
static SUNXI_CCU_GATE_HWS(bus_dma_clk, "bus-dma", ahb_hws, 0x70c, BIT(0), 0);
490503

491504
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[] = {
12171230
&bus_ce_sys_clk.common,
12181231
&ve_clk.common,
12191232
&bus_ve_clk.common,
1233+
&npu_clk.common,
12201234
&bus_dma_clk.common,
12211235
&bus_msgbox_clk.common,
12221236
&bus_spinlock_clk.common,
@@ -1343,7 +1357,6 @@ static struct ccu_common *sun55i_a523_ccu_clks[] = {
13431357
};
13441358

13451359
static struct clk_hw_onecell_data sun55i_a523_hw_clks = {
1346-
.num = CLK_NUMBER,
13471360
.hws = {
13481361
[CLK_PLL_DDR0] = &pll_ddr_clk.common.hw,
13491362
[CLK_PLL_PERIPH0_4X] = &pll_periph0_4x_clk.common.hw,
@@ -1524,7 +1537,9 @@ static struct clk_hw_onecell_data sun55i_a523_hw_clks = {
15241537
[CLK_FANOUT0] = &fanout0_clk.common.hw,
15251538
[CLK_FANOUT1] = &fanout1_clk.common.hw,
15261539
[CLK_FANOUT2] = &fanout2_clk.common.hw,
1540+
[CLK_NPU] = &npu_clk.common.hw,
15271541
},
1542+
.num = CLK_NPU + 1,
15281543
};
15291544

15301545
static struct ccu_reset_map sun55i_a523_ccu_resets[] = {

drivers/clk/sunxi-ng/ccu-sun55i-a523.h

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)