Commit | Line | Data |
---|---|---|
5f5663a4 JA |
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> | |
b1e3be06 | 8 | #include <linux/errno.h> |
5f5663a4 | 9 | #include <linux/clksrc-dbx500-prcmu.h> |
da4a686a | 10 | #include <linux/clocksource.h> |
71de5c46 | 11 | #include <linux/of.h> |
c51423fc | 12 | #include <linux/of_address.h> |
5f5663a4 | 13 | |
e657bcf6 | 14 | #include "setup.h" |
5f5663a4 | 15 | |
174e7796 | 16 | #include "db8500-regs.h" |
7a4f2609 LW |
17 | #include "id.h" |
18 | ||
922468cd | 19 | static const struct of_device_id prcmu_timer_of_match[] __initconst = { |
c51423fc LJ |
20 | { .compatible = "stericsson,db8500-prcmu-timer-4", }, |
21 | { }, | |
22 | }; | |
23 | ||
6bb27d73 | 24 | void __init ux500_timer_init(void) |
5f5663a4 | 25 | { |
b1e3be06 | 26 | void __iomem *prcmu_timer_base; |
c51423fc LJ |
27 | void __iomem *tmp_base; |
28 | struct device_node *np; | |
b1e3be06 | 29 | |
8da15e17 | 30 | if (cpu_is_u8500_family() || cpu_is_ux540_family()) |
b1e3be06 | 31 | prcmu_timer_base = __io_address(U8500_PRCMU_TIMER_4_BASE); |
8da15e17 | 32 | else |
5f5663a4 | 33 | ux500_unknown_soc(); |
5f5663a4 | 34 | |
ac9c0cf1 LJ |
35 | np = of_find_matching_node(NULL, prcmu_timer_of_match); |
36 | if (!np) | |
37 | goto dt_fail; | |
c51423fc | 38 | |
ac9c0cf1 LJ |
39 | tmp_base = of_iomap(np, 0); |
40 | if (!tmp_base) | |
41 | goto dt_fail; | |
c51423fc | 42 | |
ac9c0cf1 | 43 | prcmu_timer_base = tmp_base; |
c51423fc LJ |
44 | |
45 | dt_fail: | |
b1e3be06 | 46 | clksrc_dbx500_prcmu_init(prcmu_timer_base); |
089b5c95 | 47 | clocksource_of_init(); |
5f5663a4 | 48 | } |