* [PATCH v4 0/4] clocksource: Add module support for timer drivers
@ 2026-03-04 8:12 Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 1/4] clocksource/drivers/mmio: Export clocksource_mmio_init() Zhipeng Wang
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-04 8:12 UTC (permalink / raw)
To: daniel.lezcano, tglx
Cc: shawnguo, s.hauer, kernel, festevam, matthias.bgg,
angelogioacchino.delregno, linux-kernel, imx, linux-arm-kernel,
linux-mediatek, chun-hung.wu, walter.chang, jstultz, amergnat,
aisheng.dong, jindong.yue, xuegang.liu
This patch series enables SoC-specific timer drivers to be built as
loadable modules for Generic Kernel Image (GKI). SoC-specific timer
drivers provide always-on broadcast timers that complement the ARM
architectural timer.
This series is based on the previous MediaTek timer modularization work:
Link: https://lore.kernel.org/all/20230517022557.24388-1-walter.chang@mediatek.com/
The series includes:
1. Export necessary functions from clocksource/mmio
2. Remove __init markings from timer-of to support modules
3. Convert MediaTek timer driver to support module build
4. Convert i.MX TPM timer driver to support module build
Testing performed:
- Built and tested on i.MX8ULP platform
- Built and tested on MediaTek platform
- Verified both built-in and module configurations
- Confirmed timer functionality in both configurations
Changes in v4:
- Refined the cover letter introduction to clarify that SoC-specific
timers act as always-on broadcast timers complementing the ARM
architectural timer.
- Expanded "GKI" to "Generic Kernel Image (GKI)" in commit messages.
- No functional changes to the code.
Changes in v3:
- Reworded summary line for timer-mediatek driver as suggested.
- Improved commit message formatting (line wrapping).
- No functional changes to the code.
Changes in v2:
- Added Signed-off-by from submitter (Zhipeng Wang) to all patches
as requested by reviewers
Changes in v1:
- Fixed 'unsigned' to 'unsigned int' in clocksource_mmio_init()
- Changed MODULE_LICENSE from "GPL v2" to "GPL" for mediatek driver
- Added i.MX TPM timer driver module support
Chun-Hung Wu (3):
clocksource/drivers/mmio: Export clocksource_mmio_init()
clocksource/drivers/timer-of: Remove __init markings
clocksource/drivers/timer-mediatek: Convert timer-mediatek to a
loadable module
Jindong Yue (1):
clocksource/drivers/imx-tpm: Support building imx-tpm driver as module
drivers/clocksource/Kconfig | 4 ++--
drivers/clocksource/mmio.c | 8 ++++---
drivers/clocksource/timer-imx-tpm.c | 36 +++++++++++++++++++++++++---
drivers/clocksource/timer-mediatek.c | 33 +++++++++++++++++++++++++
drivers/clocksource/timer-of.c | 23 +++++++++---------
drivers/clocksource/timer-of.h | 6 ++---
6 files changed, 88 insertions(+), 22 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v4 1/4] clocksource/drivers/mmio: Export clocksource_mmio_init()
2026-03-04 8:12 [PATCH v4 0/4] clocksource: Add module support for timer drivers Zhipeng Wang
@ 2026-03-04 8:12 ` Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 2/4] clocksource/drivers/timer-of: Remove __init markings Zhipeng Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-04 8:12 UTC (permalink / raw)
To: daniel.lezcano, tglx
Cc: shawnguo, s.hauer, kernel, festevam, matthias.bgg,
angelogioacchino.delregno, linux-kernel, imx, linux-arm-kernel,
linux-mediatek, chun-hung.wu, walter.chang, jstultz, amergnat,
aisheng.dong, jindong.yue, xuegang.liu
From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Export clocksource_mmio_init() and clocksource_mmio_readl_up()
to support building clocksource driver as module,
such as timer-mediatek.c.
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Signed-off-by: Walter Chang <walter.chang@mediatek.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
---
drivers/clocksource/mmio.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/clocksource/mmio.c b/drivers/clocksource/mmio.c
index cd5fbf49ac29..238bf29db6f7 100644
--- a/drivers/clocksource/mmio.c
+++ b/drivers/clocksource/mmio.c
@@ -21,6 +21,7 @@ u64 clocksource_mmio_readl_up(struct clocksource *c)
{
return (u64)readl_relaxed(to_mmio_clksrc(c)->reg);
}
+EXPORT_SYMBOL_GPL(clocksource_mmio_readl_up);
u64 clocksource_mmio_readl_down(struct clocksource *c)
{
@@ -46,9 +47,9 @@ u64 clocksource_mmio_readw_down(struct clocksource *c)
* @bits: Number of valid bits
* @read: One of clocksource_mmio_read*() above
*/
-int __init clocksource_mmio_init(void __iomem *base, const char *name,
- unsigned long hz, int rating, unsigned bits,
- u64 (*read)(struct clocksource *))
+int clocksource_mmio_init(void __iomem *base, const char *name,
+ unsigned long hz, int rating, unsigned int bits,
+ u64 (*read)(struct clocksource *))
{
struct clocksource_mmio *cs;
@@ -68,3 +69,4 @@ int __init clocksource_mmio_init(void __iomem *base, const char *name,
return clocksource_register_hz(&cs->clksrc, hz);
}
+EXPORT_SYMBOL_GPL(clocksource_mmio_init);
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 2/4] clocksource/drivers/timer-of: Remove __init markings
2026-03-04 8:12 [PATCH v4 0/4] clocksource: Add module support for timer drivers Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 1/4] clocksource/drivers/mmio: Export clocksource_mmio_init() Zhipeng Wang
@ 2026-03-04 8:12 ` Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module Zhipeng Wang
3 siblings, 0 replies; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-04 8:12 UTC (permalink / raw)
To: daniel.lezcano, tglx
Cc: shawnguo, s.hauer, kernel, festevam, matthias.bgg,
angelogioacchino.delregno, linux-kernel, imx, linux-arm-kernel,
linux-mediatek, chun-hung.wu, walter.chang, jstultz, amergnat,
aisheng.dong, jindong.yue, xuegang.liu
From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Remove __init markings to allow timer drivers
can be compiled as modules.
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Signed-off-by: Walter Chang <walter.chang@mediatek.com>
Acked-by: John Stultz <jstultz@google.com>
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
---
drivers/clocksource/timer-of.c | 23 ++++++++++++-----------
drivers/clocksource/timer-of.h | 6 +++---
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/clocksource/timer-of.c b/drivers/clocksource/timer-of.c
index 420202bf76e4..b7c186dc83da 100644
--- a/drivers/clocksource/timer-of.c
+++ b/drivers/clocksource/timer-of.c
@@ -19,7 +19,7 @@
*
* Free the irq resource
*/
-static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
+static void timer_of_irq_exit(struct of_timer_irq *of_irq)
{
struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -41,8 +41,8 @@ static __init void timer_of_irq_exit(struct of_timer_irq *of_irq)
*
* Returns 0 on success, < 0 otherwise
*/
-static __init int timer_of_irq_init(struct device_node *np,
- struct of_timer_irq *of_irq)
+static int timer_of_irq_init(struct device_node *np,
+ struct of_timer_irq *of_irq)
{
int ret;
struct timer_of *to = container_of(of_irq, struct timer_of, of_irq);
@@ -82,7 +82,7 @@ static __init int timer_of_irq_init(struct device_node *np,
*
* Disables and releases the refcount on the clk
*/
-static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)
+static void timer_of_clk_exit(struct of_timer_clk *of_clk)
{
of_clk->rate = 0;
clk_disable_unprepare(of_clk->clk);
@@ -98,8 +98,8 @@ static __init void timer_of_clk_exit(struct of_timer_clk *of_clk)
*
* Returns 0 on success, < 0 otherwise
*/
-static __init int timer_of_clk_init(struct device_node *np,
- struct of_timer_clk *of_clk)
+static int timer_of_clk_init(struct device_node *np,
+ struct of_timer_clk *of_clk)
{
int ret;
@@ -137,13 +137,13 @@ static __init int timer_of_clk_init(struct device_node *np,
goto out;
}
-static __init void timer_of_base_exit(struct of_timer_base *of_base)
+static void timer_of_base_exit(struct of_timer_base *of_base)
{
iounmap(of_base->base);
}
-static __init int timer_of_base_init(struct device_node *np,
- struct of_timer_base *of_base)
+static int timer_of_base_init(struct device_node *np,
+ struct of_timer_base *of_base)
{
of_base->base = of_base->name ?
of_io_request_and_map(np, of_base->index, of_base->name) :
@@ -156,7 +156,7 @@ static __init int timer_of_base_init(struct device_node *np,
return 0;
}
-int __init timer_of_init(struct device_node *np, struct timer_of *to)
+int timer_of_init(struct device_node *np, struct timer_of *to)
{
int ret = -EINVAL;
int flags = 0;
@@ -200,6 +200,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)
timer_of_base_exit(&to->of_base);
return ret;
}
+EXPORT_SYMBOL_GPL(timer_of_init);
/**
* timer_of_cleanup - release timer_of resources
@@ -208,7 +209,7 @@ int __init timer_of_init(struct device_node *np, struct timer_of *to)
* Release the resources that has been used in timer_of_init().
* This function should be called in init error cases
*/
-void __init timer_of_cleanup(struct timer_of *to)
+void timer_of_cleanup(struct timer_of *to)
{
if (to->flags & TIMER_OF_IRQ)
timer_of_irq_exit(&to->of_irq);
diff --git a/drivers/clocksource/timer-of.h b/drivers/clocksource/timer-of.h
index 01a2c6b7db06..367d7023c623 100644
--- a/drivers/clocksource/timer-of.h
+++ b/drivers/clocksource/timer-of.h
@@ -65,9 +65,9 @@ static inline unsigned long timer_of_period(struct timer_of *to)
return to->of_clk.period;
}
-extern int __init timer_of_init(struct device_node *np,
- struct timer_of *to);
+extern int timer_of_init(struct device_node *np,
+ struct timer_of *to);
-extern void __init timer_of_cleanup(struct timer_of *to);
+extern void timer_of_cleanup(struct timer_of *to);
#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-04 8:12 [PATCH v4 0/4] clocksource: Add module support for timer drivers Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 1/4] clocksource/drivers/mmio: Export clocksource_mmio_init() Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 2/4] clocksource/drivers/timer-of: Remove __init markings Zhipeng Wang
@ 2026-03-04 8:12 ` Zhipeng Wang
2026-03-04 19:02 ` Daniel Lezcano
2026-03-04 8:12 ` [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module Zhipeng Wang
3 siblings, 1 reply; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-04 8:12 UTC (permalink / raw)
To: daniel.lezcano, tglx
Cc: shawnguo, s.hauer, kernel, festevam, matthias.bgg,
angelogioacchino.delregno, linux-kernel, imx, linux-arm-kernel,
linux-mediatek, chun-hung.wu, walter.chang, jstultz, amergnat,
aisheng.dong, jindong.yue, xuegang.liu
From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Convert the timer-mediatek driver into a loadable module so that it
can register an always-on timer as the tick_broadcast_device on
MediaTek SoCs. This helps support GKI(Generic Kernel Image) modular
configurations.
Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
Signed-off-by: Walter Chang <walter.chang@mediatek.com>
Tested-by: Walter Chang <walter.chang@mediatek.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
---
drivers/clocksource/Kconfig | 2 +-
drivers/clocksource/timer-mediatek.c | 33 ++++++++++++++++++++++++++++
2 files changed, 34 insertions(+), 1 deletion(-)
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index fd9112706545..2112efb85029 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -488,7 +488,7 @@ config SYS_SUPPORTS_SH_CMT
bool
config MTK_TIMER
- bool "Mediatek timer driver" if COMPILE_TEST
+ tristate "MediaTek timer driver"
depends on HAS_IOMEM
select TIMER_OF
select CLKSRC_MMIO
diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
index 7bcb4a3f26fb..4ad4bac6f34b 100644
--- a/drivers/clocksource/timer-mediatek.c
+++ b/drivers/clocksource/timer-mediatek.c
@@ -13,6 +13,9 @@
#include <linux/clocksource.h>
#include <linux/interrupt.h>
#include <linux/irqreturn.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>
#include <linux/sched_clock.h>
#include <linux/slab.h>
#include "timer-of.h"
@@ -337,5 +340,35 @@ static int __init mtk_gpt_init(struct device_node *node)
return 0;
}
+
+#ifndef MODULE
TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);
+#else
+static int mtk_timer_probe(struct platform_device *pdev)
+{
+ int (*timer_init)(struct device_node *node);
+ struct device_node *np = pdev->dev.of_node;
+
+ timer_init = of_device_get_match_data(&pdev->dev);
+ return timer_init(np);
+}
+
+static const struct of_device_id mtk_timer_match_table[] = {
+ { .compatible = "mediatek,mt6577-timer", .data = mtk_gpt_init },
+ { .compatible = "mediatek,mt6765-timer", .data = mtk_syst_init },
+ { /* sentinel */ }
+};
+
+static struct platform_driver mtk_timer_driver = {
+ .probe = mtk_timer_probe,
+ .driver = {
+ .name = "mediatek-timer",
+ .of_match_table = mtk_timer_match_table,
+ },
+};
+module_platform_driver(mtk_timer_driver);
+
+MODULE_DESCRIPTION("MediaTek Timer driver");
+MODULE_LICENSE("GPL");
+#endif
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module
2026-03-04 8:12 [PATCH v4 0/4] clocksource: Add module support for timer drivers Zhipeng Wang
` (2 preceding siblings ...)
2026-03-04 8:12 ` [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module Zhipeng Wang
@ 2026-03-04 8:12 ` Zhipeng Wang
2026-03-05 13:44 ` kernel test robot
3 siblings, 1 reply; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-04 8:12 UTC (permalink / raw)
To: daniel.lezcano, tglx
Cc: shawnguo, s.hauer, kernel, festevam, matthias.bgg,
angelogioacchino.delregno, linux-kernel, imx, linux-arm-kernel,
linux-mediatek, chun-hung.wu, walter.chang, jstultz, amergnat,
aisheng.dong, jindong.yue, xuegang.liu
From: Jindong Yue <jindong.yue@nxp.com>
Change defconfig as tristate type and add platform driver
to support building it as a module.
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
---
drivers/clocksource/Kconfig | 2 +-
drivers/clocksource/timer-imx-tpm.c | 36 ++++++++++++++++++++++++++---
2 files changed, 34 insertions(+), 4 deletions(-)
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 2112efb85029..1ba3e9bca3db 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -613,7 +613,7 @@ config CLKSRC_IMX_GPT
select CLKSRC_MMIO
config CLKSRC_IMX_TPM
- bool "Clocksource using i.MX TPM" if COMPILE_TEST
+ tristate "Clocksource using i.MX TPM"
depends on (ARM || ARM64) && HAVE_CLK
select CLKSRC_MMIO
select TIMER_OF
diff --git a/drivers/clocksource/timer-imx-tpm.c b/drivers/clocksource/timer-imx-tpm.c
index 92c025b70eb6..419d094459b2 100644
--- a/drivers/clocksource/timer-imx-tpm.c
+++ b/drivers/clocksource/timer-imx-tpm.c
@@ -8,6 +8,8 @@
#include <linux/clocksource.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
#include <linux/sched_clock.h>
#include "timer-of.h"
@@ -152,7 +154,7 @@ static struct timer_of to_tpm = {
},
};
-static int __init tpm_clocksource_init(void)
+static int tpm_clocksource_init(void)
{
#if defined(CONFIG_ARM)
tpm_delay_timer.read_current_timer = &tpm_read_current_timer;
@@ -171,7 +173,7 @@ static int __init tpm_clocksource_init(void)
clocksource_mmio_readl_up);
}
-static void __init tpm_clockevent_init(void)
+static void tpm_clockevent_init(void)
{
clockevents_config_and_register(&to_tpm.clkevt,
timer_of_rate(&to_tpm) >> 3,
@@ -180,7 +182,7 @@ static void __init tpm_clockevent_init(void)
1));
}
-static int __init tpm_timer_init(struct device_node *np)
+static int tpm_timer_init(struct device_node *np)
{
struct clk *ipg;
int ret;
@@ -241,4 +243,32 @@ static int __init tpm_timer_init(struct device_node *np)
return tpm_clocksource_init();
}
+#ifdef MODULE
+static int tpm_timer_probe(struct platform_device *pdev)
+{
+ struct device_node *np = pdev->dev.of_node;
+
+ return tpm_timer_init(np);
+}
+
+static const struct of_device_id tpm_timer_match_table[] = {
+ { .compatible = "fsl,imx7ulp-tpm" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, tpm_timer_match_table);
+
+static struct platform_driver tpm_timer_driver = {
+ .probe = tpm_timer_probe,
+ .driver = {
+ .name = "tpm-timer",
+ .of_match_table = tpm_timer_match_table,
+ },
+};
+module_platform_driver(tpm_timer_driver);
+
+#else
TIMER_OF_DECLARE(imx7ulp, "fsl,imx7ulp-tpm", tpm_timer_init);
+#endif
+
+MODULE_DESCRIPTION("i.MX TPM Timer Driver");
+MODULE_LICENSE("GPL");
--
2.34.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-04 8:12 ` [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module Zhipeng Wang
@ 2026-03-04 19:02 ` Daniel Lezcano
2026-03-06 5:46 ` [EXT] " Zhipeng Wang
0 siblings, 1 reply; 15+ messages in thread
From: Daniel Lezcano @ 2026-03-04 19:02 UTC (permalink / raw)
To: Zhipeng Wang
Cc: daniel.lezcano, tglx, shawnguo, s.hauer, kernel, festevam,
matthias.bgg, angelogioacchino.delregno, linux-kernel, imx,
linux-arm-kernel, linux-mediatek, chun-hung.wu, walter.chang,
jstultz, amergnat, aisheng.dong, jindong.yue, xuegang.liu
On Wed, Mar 04, 2026 at 05:12:06PM +0900, Zhipeng Wang wrote:
> From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
>
> Convert the timer-mediatek driver into a loadable module so that it
> can register an always-on timer as the tick_broadcast_device on
> MediaTek SoCs. This helps support GKI(Generic Kernel Image) modular
> configurations.
>
> Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
> Signed-off-by: Walter Chang <walter.chang@mediatek.com>
> Tested-by: Walter Chang <walter.chang@mediatek.com>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
> Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
> ---
> drivers/clocksource/Kconfig | 2 +-
> drivers/clocksource/timer-mediatek.c | 33 ++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index fd9112706545..2112efb85029 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -488,7 +488,7 @@ config SYS_SUPPORTS_SH_CMT
> bool
>
> config MTK_TIMER
> - bool "Mediatek timer driver" if COMPILE_TEST
> + tristate "MediaTek timer driver"
> depends on HAS_IOMEM
> select TIMER_OF
> select CLKSRC_MMIO
> diff --git a/drivers/clocksource/timer-mediatek.c b/drivers/clocksource/timer-mediatek.c
> index 7bcb4a3f26fb..4ad4bac6f34b 100644
> --- a/drivers/clocksource/timer-mediatek.c
> +++ b/drivers/clocksource/timer-mediatek.c
> @@ -13,6 +13,9 @@
> #include <linux/clocksource.h>
> #include <linux/interrupt.h>
> #include <linux/irqreturn.h>
> +#include <linux/module.h>
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> #include <linux/sched_clock.h>
> #include <linux/slab.h>
> #include "timer-of.h"
> @@ -337,5 +340,35 @@ static int __init mtk_gpt_init(struct device_node *node)
>
> return 0;
> }
> +
> +#ifndef MODULE
> TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_gpt_init);
> TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer", mtk_syst_init);
> +#else
> +static int mtk_timer_probe(struct platform_device *pdev)
> +{
> + int (*timer_init)(struct device_node *node);
> + struct device_node *np = pdev->dev.of_node;
> +
> + timer_init = of_device_get_match_data(&pdev->dev);
> + return timer_init(np);
> +}
> +
> +static const struct of_device_id mtk_timer_match_table[] = {
> + { .compatible = "mediatek,mt6577-timer", .data = mtk_gpt_init },
> + { .compatible = "mediatek,mt6765-timer", .data = mtk_syst_init },
> + { /* sentinel */ }
> +};
> +
> +static struct platform_driver mtk_timer_driver = {
> + .probe = mtk_timer_probe,
> + .driver = {
> + .name = "mediatek-timer",
> + .of_match_table = mtk_timer_match_table,
> + },
> +};
> +module_platform_driver(mtk_timer_driver);
> +
> +MODULE_DESCRIPTION("MediaTek Timer driver");
> +MODULE_LICENSE("GPL");
> +#endif
What do you think about the approach found here:
https://lore.kernel.org/all/20250625085715.889837-1-daniel.lezcano@linaro.org/
> --
> 2.34.1
>
--
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module
2026-03-04 8:12 ` [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module Zhipeng Wang
@ 2026-03-05 13:44 ` kernel test robot
0 siblings, 0 replies; 15+ messages in thread
From: kernel test robot @ 2026-03-05 13:44 UTC (permalink / raw)
To: Zhipeng Wang, daniel.lezcano, tglx
Cc: llvm, oe-kbuild-all, shawnguo, s.hauer, kernel, festevam,
matthias.bgg, angelogioacchino.delregno, linux-kernel, imx,
linux-arm-kernel, linux-mediatek, chun-hung.wu, walter.chang,
jstultz, amergnat, aisheng.dong, jindong.yue, xuegang.liu
Hi Zhipeng,
kernel test robot noticed the following build warnings:
[auto build test WARNING on tip/timers/core]
[also build test WARNING on soc/for-next linus/master v7.0-rc2 next-20260304]
[cannot apply to daniel-lezcano/clockevents/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Zhipeng-Wang/clocksource-drivers-mmio-Export-clocksource_mmio_init/20260304-162226
base: tip/timers/core
patch link: https://lore.kernel.org/r/20260304081207.4030882-5-zhipeng.wang_1%40nxp.com
patch subject: [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module
config: arm-randconfig-001-20260305 (https://download.01.org/0day-ci/archive/20260305/202603052149.00j5uebB-lkp@intel.com/config)
compiler: clang version 23.0.0git (https://github.com/llvm/llvm-project 9a109fbb6e184ec9bcce10615949f598f4c974a9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603052149.00j5uebB-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603052149.00j5uebB-lkp@intel.com/
All warnings (new ones prefixed by >>, old ones prefixed by <<):
>> WARNING: modpost: vmlinux: section mismatch in reference: tpm_timer_init+0x111 (section: .text) -> register_current_timer_delay (section: .init.text)
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-04 19:02 ` Daniel Lezcano
@ 2026-03-06 5:46 ` Zhipeng Wang
2026-03-08 19:51 ` Daniel Lezcano
0 siblings, 1 reply; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-06 5:46 UTC (permalink / raw)
To: Daniel Lezcano
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
Hi Daniel,
Thank you for sharing your RFC patch. I think the approach is very
interesting and addresses a real problem in the timer subsystem.
For the MediaTek and IMX timer driver, I see a few considerations:
1. Current approach: My current patch uses the existing pattern
(similar to renesas-ostm.c) with #ifdef MODULE. It's simple and
works, but I agree it's not ideal.
2. Your approach: Your TIMER_OF_DECLARE_PDEV approach would be
cleaner and allow us to use devm_ functions, which would be a
nice improvement.
3. MediaTek and IMX timer specifics: The IMX timer doesn't require
early initialization on modern platforms (we have arch timers on
ARM64), so it would fit well with your TIMER_OF_DECLARE_PLATFORM_DRIVER
macro (if you go with the two-macro approach).
I'm very interested in your approach. May I ask what timeline you're
considering for your patch series?
The reason I ask is that we're working towards GKI support and I want
to make sure I choose the right approach.
BRs,
Zhipeng
> -----Original Message-----
> From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> Sent: 2026年3月5日 3:03
> To: Zhipeng Wang <zhipeng.wang_1@nxp.com>
> Cc: daniel.lezcano@linaro.org; tglx@kernel.org; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> matthias.bgg@gmail.com; angelogioacchino.delregno@collabora.com;
> linux-kernel@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-mediatek@lists.infradead.org;
> chun-hung.wu@mediatek.com; walter.chang@mediatek.com;
> jstultz@google.com; amergnat@baylibre.com; Aisheng Dong
> <aisheng.dong@nxp.com>; Jindong Yue <jindong.yue@nxp.com>; Xuegang Liu
> <xuegang.liu@nxp.com>
> Subject: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert
> timer-mediatek to a loadable module
>
> [You don't often get email from daniel.lezcano@oss.qualcomm.com. Learn
> why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> On Wed, Mar 04, 2026 at 05:12:06PM +0900, Zhipeng Wang wrote:
> > From: Chun-Hung Wu <chun-hung.wu@mediatek.com>
> >
> > Convert the timer-mediatek driver into a loadable module so that it
> > can register an always-on timer as the tick_broadcast_device on
> > MediaTek SoCs. This helps support GKI(Generic Kernel Image) modular
> > configurations.
> >
> > Signed-off-by: Chun-Hung Wu <chun-hung.wu@mediatek.com>
> > Signed-off-by: Walter Chang <walter.chang@mediatek.com>
> > Tested-by: Walter Chang <walter.chang@mediatek.com>
> > Reviewed-by: AngeloGioacchino Del Regno
> > <angelogioacchino.delregno@collabora.com>
> > Reviewed-by: Alexandre Mergnat <amergnat@baylibre.com>
> > Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
> > ---
> > drivers/clocksource/Kconfig | 2 +-
> > drivers/clocksource/timer-mediatek.c | 33
> > ++++++++++++++++++++++++++++
> > 2 files changed, 34 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> > index fd9112706545..2112efb85029 100644
> > --- a/drivers/clocksource/Kconfig
> > +++ b/drivers/clocksource/Kconfig
> > @@ -488,7 +488,7 @@ config SYS_SUPPORTS_SH_CMT
> > bool
> >
> > config MTK_TIMER
> > - bool "Mediatek timer driver" if COMPILE_TEST
> > + tristate "MediaTek timer driver"
> > depends on HAS_IOMEM
> > select TIMER_OF
> > select CLKSRC_MMIO
> > diff --git a/drivers/clocksource/timer-mediatek.c
> > b/drivers/clocksource/timer-mediatek.c
> > index 7bcb4a3f26fb..4ad4bac6f34b 100644
> > --- a/drivers/clocksource/timer-mediatek.c
> > +++ b/drivers/clocksource/timer-mediatek.c
> > @@ -13,6 +13,9 @@
> > #include <linux/clocksource.h>
> > #include <linux/interrupt.h>
> > #include <linux/irqreturn.h>
> > +#include <linux/module.h>
> > +#include <linux/of_device.h>
> > +#include <linux/platform_device.h>
> > #include <linux/sched_clock.h>
> > #include <linux/slab.h>
> > #include "timer-of.h"
> > @@ -337,5 +340,35 @@ static int __init mtk_gpt_init(struct device_node
> > *node)
> >
> > return 0;
> > }
> > +
> > +#ifndef MODULE
> > TIMER_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer",
> mtk_gpt_init);
> > TIMER_OF_DECLARE(mtk_mt6765, "mediatek,mt6765-timer",
> mtk_syst_init);
> > +#else
> > +static int mtk_timer_probe(struct platform_device *pdev) {
> > + int (*timer_init)(struct device_node *node);
> > + struct device_node *np = pdev->dev.of_node;
> > +
> > + timer_init = of_device_get_match_data(&pdev->dev);
> > + return timer_init(np);
> > +}
> > +
> > +static const struct of_device_id mtk_timer_match_table[] = {
> > + { .compatible = "mediatek,mt6577-timer", .data = mtk_gpt_init },
> > + { .compatible = "mediatek,mt6765-timer", .data = mtk_syst_init },
> > + { /* sentinel */ }
> > +};
> > +
> > +static struct platform_driver mtk_timer_driver = {
> > + .probe = mtk_timer_probe,
> > + .driver = {
> > + .name = "mediatek-timer",
> > + .of_match_table = mtk_timer_match_table,
> > + },
> > +};
> > +module_platform_driver(mtk_timer_driver);
> > +
> > +MODULE_DESCRIPTION("MediaTek Timer driver");
> MODULE_LICENSE("GPL");
> > +#endif
>
> What do you think about the approach found here:
>
> https://lore.ker/
> nel.org%2Fall%2F20250625085715.889837-1-daniel.lezcano%40linaro.org%2
> F&data=05%7C02%7Czhipeng.wang_1%40nxp.com%7Cf1fa174b13094e25d92
> 308de7a209d3b%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63
> 9082477664309790%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnR
> ydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3
> D%3D%7C0%7C%7C%7C&sdata=Dn4Qd9IdMYON0dLy2BRnN5FV3k1C2Cm3yv
> dS%2Bd%2BFn20%3D&reserved=0
>
> > --
> > 2.34.1
> >
>
> --
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-06 5:46 ` [EXT] " Zhipeng Wang
@ 2026-03-08 19:51 ` Daniel Lezcano
2026-03-09 5:31 ` Zhipeng Wang
0 siblings, 1 reply; 15+ messages in thread
From: Daniel Lezcano @ 2026-03-08 19:51 UTC (permalink / raw)
To: Zhipeng Wang
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
On 3/6/26 06:46, Zhipeng Wang wrote:
> Hi Daniel,
>
> Thank you for sharing your RFC patch. I think the approach is very
> interesting and addresses a real problem in the timer subsystem.
>
> For the MediaTek and IMX timer driver, I see a few considerations:
>
> 1. Current approach: My current patch uses the existing pattern
> (similar to renesas-ostm.c) with #ifdef MODULE. It's simple and
> works, but I agree it's not ideal.
> 2. Your approach: Your TIMER_OF_DECLARE_PDEV approach would be
> cleaner and allow us to use devm_ functions, which would be a
> nice improvement.
> 3. MediaTek and IMX timer specifics: The IMX timer doesn't require
> early initialization on modern platforms (we have arch timers on
> ARM64), so it would fit well with your TIMER_OF_DECLARE_PLATFORM_DRIVER
> macro (if you go with the two-macro approach).
>
> I'm very interested in your approach. May I ask what timeline you're
> considering for your patch series?
> The reason I ask is that we're working towards GKI support and I want
> to make sure I choose the right approach.
Well, if you are willing to collaborate, we can start right now to think
about it and propose an unified solution
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-08 19:51 ` Daniel Lezcano
@ 2026-03-09 5:31 ` Zhipeng Wang
2026-03-09 6:14 ` Trilok Soni
2026-03-09 9:38 ` Daniel Lezcano
0 siblings, 2 replies; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-09 5:31 UTC (permalink / raw)
To: Daniel Lezcano
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
Hello Daniel,
I'd be very happy to collaborate on this!
My availability: I can dedicate time to work on this over the next few weeks. I'm happy to help with:
- Testing the new macros with IMX timer drivers
- Converting existing drivers as examples
- Reviewing and testing patches
- Documentation
My understanding is that, based on your RFC, we should use two macros ― TIMER_OF_DECLARE_PDEV and TIMER_OF_DECLARE_PLATFORM_DRIVER.
BRs,
Zhipeng
> -----Original Message-----
> From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> Sent: 2026年3月9日 3:51
> To: Zhipeng Wang <zhipeng.wang_1@nxp.com>
> Cc: daniel.lezcano@linaro.org; tglx@kernel.org; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> matthias.bgg@gmail.com; angelogioacchino.delregno@collabora.com;
> linux-kernel@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-mediatek@lists.infradead.org;
> chun-hung.wu@mediatek.com; walter.chang@mediatek.com;
> jstultz@google.com; amergnat@baylibre.com; Aisheng Dong
> <aisheng.dong@nxp.com>; Jindong Yue <jindong.yue@nxp.com>; Xuegang Liu
> <xuegang.liu@nxp.com>; Greg Kroah-Hartman <gregkh@google.com>
> Subject: Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek:
> Convert timer-mediatek to a loadable module
>
> [You don't often get email from daniel.lezcano@oss.qualcomm.com. Learn
> why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> On 3/6/26 06:46, Zhipeng Wang wrote:
> > Hi Daniel,
> >
> > Thank you for sharing your RFC patch. I think the approach is very
> > interesting and addresses a real problem in the timer subsystem.
> >
> > For the MediaTek and IMX timer driver, I see a few considerations:
> >
> > 1. Current approach: My current patch uses the existing pattern
> > (similar to renesas-ostm.c) with #ifdef MODULE. It's simple and
> > works, but I agree it's not ideal.
> > 2. Your approach: Your TIMER_OF_DECLARE_PDEV approach would be
> > cleaner and allow us to use devm_ functions, which would be a
> > nice improvement.
> > 3. MediaTek and IMX timer specifics: The IMX timer doesn't require
> > early initialization on modern platforms (we have arch timers on
> > ARM64), so it would fit well with your
> TIMER_OF_DECLARE_PLATFORM_DRIVER
> > macro (if you go with the two-macro approach).
> >
> > I'm very interested in your approach. May I ask what timeline you're
> > considering for your patch series?
> > The reason I ask is that we're working towards GKI support and I want
> > to make sure I choose the right approach.
>
> Well, if you are willing to collaborate, we can start right now to think about it
> and propose an unified solution
>
>
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-09 5:31 ` Zhipeng Wang
@ 2026-03-09 6:14 ` Trilok Soni
2026-03-09 9:38 ` Daniel Lezcano
1 sibling, 0 replies; 15+ messages in thread
From: Trilok Soni @ 2026-03-09 6:14 UTC (permalink / raw)
To: Zhipeng Wang, Daniel Lezcano
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
On 3/8/2026 10:31 PM, Zhipeng Wang wrote:
> Hello Daniel,
>
> I'd be very happy to collaborate on this!
>
> My availability: I can dedicate time to work on this over the next few weeks. I'm happy to help with:
> - Testing the new macros with IMX timer drivers
> - Converting existing drivers as examples
> - Reviewing and testing patches
> - Documentation
>
> My understanding is that, based on your RFC, we should use two macros — TIMER_OF_DECLARE_PDEV and TIMER_OF_DECLARE_PLATFORM_DRIVER.
>
> BRs,
> Zhipeng
Please don't top post and something is wrong w/ your email fonts. Please fix.
>> -----Original Message-----
>> From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
>> Sent: 2026年3月9日 3:51
>> To: Zhipeng Wang <zhipeng.wang_1@nxp.com>
>> Cc: daniel.lezcano@linaro.org; tglx@kernel.org; shawnguo@kernel.org;
>> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
>> matthias.bgg@gmail.com; angelogioacchino.delregno@collabora.com;
>> linux-kernel@vger.kernel.org; imx@lists.linux.dev;
>> linux-arm-kernel@lists.infradead.org; linux-mediatek@lists.infradead.org;
>> chun-hung.wu@mediatek.com; walter.chang@mediatek.com;
>> jstultz@google.com; amergnat@baylibre.com; Aisheng Dong
>> <aisheng.dong@nxp.com>; Jindong Yue <jindong.yue@nxp.com>; Xuegang Liu
>> <xuegang.liu@nxp.com>; Greg Kroah-Hartman <gregkh@google.com>
>> Subject: Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek:
>> Convert timer-mediatek to a loadable module
>>
>> [You don't often get email from daniel.lezcano@oss.qualcomm.com. Learn
>> why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>>
>> Caution: This is an external email. Please take care when clicking links or
>> opening attachments. When in doubt, report the message using the 'Report
>> this email' button
>>
>>
>> On 3/6/26 06:46, Zhipeng Wang wrote:
>>> Hi Daniel,
>>>
>>> Thank you for sharing your RFC patch. I think the approach is very
>>> interesting and addresses a real problem in the timer subsystem.
>>>
>>> For the MediaTek and IMX timer driver, I see a few considerations:
>>>
>>> 1. Current approach: My current patch uses the existing pattern
>>> (similar to renesas-ostm.c) with #ifdef MODULE. It's simple and
>>> works, but I agree it's not ideal.
>>> 2. Your approach: Your TIMER_OF_DECLARE_PDEV approach would be
>>> cleaner and allow us to use devm_ functions, which would be a
>>> nice improvement.
>>> 3. MediaTek and IMX timer specifics: The IMX timer doesn't require
>>> early initialization on modern platforms (we have arch timers on
>>> ARM64), so it would fit well with your
>> TIMER_OF_DECLARE_PLATFORM_DRIVER
>>> macro (if you go with the two-macro approach).
>>>
>>> I'm very interested in your approach. May I ask what timeline you're
>>> considering for your patch series?
>>> The reason I ask is that we're working towards GKI support and I want
>>> to make sure I choose the right approach.
>>
>> Well, if you are willing to collaborate, we can start right now to think about it
>> and propose an unified solution
>>
>>
>>
>>
>>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-09 5:31 ` Zhipeng Wang
2026-03-09 6:14 ` Trilok Soni
@ 2026-03-09 9:38 ` Daniel Lezcano
2026-03-10 8:41 ` Zhipeng Wang
1 sibling, 1 reply; 15+ messages in thread
From: Daniel Lezcano @ 2026-03-09 9:38 UTC (permalink / raw)
To: Zhipeng Wang
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
Hi Zhipeng,
On 3/9/26 06:31, Zhipeng Wang wrote:
> Hello Daniel,
>
> I'd be very happy to collaborate on this!
Great, let me see if I can cook a patch in the next days
> My availability: I can dedicate time to work on this over the next few weeks. I'm happy to help with:
> - Testing the new macros with IMX timer drivers
> - Converting existing drivers as examples
> - Reviewing and testing patches
> - Documentation
That's awesome, thanks
> My understanding is that, based on your RFC, we should use two macros — TIMER_OF_DECLARE_PDEV and TIMER_OF_DECLARE_PLATFORM_DRIVER.
Yes, but also sort out the existing TIMER_OF_DECLARE macro vs MODULE in
order to prevent #ifdef MODULE in the drivers
A side note, as Trilok commented:
- you should not do top post. Keep inline comments with the previous
emails so we can have the context.
- trim the emails when possible. IOW remove text not related with the
discussion
- use text mode with the mailer, not html or whatever
- for more information refer to Documentation/process/email-clients.rst
Thanks for your help
-- Daniel
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-09 9:38 ` Daniel Lezcano
@ 2026-03-10 8:41 ` Zhipeng Wang
2026-03-25 14:42 ` Daniel Lezcano
0 siblings, 1 reply; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-10 8:41 UTC (permalink / raw)
To: Daniel Lezcano
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
>
>
> Hi Zhipeng,
>
> On 3/9/26 06:31, Zhipeng Wang wrote:
> > Hello Daniel,
> >
> > I'd be very happy to collaborate on this!
>
> Great, let me see if I can cook a patch in the next days
>
> > My availability: I can dedicate time to work on this over the next few weeks.
> I'm happy to help with:
> > - Testing the new macros with IMX timer drivers
> > - Converting existing drivers as examples
> > - Reviewing and testing patches
> > - Documentation
>
> That's awesome, thanks
>
> > My understanding is that, based on your RFC, we should use two macros —
> TIMER_OF_DECLARE_PDEV and TIMER_OF_DECLARE_PLATFORM_DRIVER.
>
> Yes, but also sort out the existing TIMER_OF_DECLARE macro vs MODULE in
> order to prevent #ifdef MODULE in the drivers
>
Hi Daniel,
Yes, that's our goal.
I'll test the new macros (TIMER_OF_DECLARE_PLATFORM_DRIVER and
TIMER_OF_DECLARE_EARLY_PLATFORM_DRIVER) with the IMX timer drivers
once the patches are available.
Best regards,
Zhipeng
> A side note, as Trilok commented:
>
> - you should not do top post. Keep inline comments with the previous emails
> so we can have the context.
>
> - trim the emails when possible. IOW remove text not related with the
> discussion
>
> - use text mode with the mailer, not html or whatever
>
> - for more information refer to Documentation/process/email-clients.rst
>
> Thanks for your help
>
> -- Daniel
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-10 8:41 ` Zhipeng Wang
@ 2026-03-25 14:42 ` Daniel Lezcano
2026-03-26 10:34 ` Zhipeng Wang
0 siblings, 1 reply; 15+ messages in thread
From: Daniel Lezcano @ 2026-03-25 14:42 UTC (permalink / raw)
To: Zhipeng Wang
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
Hi Zhipeng,
On 3/10/26 09:41, Zhipeng Wang wrote:
>>
>>
>> Hi Zhipeng,
>>
>> On 3/9/26 06:31, Zhipeng Wang wrote:
>>> Hello Daniel,
>>>
>>> I'd be very happy to collaborate on this!
>>
>> Great, let me see if I can cook a patch in the next days
>>
>>> My availability: I can dedicate time to work on this over the next few weeks.
>> I'm happy to help with:
>>> - Testing the new macros with IMX timer drivers
>>> - Converting existing drivers as examples
>>> - Reviewing and testing patches
>>> - Documentation
>>
>> That's awesome, thanks
>>
>>> My understanding is that, based on your RFC, we should use two macros —
>> TIMER_OF_DECLARE_PDEV and TIMER_OF_DECLARE_PLATFORM_DRIVER.
>>
>> Yes, but also sort out the existing TIMER_OF_DECLARE macro vs MODULE in
>> order to prevent #ifdef MODULE in the drivers
>>
> Hi Daniel,
>
> Yes, that's our goal.
>
> I'll test the new macros (TIMER_OF_DECLARE_PLATFORM_DRIVER and
> TIMER_OF_DECLARE_EARLY_PLATFORM_DRIVER) with the IMX timer drivers
> once the patches are available.
I think I have an idea on how to achieve that. That will result in the
removal of TIMER_OF_DECLARE() when all drivers will be changed to use
the new macro.
The #ifdef MODULE macro is set when the driver is compiled as a module.
So we can do something like:
#ifdef MODULE
#define TIMER_OF_DECLARE_PDEV(name, compat, data, fn) \
OF_DECLARE_1_RET(timer_pdev, name, compat, data, fn)
#else
#define TIMER_OF_DECLARE_PDEV(__name, compat, data, fn) \
OF_DECLARE_1_RET(of_pdev_timer_match_table,
__name, compat, data, fn)
static struct platform_driver __##__name##_timer_driver = {
.probe = __##__name##_timer_probe,
.driver = {
.name = name,
.of_match_table = of_pdev_timer_match_table,
},
};
module_platform_driver(__##__name##_timer_driver);
#endif
So we deal with two tables, one for platform device non module and one
module for modules.
The first one is called by the timer-of init routine. The other one is
called by the probe function.
The drawback will be the match table will be common to all timer
drivers. So probe will be a bit slower. May be there is an area of
optimization here.
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module
2026-03-25 14:42 ` Daniel Lezcano
@ 2026-03-26 10:34 ` Zhipeng Wang
0 siblings, 0 replies; 15+ messages in thread
From: Zhipeng Wang @ 2026-03-26 10:34 UTC (permalink / raw)
To: Daniel Lezcano
Cc: daniel.lezcano@linaro.org, tglx@kernel.org, shawnguo@kernel.org,
s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
linux-kernel@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, chun-hung.wu@mediatek.com,
walter.chang@mediatek.com, jstultz@google.com,
amergnat@baylibre.com, Aisheng Dong, Jindong Yue, Xuegang Liu,
Greg Kroah-Hartman
> -----Original Message-----
> From: Daniel Lezcano <daniel.lezcano@oss.qualcomm.com>
> Sent: 2026年3月25日 22:43
> To: Zhipeng Wang <zhipeng.wang_1@nxp.com>
> Cc: daniel.lezcano@linaro.org; tglx@kernel.org; shawnguo@kernel.org;
> s.hauer@pengutronix.de; kernel@pengutronix.de; festevam@gmail.com;
> matthias.bgg@gmail.com; angelogioacchino.delregno@collabora.com;
> linux-kernel@vger.kernel.org; imx@lists.linux.dev;
> linux-arm-kernel@lists.infradead.org; linux-mediatek@lists.infradead.org;
> chun-hung.wu@mediatek.com; walter.chang@mediatek.com;
> jstultz@google.com; amergnat@baylibre.com; Aisheng Dong
> <aisheng.dong@nxp.com>; Jindong Yue <jindong.yue@nxp.com>; Xuegang Liu
> <xuegang.liu@nxp.com>; Greg Kroah-Hartman <gregkh@google.com>
> Subject: Re: [EXT] Re: [PATCH v4 3/4] clocksource/drivers/timer-mediatek:
> Convert timer-mediatek to a loadable module
>
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report
> this email' button
>
>
> Hi Zhipeng,
>
> On 3/10/26 09:41, Zhipeng Wang wrote:
> >>
> >>
> >> Hi Zhipeng,
> >>
> >> On 3/9/26 06:31, Zhipeng Wang wrote:
> >>> Hello Daniel,
> >>>
> >>> I'd be very happy to collaborate on this!
> >>
> >> Great, let me see if I can cook a patch in the next days
> >>
> >>> My availability: I can dedicate time to work on this over the next few
> weeks.
> >> I'm happy to help with:
> >>> - Testing the new macros with IMX timer drivers
> >>> - Converting existing drivers as examples
> >>> - Reviewing and testing patches
> >>> - Documentation
> >>
> >> That's awesome, thanks
> >>
> >>> My understanding is that, based on your RFC, we should use two
> >>> macros —
> >> TIMER_OF_DECLARE_PDEV and TIMER_OF_DECLARE_PLATFORM_DRIVER.
> >>
> >> Yes, but also sort out the existing TIMER_OF_DECLARE macro vs MODULE
> >> in order to prevent #ifdef MODULE in the drivers
> >>
> > Hi Daniel,
> >
> > Yes, that's our goal.
> >
> > I'll test the new macros (TIMER_OF_DECLARE_PLATFORM_DRIVER and
> > TIMER_OF_DECLARE_EARLY_PLATFORM_DRIVER) with the IMX timer drivers
> > once the patches are available.
>
> I think I have an idea on how to achieve that. That will result in the removal of
> TIMER_OF_DECLARE() when all drivers will be changed to use the new macro.
>
> The #ifdef MODULE macro is set when the driver is compiled as a module.
>
> So we can do something like:
>
> #ifdef MODULE
>
I think there might be a typo here - should this be "#ifndef MODULE" instead?
> #define TIMER_OF_DECLARE_PDEV(name, compat, data, fn) \
> OF_DECLARE_1_RET(timer_pdev, name, compat, data, fn)
>
>
> #else
>
> #define TIMER_OF_DECLARE_PDEV(__name, compat, data, fn) \
> OF_DECLARE_1_RET(of_pdev_timer_match_table,
> __name, compat, data, fn)
>
> static struct platform_driver __##__name##_timer_driver = {
> .probe = __##__name##_timer_probe,
> .driver = {
> .name = name,
> .of_match_table = of_pdev_timer_match_table,
> },
> };
> module_platform_driver(__##__name##_timer_driver);
>
> #endif
>
> So we deal with two tables, one for platform device non module and one
> module for modules.
>
> The first one is called by the timer-of init routine. The other one is called by the
> probe function.
>
> The drawback will be the match table will be common to all timer drivers. So
> probe will be a bit slower. May be there is an area of optimization here.
This doesn't support EPROBE_DEFER for built-in drivers, correct?
BRs,
Zhipeng
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-03-26 10:34 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 8:12 [PATCH v4 0/4] clocksource: Add module support for timer drivers Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 1/4] clocksource/drivers/mmio: Export clocksource_mmio_init() Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 2/4] clocksource/drivers/timer-of: Remove __init markings Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 3/4] clocksource/drivers/timer-mediatek: Convert timer-mediatek to a loadable module Zhipeng Wang
2026-03-04 19:02 ` Daniel Lezcano
2026-03-06 5:46 ` [EXT] " Zhipeng Wang
2026-03-08 19:51 ` Daniel Lezcano
2026-03-09 5:31 ` Zhipeng Wang
2026-03-09 6:14 ` Trilok Soni
2026-03-09 9:38 ` Daniel Lezcano
2026-03-10 8:41 ` Zhipeng Wang
2026-03-25 14:42 ` Daniel Lezcano
2026-03-26 10:34 ` Zhipeng Wang
2026-03-04 8:12 ` [PATCH v4 4/4] clocksource/drivers/imx-tpm: Support building imx-tpm driver as module Zhipeng Wang
2026-03-05 13:44 ` kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox