From 32c339a6819e703d71a8a4b76bc9c90a68f06ab3 Mon Sep 17 00:00:00 2001 From: ian Date: Sat, 17 May 2014 20:22:22 +0000 Subject: [PATCH] MFC 264054, 264056 Switch imx6 to using the mpcore per-cpu event timers, but continue to use the GPT timer, which is fixed-frequency, as a timecounter. Change NO_EVENTTIMERS from an arm-specific to an MI option, so that it can be used in MI code. git-svn-id: svn://svn.freebsd.org/base/stable/10@266348 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/arm/freescale/imx/files.imx6 | 1 + sys/arm/freescale/imx/imx6_anatop.c | 3 +++ sys/arm/freescale/imx/imx6_machdep.c | 3 +++ sys/boot/fdt/dts/arm/imx6.dtsi | 8 ++++++++ sys/conf/options | 1 + sys/conf/options.arm | 1 - 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/sys/arm/freescale/imx/files.imx6 b/sys/arm/freescale/imx/files.imx6 index cab333f91..8697f6e4a 100644 --- a/sys/arm/freescale/imx/files.imx6 +++ b/sys/arm/freescale/imx/files.imx6 @@ -16,6 +16,7 @@ kern/kern_clocksource.c standard arm/arm/gic.c standard arm/arm/pl310.c standard arm/freescale/imx/bus_space.c standard +arm/arm/mpcore_timer.c standard arm/freescale/fsl_ocotp.c standard arm/freescale/imx/imx6_anatop.c standard arm/freescale/imx/imx_common.c standard diff --git a/sys/arm/freescale/imx/imx6_anatop.c b/sys/arm/freescale/imx/imx6_anatop.c index c713d8a76..eb784ed61 100644 --- a/sys/arm/freescale/imx/imx6_anatop.c +++ b/sys/arm/freescale/imx/imx6_anatop.c @@ -68,6 +68,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -263,6 +264,8 @@ cpufreq_set_clock(struct imx6_anatop_softc * sc, uint32_t cpu_newhz) imx6_anatop_write_4(IMX6_ANALOG_CCM_PLL_ARM_CLR, IMX6_ANALOG_CCM_PLL_ARM_BYPASS); + + arm_tmr_change_frequency(sc->cpu_curhz / 2); } static void diff --git a/sys/arm/freescale/imx/imx6_machdep.c b/sys/arm/freescale/imx/imx6_machdep.c index abca91fa2..c1074d02e 100644 --- a/sys/arm/freescale/imx/imx6_machdep.c +++ b/sys/arm/freescale/imx/imx6_machdep.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -55,6 +56,8 @@ void initarm_early_init(void) { + /* Inform the MPCore timer driver that its clock is variable. */ + arm_tmr_change_frequency(ARM_TMR_FREQUENCY_VARIES); } void diff --git a/sys/boot/fdt/dts/arm/imx6.dtsi b/sys/boot/fdt/dts/arm/imx6.dtsi index 35e87845f..d89a1a5e4 100644 --- a/sys/boot/fdt/dts/arm/imx6.dtsi +++ b/sys/boot/fdt/dts/arm/imx6.dtsi @@ -71,6 +71,14 @@ 0x00a00100 0x00000100>; }; + mp_tmr0@00a00200 { + compatible = "arm,mpcore-timers"; + reg = <0x00a00200 0x100 + 0x00a00600 0x100>; + interrupts = <27 29>; + interrupt-parent = <&gic>; + }; + l2-cache@00a02000 { compatible = "arm,pl310-cache", "arm,pl310"; reg = <0xa02000 0x1000>; diff --git a/sys/conf/options b/sys/conf/options index 4b66a9194..f5ae54c03 100644 --- a/sys/conf/options +++ b/sys/conf/options @@ -158,6 +158,7 @@ NEW_PCIB opt_global.h NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h NO_ADAPTIVE_RWLOCKS NO_ADAPTIVE_SX +NO_EVENTTIMERS opt_timer.h NO_SYSCTL_DESCR opt_global.h NSWBUF_MIN opt_swap.h MBUF_PACKET_ZONE_DISABLE opt_global.h diff --git a/sys/conf/options.arm b/sys/conf/options.arm index 87f17b0a0..a01a59cde 100644 --- a/sys/conf/options.arm +++ b/sys/conf/options.arm @@ -31,7 +31,6 @@ KERNPHYSADDR opt_global.h KERNVIRTADDR opt_global.h LINUX_BOOT_ABI opt_global.h LOADERRAMADDR opt_global.h -NO_EVENTTIMERS opt_timer.h PHYSADDR opt_global.h SOCDEV_PA opt_global.h SOCDEV_VA opt_global.h -- 2.45.0