Failed to initialize ' timer@0'

 

[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [2]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x2c47f4ee7, max_idle_ns: 440795202497 ns
[    0.000036] sched_clock: 64 bits at 12MHz, resolution 83ns, wraps every 4398046511096ns
[    0.010323] OF: tracing timer@0 __of_get_address  1
[    0.010551] Failed to initialize ' timer@0': -6

 

void __init timer_probe(void)

{
        struct device_node *np;
        const struct of_device_id *match;
        of_init_fn_1_ret init_func_ret;
        unsigned timers = 0;
        int ret;

        for_each_matching_node_and_match(np, __timer_of_table, &match) {
                if (!of_device_is_available(np))
                        continue;

                init_func_ret = match->data;

                ret = init_func_ret(np);
                if (ret) {
                        if (ret != -EPROBE_DEFER)
                                pr_err("Failed to initialize '%pOF': %d\n", np,
                                       ret);
                        continue;
                }

                timers++;
        }



timers
+= acpi_probe_device_table(timer); if (!timers) pr_crit("%s: no matching timers found\n", __func__); } ~

 

static int __init arm_sp804_of_init(struct device_node *np)
{
    return sp804_of_init(np, &arm_sp804_timer);
}
TIMER_OF_DECLARE(sp804, "arm,sp804", arm_sp804_of_init);

 

#define TIMER_OF_DECLARE(name, compat, fn) \
        OF_DECLARE_1_RET(timer, name, compat, fn)

 

 

复制代码
#define OF_DECLARE_1(table, name, compat, fn) \
                _OF_DECLARE(table, name, compat, fn, of_init_fn_1)
#define OF_DECLARE_1_RET(table, name, compat, fn) \
                _OF_DECLARE(table, name, compat, fn, of_init_fn_1_ret)
#define OF_DECLARE_2(table, name, compat, fn) \
                _OF_DECLARE(table, name, compat, fn, of_init_fn_2)
复制代码
#if defined(CONFIG_OF) && !defined(MODULE)
#define _OF_DECLARE(table, name, compat, fn, fn_type)                   \
        static const struct of_device_id __of_table_##name              \
                __used __section("__" #table "_of_table")               \
                __aligned(__alignof__(struct of_device_id))             \
                 = { .compatible = compat,                              \
                     .data = (fn == (fn_type)NULL) ? fn : fn  }
#else
#define _OF_DECLARE(table, name, compat, fn, fn_type)                   \
        _OF_DECLARE_STUB(table, name, compat, fn, fn_type)
#endif

 

 

 

加上#clock-cells = <0>;

复制代码
      timclk2: clk@2 {
                        compatible = "fixed-clock";
                        #clock-cells = <0>;
                        clock-frequency = <48000000>;
                        clock-output-names = "timer2";
                };
复制代码

posted on 2021-11-16 16:56  tycoon3  阅读(188)  评论(0编辑  收藏  举报

导航