[PATCHv4] powerpc/timer - large decrementer support
oliver
oohall at gmail.com
Thu Jun 23 18:21:23 AEST 2016
On Thu, Jun 23, 2016 at 6:02 PM, Denis Kirjanov <kirjanov at gmail.com> wrote:
> On 6/23/16, Oliver O'Halloran <oohall at gmail.com> wrote:
>> +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);
>> +
>> + if (bits > 64 || bits < 32) {
>> + pr_warn("time_init: firmware supplied invalid ibm,dec-bits");
>> + bits = 32;
>> + }
>> +
>> +
>> + /* calculate the signed maximum given this many bits */
>> + decrementer_max = (1ul << (bits - 1)) - 1;
>> + }
>> +
>> + pr_info("time_init: %llu bit decrementer (max: %llx)\n",
>> + bits, decrementer_max);
>> +}
> the call to of_node_put(cpu) is missing in the function.
Well spotted, thanks.
More information about the Linuxppc-dev
mailing list