[PATCH v3 1/9] clocksource: time-armada-370-xp: Marvell Armada 370/XP SoC timer driver

Gregory CLEMENT gregory.clement at free-electrons.com
Fri Jun 15 07:38:45 EDT 2012


On 06/15/2012 12:45 PM, Andrew Lunn wrote:
>> +void __init armada_370_xp_timer_init(void)
>> +{
>> +	u32 u;
>> +	struct device_node *np;
>> +	unsigned int timer_clk;
>> +	int ret;
>> +	np = of_find_compatible_node(NULL, NULL, "marvell,timer");
>> +	timer_base = of_iomap(np, 0);
>> +	WARN_ON(!timer_base);
>> +
>> +	if (of_find_property(np, "marvell,timer-25Mhz", NULL)) {
>> +		/* The fixed 25MHz timer is available so let's use it */
>> +		u = readl(timer_base + TIMER_CTRL_OFF);
>> +		writel(u | TIMER0_25MHZ | TIMER1_25MHZ,
>> +		       timer_base + TIMER_CTRL_OFF);
>> +		timer_clk = 25000000;
>> +	} else {
>> +		u32 clk = 0;
>> +		ret = of_property_read_u32(np, "clock-frequency", &clk);
>> +		WARN_ON(!clk || ret < 0);
>> +		u = readl(timer_base + TIMER_CTRL_OFF);
>> +		writel(u & ~(TIMER0_25MHZ | TIMER1_25MHZ),
>> +		       timer_base + TIMER_CTRL_OFF);
>> +		timer_clk = clk / TIMER_DIVIDER;
>> +	}
> 
> Hi Gregory
> 
> This all looks very similar to plat-orion/timer.c. The biggest
> difference is the support for this 25Mhz timer mode. Maybe, so long as
> this property is not used, the code will work for all orion platforms.
> If so, we should drop all the armada_370_xp prefixes and just call it
> orion.
> 
> I will try to test it on a Kirkwood today/tomorrow.

I wait for your results, and if it works for you then I drop all the
armada_370_xp prefixes. About calling it orion, it should be mvebu I
think.


> 
>    Andrew


-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
+33 602 196 044



More information about the linux-arm-kernel mailing list