-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'timers/core' into sched/hrtimers
Merge sched/core and timers/core so we can apply the sched balancing patch queue, which depends on both.
- Loading branch information
Showing
74 changed files
with
2,057 additions
and
1,324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
* ARMv7M System Timer | ||
|
||
ARMv7-M includes a system timer, known as SysTick. Current driver only | ||
implements the clocksource feature. | ||
|
||
Required properties: | ||
- compatible : Should be "arm,armv7m-systick" | ||
- reg : The address range of the timer | ||
|
||
Required clocking property, have to be one of: | ||
- clocks : The input clock of the timer | ||
- clock-frequency : The rate in HZ in input of the ARM SysTick | ||
|
||
Examples: | ||
|
||
systick: timer@e000e010 { | ||
compatible = "arm,armv7m-systick"; | ||
reg = <0xe000e010 0x10>; | ||
clocks = <&clk_systick>; | ||
}; | ||
|
||
systick: timer@e000e010 { | ||
compatible = "arm,armv7m-systick"; | ||
reg = <0xe000e010 0x10>; | ||
clock-frequency = <90000000>; | ||
}; |
26 changes: 26 additions & 0 deletions
26
Documentation/devicetree/bindings/timer/nxp,lpc3220-timer.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
* NXP LPC3220 timer | ||
|
||
The NXP LPC3220 timer is used on a wide range of NXP SoCs. This | ||
includes LPC32xx, LPC178x, LPC18xx and LPC43xx parts. | ||
|
||
Required properties: | ||
- compatible: | ||
Should be "nxp,lpc3220-timer". | ||
- reg: | ||
Address and length of the register set. | ||
- interrupts: | ||
Reference to the timer interrupt | ||
- clocks: | ||
Should contain a reference to timer clock. | ||
- clock-names: | ||
Should contain "timerclk". | ||
|
||
Example: | ||
|
||
timer1: timer@40085000 { | ||
compatible = "nxp,lpc3220-timer"; | ||
reg = <0x40085000 0x1000>; | ||
interrupts = <13>; | ||
clocks = <&ccu1 CLK_CPU_TIMER1>; | ||
clock-names = "timerclk"; | ||
}; |
22 changes: 22 additions & 0 deletions
22
Documentation/devicetree/bindings/timer/st,stm32-timer.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
. STMicroelectronics STM32 timer | ||
|
||
The STM32 MCUs family has several general-purpose 16 and 32 bits timers. | ||
|
||
Required properties: | ||
- compatible : Should be "st,stm32-timer" | ||
- reg : Address and length of the register set | ||
- clocks : Reference on the timer input clock | ||
- interrupts : Reference to the timer interrupt | ||
|
||
Optional properties: | ||
- resets: Reference to a reset controller asserting the timer | ||
|
||
Example: | ||
|
||
timer5: timer@40000c00 { | ||
compatible = "st,stm32-timer"; | ||
reg = <0x40000c00 0x400>; | ||
interrupts = <50>; | ||
resets = <&rrc 259>; | ||
clocks = <&clk_pmtr1>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright (C) Maxime Coquelin 2015 | ||
* Author: Maxime Coquelin <mcoquelin.stm32@gmail.com> | ||
* License terms: GNU General Public License (GPL), version 2 | ||
*/ | ||
|
||
#include <linux/kernel.h> | ||
#include <linux/clocksource.h> | ||
#include <linux/clockchips.h> | ||
#include <linux/of.h> | ||
#include <linux/of_address.h> | ||
#include <linux/clk.h> | ||
#include <linux/bitops.h> | ||
|
||
#define SYST_CSR 0x00 | ||
#define SYST_RVR 0x04 | ||
#define SYST_CVR 0x08 | ||
#define SYST_CALIB 0x0c | ||
|
||
#define SYST_CSR_ENABLE BIT(0) | ||
|
||
#define SYSTICK_LOAD_RELOAD_MASK 0x00FFFFFF | ||
|
||
static void __init system_timer_of_register(struct device_node *np) | ||
{ | ||
struct clk *clk = NULL; | ||
void __iomem *base; | ||
u32 rate; | ||
int ret; | ||
|
||
base = of_iomap(np, 0); | ||
if (!base) { | ||
pr_warn("system-timer: invalid base address\n"); | ||
return; | ||
} | ||
|
||
ret = of_property_read_u32(np, "clock-frequency", &rate); | ||
if (ret) { | ||
clk = of_clk_get(np, 0); | ||
if (IS_ERR(clk)) | ||
goto out_unmap; | ||
|
||
ret = clk_prepare_enable(clk); | ||
if (ret) | ||
goto out_clk_put; | ||
|
||
rate = clk_get_rate(clk); | ||
if (!rate) | ||
goto out_clk_disable; | ||
} | ||
|
||
writel_relaxed(SYSTICK_LOAD_RELOAD_MASK, base + SYST_RVR); | ||
writel_relaxed(SYST_CSR_ENABLE, base + SYST_CSR); | ||
|
||
ret = clocksource_mmio_init(base + SYST_CVR, "arm_system_timer", rate, | ||
200, 24, clocksource_mmio_readl_down); | ||
if (ret) { | ||
pr_err("failed to init clocksource (%d)\n", ret); | ||
if (clk) | ||
goto out_clk_disable; | ||
else | ||
goto out_unmap; | ||
} | ||
|
||
pr_info("ARM System timer initialized as clocksource\n"); | ||
|
||
return; | ||
|
||
out_clk_disable: | ||
clk_disable_unprepare(clk); | ||
out_clk_put: | ||
clk_put(clk); | ||
out_unmap: | ||
iounmap(base); | ||
pr_warn("ARM System timer register failed (%d)\n", ret); | ||
} | ||
|
||
CLOCKSOURCE_OF_DECLARE(arm_systick, "arm,armv7m-systick", | ||
system_timer_of_register); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.