[PATCH v6 06/15] ARM: mxs: Add timer support

Russell King - ARM Linux linux at arm.linux.org.uk
Mon Dec 13 08:53:26 EST 2010


On Mon, Dec 13, 2010 at 08:55:00PM +0800, Shawn Guo wrote:
> +static struct clocksource clocksource_mxs = {
> +	.name 		= "mxs_timer",
> +	.rating		= 200,
> +	.read		= timrotv2_get_cycles,
> +	.mask		= CLOCKSOURCE_MASK(32),
> +	.shift 		= 17,

Please remove the .shift initializer.

> +	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
> +};
> +
> +static int __init mxs_clocksource_init(struct clk *timer_clk)
> +{
> +	unsigned int c = clk_get_rate(timer_clk);
> +
> +	if (timrot_is_v1()) {
> +		clocksource_mxs.read = timrotv1_get_cycles;
> +		clocksource_mxs.mask = CLOCKSOURCE_MASK(16);
> +	}
> +	clocksource_mxs.mult = clocksource_hz2mult(c, clocksource_mxs.shift);
> +	clocksource_register(&clocksource_mxs);

and use clocksource_register_hz(&clocksource_mxs, c); instead here -
it will calculate the shift and mult for you.



More information about the linux-arm-kernel mailing list