[PATCH v4 5/6] clocksource/drivers/exynos_mct: Add module support
William McVicker
willmcvicker at google.com
Tue Jun 24 16:47:07 PDT 2025
On 06/24/2025, Daniel Lezcano wrote:
> On Fri, Jun 20, 2025 at 11:17:08AM -0700, Will McVicker wrote:
> > From: Donghoon Yu <hoony.yu at samsung.com>
> >
> > On Arm64 platforms the Exynos MCT driver can be built as a module. On
> > boot (and even after boot) the arch_timer is used as the clocksource and
> > tick timer. Once the MCT driver is loaded, it can be used as the wakeup
> > source for the arch_timer.
> >
> > Signed-off-by: Donghoon Yu <hoony.yu at samsung.com>
> > Signed-off-by: Youngmin Nam <youngmin.nam at samsung.com>
> > [original commit from https://android.googlesource.com/kernel/gs/+/8a52a8288ec7d88ff78f0b37480dbb0e9c65bbfd]
> > Reviewed-by: Youngmin Nam <youngmin.nam at samsung.com>
> > Tested-by: Youngmin Nam <youngmin.nam at samsung.com>
> > Signed-off-by: Will McVicker <willmcvicker at google.com>
> > ---
>
> ...
>
> > -static int __init mct_init_spi(struct device_node *np)
>
> __init_or_module
Thanks, I'll update in v5.
>
> > +static int mct_init_spi(struct device_node *np)
> > {
> > return mct_init_dt(np, MCT_INT_SPI);
> > }
> >
> > -static int __init mct_init_ppi(struct device_node *np)
> > +static int mct_init_ppi(struct device_node *np)
> > {
> > return mct_init_dt(np, MCT_INT_PPI);
> > }
> > -TIMER_OF_DECLARE(exynos4210, "samsung,exynos4210-mct", mct_init_spi);
> > -TIMER_OF_DECLARE(exynos4412, "samsung,exynos4412-mct", mct_init_ppi);
>
> Are you sure this is not going to hurt the ARM platforms ? Here the
> timer is enabled very early in the boot process while with this change
> the timer will be available later.
I took a second look at the TIMER_OF_DECLARE() macro and FWICT the timer will
only be enabled "very early" via timer_probe() if "MODULE" is not defined which
is only defined when this specific driver is compiled as a module. Note, this
"MODULE" define is not the same as the Kconfig option "CONFIG_MODULES".
That is why in my v1 and v2 patch [1] I had:
#ifdef MODULE
...
module_platform_driver(exynos4_mct_driver);
#else
TIMER_OF_DECLARE(...)
TIMER_OF_DECLARE(...)
#endif
However, I dropped that since Saravana mentioned that we should not be using
TIMER_OF_DECLARE() for drivers that can be modules. I don't have an ARM Exynos
device to verify dropping TIMER_OF_DECLARE() is safe. So if you and Saravana
agree, I can work on creating a patch to define TIMER_OF_DECLARE_MODULE() like
you proposed in [2] to handle this for all the drivers that are used for both ARM and
ARM64 SoCs.
Thanks,
Will
[1] https://lore.kernel.org/all/6e6b0f5f-ac60-48bb-af6c-fa58658d2639@linaro.org/
[2] https://lore.kernel.org/all/f2f914aa-c554-4135-afaa-f075537ed929@linaro.org/
<snip>
More information about the linux-arm-kernel
mailing list