Merge branch 'clocksource/physical-timers' into next/dt
authorOlof Johansson <olof@lixom.net>
Fri, 5 Dec 2014 07:33:16 +0000 (23:33 -0800)
committerOlof Johansson <olof@lixom.net>
Fri, 5 Dec 2014 07:33:16 +0000 (23:33 -0800)
These are a pre-req to get rk3288 SMP to work with some firmwares, so merge
it in here as well as in next/drivers.

* clocksource/physical-timers:
  clocksource: arch_timer: Allow the device tree to specify uninitialized timer registers
  clocksource: arch_timer: Fix code to use physical timers when requested

1  2 
drivers/clocksource/arm_arch_timer.c

@@@ -462,7 -462,10 +462,10 @@@ static void __init arch_counter_registe
  
        /* Register the CP15 based counter if we have one */
        if (type & ARCH_CP15_TIMER) {
-               arch_timer_read_counter = arch_counter_get_cntvct;
+               if (arch_timer_use_virtual)
+                       arch_timer_read_counter = arch_counter_get_cntvct;
+               else
+                       arch_timer_read_counter = arch_counter_get_cntpct;
        } else {
                arch_timer_read_counter = arch_counter_get_cntvct_mem;
  
@@@ -660,11 -663,11 +663,11 @@@ static bool __ini
  arch_timer_probed(int type, const struct of_device_id *matches)
  {
        struct device_node *dn;
 -      bool probed = false;
 +      bool probed = true;
  
        dn = of_find_matching_node(NULL, matches);
 -      if (dn && of_device_is_available(dn) && (arch_timers_present & type))
 -              probed = true;
 +      if (dn && of_device_is_available(dn) && !(arch_timers_present & type))
 +              probed = false;
        of_node_put(dn);
  
        return probed;
@@@ -701,6 -704,14 +704,14 @@@ static void __init arch_timer_init(stru
                arch_timer_ppi[i] = irq_of_parse_and_map(np, i);
        arch_timer_detect_rate(NULL, np);
  
+       /*
+        * If we cannot rely on firmware initializing the timer registers then
+        * we should use the physical timers instead.
+        */
+       if (IS_ENABLED(CONFIG_ARM) &&
+           of_property_read_bool(np, "arm,cpu-registers-not-fw-configured"))
+                       arch_timer_use_virtual = false;
        /*
         * If HYP mode is available, we know that the physical timer
         * has been configured to be accessible from PL1. Use it, so