From 49b2b0a2b6782609a9977095d9c80391de463044 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 9 May 2022 00:29:31 -0500 Subject: clk: sunxi: Store the array sizes in the CCU descriptor The reset array size is currently used for bounds checking in the reset driver. The same bounds check should really be done in the clock driver. Currently, the array size is provided to the reset driver separately from the CCU descriptor, which is a bit strange. Let's do this the usual way, with the array sizes next to the arrays themselves. Signed-off-by: Samuel Holland Reviewed-by: Andre Przywara [Andre: add F1C100s support] Signed-off-by: Andre Przywara --- include/clk/sunxi.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/clk/sunxi.h b/include/clk/sunxi.h index c4a9dee5ebf..f1717a5e954 100644 --- a/include/clk/sunxi.h +++ b/include/clk/sunxi.h @@ -70,6 +70,8 @@ struct ccu_reset { struct ccu_desc { const struct ccu_clk_gate *gates; const struct ccu_reset *resets; + u8 num_gates; + u8 num_resets; }; /** -- cgit v1.2.3 From d39088ad9c97fa612c480475b18759a3931c41fd Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 9 May 2022 00:29:33 -0500 Subject: reset: sunxi: Get the reset count from the CCU descriptor This allows all of the clock drivers to use a common bind function. Signed-off-by: Samuel Holland Reviewed-by: Andre Przywara [Andre: add F1C100s support] Signed-off-by: Andre Przywara --- include/clk/sunxi.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/clk/sunxi.h b/include/clk/sunxi.h index f1717a5e954..a70119304a7 100644 --- a/include/clk/sunxi.h +++ b/include/clk/sunxi.h @@ -85,6 +85,12 @@ struct ccu_priv { const struct ccu_desc *desc; }; +/** + * sunxi_clk_bind - common sunxi clock bind + * @dev: clock device + */ +int sunxi_clk_bind(struct udevice *dev); + /** * sunxi_clk_probe - common sunxi clock probe * @dev: clock device @@ -97,9 +103,8 @@ extern struct clk_ops sunxi_clk_ops; * sunxi_reset_bind() - reset binding * * @dev: reset device - * @count: reset count * Return: 0 success, or error value */ -int sunxi_reset_bind(struct udevice *dev, ulong count); +int sunxi_reset_bind(struct udevice *dev); #endif /* _CLK_SUNXI_H */ -- cgit v1.2.3 From 46fa23f9eecd0fc32215a194e7a7f5f5abe67cdc Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 9 May 2022 00:29:34 -0500 Subject: clk: sunxi: Use a single driver for all variants Now that all of the variants use the same bind/probe functions and ops, there is no need to have a separate driver for each variant. Since most SoCs contain two variants (the main CCU and PRCM CCU), this saves a bit of firmware size and RAM. Signed-off-by: Samuel Holland Reviewed-by: Andre Przywara [Andre: add F1C100s support] Signed-off-by: Andre Przywara --- include/clk/sunxi.h | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'include') diff --git a/include/clk/sunxi.h b/include/clk/sunxi.h index a70119304a7..65da03ee60c 100644 --- a/include/clk/sunxi.h +++ b/include/clk/sunxi.h @@ -85,18 +85,6 @@ struct ccu_priv { const struct ccu_desc *desc; }; -/** - * sunxi_clk_bind - common sunxi clock bind - * @dev: clock device - */ -int sunxi_clk_bind(struct udevice *dev); - -/** - * sunxi_clk_probe - common sunxi clock probe - * @dev: clock device - */ -int sunxi_clk_probe(struct udevice *dev); - extern struct clk_ops sunxi_clk_ops; /** -- cgit v1.2.3 From 5af97b6ff74e3ce7312b3ef533c55f73430fb7d5 Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 9 May 2022 00:29:35 -0500 Subject: clk: sunxi: Convert driver private data to platform data All of the driver private data should really be platform data since it is determined statically (selected by the compatible string or extracted from the devicetree). Move everything to platform data, so it can be provided when binding the driver. This is useful for SPL, or for instantiating the driver as part of an MFD. Signed-off-by: Samuel Holland Reviewed-by: Andre Przywara Signed-off-by: Andre Przywara --- include/clk/sunxi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/clk/sunxi.h b/include/clk/sunxi.h index 65da03ee60c..640b5cfc331 100644 --- a/include/clk/sunxi.h +++ b/include/clk/sunxi.h @@ -75,12 +75,12 @@ struct ccu_desc { }; /** - * struct ccu_priv - sunxi clock control unit + * struct ccu_plat - sunxi clock control unit platform data * * @base: base address * @desc: ccu descriptor */ -struct ccu_priv { +struct ccu_plat { void *base; const struct ccu_desc *desc; }; -- cgit v1.2.3 From 66391263f8484aae41cae80753f31c0edc6138af Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 9 May 2022 00:29:37 -0500 Subject: reset: sunxi: Reuse the platform data from the clock driver The clock and reset drivers use the exact same platform data. Simplify them by sharing the object. This is safe because the parent device (the clock device) always gets its driver model callbacks run first. Signed-off-by: Samuel Holland Acked-by: Andre Przywara Signed-off-by: Andre Przywara --- include/clk/sunxi.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'include') diff --git a/include/clk/sunxi.h b/include/clk/sunxi.h index 640b5cfc331..c298195c51e 100644 --- a/include/clk/sunxi.h +++ b/include/clk/sunxi.h @@ -87,12 +87,4 @@ struct ccu_plat { extern struct clk_ops sunxi_clk_ops; -/** - * sunxi_reset_bind() - reset binding - * - * @dev: reset device - * Return: 0 success, or error value - */ -int sunxi_reset_bind(struct udevice *dev); - #endif /* _CLK_SUNXI_H */ -- cgit v1.2.3 From 93118438243ba428b7f3949a3ba14a9ae54b7381 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Mon, 4 Jul 2022 15:10:03 +0100 Subject: sunxi: configs: streamline include/configs/sun*.h wrappers For mostly historic reasons we had configuration headers for each Allwinner CPU "family". These days they are mostly just including one common header, with the rest being somewhat empty. There were attempts to remove them, and to just use the one common header to begin with, but this has implications to the build system, which me might not be ready for, yet. To document this behaviour, and to avoid something sneaking in over time, make those files all the same (minus the CPU family name and the copyrights), and add a comment explaining that. This makes it easier to just remove those files later on, when needed and possible. Signed-off-by: Andre Przywara Reviewed-by: Tom Rini --- include/configs/sun4i.h | 10 ++-------- include/configs/sun50i.h | 19 ++----------------- include/configs/sun5i.h | 10 ++-------- include/configs/sun6i.h | 7 ++----- include/configs/sun7i.h | 6 ++---- include/configs/sun8i.h | 13 ++----------- include/configs/sun9i.h | 11 ++--------- include/configs/suniv.h | 7 ++----- 8 files changed, 16 insertions(+), 67 deletions(-) (limited to 'include') diff --git a/include/configs/sun4i.h b/include/configs/sun4i.h index 0e1baa91bb1..70d451f2243 100644 --- a/include/configs/sun4i.h +++ b/include/configs/sun4i.h @@ -2,18 +2,12 @@ /* * (C) Copyright 2012-2013 Henrik Nordstrom * - * Configuration settings for the Allwinner A10 (sun4i) CPU + * Placeholder wrapper to allow addressing Allwinner A10 (sun4i) CPU + * based devices separately. Please do not add anything in here. */ #ifndef __CONFIG_H #define __CONFIG_H -/* - * A10 specific configuration - */ - -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ diff --git a/include/configs/sun50i.h b/include/configs/sun50i.h index bc2e3a3d008..dfcb321d425 100644 --- a/include/configs/sun50i.h +++ b/include/configs/sun50i.h @@ -1,26 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Configuration settings for the Allwinner A64 (sun50i) CPU + * Placeholder wrapper to allow addressing Allwinner A64 (and later) sun50i + * CPU based devices separately. Please do not add anything in here. */ - #ifndef __CONFIG_H #define __CONFIG_H -/* - * A64 specific configuration - */ - -#ifndef CONFIG_SUN50I_GEN_H6 -#define GICD_BASE 0x1c81000 -#define GICC_BASE 0x1c82000 -#else -#define GICD_BASE 0x3021000 -#define GICC_BASE 0x3022000 -#endif - -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ diff --git a/include/configs/sun5i.h b/include/configs/sun5i.h index ada18de7537..30173078548 100644 --- a/include/configs/sun5i.h +++ b/include/configs/sun5i.h @@ -2,18 +2,12 @@ /* * (C) Copyright 2012-2013 Henrik Nordstrom * - * Configuration settings for the Allwinner A13 (sun5i) CPU + * Placeholder wrapper to allow addressing Allwinner A13 (sun5i) CPU + * based devices separately. Please do not add anything in here. */ #ifndef __CONFIG_H #define __CONFIG_H -/* - * High Level Configuration Options - */ - -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ diff --git a/include/configs/sun6i.h b/include/configs/sun6i.h index 0b1fedda108..cbe04ac3c23 100644 --- a/include/configs/sun6i.h +++ b/include/configs/sun6i.h @@ -4,15 +4,12 @@ * (C) Copyright 2013 Luke Kenneth Casson Leighton * (C) Copyright 2013 Maxime Ripard * - * Configuration settings for the Allwinner A31 (sun6i) CPU + * Placeholder wrapper to allow addressing Allwinner A31 (sun6i) CPU + * based devices separately. Please do not add anything in here. */ - #ifndef __CONFIG_H #define __CONFIG_H -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h index bc2779fa26f..ad24ab98b52 100644 --- a/include/configs/sun7i.h +++ b/include/configs/sun7i.h @@ -3,14 +3,12 @@ * (C) Copyright 2012-2013 Henrik Nordstrom * (C) Copyright 2013 Luke Kenneth Casson Leighton * - * Configuration settings for the Allwinner A20 (sun7i) CPU + * Placeholder wrapper to allow addressing Allwinner A20 (sun7i) CPU + * based devices separately. Please do not add anything in here. */ #ifndef __CONFIG_H #define __CONFIG_H -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h index 106139d0904..b6cd8d39a8f 100644 --- a/include/configs/sun8i.h +++ b/include/configs/sun8i.h @@ -2,21 +2,12 @@ /* * (C) Copyright 2014 Chen-Yu Tsai * - * Configuration settings for the Allwinner A23 (sun8i) CPU + * Placeholder wrapper to allow addressing Allwinner A23 (and later) sun8i + * CPU based devices separately. Please do not add anything in here. */ - #ifndef __CONFIG_H #define __CONFIG_H -/* - * A23 specific configuration - */ - -#include - -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ diff --git a/include/configs/sun9i.h b/include/configs/sun9i.h index 6ee08cf0d95..6bf5fc3f66a 100644 --- a/include/configs/sun9i.h +++ b/include/configs/sun9i.h @@ -2,19 +2,12 @@ /* * (C) Copyright 2015 Hans de Goede * - * Configuration settings for the Allwinner A80 (sun9i) CPU + * Placeholder wrapper to allow addressing Allwinner A80 (sun9i) CPU + * based devices separately. Please do not add anything in here. */ - #ifndef __CONFIG_H #define __CONFIG_H -/* - * A80 specific configuration - */ - -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ diff --git a/include/configs/suniv.h b/include/configs/suniv.h index 6118cd5e1a6..9cc1a77f6c8 100644 --- a/include/configs/suniv.h +++ b/include/configs/suniv.h @@ -1,14 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0+ */ /* - * Configuration settings for new Allwinner F-series (suniv) CPU + * Placeholder wrapper to allow addressing Allwinner F-series (suniv) CPU + * based devices separately. Please do not add anything in here. */ - #ifndef __CONFIG_H #define __CONFIG_H -/* - * Include common sunxi configuration where most the settings are - */ #include #endif /* __CONFIG_H */ -- cgit v1.2.3