DTS: clock not found

Matthias Brugger matthias.bgg at gmail.com
Wed Feb 5 16:02:33 EST 2014


Hi,

I'm stuck with dts problem. Whenever I try to find a clock for my
device, the of_get_clk returns an error "Kernel panic - not syncing:
Can't get timer clock"

My DTS looks like this (reduced to relevant parts for easier reading):

#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/interrupt-controller/arm-gic.h>
#include "skeleton.dtsi"

/ {

[...]

    soc {
        #address-cells = <1>;
        #size-cells = <1>;
        compatible = "simple-bus";
        ranges;

        gic: interrupt-controller at 10212000 {
            compatible = "arm,cortex-a9-gic";
            interrupt-controller;
            #interrupt-cells = <3>;
            reg = <0x10211000 0x1000>,
                  <0x10212000 0x1000>;
        };

       osc: oscillator {
            compatible = "fixed-clock";
            #clock-cells = <1>;
            clock-frequency  = <15000000>;
            clock-output-names = "osc";
        };

        timer: timer-mysoc {
            compatible = "mysoc,mysoc-timer";
            reg = <0x10008000 0x30>;
            interrupts = <GIC_SPI 113 IRQ_TYPE_EDGE_RISING>;
            clocks = <&osc 0>;
            clock-names = "system15m";
        };
    };
};


my /drivers/clocksource/mysoc-timer.c looks like this (reduced to
relevant parts for easier reading):

[...]

static void __init mysoc_timer_init(struct device_node *node)
{
    unsigned long rate = 0;
    struct clk *clk;
    int ret, irq;
    u32 val;

    gpt_base = of_iomap(node, 0);
    if (!gpt_base)
        panic("Can't map registers");

    irq = irq_of_parse_and_map(node, 0);
    if (irq <= 0)
        panic("Can't parse IRQ");

    clk = of_clk_get(node, 0);
    if (IS_ERR(clk))
        panic("Can't get timer clock");
    clk_prepare_enable(clk);

    rate = clk_get_rate(clk);

}
CLOCKSOURCE_OF_DECLARE(mtk_mt6589, "mysoc,mysoc-timer",
            mysoc_timer_init);


What I'm missing? I seems as if the clock "osc" is not found in the
device tree. Any idea why. Building the DTB works without errors, but
I suppose that doesn't mean too much anyway.

Cheers,
Matthias

-- 
motzblog.wordpress.com



More information about the Kernelnewbies mailing list