Skip to content

Commit c8c525b

Browse files
smaeulmripard
authored andcommitted
clk: sunxi-ng: Allow drivers to be built as modules
While it is useful to build all of the CCU drivers at once, only 1-3 of them will be loaded at a time, or possibly none of them if the kernel is booted on a non-sunxi platform. These CCU drivers are relatively large; 32-bit drivers have 30-50k of data each, while the 64-bit ones are 50-75k due to the increased pointer overhead. About half of that data comes from relocations. Let's allow the user to build these drivers as modules so only the necessary data is loaded. As a first step, convert the CCUs that are already platform drivers. When the drivers are built as modules, normally the file name becomes the module name. However, the current file names are inconsistent with the <platform>-<peripheral> name used everywhere else: the devicetree bindings, the platform driver names, and the Kconfig symbols. Use Makfile logic to rename the modules so they follow the usual pattern. Signed-off-by: Samuel Holland <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 551b62b commit c8c525b

12 files changed

+98
-47
lines changed

drivers/clk/sunxi-ng/Kconfig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,22 @@ config SUNIV_F1C100S_CCU
1313
depends on MACH_SUNIV || COMPILE_TEST
1414

1515
config SUN50I_A64_CCU
16-
bool "Support for the Allwinner A64 CCU"
16+
tristate "Support for the Allwinner A64 CCU"
1717
default ARM64 && ARCH_SUNXI
1818
depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
1919

2020
config SUN50I_A100_CCU
21-
bool "Support for the Allwinner A100 CCU"
21+
tristate "Support for the Allwinner A100 CCU"
2222
default ARM64 && ARCH_SUNXI
2323
depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
2424

2525
config SUN50I_A100_R_CCU
26-
bool "Support for the Allwinner A100 PRCM CCU"
26+
tristate "Support for the Allwinner A100 PRCM CCU"
2727
default ARM64 && ARCH_SUNXI
2828
depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
2929

3030
config SUN50I_H6_CCU
31-
bool "Support for the Allwinner H6 CCU"
31+
tristate "Support for the Allwinner H6 CCU"
3232
default ARM64 && ARCH_SUNXI
3333
depends on (ARM64 && ARCH_SUNXI) || COMPILE_TEST
3434

@@ -69,7 +69,7 @@ config SUN8I_A33_CCU
6969
depends on MACH_SUN8I || COMPILE_TEST
7070

7171
config SUN8I_A83T_CCU
72-
bool "Support for the Allwinner A83T CCU"
72+
tristate "Support for the Allwinner A83T CCU"
7373
default MACH_SUN8I
7474
depends on MACH_SUN8I || COMPILE_TEST
7575

@@ -84,16 +84,16 @@ config SUN8I_V3S_CCU
8484
depends on MACH_SUN8I || COMPILE_TEST
8585

8686
config SUN8I_DE2_CCU
87-
bool "Support for the Allwinner SoCs DE2 CCU"
87+
tristate "Support for the Allwinner SoCs DE2 CCU"
8888
default MACH_SUN8I || (ARM64 && ARCH_SUNXI)
8989

9090
config SUN8I_R40_CCU
91-
bool "Support for the Allwinner R40 CCU"
91+
tristate "Support for the Allwinner R40 CCU"
9292
default MACH_SUN8I
9393
depends on MACH_SUN8I || COMPILE_TEST
9494

9595
config SUN9I_A80_CCU
96-
bool "Support for the Allwinner A80 CCU"
96+
tristate "Support for the Allwinner A80 CCU"
9797
default MACH_SUN9I
9898
depends on MACH_SUN9I || COMPILE_TEST
9999

drivers/clk/sunxi-ng/Makefile

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,46 @@ obj-y += ccu_nm.o
2121
obj-y += ccu_mp.o
2222

