* [PATCH 1/2] clk: analogbits: Allow building the library as a module
@ 2023-07-17 21:03 Samuel Holland
2023-07-17 21:03 ` [PATCH 2/2] clk: sifive: Allow building the driver " Samuel Holland
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Holland @ 2023-07-17 21:03 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Samuel Holland, Paul Walmsley, linux-clk, linux-kernel
This library is only used by the SiFive PRCI driver. When that driver is
built as a module, it makes sense to build this library as a module too.
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
---
drivers/clk/analogbits/Kconfig | 2 +-
drivers/clk/analogbits/wrpll-cln28hpc.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/analogbits/Kconfig b/drivers/clk/analogbits/Kconfig
index 1e291b185438..7d73db0fcd49 100644
--- a/drivers/clk/analogbits/Kconfig
+++ b/drivers/clk/analogbits/Kconfig
@@ -1,3 +1,3 @@
# SPDX-License-Identifier: GPL-2.0-only
config CLK_ANALOGBITS_WRPLL_CLN28HPC
- bool
+ tristate
diff --git a/drivers/clk/analogbits/wrpll-cln28hpc.c b/drivers/clk/analogbits/wrpll-cln28hpc.c
index 09ca82356399..760b51031795 100644
--- a/drivers/clk/analogbits/wrpll-cln28hpc.c
+++ b/drivers/clk/analogbits/wrpll-cln28hpc.c
@@ -28,6 +28,7 @@
#include <linux/math64.h>
#include <linux/math.h>
#include <linux/minmax.h>
+#include <linux/module.h>
#include <linux/clk/analogbits-wrpll-cln28hpc.h>
@@ -312,6 +313,7 @@ int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate,
return 0;
}
+EXPORT_SYMBOL_GPL(wrpll_configure_for_rate);
/**
* wrpll_calc_output_rate() - calculate the PLL's target output rate
@@ -349,6 +351,7 @@ unsigned long wrpll_calc_output_rate(const struct wrpll_cfg *c,
return n;
}
+EXPORT_SYMBOL_GPL(wrpll_calc_output_rate);
/**
* wrpll_calc_max_lock_us() - return the time for the PLL to lock
@@ -366,3 +369,6 @@ unsigned int wrpll_calc_max_lock_us(const struct wrpll_cfg *c)
{
return MAX_LOCK_US;
}
+EXPORT_SYMBOL_GPL(wrpll_calc_max_lock_us);
+
+MODULE_LICENSE("GPL");
--
2.40.1
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 2/2] clk: sifive: Allow building the driver as a module
2023-07-17 21:03 [PATCH 1/2] clk: analogbits: Allow building the library as a module Samuel Holland
@ 2023-07-17 21:03 ` Samuel Holland
2023-07-19 14:18 ` Emil Renner Berthing
0 siblings, 1 reply; 4+ messages in thread
From: Samuel Holland @ 2023-07-17 21:03 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd
Cc: Samuel Holland, Conor Dooley, Palmer Dabbelt, Paul Walmsley,
Yang Li, linux-clk, linux-kernel, linux-riscv
This can reduce the kernel image size in multiplatform configurations.
Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
---
drivers/clk/sifive/Kconfig | 2 +-
drivers/clk/sifive/sifive-prci.c | 8 +++-----
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/clk/sifive/Kconfig b/drivers/clk/sifive/Kconfig
index 2322f634a910..49597d95602e 100644
--- a/drivers/clk/sifive/Kconfig
+++ b/drivers/clk/sifive/Kconfig
@@ -10,7 +10,7 @@ menuconfig CLK_SIFIVE
if CLK_SIFIVE
config CLK_SIFIVE_PRCI
- bool "PRCI driver for SiFive SoCs"
+ tristate "PRCI driver for SiFive SoCs"
default ARCH_SIFIVE
select RESET_CONTROLLER
select RESET_SIMPLE
diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c
index e317f3454e93..8c67d1a7c8df 100644
--- a/drivers/clk/sifive/sifive-prci.c
+++ b/drivers/clk/sifive/sifive-prci.c
@@ -7,6 +7,7 @@
#include <linux/clkdev.h>
#include <linux/delay.h>
#include <linux/io.h>
+#include <linux/module.h>
#include <linux/of_device.h>
#include "sifive-prci.h"
#include "fu540-prci.h"
@@ -618,9 +619,6 @@ static struct platform_driver sifive_prci_driver = {
},
.probe = sifive_prci_probe,
};
+module_platform_driver(sifive_prci_driver);
-static int __init sifive_prci_init(void)
-{
- return platform_driver_register(&sifive_prci_driver);
-}
-core_initcall(sifive_prci_init);
+MODULE_LICENSE("GPL");
--
2.40.1
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] clk: sifive: Allow building the driver as a module
2023-07-17 21:03 ` [PATCH 2/2] clk: sifive: Allow building the driver " Samuel Holland
@ 2023-07-19 14:18 ` Emil Renner Berthing
2023-07-25 0:19 ` Samuel Holland
0 siblings, 1 reply; 4+ messages in thread
From: Emil Renner Berthing @ 2023-07-19 14:18 UTC (permalink / raw)
To: Samuel Holland
Cc: Michael Turquette, Stephen Boyd, Conor Dooley, Palmer Dabbelt,
Paul Walmsley, Yang Li, linux-clk, linux-kernel, linux-riscv
On Wed, 19 Jul 2023 at 10:07, Samuel Holland <samuel.holland@sifive.com> wrote:
>
> This can reduce the kernel image size in multiplatform configurations.
I don't mind this, but booting without this driver also means there is
no uart for debug output or any other peripheral until the kernel gets
to the initrd to load the driver. Does the earlycon console work all
the way until we reach the initrd? Otherwise I can't imagine many
scenarios where configuring this as a module is desirable.
> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
> ---
>
> drivers/clk/sifive/Kconfig | 2 +-
> drivers/clk/sifive/sifive-prci.c | 8 +++-----
> 2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clk/sifive/Kconfig b/drivers/clk/sifive/Kconfig
> index 2322f634a910..49597d95602e 100644
> --- a/drivers/clk/sifive/Kconfig
> +++ b/drivers/clk/sifive/Kconfig
> @@ -10,7 +10,7 @@ menuconfig CLK_SIFIVE
> if CLK_SIFIVE
>
> config CLK_SIFIVE_PRCI
> - bool "PRCI driver for SiFive SoCs"
> + tristate "PRCI driver for SiFive SoCs"
> default ARCH_SIFIVE
> select RESET_CONTROLLER
> select RESET_SIMPLE
> diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c
> index e317f3454e93..8c67d1a7c8df 100644
> --- a/drivers/clk/sifive/sifive-prci.c
> +++ b/drivers/clk/sifive/sifive-prci.c
> @@ -7,6 +7,7 @@
> #include <linux/clkdev.h>
> #include <linux/delay.h>
> #include <linux/io.h>
> +#include <linux/module.h>
> #include <linux/of_device.h>
> #include "sifive-prci.h"
> #include "fu540-prci.h"
> @@ -618,9 +619,6 @@ static struct platform_driver sifive_prci_driver = {
> },
> .probe = sifive_prci_probe,
> };
> +module_platform_driver(sifive_prci_driver);
>
> -static int __init sifive_prci_init(void)
> -{
> - return platform_driver_register(&sifive_prci_driver);
> -}
> -core_initcall(sifive_prci_init);
Maybe also add the MODULE_AUTHOR() and MODULE_DESCRIPTION() macros
while you're at it.
> +MODULE_LICENSE("GPL");
> --
> 2.40.1
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH 2/2] clk: sifive: Allow building the driver as a module
2023-07-19 14:18 ` Emil Renner Berthing
@ 2023-07-25 0:19 ` Samuel Holland
0 siblings, 0 replies; 4+ messages in thread
From: Samuel Holland @ 2023-07-25 0:19 UTC (permalink / raw)
To: Emil Renner Berthing
Cc: Michael Turquette, Stephen Boyd, Conor Dooley, Palmer Dabbelt,
Paul Walmsley, Yang Li, linux-clk, linux-kernel, linux-riscv
On 2023-07-19 9:18 AM, Emil Renner Berthing wrote:
> On Wed, 19 Jul 2023 at 10:07, Samuel Holland <samuel.holland@sifive.com> wrote:
>>
>> This can reduce the kernel image size in multiplatform configurations.
>
> I don't mind this, but booting without this driver also means there is
> no uart for debug output or any other peripheral until the kernel gets
> to the initrd to load the driver. Does the earlycon console work all
> the way until we reach the initrd? Otherwise I can't imagine many
> scenarios where configuring this as a module is desirable.
Thanks for the review.
Yes, an "earlycon" command-line argument still works after this change, since
the stdout-path UART already has its clock set up by a previous boot stage.
>> Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
>> ---
>>
>> drivers/clk/sifive/Kconfig | 2 +-
>> drivers/clk/sifive/sifive-prci.c | 8 +++-----
>> 2 files changed, 4 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/clk/sifive/Kconfig b/drivers/clk/sifive/Kconfig
>> index 2322f634a910..49597d95602e 100644
>> --- a/drivers/clk/sifive/Kconfig
>> +++ b/drivers/clk/sifive/Kconfig
>> @@ -10,7 +10,7 @@ menuconfig CLK_SIFIVE
>> if CLK_SIFIVE
>>
>> config CLK_SIFIVE_PRCI
>> - bool "PRCI driver for SiFive SoCs"
>> + tristate "PRCI driver for SiFive SoCs"
>> default ARCH_SIFIVE
>> select RESET_CONTROLLER
>> select RESET_SIMPLE
>> diff --git a/drivers/clk/sifive/sifive-prci.c b/drivers/clk/sifive/sifive-prci.c
>> index e317f3454e93..8c67d1a7c8df 100644
>> --- a/drivers/clk/sifive/sifive-prci.c
>> +++ b/drivers/clk/sifive/sifive-prci.c
>> @@ -7,6 +7,7 @@
>> #include <linux/clkdev.h>
>> #include <linux/delay.h>
>> #include <linux/io.h>
>> +#include <linux/module.h>
>> #include <linux/of_device.h>
>> #include "sifive-prci.h"
>> #include "fu540-prci.h"
>> @@ -618,9 +619,6 @@ static struct platform_driver sifive_prci_driver = {
>> },
>> .probe = sifive_prci_probe,
>> };
>> +module_platform_driver(sifive_prci_driver);
>>
>> -static int __init sifive_prci_init(void)
>> -{
>> - return platform_driver_register(&sifive_prci_driver);
>> -}
>> -core_initcall(sifive_prci_init);
>
> Maybe also add the MODULE_AUTHOR() and MODULE_DESCRIPTION() macros
> while you're at it.
Will do.
>> +MODULE_LICENSE("GPL");
>> --
>> 2.40.1
>>
>>
>> _______________________________________________
>> linux-riscv mailing list
>> linux-riscv@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-07-25 0:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-17 21:03 [PATCH 1/2] clk: analogbits: Allow building the library as a module Samuel Holland
2023-07-17 21:03 ` [PATCH 2/2] clk: sifive: Allow building the driver " Samuel Holland
2023-07-19 14:18 ` Emil Renner Berthing
2023-07-25 0:19 ` Samuel Holland
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®