[PATCH 1/6] clocksource: sunxi: Add Allwinner A1X Timer Driver

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri Nov 16 08:14:57 EST 2012


Dear Maxime Ripard,

On Thu, 15 Nov 2012 23:46:20 +0100, Maxime Ripard wrote:
> +	/* Enable timer0 interrupt */
> +	val = readl(timer_base + TIMER_CTL_REG);
> +	writel(val | TIMER_CTL_ENABLE, timer_base + TIMER_CTL_REG);
> +
> +	sunxi_clockevent.mult = div_sc(TIMER_CLKSRC / TIMER_SCAL,
> +				NSEC_PER_SEC,
> +				sunxi_clockevent.shift);
> +	sunxi_clockevent.max_delta_ns = clockevent_delta2ns(0xff,
> +							    &sunxi_clockevent);
> +	sunxi_clockevent.min_delta_ns = clockevent_delta2ns(0x1,
> +							    &sunxi_clockevent);
> +	sunxi_clockevent.cpumask = cpumask_of(0);
> +
> +	clockevents_register_device(&sunxi_clockevent);

I haven't looked in details, but maybe it is possible here to use
clockevents_config_and_register() instead of
clockevents_register_device(). It would simplify this code a bit if it
works.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com



More information about the linux-arm-kernel mailing list