Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 1 | /* |
2 | * Copyright (C) ST-Ericsson SA 2011 | ||||
3 | * | ||||
4 | * License Terms: GNU General Public License v2 | ||||
5 | * Author: Mattias Wallin <mattias.wallin@stericsson.com> for ST-Ericsson | ||||
6 | */ | ||||
7 | #include <linux/io.h> | ||||
Linus Walleij | b1e3be06 | 2011-10-03 09:30:20 +0200 | [diff] [blame] | 8 | #include <linux/errno.h> |
Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 9 | #include <linux/clksrc-dbx500-prcmu.h> |
Rob Herring | da4a686 | 2013-02-06 21:17:47 -0600 | [diff] [blame] | 10 | #include <linux/clocksource.h> |
Lee Jones | 71de5c4 | 2012-03-16 09:53:24 +0000 | [diff] [blame] | 11 | #include <linux/of.h> |
Lee Jones | c51423f | 2012-04-24 10:04:46 +0100 | [diff] [blame] | 12 | #include <linux/of_address.h> |
Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 13 | |
Arnd Bergmann | e657bcf | 2013-03-21 22:51:12 +0100 | [diff] [blame] | 14 | #include "setup.h" |
Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 15 | |
Linus Walleij | 174e779 | 2013-03-19 15:41:55 +0100 | [diff] [blame] | 16 | #include "db8500-regs.h" |
Linus Walleij | 7a4f260 | 2012-09-19 19:31:19 +0200 | [diff] [blame] | 17 | #include "id.h" |
18 | |||||
Tobias Klauser | 922468c | 2014-07-01 10:47:48 +0200 | [diff] [blame] | 19 | static const struct of_device_id prcmu_timer_of_match[] __initconst = { |
Lee Jones | c51423f | 2012-04-24 10:04:46 +0100 | [diff] [blame] | 20 | { .compatible = "stericsson,db8500-prcmu-timer-4", }, |
21 | { }, | ||||
22 | }; | ||||
23 | |||||
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 24 | void __init ux500_timer_init(void) |
Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 25 | { |
Linus Walleij | b1e3be06 | 2011-10-03 09:30:20 +0200 | [diff] [blame] | 26 | void __iomem *prcmu_timer_base; |
Lee Jones | c51423f | 2012-04-24 10:04:46 +0100 | [diff] [blame] | 27 | void __iomem *tmp_base; |
28 | struct device_node *np; | ||||
Linus Walleij | b1e3be06 | 2011-10-03 09:30:20 +0200 | [diff] [blame] | 29 | |
Linus Walleij | 8da15e1 | 2013-11-19 22:17:06 +0100 | [diff] [blame] | 30 | if (cpu_is_u8500_family() || cpu_is_ux540_family()) |
Linus Walleij | b1e3be06 | 2011-10-03 09:30:20 +0200 | [diff] [blame] | 31 | prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); |
Linus Walleij | 8da15e1 | 2013-11-19 22:17:06 +0100 | [diff] [blame] | 32 | else |
Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 33 | ux500_unknown_soc(); |
Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 34 | |
Lee Jones | ac9c0cf | 2013-11-06 10:05:48 +0000 | [diff] [blame] | 35 | np = of_find_matching_node(NULL, prcmu_timer_of_match); |
36 | if (!np) | ||||
37 | goto dt_fail; | ||||
Lee Jones | c51423f | 2012-04-24 10:04:46 +0100 | [diff] [blame] | 38 | |
Lee Jones | ac9c0cf | 2013-11-06 10:05:48 +0000 | [diff] [blame] | 39 | tmp_base = of_iomap(np, 0); |
40 | if (!tmp_base) | ||||
41 | goto dt_fail; | ||||
Lee Jones | c51423f | 2012-04-24 10:04:46 +0100 | [diff] [blame] | 42 | |
Lee Jones | ac9c0cf | 2013-11-06 10:05:48 +0000 | [diff] [blame] | 43 | prcmu_timer_base = tmp_base; |
Lee Jones | c51423f | 2012-04-24 10:04:46 +0100 | [diff] [blame] | 44 | |
45 | dt_fail: | ||||
Linus Walleij | b1e3be06 | 2011-10-03 09:30:20 +0200 | [diff] [blame] | 46 | clksrc_dbx500_prcmu_init(prcmu_timer_base); |
Linus Walleij | 089b5c9 | 2013-11-19 22:37:55 +0100 | [diff] [blame] | 47 | clocksource_of_init(); |
Jonas Aaberg | 5f5663a | 2011-09-14 09:10:54 +0200 | [diff] [blame] | 48 | } |