[v5] powerpc/timer - large decrementer support
Michael Ellerman
mpe at ellerman.id.au
Tue Jun 28 14:19:55 AEST 2016
On Fri, 2016-24-06 at 00:55:55 UTC, Oliver O'Halloran wrote:
> diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
> index 7a482a7f4d8d..efebe52133ef 100644
> --- a/arch/powerpc/kernel/time.c
> +++ b/arch/powerpc/kernel/time.c
> @@ -893,6 +894,86 @@ static void register_decrementer_clockevent(int cpu)
...
> +static void __init set_decrementer_max(void)
> +{
> + struct device_node *cpu;
> + const __be32 *fp;
> + u64 bits = 32;
> +
> + /* Prior to ISAv3 the decrementer is always 32 bit */
> + if (!cpu_has_feature(CPU_FTR_ARCH_300))
> + return;
> +
> + cpu = of_find_node_by_type(NULL, "cpu");
> + if (cpu)
> + fp = of_get_property(cpu, "ibm,dec-bits", NULL);
> +
> + if (cpu && fp) {
> + bits = of_read_number(fp, 1);
Sorry I didn't catch it earlier, but I prefer of_property_read_u32().
You should be able to do:
cpu = of_find_node_by_type(NULL, "cpu");
if (of_property_read_u32(cpu, "ibm,dec-bits", &bits) == 0) {
...
}
cheers
More information about the Linuxppc-dev
mailing list