2323
# SoC support
24-
obj-$(CONFIG_SUNIV_F1C100S_CCU) += ccu-suniv-f1c100s.o
25-
obj-$(CONFIG_SUN50I_A64_CCU) += ccu-sun50i-a64.o
26-
obj-$(CONFIG_SUN50I_A100_CCU) += ccu-sun50i-a100.o
27-
obj-$(CONFIG_SUN50I_A100_R_CCU) += ccu-sun50i-a100-r.o
28-
obj-$(CONFIG_SUN50I_H6_CCU) += ccu-sun50i-h6.o
29-
obj-$(CONFIG_SUN50I_H616_CCU) += ccu-sun50i-h616.o
30-
obj-$(CONFIG_SUN50I_H6_R_CCU) += ccu-sun50i-h6-r.o
31-
obj-$(CONFIG_SUN4I_A10_CCU) += ccu-sun4i-a10.o
32-
obj-$(CONFIG_SUN5I_CCU) += ccu-sun5i.o
33-
obj-$(CONFIG_SUN6I_A31_CCU) += ccu-sun6i-a31.o
34-
obj-$(CONFIG_SUN8I_A23_CCU) += ccu-sun8i-a23.o
35-
obj-$(CONFIG_SUN8I_A33_CCU) += ccu-sun8i-a33.o
36-
obj-$(CONFIG_SUN8I_A83T_CCU) += ccu-sun8i-a83t.o
37-
obj-$(CONFIG_SUN8I_H3_CCU) += ccu-sun8i-h3.o
38-
obj-$(CONFIG_SUN8I_V3S_CCU) += ccu-sun8i-v3s.o
39-
obj-$(CONFIG_SUN8I_DE2_CCU) += ccu-sun8i-de2.o
40-
obj-$(CONFIG_SUN8I_R_CCU) += ccu-sun8i-r.o
41-
obj-$(CONFIG_SUN8I_R40_CCU) += ccu-sun8i-r40.o
42-
obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80.o
43-
obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-de.o
44-
obj-$(CONFIG_SUN9I_A80_CCU) += ccu-sun9i-a80-usb.o
24+
obj-$(CONFIG_SUNIV_F1C100S_CCU) += suniv-f1c100s-ccu.o
25+
obj-$(CONFIG_SUN50I_A64_CCU) += sun50i-a64-ccu.o
26+
obj-$(CONFIG_SUN50I_A100_CCU) += sun50i-a100-ccu.o
27+
obj-$(CONFIG_SUN50I_A100_R_CCU) += sun50i-a100-r-ccu.o
28+
obj-$(CONFIG_SUN50I_H6_CCU) += sun50i-h6-ccu.o
29+
obj-$(CONFIG_SUN50I_H6_R_CCU) += sun50i-h6-r-ccu.o
30+
obj-$(CONFIG_SUN50I_H616_CCU) += sun50i-h616-ccu.o
31+
obj-$(CONFIG_SUN4I_A10_CCU) += sun4i-a10-ccu.o
32+
obj-$(CONFIG_SUN5I_CCU) += sun5i-ccu.o
33+
obj-$(CONFIG_SUN6I_A31_CCU) += sun6i-a31-ccu.o
34+
obj-$(CONFIG_SUN8I_A23_CCU) += sun8i-a23-ccu.o
35+
obj-$(CONFIG_SUN8I_A33_CCU) += sun8i-a33-ccu.o
36+
obj-$(CONFIG_SUN8I_A83T_CCU) += sun8i-a83t-ccu.o
37+
obj-$(CONFIG_SUN8I_H3_CCU) += sun8i-h3-ccu.o
38+
obj-$(CONFIG_SUN8I_R40_CCU) += sun8i-r40-ccu.o
39+
obj-$(CONFIG_SUN8I_V3S_CCU) += sun8i-v3s-ccu.o
40+
obj-$(CONFIG_SUN8I_DE2_CCU) += sun8i-de2-ccu.o
41+
obj-$(CONFIG_SUN8I_R_CCU) += sun8i-r-ccu.o
42+
obj-$(CONFIG_SUN9I_A80_CCU) += sun9i-a80-ccu.o
43+
obj-$(CONFIG_SUN9I_A80_CCU) += sun9i-a80-de-ccu.o
44+
obj-$(CONFIG_SUN9I_A80_CCU) += sun9i-a80-usb-ccu.o
45+
46+
suniv-f1c100s-ccu-y += ccu-suniv-f1c100s.o
47+
sun50i-a64-ccu-y += ccu-sun50i-a64.o
48+
sun50i-a100-ccu-y += ccu-sun50i-a100.o
49+
sun50i-a100-r-ccu-y += ccu-sun50i-a100-r.o
50+
sun50i-h6-ccu-y += ccu-sun50i-h6.o
51+
sun50i-h6-r-ccu-y += ccu-sun50i-h6-r.o
52+
sun50i-h616-ccu-y += ccu-sun50i-h616.o
53+
sun4i-a10-ccu-y += ccu-sun4i-a10.o
54+
sun5i-ccu-y += ccu-sun5i.o
55+
sun6i-a31-ccu-y += ccu-sun6i-a31.o
56+
sun8i-a23-ccu-y += ccu-sun8i-a23.o
57+
sun8i-a33-ccu-y += ccu-sun8i-a33.o
58+
sun8i-a83t-ccu-y += ccu-sun8i-a83t.o
59+
sun8i-h3-ccu-y += ccu-sun8i-h3.o
60+
sun8i-r40-ccu-y += ccu-sun8i-r40.o
61+
sun8i-v3s-ccu-y += ccu-sun8i-v3s.o
62+
sun8i-de2-ccu-y += ccu-sun8i-de2.o
63+
sun8i-r-ccu-y += ccu-sun8i-r.o
64+
sun9i-a80-ccu-y += ccu-sun9i-a80.o
65+
sun9i-a80-de-ccu-y += ccu-sun9i-a80-de.o
66+
sun9i-a80-usb-ccu-y += ccu-sun9i-a80-usb.o

