diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-02 17:23:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-02 17:23:01 -0400 |
commit | ee1a8d402e7e204d57fb108aa40003b6d1633036 (patch) | |
tree | 3abf4be63d11bbbd04c89bd668a17533f942b911 /drivers/clocksource/nomadik-mtu.c | |
parent | 40e71e7015ab85c8606f50736525220948a3b24b (diff) | |
parent | 9686bb66a4c50e43ffee903a9fc62237ee2de1e6 (diff) |
Merge tag 'dt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC device tree changes from Arnd Bergmann:
"These changes from 30 individual branches for the most part update
device tree files, but there are also a few source code changes that
have crept in this time, usually in order to atomically move over a
driver from using hardcoded data to DT probing.
A number of platforms change their DT files to use the C preprocessor,
which is causing a bit of churn, but that is hopefully only this once"
* tag 'dt-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (372 commits)
ARM: at91: dt: rm9200ek: add spi support
ARM: at91: dt: rm9200: add spi support
ARM: at91/DT: at91sam9n12: add SPI DMA client infos
ARM: at91/DT: sama5d3: add SPI DMA client infos
ARM: at91/DT: fix SPI compatibility string
ARM: Kirkwood: Fix the internal register ranges translation
ARM: dts: bcm281xx: change comment to C89 style
ARM: mmc: bcm281xx SDHCI driver (dt mods)
ARM: nomadik: add the new clocks to the device tree
clk: nomadik: implement the Nomadik clocks properly
ARM: dts: omap5-uevm: Provide USB Host PHY clock frequency
ARM: dts: omap4-panda: Fix DVI EDID reads
ARM: dts: omap4-panda: Add USB Host support
arm: mvebu: enable mini-PCIe connectors on Armada 370 RD
ARM: shmobile: irqpin: add a DT property to enable masking on parent
ARM: dts: AM43x EPOS EVM support
ARM: dts: OMAP5: Add bandgap DT entry
ARM: dts: AM33XX: Add pinmux configuration for CPSW to am335x EVM
ARM: dts: AM33XX: Add pinmux configuration for CPSW to EVMsk
ARM: dts: AM33XX: Add pinmux configuration for CPSW to beaglebone
...
Diffstat (limited to 'drivers/clocksource/nomadik-mtu.c')
-rw-r--r-- | drivers/clocksource/nomadik-mtu.c | 60 |
1 files changed, 48 insertions, 12 deletions
diff --git a/drivers/clocksource/nomadik-mtu.c b/drivers/clocksource/nomadik-mtu.c index e405531e1cc5..b9415b622f55 100644 --- a/drivers/clocksource/nomadik-mtu.c +++ b/drivers/clocksource/nomadik-mtu.c | |||
@@ -13,6 +13,9 @@ | |||
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/clockchips.h> | 14 | #include <linux/clockchips.h> |
15 | #include <linux/clocksource.h> | 15 | #include <linux/clocksource.h> |
16 | #include <linux/of_address.h> | ||
17 | #include <linux/of_irq.h> | ||
18 | #include <linux/of_platform.h> | ||
16 | #include <linux/clk.h> | 19 | #include <linux/clk.h> |
17 | #include <linux/jiffies.h> | 20 | #include <linux/jiffies.h> |
18 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
@@ -188,22 +191,15 @@ static struct irqaction nmdk_timer_irq = { | |||
188 | .dev_id = &nmdk_clkevt, | 191 | .dev_id = &nmdk_clkevt, |
189 | }; | 192 | }; |
190 | 193 | ||
191 | void __init nmdk_timer_init(void __iomem *base, int irq) | 194 | static void __init __nmdk_timer_init(void __iomem *base, int irq, |
195 | struct clk *pclk, struct clk *clk) | ||
192 | { | 196 | { |
193 | unsigned long rate; | 197 | unsigned long rate; |
194 | struct clk *clk0, *pclk0; | ||
195 | 198 | ||
196 | mtu_base = base; | 199 | mtu_base = base; |
197 | 200 | ||
198 | pclk0 = clk_get_sys("mtu0", "apb_pclk"); | 201 | BUG_ON(clk_prepare_enable(pclk)); |
199 | BUG_ON(IS_ERR(pclk0)); | 202 | BUG_ON(clk_prepare_enable(clk)); |
200 | BUG_ON(clk_prepare(pclk0) < 0); | ||
201 | BUG_ON(clk_enable(pclk0) < 0); | ||
202 | |||
203 | clk0 = clk_get_sys("mtu0", NULL); | ||
204 | BUG_ON(IS_ERR(clk0)); | ||
205 | BUG_ON(clk_prepare(clk0) < 0); | ||
206 | BUG_ON(clk_enable(clk0) < 0); | ||
207 | 203 | ||
208 | /* | 204 | /* |
209 | * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz | 205 | * Tick rate is 2.4MHz for Nomadik and 2.4Mhz, 100MHz or 133 MHz |
@@ -213,7 +209,7 @@ void __init nmdk_timer_init(void __iomem *base, int irq) | |||
213 | * to wake-up at a max 127s a head in time. Dividing a 2.4 MHz timer | 209 | * to wake-up at a max 127s a head in time. Dividing a 2.4 MHz timer |
214 | * with 16 gives too low timer resolution. | 210 | * with 16 gives too low timer resolution. |
215 | */ | 211 | */ |
216 | rate = clk_get_rate(clk0); | 212 | rate = clk_get_rate(clk); |
217 | if (rate > 32000000) { | 213 | if (rate > 32000000) { |
218 | rate /= 16; | 214 | rate /= 16; |
219 | clk_prescale = MTU_CRn_PRESCALE_16; | 215 | clk_prescale = MTU_CRn_PRESCALE_16; |
@@ -247,3 +243,43 @@ void __init nmdk_timer_init(void __iomem *base, int irq) | |||
247 | mtu_delay_timer.freq = rate; | 243 | mtu_delay_timer.freq = rate; |
248 | register_current_timer_delay(&mtu_delay_timer); | 244 | register_current_timer_delay(&mtu_delay_timer); |
249 | } | 245 | } |
246 | |||
247 | void __init nmdk_timer_init(void __iomem *base, int irq) | ||
248 | { | ||
249 | struct clk *clk0, *pclk0; | ||
250 | |||
251 | pclk0 = clk_get_sys("mtu0", "apb_pclk"); | ||
252 | BUG_ON(IS_ERR(pclk0)); | ||
253 | clk0 = clk_get_sys("mtu0", NULL); | ||
254 | BUG_ON(IS_ERR(clk0)); | ||
255 | |||
256 | __nmdk_timer_init(base, irq, pclk0, clk0); | ||
257 | } | ||
258 | |||
259 | static void __init nmdk_timer_of_init(struct device_node *node) | ||
260 | { | ||
261 | struct clk *pclk; | ||
262 | struct clk *clk; | ||
263 | void __iomem *base; | ||
264 | int irq; | ||
265 | |||
266 | base = of_iomap(node, 0); | ||
267 | if (!base) | ||
268 | panic("Can't remap registers"); | ||
269 | |||
270 | pclk = of_clk_get_by_name(node, "apb_pclk"); | ||
271 | if (IS_ERR(pclk)) | ||
272 | panic("could not get apb_pclk"); | ||
273 | |||
274 | clk = of_clk_get_by_name(node, "timclk"); | ||
275 | if (IS_ERR(clk)) | ||
276 | panic("could not get timclk"); | ||
277 | |||
278 | irq = irq_of_parse_and_map(node, 0); | ||
279 | if (irq <= 0) | ||
280 | panic("Can't parse IRQ"); | ||
281 | |||
282 | __nmdk_timer_init(base, irq, pclk, clk); | ||
283 | } | ||
284 | CLOCKSOURCE_OF_DECLARE(nomadik_mtu, "st,nomadik-mtu", | ||
285 | nmdk_timer_of_init); | ||