On Tue, Apr 22, 2025 at 07:26:28AM +0200, Ahmad Fatoum wrote: > Now that there's clocksource framework support in PBL, let's make > available the first clocksource driver for use by OMAP HSMMC. > > Signed-off-by: Ahmad Fatoum <a.fat...@pengutronix.de> > --- > arch/arm/mach-omap/Kconfig | 1 + > drivers/clocksource/Makefile | 2 +- > drivers/clocksource/timer-ti-dm.c | 19 +++++++++++++------ > include/mach/omap/am33xx-clock.h | 3 +++ > 4 files changed, 18 insertions(+), 7 deletions(-) > > diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig > index 6c4e9d748d61..e7a9b331125d 100644 > --- a/arch/arm/mach-omap/Kconfig > +++ b/arch/arm/mach-omap/Kconfig > @@ -40,6 +40,7 @@ config ARCH_AM33XX > select CPU_V7 > select GENERIC_GPIO > select CLOCKSOURCE_TI_DM > + select PBL_CLOCKSOURCE > help > Say Y here if you are using Texas Instrument's AM33xx based platform > > diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile > index eceaa990d43d..dff825565072 100644 > --- a/drivers/clocksource/Makefile > +++ b/drivers/clocksource/Makefile > @@ -20,7 +20,7 @@ endif > obj-$(CONFIG_CLOCKSOURCE_ARM_GLOBAL_TIMER) += arm_global_timer.o > obj-$(CONFIG_CLOCKSOURCE_IMX_GPT) += timer-imx-gpt.o > obj-$(CONFIG_CLOCKSOURCE_DW_APB_TIMER) += dw_apb_timer.o > -obj-$(CONFIG_CLOCKSOURCE_TI_DM) += timer-ti-dm.o > +obj-pbl-$(CONFIG_CLOCKSOURCE_TI_DM) += timer-ti-dm.o > obj-$(CONFIG_CLOCKSOURCE_TI_32K) += timer-ti-32k.o > obj-$(CONFIG_CLINT_TIMER) += timer-clint.o > obj-$(CONFIG_RISCV_TIMER) += timer-riscv.o > diff --git a/drivers/clocksource/timer-ti-dm.c > b/drivers/clocksource/timer-ti-dm.c > index eb658402f58d..1090b96a0e94 100644 > --- a/drivers/clocksource/timer-ti-dm.c > +++ b/drivers/clocksource/timer-ti-dm.c > @@ -69,6 +69,18 @@ struct omap_dmtimer_data { > int (*get_clock)(struct device *dev); > }; > > +int omap_dmtimer_init(void __iomem *mmio_start, unsigned clk_speed) > +{ > + base = mmio_start; > + > + dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift); > + > + /* Enable counter */ > + writel(0x3, base + TCLR); > + > + return init_clock(&dmtimer_cs); > +}
Can you take the opportunity to fix the function prototype with the correct types 'u32' ? And replacing the litteral 0x3 with a macro ? > + > static int omap_dmtimer_probe(struct device *dev) > { > struct resource *iores; > @@ -90,12 +102,7 @@ static int omap_dmtimer_probe(struct device *dev) > if (clk_speed < 0) > return clk_speed; > > - dmtimer_cs.mult = clocksource_hz2mult(clk_speed, dmtimer_cs.shift); > - > - /* Enable counter */ > - writel(0x3, base + TCLR); > - > - return init_clock(&dmtimer_cs); > + return omap_dmtimer_init(IOMEM(iores->start), clk_speed); > } > > static int am335x_get_clock(struct device *dev) > diff --git a/include/mach/omap/am33xx-clock.h > b/include/mach/omap/am33xx-clock.h > index af47a0f3e77a..b064337ac4f8 100644 > --- a/include/mach/omap/am33xx-clock.h > +++ b/include/mach/omap/am33xx-clock.h > @@ -191,4 +191,7 @@ void am33xx_pll_init(int mpupll_M, int ddrpll_M); > void am33xx_enable_ddr_clocks(void); > int am33xx_get_osc_clock(void); > > +int omap_dmtimer_init(void __iomem *mmio_start, > + unsigned clk_speed); > + > #endif /* endif _AM33XX_CLOCKS_H_ */ > -- > 2.39.5 > > > -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog