Merge branch 'clockevents/3.14' of git://git.linaro.org/people/daniel.lezcano/linux...
authorIngo Molnar <mingo@kernel.org>
Sun, 12 Jan 2014 16:28:52 +0000 (17:28 +0100)
committerIngo Molnar <mingo@kernel.org>
Tue, 14 Jan 2014 13:33:29 +0000 (14:33 +0100)
Pull clocksource/clockevent updates from Daniel Lezcano:

  * Axel Lin removed an unused structure defining the ids for the
    bcm kona driver.

  * Ezequiel Garcia enabled the timer divider only when the 25MHz
    timer is not used for the armada 370 XP.

  * Jingoo Han removed a pointless platform data initialization for
    the sh_mtu and sh_mtu2.

  * Laurent Pinchart added the clk_prepare/clk_unprepare for sh_cmt.

  * Linus Walleij added a useful warning in clk_of when no clocks
    are found while the old behavior was to silently hang at boot time.

  * Maxime Ripard added the high speed timer drivers for the
    Allwinner SoCs (A10, A13, A20). He increased the rating, shared the
    irq across all available cpus and fixed the clockevent's irq
    initialization for the sun4i.

  * Michael Opdenacker removed the usage of the IRQF_DISABLED for the
    all the timers driver located in drivers/clocksource.

  * Stephen Boyd switched to sched_clock_register for the
    arm_global_timer, cadence_ttc, sun4i and orion timers.

Conflicts:
drivers/clocksource/clksrc-of.c

Signed-off-by: Ingo Molnar <mingo@kernel.org>
1  2 
arch/arm/boot/dts/sun7i-a20.dtsi
drivers/clocksource/Kconfig
drivers/clocksource/clksrc-of.c
drivers/clocksource/sh_mtu2.c
drivers/clocksource/sh_tmu.c
drivers/clocksource/sun4i_timer.c
drivers/clocksource/time-armada-370-xp.c

index 367611a0730bc0c978d24737fa611c1beeac7417,ee6cec7b0c90c2c3d1e5131ab85fe3e1f2a02146..0135039eff96440dfc5b2fbb7813a137bd51122d
                emac: ethernet@01c0b000 {
                        compatible = "allwinner,sun4i-emac";
                        reg = <0x01c0b000 0x1000>;
 -                      interrupts = <0 55 1>;
 +                      interrupts = <0 55 4>;
                        clocks = <&ahb_gates 17>;
                        status = "disabled";
                };
                pio: pinctrl@01c20800 {
                        compatible = "allwinner,sun7i-a20-pinctrl";
                        reg = <0x01c20800 0x400>;
 -                      interrupts = <0 28 1>;
 +                      interrupts = <0 28 4>;
                        clocks = <&apb0_gates 5>;
                        gpio-controller;
                        interrupt-controller;
                timer@01c20c00 {
                        compatible = "allwinner,sun4i-timer";
                        reg = <0x01c20c00 0x90>;
 -                      interrupts = <0 22 1>,
 -                                   <0 23 1>,
 -                                   <0 24 1>,
 -                                   <0 25 1>,
 -                                   <0 67 1>,
 -                                   <0 68 1>;
 +                      interrupts = <0 22 4>,
 +                                   <0 23 4>,
 +                                   <0 24 4>,
 +                                   <0 25 4>,
 +                                   <0 67 4>,
 +                                   <0 68 4>;
                        clocks = <&osc24M>;
                };
  
                uart0: serial@01c28000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28000 0x400>;
 -                      interrupts = <0 1 1>;
 +                      interrupts = <0 1 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 16>;
                uart1: serial@01c28400 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28400 0x400>;
 -                      interrupts = <0 2 1>;
 +                      interrupts = <0 2 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 17>;
                uart2: serial@01c28800 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28800 0x400>;
 -                      interrupts = <0 3 1>;
 +                      interrupts = <0 3 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 18>;
                uart3: serial@01c28c00 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c28c00 0x400>;
 -                      interrupts = <0 4 1>;
 +                      interrupts = <0 4 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 19>;
                uart4: serial@01c29000 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c29000 0x400>;
 -                      interrupts = <0 17 1>;
 +                      interrupts = <0 17 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 20>;
                uart5: serial@01c29400 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c29400 0x400>;
 -                      interrupts = <0 18 1>;
 +                      interrupts = <0 18 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 21>;
                uart6: serial@01c29800 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c29800 0x400>;
 -                      interrupts = <0 19 1>;
 +                      interrupts = <0 19 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 22>;
                uart7: serial@01c29c00 {
                        compatible = "snps,dw-apb-uart";
                        reg = <0x01c29c00 0x400>;
 -                      interrupts = <0 20 1>;
 +                      interrupts = <0 20 4>;
                        reg-shift = <2>;
                        reg-io-width = <4>;
                        clocks = <&apb1_gates 23>;
                i2c0: i2c@01c2ac00 {
                        compatible = "allwinner,sun4i-i2c";
                        reg = <0x01c2ac00 0x400>;
 -                      interrupts = <0 7 1>;
 +                      interrupts = <0 7 4>;
                        clocks = <&apb1_gates 0>;
                        clock-frequency = <100000>;
                        status = "disabled";
                i2c1: i2c@01c2b000 {
                        compatible = "allwinner,sun4i-i2c";
                        reg = <0x01c2b000 0x400>;
 -                      interrupts = <0 8 1>;
 +                      interrupts = <0 8 4>;
                        clocks = <&apb1_gates 1>;
                        clock-frequency = <100000>;
                        status = "disabled";
                i2c2: i2c@01c2b400 {
                        compatible = "allwinner,sun4i-i2c";
                        reg = <0x01c2b400 0x400>;
 -                      interrupts = <0 9 1>;
 +                      interrupts = <0 9 4>;
                        clocks = <&apb1_gates 2>;
                        clock-frequency = <100000>;
                        status = "disabled";
                i2c3: i2c@01c2b800 {
                        compatible = "allwinner,sun4i-i2c";
                        reg = <0x01c2b800 0x400>;
 -                      interrupts = <0 88 1>;
 +                      interrupts = <0 88 4>;
                        clocks = <&apb1_gates 3>;
                        clock-frequency = <100000>;
                        status = "disabled";
                i2c4: i2c@01c2bc00 {
                        compatible = "allwinner,sun4i-i2c";
                        reg = <0x01c2bc00 0x400>;
 -                      interrupts = <0 89 1>;
 +                      interrupts = <0 89 4>;
                        clocks = <&apb1_gates 15>;
                        clock-frequency = <100000>;
                        status = "disabled";
                };
  
+               hstimer@01c60000 {
+                       compatible = "allwinner,sun7i-a20-hstimer";
+                       reg = <0x01c60000 0x1000>;
+                       interrupts = <0 81 1>,
+                                    <0 82 1>,
+                                    <0 83 1>,
+                                    <0 84 1>;
+                       clocks = <&ahb_gates 28>;
+               };
                gic: interrupt-controller@01c81000 {
                        compatible = "arm,cortex-a7-gic", "arm,cortex-a15-gic";
                        reg = <0x01c81000 0x1000>,
index 634c4d6dd45a489384d4c6b293e56f0fcc2ba331,884eeff8e32d3e0a995963d0417357e973e1ecd1..cd6950fd8caf063417f6717db581f39d69100ed4
@@@ -37,6 -37,10 +37,10 @@@ config SUN4I_TIME
        select CLKSRC_MMIO
        bool
  
+ config SUN5I_HSTIMER
+       select CLKSRC_MMIO
+       bool
  config VT8500_TIMER
        bool
  
@@@ -75,7 -79,6 +79,7 @@@ config CLKSRC_DBX500_PRCMU_SCHED_CLOC
  config CLKSRC_EFM32
        bool "Clocksource for Energy Micro's EFM32 SoCs" if !ARCH_EFM32
        depends on OF && ARM && (ARCH_EFM32 || COMPILE_TEST)
 +      select CLKSRC_MMIO
        default ARCH_EFM32
        help
          Support to use the timers of EFM32 SoCs as clock source and clock
@@@ -88,7 -91,6 +92,7 @@@ config ARM_ARCH_TIME
  config ARM_ARCH_TIMER_EVTSTREAM
        bool "Support for ARM architected timer event stream generation"
        default y if ARM_ARCH_TIMER
 +      depends on ARM_ARCH_TIMER
        help
          This option enables support for event stream generation based on
          the ARM architected timer. It is used for waking up CPUs executing
index b9ddd9e3a2f599e2cc7424c1eac18d4280b2f850,a30b42c3ac3bdc483490a1bc781e663fc91edab5..ae2e4278c42abd75358279e937e991497097a2e6
@@@ -28,6 -28,7 +28,7 @@@ void __init clocksource_of_init(void
        struct device_node *np;
        const struct of_device_id *match;
        clocksource_of_init_fn init_func;
+       unsigned clocksources = 0;
  
        for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
                if (!of_device_is_available(np))
@@@ -35,5 -36,9 +36,8 @@@
  
                init_func = match->data;
                init_func(np);
 -              of_node_put(np);
+               clocksources++;
        }
+       if (!clocksources)
+               pr_crit("%s: no matching clocksources found\n", __func__);
  }
index 3cf12834681e8335fa7f49dd032eb3cb57ad128a,b6a56b1c8947030e94ae94d0ee50e5f361160b19..e30d76e0a6fae9dab56a1b4ebc15ee769dd2fca3
@@@ -302,8 -302,7 +302,7 @@@ static int sh_mtu2_setup(struct sh_mtu2
        p->irqaction.handler = sh_mtu2_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.irq = irq;
-       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | \
-                            IRQF_IRQPOLL  | IRQF_NOBALANCING;
+       p->irqaction.flags = IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING;
  
        /* get hold of clock */
        p->clk = clk_get(&p->pdev->dev, "mtu2_fck");
                goto err1;
        }
  
 -      return sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
 -                              cfg->clockevent_rating);
 +      ret = clk_prepare(p->clk);
 +      if (ret < 0)
 +              goto err2;
 +
 +      ret = sh_mtu2_register(p, (char *)dev_name(&p->pdev->dev),
 +                             cfg->clockevent_rating);
 +      if (ret < 0)
 +              goto err3;
 +
 +      return 0;
 + err3:
 +      clk_unprepare(p->clk);
 + err2:
 +      clk_put(p->clk);
   err1:
        iounmap(p->mapbase);
   err0:
@@@ -358,7 -345,6 +357,6 @@@ static int sh_mtu2_probe(struct platfor
        ret = sh_mtu2_setup(p, pdev);
        if (ret) {
                kfree(p);
-               platform_set_drvdata(pdev, NULL);
                pm_runtime_idle(&pdev->dev);
                return ret;
        }
index 63557cda0a7d599e352c402f2db23b348481e365,fc752f7b27191ae556d29af54af32775da89c1c0..ecd7b60bfdfa9d2323053f325b8f9d4447988c9d
@@@ -462,8 -462,7 +462,7 @@@ static int sh_tmu_setup(struct sh_tmu_p
        p->irqaction.handler = sh_tmu_interrupt;
        p->irqaction.dev_id = p;
        p->irqaction.irq = irq;
-       p->irqaction.flags = IRQF_DISABLED | IRQF_TIMER | \
-                            IRQF_IRQPOLL  | IRQF_NOBALANCING;
+       p->irqaction.flags = IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING;
  
        /* get hold of clock */
        p->clk = clk_get(&p->pdev->dev, "tmu_fck");
                ret = PTR_ERR(p->clk);
                goto err1;
        }
 +
 +      ret = clk_prepare(p->clk);
 +      if (ret < 0)
 +              goto err2;
 +
        p->cs_enabled = false;
        p->enable_count = 0;
  
 -      return sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
 -                             cfg->clockevent_rating,
 -                             cfg->clocksource_rating);
 +      ret = sh_tmu_register(p, (char *)dev_name(&p->pdev->dev),
 +                            cfg->clockevent_rating,
 +                            cfg->clocksource_rating);
 +      if (ret < 0)
 +              goto err3;
 +
 +      return 0;
 +
 + err3:
 +      clk_unprepare(p->clk);
 + err2:
 +      clk_put(p->clk);
   err1:
        iounmap(p->mapbase);
   err0:
@@@ -523,7 -508,6 +522,6 @@@ static int sh_tmu_probe(struct platform
        ret = sh_tmu_setup(p, pdev);
        if (ret) {
                kfree(p);
-               platform_set_drvdata(pdev, NULL);
                pm_runtime_idle(&pdev->dev);
                return ret;
        }
index a4f6119aafd814efe2839f416bbe8fe99bc41554,191187470aa64fd4d6ae1f1238cfed1d09719ed2..bf497afba9ad1ef0c6c8ec57c9761f05d3acf799
@@@ -114,7 -114,7 +114,7 @@@ static int sun4i_clkevt_next_event(unsi
  
  static struct clock_event_device sun4i_clockevent = {
        .name = "sun4i_tick",
-       .rating = 300,
+       .rating = 350,
        .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
        .set_mode = sun4i_clkevt_mode,
        .set_next_event = sun4i_clkevt_next_event,
@@@ -138,7 -138,7 +138,7 @@@ static struct irqaction sun4i_timer_ir
        .dev_id = &sun4i_clockevent,
  };
  
- static u32 sun4i_timer_sched_read(void)
+ static u64 notrace sun4i_timer_sched_read(void)
  {
        return ~readl(timer_base + TIMER_CNTVAL_REG(1));
  }
@@@ -170,18 -170,15 +170,18 @@@ static void __init sun4i_timer_init(str
               TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
               timer_base + TIMER_CTL_REG(1));
  
-       setup_sched_clock(sun4i_timer_sched_read, 32, rate);
+       sched_clock_register(sun4i_timer_sched_read, 32, rate);
        clocksource_mmio_init(timer_base + TIMER_CNTVAL_REG(1), node->name,
-                             rate, 300, 32, clocksource_mmio_readl_down);
+                             rate, 350, 32, clocksource_mmio_readl_down);
  
        ticks_per_jiffy = DIV_ROUND_UP(rate, HZ);
  
        writel(TIMER_CTL_CLK_SRC(TIMER_CTL_CLK_SRC_OSC24M),
               timer_base + TIMER_CTL_REG(0));
  
 +      /* Make sure timer is stopped before playing with interrupts */
 +      sun4i_clkevt_time_stop(0);
 +
        ret = setup_irq(irq, &sun4i_timer_irq);
        if (ret)
                pr_warn("failed to setup irq %d\n", irq);
        val = readl(timer_base + TIMER_IRQ_EN_REG);
        writel(val | TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_EN_REG);
  
-       sun4i_clockevent.cpumask = cpumask_of(0);
+       sun4i_clockevent.cpumask = cpu_possible_mask;
+       sun4i_clockevent.irq = irq;
  
        clockevents_config_and_register(&sun4i_clockevent, rate,
                                        TIMER_SYNC_TICKS, 0xffffffff);
index 4e7f6802e840ba9379eb42d733801526d173e89e,0450f6b69ade314d023095c83e37720cab7e731a..ee8691b89944e3fcbc3dbf7eeaadf00ec38ffd93
@@@ -76,6 -76,7 +76,7 @@@
  static void __iomem *timer_base, *local_base;
  static unsigned int timer_clk;
  static bool timer25Mhz = true;
+ static u32 enable_mask;
  
  /*
   * Number of timer ticks per jiffy.
@@@ -121,8 -122,7 +122,7 @@@ armada_370_xp_clkevt_next_event(unsigne
        /*
         * Enable the timer.
         */
-       local_timer_ctrl_clrset(TIMER0_RELOAD_EN,
-                               TIMER0_EN | TIMER0_DIV(TIMER_DIVIDER_SHIFT));
+       local_timer_ctrl_clrset(TIMER0_RELOAD_EN, enable_mask);
        return 0;
  }
  
@@@ -141,9 -141,7 +141,7 @@@ armada_370_xp_clkevt_mode(enum clock_ev
                /*
                 * Enable timer.
                 */
-               local_timer_ctrl_clrset(0, TIMER0_RELOAD_EN |
-                                          TIMER0_EN |
-                                          TIMER0_DIV(TIMER_DIVIDER_SHIFT));
+               local_timer_ctrl_clrset(0, TIMER0_RELOAD_EN | enable_mask);
        } else {
                /*
                 * Disable timer.
@@@ -240,10 -238,13 +238,13 @@@ static void __init armada_370_xp_timer_
        WARN_ON(!timer_base);
        local_base = of_iomap(np, 1);
  
-       if (timer25Mhz)
+       if (timer25Mhz) {
                set = TIMER0_25MHZ;             
-       else
+               enable_mask = TIMER0_EN;
+       } else {
                clr = TIMER0_25MHZ;
+               enable_mask = TIMER0_EN | TIMER0_DIV(TIMER_DIVIDER_SHIFT);
+       }
        timer_ctrl_clrset(clr, set);
        local_timer_ctrl_clrset(clr, set);
  
  
        ticks_per_jiffy = (timer_clk + HZ / 2) / HZ;
  
 -      /*
 -       * Set scale and timer for sched_clock.
 -       */
 -      sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
 -
        /*
         * Setup free-running clocksource timer (interrupts
         * disabled).
        writel(0xffffffff, timer_base + TIMER0_VAL_OFF);
        writel(0xffffffff, timer_base + TIMER0_RELOAD_OFF);
  
-       timer_ctrl_clrset(0, TIMER0_EN | TIMER0_RELOAD_EN |
-                            TIMER0_DIV(TIMER_DIVIDER_SHIFT));
+       timer_ctrl_clrset(0, TIMER0_RELOAD_EN | enable_mask);
  
 +      /*
 +       * Set scale and timer for sched_clock.
 +       */
 +      sched_clock_register(armada_370_xp_read_sched_clock, 32, timer_clk);
 +
        clocksource_mmio_init(timer_base + TIMER0_VAL_OFF,
                              "armada_370_xp_clocksource",
                              timer_clk, 300, 32, clocksource_mmio_readl_down);