diff --git a/sys/arm/allwinner/timer.c b/sys/arm/allwinner/timer.c index 4668026f327..c87f9471115 100644 --- a/sys/arm/allwinner/timer.c +++ b/sys/arm/allwinner/timer.c @@ -295,12 +295,6 @@ a10_timer_get_timerfreq(struct a10_timer_softc *sc) return (sc->timer0_freq); } -void -cpu_initclocks(void) -{ - cpu_initclocks_bsp(); -} - static int a10_timer_hardclock(void *arg) { diff --git a/sys/arm/arm/generic_timer.c b/sys/arm/arm/generic_timer.c index 8de31bf0b61..1621e24a0d5 100644 --- a/sys/arm/arm/generic_timer.c +++ b/sys/arm/arm/generic_timer.c @@ -331,16 +331,6 @@ static devclass_t arm_tmr_devclass; DRIVER_MODULE(timer, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0); -void -cpu_initclocks(void) -{ - - if (PCPU_GET(cpuid) == 0) - cpu_initclocks_bsp(); - else - cpu_initclocks_ap(); -} - void DELAY(int usec) { diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index 1386210251f..68f4318d5d3 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -456,6 +456,30 @@ cpu_idle_wakeup(int cpu) return (0); } +/* + * Most ARM platforms don't need to do anything special to init their clocks + * (they get intialized during normal device attachment), and by not defining a + * cpu_initclocks() function they get this generic one. Any platform that needs + * to do something special can just provide their own implementation, which will + * override this one due to the weak linkage. + */ +void +arm_generic_initclocks(void) +{ + +#ifndef NO_EVENTTIMERS +#ifdef SMP + if (PCPU_GET(cpuid) == 0) + cpu_initclocks_bsp(); + else + cpu_initclocks_ap(); +#else + cpu_initclocks_bsp(); +#endif +#endif +} +__weak_reference(arm_generic_initclocks, cpu_initclocks); + int fill_regs(struct thread *td, struct reg *regs) { diff --git a/sys/arm/arm/mpcore_timer.c b/sys/arm/arm/mpcore_timer.c index 5024efe1254..719685980e5 100644 --- a/sys/arm/arm/mpcore_timer.c +++ b/sys/arm/arm/mpcore_timer.c @@ -358,25 +358,6 @@ static devclass_t arm_tmr_devclass; DRIVER_MODULE(mp_tmr, simplebus, arm_tmr_driver, arm_tmr_devclass, 0, 0); -/** - * cpu_initclocks - called by system to initialise the cpu clocks - * - * This is a boilerplat function, most of the setup has already been done - * when the driver was attached. Therefore this function must only be called - * after the driver is attached. - * - * RETURNS - * nothing - */ -void -cpu_initclocks(void) -{ - if (PCPU_GET(cpuid) == 0) - cpu_initclocks_bsp(); - else - cpu_initclocks_ap(); -} - /** * DELAY - Delay for at least usec microseconds. * @usec: number of microseconds to delay by diff --git a/sys/arm/broadcom/bcm2835/bcm2835_systimer.c b/sys/arm/broadcom/bcm2835/bcm2835_systimer.c index 1dc8d5d9dbc..5e737471a8e 100644 --- a/sys/arm/broadcom/bcm2835/bcm2835_systimer.c +++ b/sys/arm/broadcom/bcm2835/bcm2835_systimer.c @@ -277,12 +277,6 @@ static devclass_t bcm_systimer_devclass; DRIVER_MODULE(bcm_systimer, simplebus, bcm_systimer_driver, bcm_systimer_devclass, 0, 0); -void -cpu_initclocks(void) -{ - cpu_initclocks_bsp(); -} - void DELAY(int usec) { diff --git a/sys/arm/freescale/imx/imx_gpt.c b/sys/arm/freescale/imx/imx_gpt.c index f792a97ad8b..73bc8ece31f 100644 --- a/sys/arm/freescale/imx/imx_gpt.c +++ b/sys/arm/freescale/imx/imx_gpt.c @@ -319,17 +319,6 @@ imx_gpt_get_timerfreq(struct imx_gpt_softc *sc) return (sc->clkfreq); } -void -cpu_initclocks(void) -{ - - if (imx_gpt_sc == NULL) { - panic("%s: i.MX GPT driver has not been initialized!", __func__); - } - - cpu_initclocks_bsp(); -} - static int imx_gpt_intr(void *arg) { diff --git a/sys/arm/include/machdep.h b/sys/arm/include/machdep.h index c37f38644dc..8c7aaab3f35 100644 --- a/sys/arm/include/machdep.h +++ b/sys/arm/include/machdep.h @@ -32,6 +32,7 @@ vm_offset_t freebsd_parse_boot_param(struct arm_boot_params *abp); vm_offset_t linux_parse_boot_param(struct arm_boot_params *abp); vm_offset_t fake_preload_metadata(struct arm_boot_params *abp); vm_offset_t parse_boot_param(struct arm_boot_params *abp); +void arm_generic_initclocks(void); /* * Initialization functions called by the common initarm() function in diff --git a/sys/arm/lpc/lpc_timer.c b/sys/arm/lpc/lpc_timer.c index 5769435d375..ded53fa9931 100644 --- a/sys/arm/lpc/lpc_timer.c +++ b/sys/arm/lpc/lpc_timer.c @@ -279,12 +279,6 @@ lpc_get_timecount(struct timecounter *tc) return timer1_read_4(timer_softc, LPC_TIMER_TC); } -void -cpu_initclocks(void) -{ - cpu_initclocks_bsp(); -} - void DELAY(int usec) { diff --git a/sys/arm/mv/timer.c b/sys/arm/mv/timer.c index 3c6f1497d9c..ef8ce5f23ad 100644 --- a/sys/arm/mv/timer.c +++ b/sys/arm/mv/timer.c @@ -223,13 +223,6 @@ mv_timer_get_timecount(struct timecounter *tc) return (INITIAL_TIMECOUNTER - mv_get_timer(1)); } -void -cpu_initclocks(void) -{ - - cpu_initclocks_bsp(); -} - void DELAY(int usec) { diff --git a/sys/arm/ti/am335x/am335x_dmtimer.c b/sys/arm/ti/am335x/am335x_dmtimer.c index a01cf6a2356..240a7a77fa5 100644 --- a/sys/arm/ti/am335x/am335x_dmtimer.c +++ b/sys/arm/ti/am335x/am335x_dmtimer.c @@ -661,12 +661,6 @@ static devclass_t am335x_dmtimer_devclass; DRIVER_MODULE(am335x_dmtimer, simplebus, am335x_dmtimer_driver, am335x_dmtimer_devclass, 0, 0); MODULE_DEPEND(am335x_dmtimer, am335x_prcm, 1, 1, 1); -void -cpu_initclocks(void) -{ - cpu_initclocks_bsp(); -} - void DELAY(int usec) {