drivers/clk/sunxi-ng/ccu-sun50i-a100-r.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#include <linux/clk-provider.h>
77
#include <linux/module.h>
8-
#include <linux/of_address.h>
98
#include <linux/platform_device.h>
109

1110
#include "ccu_common.h"
@@ -213,3 +212,6 @@ static struct platform_driver sun50i_a100_r_ccu_driver = {
213212
},
214213
};
215214
module_platform_driver(sun50i_a100_r_ccu_driver);
215+
216+
MODULE_IMPORT_NS(SUNXI_CCU);
217+
MODULE_LICENSE("GPL");

drivers/clk/sunxi-ng/ccu-sun50i-a100.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <linux/clk-provider.h>
77
#include <linux/io.h>
88
#include <linux/module.h>
9-
#include <linux/of_address.h>
109
#include <linux/platform_device.h>
1110

1211
#include "ccu_common.h"
@@ -1275,3 +1274,6 @@ static struct platform_driver sun50i_a100_ccu_driver = {
12751274
},
12761275
};
12771276
module_platform_driver(sun50i_a100_ccu_driver);
1277+
1278+
MODULE_IMPORT_NS(SUNXI_CCU);
1279+
MODULE_LICENSE("GPL");

drivers/clk/sunxi-ng/ccu-sun50i-a64.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <linux/clk-provider.h>
77
#include <linux/io.h>
8-
#include <linux/of_address.h>
8+
#include <linux/module.h>
99
#include <linux/platform_device.h>
1010

1111
#include "ccu_common.h"
@@ -980,4 +980,7 @@ static struct platform_driver sun50i_a64_ccu_driver = {
980980
.of_match_table = sun50i_a64_ccu_ids,
981981
},
982982
};
983-
builtin_platform_driver(sun50i_a64_ccu_driver);
983+
module_platform_driver(sun50i_a64_ccu_driver);
984+
985+
MODULE_IMPORT_NS(SUNXI_CCU);
986+
MODULE_LICENSE("GPL");

drivers/clk/sunxi-ng/ccu-sun50i-h6.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <linux/clk-provider.h>
77
#include <linux/io.h>
8-
#include <linux/of_address.h>
8+
#include <linux/module.h>
99
#include <linux/platform_device.h>
1010

1111
#include "ccu_common.h"
@@ -1254,4 +1254,7 @@ static struct platform_driver sun50i_h6_ccu_driver = {
12541254
.of_match_table = sun50i_h6_ccu_ids,
12551255
},
12561256
};
1257-
builtin_platform_driver(sun50i_h6_ccu_driver);
1257+
module_platform_driver(sun50i_h6_ccu_driver);
1258+
1259+
MODULE_IMPORT_NS(SUNXI_CCU);
1260+
MODULE_LICENSE("GPL");

drivers/clk/sunxi-ng/ccu-sun8i-a83t.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <linux/clk-provider.h>
77
#include <linux/io.h>
8-
#include <linux/of_address.h>
8+
#include <linux/module.h>
99
#include <linux/platform_device.h>
1010

1111
#include "ccu_common.h"
@@ -920,4 +920,7 @@ static struct platform_driver sun8i_a83t_ccu_driver = {
920920
.of_match_table = sun8i_a83t_ccu_ids,
921921
},
922922
};
923-
builtin_platform_driver(sun8i_a83t_ccu_driver);
923+
module_platform_driver(sun8i_a83t_ccu_driver);
924+
925+
MODULE_IMPORT_NS(SUNXI_CCU);
926+
MODULE_LICENSE("GPL");

drivers/clk/sunxi-ng/ccu-sun8i-de2.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
#include <linux/clk.h>
77
#include <linux/clk-provider.h>
8-
#include <linux/of_address.h>
9-
#include <linux/of_platform.h>
8+
#include <linux/module.h>
9+
#include <linux/of_device.h>
1010
#include <linux/platform_device.h>
1111
#include <linux/reset.h>
1212

@@ -394,4 +394,7 @@ static struct platform_driver sunxi_de2_clk_driver = {
394394
.of_match_table = sunxi_de2_clk_ids,
395395
},
396396
};
397-
builtin_platform_driver(sunxi_de2_clk_driver);
397+
module_platform_driver(sunxi_de2_clk_driver);
398+
399+
MODULE_IMPORT_NS(SUNXI_CCU);
400+
MODULE_LICENSE("GPL");

drivers/clk/sunxi-ng/ccu-sun8i-r40.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <linux/clk-provider.h>
77
#include <linux/io.h>
8+
#include <linux/module.h>
89
#include <linux/platform_device.h>
910
#include <linux/regmap.h>
1011

@@ -1371,4 +1372,7 @@ static struct platform_driver sun8i_r40_ccu_driver = {
13711372
.of_match_table = sun8i_r40_ccu_ids,
13721373
},
13731374
};
1374-
builtin_platform_driver(sun8i_r40_ccu_driver);
1375+
module_platform_driver(sun8i_r40_ccu_driver);
1376+
1377+
MODULE_IMPORT_NS(SUNXI_CCU);
1378+
MODULE_LICENSE("GPL");

drivers/clk/sunxi-ng/ccu-sun9i-a80-de.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
#include <linux/clk.h>
77
#include <linux/clk-provider.h>
8-
#include <linux/of_address.h>
8+
#include <linux/module.h>
99
#include <linux/platform_device.h>
1010
#include <linux/reset.h>
1111

@@ -270,4 +270,7 @@ static struct platform_driver sun9i_a80_de_clk_driver = {
270270
.of_match_table = sun9i_a80_de_clk_ids,
271271
},
272272
};
273-
builtin_platform_driver(sun9i_a80_de_clk_driver);
273+
module_platform_driver(sun9i_a80_de_clk_driver);
274+
275+
MODULE_IMPORT_NS(SUNXI_CCU);
276+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)