diff options
| -rw-r--r-- | drivers/clocksource/Kconfig | 3 | ||||
| -rw-r--r-- | drivers/clocksource/Makefile | 1 | ||||
| -rw-r--r-- | drivers/clocksource/clksrc-of.c | 35 | ||||
| -rw-r--r-- | include/asm-generic/vmlinux.lds.h | 9 | ||||
| -rw-r--r-- | include/linux/clocksource.h | 9 |
5 files changed, 57 insertions, 0 deletions
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index 7fdcbd3f4da5..a32b7a9c65d3 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig | |||
| @@ -1,3 +1,6 @@ | |||
| 1 | config CLKSRC_OF | ||
| 2 | bool | ||
| 3 | |||
| 1 | config CLKSRC_I8253 | 4 | config CLKSRC_I8253 |
| 2 | bool | 5 | bool |
| 3 | 6 | ||
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index f93453d01673..a33f79240217 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | obj-$(CONFIG_CLKSRC_OF) += clksrc-of.o | ||
| 1 | obj-$(CONFIG_ATMEL_TCB_CLKSRC) += tcb_clksrc.o | 2 | obj-$(CONFIG_ATMEL_TCB_CLKSRC) += tcb_clksrc.o |
| 2 | obj-$(CONFIG_X86_CYCLONE_TIMER) += cyclone.o | 3 | obj-$(CONFIG_X86_CYCLONE_TIMER) += cyclone.o |
| 3 | obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o | 4 | obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o |
diff --git a/drivers/clocksource/clksrc-of.c b/drivers/clocksource/clksrc-of.c new file mode 100644 index 000000000000..bdabdaa8d00f --- /dev/null +++ b/drivers/clocksource/clksrc-of.c | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. | ||
| 3 | * | ||
| 4 | * This program is free software; you can redistribute it and/or modify it | ||
| 5 | * under the terms and conditions of the GNU General Public License, | ||
| 6 | * version 2, as published by the Free Software Foundation. | ||
| 7 | * | ||
| 8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
| 9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
| 11 | * more details. | ||
| 12 | * | ||
| 13 | * You should have received a copy of the GNU General Public License | ||
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 15 | */ | ||
| 16 | |||
| 17 | #include <linux/init.h> | ||
| 18 | #include <linux/of.h> | ||
| 19 | |||
| 20 | extern struct of_device_id __clksrc_of_table[]; | ||
| 21 | |||
| 22 | static const struct of_device_id __clksrc_of_table_sentinel | ||
| 23 | __used __section(__clksrc_of_table_end); | ||
| 24 | |||
| 25 | void __init clocksource_of_init(void) | ||
| 26 | { | ||
| 27 | struct device_node *np; | ||
| 28 | const struct of_device_id *match; | ||
| 29 | void (*init_func)(void); | ||
| 30 | |||
| 31 | for_each_matching_node_and_match(np, __clksrc_of_table, &match) { | ||
| 32 | init_func = match->data; | ||
| 33 | init_func(); | ||
| 34 | } | ||
| 35 | } | ||
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index d1ea7ce0b4cb..1e744c5a0ffe 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
| @@ -149,6 +149,14 @@ | |||
| 149 | #define TRACE_SYSCALLS() | 149 | #define TRACE_SYSCALLS() |
| 150 | #endif | 150 | #endif |
| 151 | 151 | ||
| 152 | #ifdef CONFIG_CLKSRC_OF | ||
| 153 | #define CLKSRC_OF_TABLES() . = ALIGN(8); \ | ||
| 154 | VMLINUX_SYMBOL(__clksrc_of_table) = .; \ | ||
| 155 | *(__clksrc_of_table) \ | ||
| 156 | *(__clksrc_of_table_end) | ||
| 157 | #else | ||
| 158 | #define CLKSRC_OF_TABLES() | ||
| 159 | #endif | ||
| 152 | 160 | ||
| 153 | #define KERNEL_DTB() \ | 161 | #define KERNEL_DTB() \ |
| 154 | STRUCT_ALIGN(); \ | 162 | STRUCT_ALIGN(); \ |
| @@ -493,6 +501,7 @@ | |||
| 493 | DEV_DISCARD(init.rodata) \ | 501 | DEV_DISCARD(init.rodata) \ |
| 494 | CPU_DISCARD(init.rodata) \ | 502 | CPU_DISCARD(init.rodata) \ |
| 495 | MEM_DISCARD(init.rodata) \ | 503 | MEM_DISCARD(init.rodata) \ |
| 504 | CLKSRC_OF_TABLES() \ | ||
| 496 | KERNEL_DTB() | 505 | KERNEL_DTB() |
| 497 | 506 | ||
| 498 | #define INIT_TEXT \ | 507 | #define INIT_TEXT \ |
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 4dceaf8ae152..7944f14ea947 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h | |||
| @@ -332,4 +332,13 @@ extern int clocksource_mmio_init(void __iomem *, const char *, | |||
| 332 | 332 | ||
| 333 | extern int clocksource_i8253_init(void); | 333 | extern int clocksource_i8253_init(void); |
| 334 | 334 | ||
| 335 | #ifdef CONFIG_CLKSRC_OF | ||
| 336 | extern void clocksource_of_init(void); | ||
| 337 | |||
| 338 | #define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \ | ||
| 339 | static const struct of_device_id __clksrc_of_table_##name \ | ||
| 340 | __used __section(__clksrc_of_table) \ | ||
| 341 | = { .compatible = compat, .data = fn }; | ||
| 342 | #endif | ||
| 343 | |||
| 335 | #endif /* _LINUX_CLOCKSOURCE_H */ | 344 | #endif /* _LINUX_CLOCKSOURCE_H */ |
