clk: sunxi-ng: describe CCUs as tables, add the Allwinner B288
Subsystems (4)
cover clk: sunxi-ng: describe CCUs as tables, add the Allwinner B288
sunxi-ng drivers describe each clock as a static structure, list it twice (ccu_clks and hw_clks) and keep a separate reset table. This adds a table front end: a SoC lists its clocks once, indexed by their binding clock ID, and the core builds the usual ccu_* clocks from that table. Bus resets come from the gate entries, and clocks that a SoC generation shares come from templates. Existing drivers and bindings are not affected.
The first user is the B288. Its driver is 212 lines here, against 749 in the current style.
This replaces patches 01 and 02 of the B288 series v4:
https://lore.kernel.org/r/[email protected]
Pablo Mazzini (3):
dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
clk: sunxi-ng: add a table front end
clk: sunxi-ng: add Allwinner B288 CCU driver
.../clock/allwinner,sun4i-a10-ccu.yaml | 1 + drivers/clk/sunxi-ng/Kconfig | 5 + drivers/clk/sunxi-ng/Makefile | 2 + drivers/clk/sunxi-ng/ccu-sun8i-b288.c | 212 ++++++++ drivers/clk/sunxi-ng/ccu-sun8i-b288.h | 11 + drivers/clk/sunxi-ng/ccu_table.c | 510 ++++++++++++++++++ drivers/clk/sunxi-ng/ccu_table.h | 233 ++++++++ include/dt-bindings/clock/sun8i-b288-ccu.h | 82 +++ include/dt-bindings/reset/sun8i-b288-ccu.h | 45 ++ 9 files changed, 1101 insertions(+) create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.h create mode 100644 drivers/clk/sunxi-ng/ccu_table.c create mode 100644 drivers/clk/sunxi-ng/ccu_table.h create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
Signature · 1 line
2.52.0
PATCH 1/3 dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
The B288 (sun8iw10p1) is a dual Cortex-A7 SoC used in e-book readers. Its CCU needs only the two oscillator inputs, so it fits the existing schema without changes.
---
Moved unchanged from the B288 series v4.
--- .../clock/allwinner,sun4i-a10-ccu.yaml | 1 + include/dt-bindings/clock/sun8i-b288-ccu.h | 82 +++++++++++++++++++ include/dt-bindings/reset/sun8i-b288-ccu.h | 45 ++++++++++ 3 files changed, 128 insertions(+) create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.h
Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-ccu.yaml +1 -0
@@ -28,6 +28,7 @@ properties: - allwinner,sun8i-a33-ccu - allwinner,sun8i-a83t-ccu - allwinner,sun8i-a83t-r-ccu + - allwinner,sun8i-b288-ccu - allwinner,sun8i-h3-ccu - allwinner,sun8i-h3-r-ccu - allwinner,sun8i-r40-ccu
include/dt-bindings/clock/sun8i-b288-ccu.h new file +82 -0
82 lines not on this page · raw message
include/dt-bindings/reset/sun8i-b288-ccu.h new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH 1/3] dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] dt-bindings: clock: sun8i-b288-ccu: inconsistent clock and reset macro names --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: clock: sun8i-b288-ccu: inconsistent clock and reset macro names
--
commit fb1a7b2f6dc03665d0714b13f4a0587e1bb34467
Author: Pablo Mazzini <[email protected]>
dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
This commit adds the Allwinner B288 CCU compatible string to the sun4i-a10-ccu binding schema and introduces the clock and reset DT binding headers for the SoC.
Quoted 6 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +0
-0@@ -0,0 +1,82 @@
[ ... ]
Quoted 9 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +9
-0+#define CLK_NAND 18 +#define CLK_MMC0 19 +#define CLK_MMC1 20 +#define CLK_MMC2 21 +#define CLK_MMC3 22 +#define CLK_SPI0 23 +#define CLK_SPI1 24 +#define CLK_SPI2 25 +#define CLK_DRAM 26
[ ... ]
Quoted 6 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +6
-0+#define CLK_BUS_THS 32 +#define CLK_BUS_NAND 33 +#define CLK_BUS_SDMMC0_BUS 34 +#define CLK_BUS_SDMMC1_BUS 35 +#define CLK_BUS_SDMMC2_BUS 36 +#define CLK_BUS_SDMMC3_BUS 37
[ ... ]
Quoted 9 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +9
-0+#define CLK_BUS_USBOHCI0 46 +#define CLK_BUS_USBEHCI0 47 +#define CLK_BUS_USBOTG 48 +#define CLK_BUS_DE 49 +#define CLK_BUS_EE 50 +#define CLK_BUS_TCON0 51 +#define CLK_BUS_CSI 52 +#define CLK_BUS_ADDA 53 +#define CLK_BUS_SDRAM 54
[ ... ]
Quoted 3 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +3
-0+#define CLK_BUS_TWI0 63 +#define CLK_BUS_TWI1 64 +#define CLK_BUS_TWI2 65
[ ... ]
Quoted 6 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +0
-0@@ -0,0 +1,45 @@
[ ... ]
Quoted 4 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +4
-0+#define RST_BUS_MMC0 2 +#define RST_BUS_MMC1 3 +#define RST_BUS_MMC2 4 +#define RST_BUS_MMC3 5
[ ... ]
Quoted 4 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +4
-0+#define RST_USBPHY0 14 +#define RST_BUS_OHCI0 15 +#define RST_BUS_EHCI0 16 +#define RST_BUS_OTG 17
[ ... ]
Quoted 1 line
+#define
RST_BUS_DRAM25
[ ... ]
include/dt-bindings/reset/sun8i-b288-ccu.h line 41
Quoted 3 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +3
-0+#define RST_BUS_I2C0 34 +#define RST_BUS_I2C1 35 +#define RST_BUS_I2C2 36
[Severity: Low]
Could these macro names be aligned between the clock and reset headers and with existing sunxi-ng CCU bindings before they become ABI?
Specifically:
- CLK_BUS_SDMMC0_BUS..CLK_BUS_SDMMC3_BUS vs. CLK_BUS_MMC0..CLK_BUS_MMC3 (matching CLK_MMC0..3 and RST_BUS_MMC0..3, without the redundant _BUS suffix)
- CLK_BUS_USBOHCI0, CLK_BUS_USBEHCI0, and CLK_BUS_USBOTG vs. CLK_BUS_OHCI0, CLK_BUS_EHCI0, and CLK_BUS_OTG (matching RST_BUS_OHCI0, RST_BUS_EHCI0, and RST_BUS_OTG)
- CLK_BUS_SDRAM vs. CLK_BUS_DRAM (matching CLK_DRAM and RST_BUS_DRAM)
- CLK_BUS_TWI0..CLK_BUS_TWI2 vs. CLK_BUS_I2C0..CLK_BUS_I2C2 (matching RST_BUS_I2C0..2)
- RST_USBPHY0 vs. RST_USB_PHY0 (matching other Allwinner CCU reset headers)
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Re: [PATCH 1/3] dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
Quoted 2 lines · On Sun, Nov 8, 2026 at 4:11 PM <[email protected]> wrote:
Could these macro names be aligned between the clock and reset headers and with existing sunxi-ng CCU bindings before they become ABI?
Yes, I'll use the names the other sunxi-ng bindings use in v2.
Quoted 113 lines · On Sun, Nov 8, 2026 at 4:11 PM <[email protected]> wrote:
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] dt-bindings: clock: sun8i-b288-ccu: inconsistent clock and reset macro names
--commit
fb1a7b2f6dc03665d0714b13f4a0587e1bb34467
Author: Pablo Mazzini <[email protected]>dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
This commit adds the Allwinner B288 CCU compatible string to the sun4i-a10-ccu binding schema and introduces the clock and reset DT binding headers for the SoC.
Quoted 6 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +0
-0@@ -0,0 +1,82 @@[ ... ]
Quoted 9 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +9
-0+#define CLK_NAND 18 +#define CLK_MMC0 19 +#define CLK_MMC1 20 +#define CLK_MMC2 21 +#define CLK_MMC3 22 +#define CLK_SPI0 23 +#define CLK_SPI1 24 +#define CLK_SPI2 25 +#define CLK_DRAM 26[ ... ]
Quoted 6 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +6
-0+#define CLK_BUS_THS 32 +#define CLK_BUS_NAND 33 +#define CLK_BUS_SDMMC0_BUS 34 +#define CLK_BUS_SDMMC1_BUS 35 +#define CLK_BUS_SDMMC2_BUS 36 +#define CLK_BUS_SDMMC3_BUS 37[ ... ]
Quoted 9 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +9
-0+#define CLK_BUS_USBOHCI0 46 +#define CLK_BUS_USBEHCI0 47 +#define CLK_BUS_USBOTG 48 +#define CLK_BUS_DE 49 +#define CLK_BUS_EE 50 +#define CLK_BUS_TCON0 51 +#define CLK_BUS_CSI 52 +#define CLK_BUS_ADDA 53 +#define CLK_BUS_SDRAM 54[ ... ]
Quoted 3 lines
include/dt-bindings/clock/sun8i-b288-ccu.h new file +3
-0+#define CLK_BUS_TWI0 63 +#define CLK_BUS_TWI1 64 +#define CLK_BUS_TWI2 65[ ... ]
Quoted 6 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +0
-0@@ -0,0 +1,45 @@[ ... ]
Quoted 4 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +4
-0+#define RST_BUS_MMC0 2 +#define RST_BUS_MMC1 3 +#define RST_BUS_MMC2 4 +#define RST_BUS_MMC3 5[ ... ]
Quoted 4 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +4
-0+#define RST_USBPHY0 14 +#define RST_BUS_OHCI0 15 +#define RST_BUS_EHCI0 16 +#define RST_BUS_OTG 17[ ... ]
Quoted 1 line
+#define
RST_BUS_DRAM25[ ... ]
include/dt-bindings/reset/sun8i-b288-ccu.h line 41
Quoted 3 lines
include/dt-bindings/reset/sun8i-b288-ccu.h new file +3
-0+#define RST_BUS_I2C0 34 +#define RST_BUS_I2C1 35 +#define RST_BUS_I2C2 36[Severity: Low]
Could these macro names be aligned between the clock and reset headers and with existing sunxi-ng CCU bindings before they become ABI?Specifically:
- CLK_BUS_SDMMC0_BUS..CLK_BUS_SDMMC3_BUS vs. CLK_BUS_MMC0..CLK_BUS_MMC3 (matching CLK_MMC0..3 and RST_BUS_MMC0..3, without the redundant_BUSsuffix)
-CLK_BUS_USBOHCI0,CLK_BUS_USBEHCI0, andCLK_BUS_USBOTGvs.CLK_BUS_OHCI0,CLK_BUS_EHCI0, andCLK_BUS_OTG(matchingRST_BUS_OHCI0,RST_BUS_EHCI0, andRST_BUS_OTG)
-CLK_BUS_SDRAMvs.CLK_BUS_DRAM(matchingCLK_DRAMandRST_BUS_DRAM)
- CLK_BUS_TWI0..CLK_BUS_TWI2 vs. CLK_BUS_I2C0..CLK_BUS_I2C2 (matching RST_BUS_I2C0..2)
-RST_USBPHY0vs.RST_USB_PHY0(matching other Allwinner CCU reset headers)--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH 2/3 clk: sunxi-ng: add a table front end
In reply to Pablo MazziniLet a SoC describe its CCU as one table indexed by DT clock ID, instead of a structure per clock plus the ccu_clks and hw_clks lists and a reset table. The core builds the usual ccu_* clocks from it at probe time, derives each bus gate's reset from the generation's register layout, and provides the clocks that a generation shares as templates.
Only the A31 generation is described for now.
--- drivers/clk/sunxi-ng/Makefile | 1 + drivers/clk/sunxi-ng/ccu_table.c | 510 +++++++++++++++++++++++++++++++ drivers/clk/sunxi-ng/ccu_table.h | 233 ++++++++++++++ 3 files changed, 744 insertions(+) create mode 100644 drivers/clk/sunxi-ng/ccu_table.c create mode 100644 drivers/clk/sunxi-ng/ccu_table.h
drivers/clk/sunxi-ng/Makefile +1 -0
@@ -6,6 +6,7 @@ obj-$(CONFIG_SUNXI_CCU) += sunxi-ccu.o sunxi-ccu-y += ccu_common.o sunxi-ccu-y += ccu_mmc_timing.o sunxi-ccu-y += ccu_reset.o +sunxi-ccu-y += ccu_table.o # Base clock types sunxi-ccu-y += ccu_div.o
drivers/clk/sunxi-ng/ccu_table.c new file +510 -0
510 lines not on this page · raw message
drivers/clk/sunxi-ng/ccu_table.h new file +233 -0
233 lines not on this page · raw message
Signature · 1 line
2.52.0
PATCH 3/3 clk: sunxi-ng: add Allwinner B288 CCU driver
In reply to Pablo MazziniCovers the PLLs, the CPU/AHB/APB tree, the module clocks and the bus gates and resets, described as a table.
--- drivers/clk/sunxi-ng/Kconfig | 5 + drivers/clk/sunxi-ng/Makefile | 1 + drivers/clk/sunxi-ng/ccu-sun8i-b288.c | 212 ++++++++++++++++++++++++++ drivers/clk/sunxi-ng/ccu-sun8i-b288.h | 11 ++ 4 files changed, 229 insertions(+) create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.h
drivers/clk/sunxi-ng/Kconfig +5 -0
@@ -88,6 +88,11 @@ config SUN6I_RTC_CCU default ARCH_SUNXI depends on MACH_SUN8I || ARM64 || RISCV || COMPILE_TEST +config SUN8I_B288_CCU + tristate "Support for the Allwinner B288 CCU" + default ARCH_SUNXI + depends on MACH_SUN8I || COMPILE_TEST + config SUN8I_A23_CCU tristate "Support for the Allwinner A23 CCU" default ARCH_SUNXI
drivers/clk/sunxi-ng/Makefile +1 -0
@@ -41,6 +41,7 @@ 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 obj-$(CONFIG_SUN6I_RTC_CCU) += sun6i-rtc-ccu.o +obj-$(CONFIG_SUN8I_B288_CCU) += ccu-sun8i-b288.o obj-$(CONFIG_SUN8I_A23_CCU) += sun8i-a23-ccu.o obj-$(CONFIG_SUN8I_A33_CCU) += sun8i-a33-ccu.o obj-$(CONFIG_SUN8I_A83T_CCU) += sun8i-a83t-ccu.o
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +212 -0
212 lines not on this page · raw message
drivers/clk/sunxi-ng/ccu-sun8i-b288.h new file +11 -0
@@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _CCU_SUN8I_B288_H_ +#define _CCU_SUN8I_B288_H_ + +#include <dt-bindings/clock/sun8i-b288-ccu.h> +#include <dt-bindings/reset/sun8i-b288-ccu.h> + +#define CLK_NUMBER (CLK_MMC1_OUTPUT + 1) +#define RST_NUMBER (RST_BUS_KEYADC + 1) + +#endif /* _CCU_SUN8I_B288_H_ */
Signature · 1 line
2.52.0
[email protected]
AI reviewRe: [PATCH 3/3] clk: sunxi-ng: add Allwinner B288 CCU driver
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [High] clk: sunxi-ng: missing CPUX mux and PLL notifiers in sun8i-b288-ccu - [Low] clk: sunxi-ng…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] clk: sunxi-ng: missing CPUX mux and PLL notifiers in sun8i-b288-ccu
- [Low] clk: sunxi-ng: inconsistent module object name for sun8i-b288-ccu
--
commit 2d968133b3c297b695cc7e5349c65174d952448b
Author: Pablo Mazzini <[email protected]>
clk: sunxi-ng: add Allwinner B288 CCU driver
This commit adds a table-based sunxi-ng Clock Control Unit driver for the Allwinner B288 (sun8iw10p1) SoC.
drivers/clk/sunxi-ng/Makefile obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o · line 47
Quoted 12 lines
drivers/clk/sunxi-ng/Makefile +1
-0@@ -41,6 +41,7 @@ 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 obj-$(CONFIG_SUN6I_RTC_CCU) += sun6i-rtc-ccu.o +obj-$(CONFIG_SUN8I_B288_CCU) += ccu-sun8i-b288.o obj-$(CONFIG_SUN8I_A23_CCU) += sun8i-a23-ccu.o obj-$(CONFIG_SUN8I_A33_CCU) += sun8i-a33-ccu.o obj-$(CONFIG_SUN8I_A83T_CCU) += sun8i-a83t-ccu.o
[Severity: Low]
Should this build sun8i-b288-ccu.o (with sun8i-b288-ccu-y += ccu-sun8i-b288.o below) like the other drivers in this Makefile? Adding ccu-sun8i-b288.o directly names the module ccu-sun8i-b288.ko instead of sun8i-b288-ccu.ko.
Quoted 5 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +0
-0
[ ... ]
Quoted 9 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +9
-0+static const struct ccu_tbl_clk sun8i_b288_clks[CLK_NUMBER ] = { +/* +* PLL_24M @ 0x034 -- B288 only. It feeds the PLLs 24 MHz whatever +* the crystal: it converts a 26 MHz one and is bypassed with a +* 24 MHz one. +*/ +CCU_TBL_FIXED_RATE (CLK_PLL_24M ,"pll-24m" ,CCU_TBL_HOSC ,24000000 ), + +CCU_TBL_STD1 (CLK_PLL_CPUX ,"pll-cpux" ,PLL_CPU ,CLK_PLL_24M ,UNGATE ),
[ ... ]
drivers/clk/sunxi-ng/ccu-sun8i-b288.c line 74
Quoted 1 line
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +1
-0+ CCU_TBL_STD(CLK_CPUX, "cpux", CPUX, cpux_parents, CRIT | RATE_PARENT),
[Severity: High]
Can changing the rate of CLK_CPUX hang the system because no CPU mux or PLL rate-change notifiers are registered?
CLK_CPUX sets CLK_SET_RATE_PARENT, so clk_set_rate() propagates to pll-cpux and updates its A31-style NKMP factors in place while the CPU is running from it. Other A31-family CCU drivers that allow rate propagation from cpux to pll-cpux (such as ccu-sun50i-a64.c, ccu-sun8i-a33.c and ccu-sun8i-h3.c) register ccu_mux_notifier_register() to temporarily reparent cpux to the 24 MHz oscillator during the rate change and ccu_pll_notifier_register() to gate and ungate the PLL after updating its factors, whereas sunxi_ccu_table_platform_probe() registers neither.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Re: [PATCH 3/3] clk: sunxi-ng: add Allwinner B288 CCU driver
Quoted 2 lines · On Sun, Nov 8, 2026 at 4:14 PM <[email protected]> wrote:
Should this build sun8i-b288-ccu.o (with sun8i-b288-ccu-y += ccu-sun8i-b288.o below) like the other drivers in this
Makefile?
Yes, I'll fix it in v2.
Quoted 73 lines · On Sun, Nov 8, 2026 at 4:14 PM <[email protected]> wrote:
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [High] clk: sunxi-ng: missing CPUX mux and PLL notifiers in sun8i-b288-ccu
- [Low] clk: sunxi-ng: inconsistent module object name for sun8i-b288-ccu
--commit
2d968133b3c297b695cc7e5349c65174d952448b
Author: Pablo Mazzini <[email protected]>clk: sunxi-ng: add Allwinner B288 CCU driver
This commit adds a table-based sunxi-ng Clock Control Unit driver for the Allwinner B288 (sun8iw10p1) SoC.
drivers/clk/sunxi-ng/Makefile obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o · line 47
Quoted 12 lines
drivers/clk/sunxi-ng/Makefile +1
-0@@ -41,6 +41,7 @@ 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 obj-$(CONFIG_SUN6I_RTC_CCU) += sun6i-rtc-ccu.o +obj-$(CONFIG_SUN8I_B288_CCU) += ccu-sun8i-b288.o obj-$(CONFIG_SUN8I_A23_CCU) += sun8i-a23-ccu.o obj-$(CONFIG_SUN8I_A33_CCU) += sun8i-a33-ccu.o obj-$(CONFIG_SUN8I_A83T_CCU) += sun8i-a83t-ccu.o[Severity: Low]
Should this build sun8i-b288-ccu.o (with sun8i-b288-ccu-y += ccu-sun8i-b288.o below) like the other drivers in thisMakefile? Adding ccu-sun8i-b288.o directly names the module ccu-sun8i-b288.ko instead of sun8i-b288-ccu.ko.Quoted 5 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +0
-0[ ... ]
Quoted 9 lines
drivers/clk/sunxi-ng/ccu-sun8i-b288.c new file +9
-0+static const struct ccu_tbl_clk sun8i_b288_clks[CLK_NUMBER ] = { +/* +* PLL_24M @ 0x034 -- B288 only. It feeds the PLLs 24 MHz whatever +* the crystal: it converts a 26 MHz one and is bypassed with a +* 24 MHz one. +*/ +CCU_TBL_FIXED_RATE (CLK_PLL_24M ,"pll-24m" ,CCU_TBL_HOSC ,24000000 ), + +CCU_TBL_STD1 (CLK_PLL_CPUX ,"pll-cpux" ,PLL_CPU ,CLK_PLL_24M ,UNGATE ),[ ... ]
Quoted 1 line
+
CCU_TBL_STD(CLK_CPUX, "cpux", CPUX, cpux_parents, CRIT | RATE_PARENT),[Severity: High]
Can changing the rate ofCLK_CPUXhang the system because no CPU mux or PLL rate-change notifiers are registered?
CLK_CPUXsetsCLK_SET_RATE_PARENT, soclk_set_rate()propagates to pll-cpux and updates its A31-style NKMP factors in place while the CPU is running from it. Other A31-family CCU drivers that allow rate propagation from cpux to pll-cpux (such asccu-sun50i-a64.c,ccu-sun8i-a33.candccu-sun8i-h3.c) registerccu_mux_notifier_register()to temporarily reparent cpux to the 24 MHz oscillator during the rate change andccu_pll_notifier_register()to gate and ungate the PLL after updating its factors, whereassunxi_ccu_table_platform_probe()registers neither.--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
Chen-Yu Tsai
maintainerQuoted 8 lines · Pablo Mazzini
sunxi-ng drivers describe each clock as a static structure, list it twice (
ccu_clksandhw_clks) and keep a separate reset table. This adds a table front end: a SoC lists its clocks once, indexed by their binding clock ID, and the core builds the usual ccu_* clocks from that table. Bus resets come from the gate entries, and clocks that a SoC generation shares come from templates. Existing drivers and bindings are not affected.
I think you're going to have to give more justification. What do we gain? What are the trade-offs? Building all the data at run-time means we end up consuming even more memory. The tables from init time typically aren't dropped when a driver is built as a module.
ChenYu
Quoted 34 lines
The first user is the B288. Its driver is 212 lines here, against 749 in the current style.
This replaces patches 01 and 02 of the B288 series v4:
https://lore.kernel.org/r/[email protected]Pablo Mazzini (3):
dt-bindings: clock: sun4i-a10-ccu: add Allwinner B288
clk: sunxi-ng: add a table front end
clk: sunxi-ng: add Allwinner B288 CCU driver.../clock/allwinner,sun4i-a10-ccu.yaml | 1 + drivers/clk/sunxi-ng/Kconfig | 5 + drivers/clk/sunxi-ng/Makefile | 2 + drivers/clk/sunxi-ng/ccu-sun8i-b288.c | 212 ++++++++ drivers/clk/sunxi-ng/ccu-sun8i-b288.h | 11 + drivers/clk/sunxi-ng/ccu_table.c | 510 ++++++++++++++++++ drivers/clk/sunxi-ng/ccu_table.h | 233 ++++++++ include/dt-bindings/clock/sun8i-b288-ccu.h | 82 +++ include/dt-bindings/reset/sun8i-b288-ccu.h | 45 ++ 9 files changed, 1101 insertions(+) create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.c create mode 100644 drivers/clk/sunxi-ng/ccu-sun8i-b288.h create mode 100644 drivers/clk/sunxi-ng/ccu_table.c create mode 100644 drivers/clk/sunxi-ng/ccu_table.h create mode 100644 include/dt-bindings/clock/sun8i-b288-ccu.h create mode 100644 include/dt-bindings/reset/sun8i-b288-ccu.hbase-commit:
6628e7d4c6b25c8d18f1345e3a20d21829aae7e4--
2.52.0