Silabs Si5340: how to define a clock for one of the chip outputs

707 Views Asked by At

We develop hardware that uses Si5340 to provide clocks for various chips (ADC, DAC).

Hardware is based on Xilinx Zynq Ultrascale and OS of choice is Petalinux 2018.3.

The driver that we use is clk-5341 (https://github.com/torvalds/linux/blob/master/Documentation/devicetree/bindings/clock/silabs,si5341.txt).

Documentation for clock chip provides two snippets how to use outputs.

some-video-node {
    /* Standard clock bindings */
    clock-names = "pixel";
    clocks = <&si5341 0 7>; /* Output 7 */

    /* Set output 7 to use syntesizer 3 as its parent */
    assigned-clocks = <&si5341 0 7>, <&si5341 1 3>;
    assigned-clock-parents = <&si5341 1 3>;
    /* Set output 7 to 148.5 MHz using a synth frequency of 594 MHz */
    assigned-clock-rates = <148500000>, <594000000>;
};

some-audio-node {
    clock-names = "i2s-clk";
    clocks = <&si5341 0 0>;
    /*
     * since output 0 is a synth-master, the synth will be automatically set
     * to an appropriate frequency when the audio driver requests another
     * frequency. We give control over synth 2 to this output here.
     */
    assigned-clocks = <&si5341 0 0>;
    assigned-clock-parents = <&si5341 1 2>;
};

Two outputs from si5340 are used:

  • 1 GHz for ADC chips
  • 250 MHz for DAC chips

I'd like to create two clock nodes that describe clock outputs that will then be referenced in ADC and DAC chip nodes.

the_adc_clock: silabs-clock {
    compatible = "fixed-clock"

    /* Standard clock bindings */
    clock-names = "silabs-out-1";
    clocks = <&si5340 0 1>; /* Output 1 */

    clock-output-names = "the-adc-clock";

    /* Set output 1 to use syntesizer 3 as its parent */
    assigned-clocks = <&si5340 0 1>, <&si5340 1 3>;
    /* Set output 1 to 148.5 MHz using a synth frequency of 594 MHz */
    assigned-clock-rates = <148500000>, <594000000>;

    assigned-clock-parents = <&si5340 1 3>;
};

hmcad1510: the-hmcad1520@1 {
    compatible = "adi,hmcad1520";
    reg = <1>;
    clocks = <&the_adc_clock>;
};

This does not work as expected. I am quite fresh with device trees. Unfortunately I did not find an example that would be helpful.

Can you please advise how to describe outputs from si5340 as clock sources properly?

0

There are 0 best solutions below