19952f691SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only 2bb0eb050SDaniel Lezcano /* 3bb0eb050SDaniel Lezcano * Copyright (c) 2012, NVIDIA CORPORATION. All rights reserved. 4bb0eb050SDaniel Lezcano */ 5bb0eb050SDaniel Lezcano 6bb0eb050SDaniel Lezcano #include <linux/acpi.h> 7bb0eb050SDaniel Lezcano #include <linux/init.h> 8bb0eb050SDaniel Lezcano #include <linux/of.h> 9bb0eb050SDaniel Lezcano #include <linux/clocksource.h> 10bb0eb050SDaniel Lezcano 11bb0eb050SDaniel Lezcano extern struct of_device_id __timer_of_table[]; 12bb0eb050SDaniel Lezcano 13bb0eb050SDaniel Lezcano static const struct of_device_id __timer_of_table_sentinel 1433def849SJoe Perches __used __section("__timer_of_table_end"); 15bb0eb050SDaniel Lezcano timer_probe(void)16bb0eb050SDaniel Lezcanovoid __init timer_probe(void) 17bb0eb050SDaniel Lezcano { 18bb0eb050SDaniel Lezcano struct device_node *np; 19bb0eb050SDaniel Lezcano const struct of_device_id *match; 20bb0eb050SDaniel Lezcano of_init_fn_1_ret init_func_ret; 21bb0eb050SDaniel Lezcano unsigned timers = 0; 22bb0eb050SDaniel Lezcano int ret; 23bb0eb050SDaniel Lezcano 24bb0eb050SDaniel Lezcano for_each_matching_node_and_match(np, __timer_of_table, &match) { 25bb0eb050SDaniel Lezcano if (!of_device_is_available(np)) 26bb0eb050SDaniel Lezcano continue; 27bb0eb050SDaniel Lezcano 28bb0eb050SDaniel Lezcano init_func_ret = match->data; 29bb0eb050SDaniel Lezcano 30bb0eb050SDaniel Lezcano ret = init_func_ret(np); 31bb0eb050SDaniel Lezcano if (ret) { 3214e019dfSJon Hunter if (ret != -EPROBE_DEFER) 3314e019dfSJon Hunter pr_err("Failed to initialize '%pOF': %d\n", np, 3414e019dfSJon Hunter ret); 35bb0eb050SDaniel Lezcano continue; 36bb0eb050SDaniel Lezcano } 37bb0eb050SDaniel Lezcano 38bb0eb050SDaniel Lezcano timers++; 39bb0eb050SDaniel Lezcano } 40bb0eb050SDaniel Lezcano 41bb0eb050SDaniel Lezcano timers += acpi_probe_device_table(timer); 42bb0eb050SDaniel Lezcano 43bb0eb050SDaniel Lezcano if (!timers) 44bb0eb050SDaniel Lezcano pr_crit("%s: no matching timers found\n", __func__); 45bb0eb050SDaniel Lezcano } 46