linuxembedded-linuxdtsdevice-tree

Finding Clock number in device tree


We have an board based on i.MX6Q Sabresd, but we have some modifications.

One of the modification is we use a different clock for one of the peripheral.

How can I know what is the number of this clock for updating device tree.

 clocks = <&clks 200>;

This is connected to GPIO_3_CLK02 pin of i.MX6Q , what will be the value for the above variable if it is connected to GPIO_O_CLK0 enter image description here


Solution

  • The correct answer is 201. One of the way to get that value is to have a look at the proper defines that should have been used in the device tree.

    You can get a look at https://elixir.bootlin.com/linux/v4.16/source/include/dt-bindings/clock/imx6qdl-clock.h#L213

    You will find:

    #define IMX6QDL_CLK_CKO2            200
    #define IMX6QDL_CLK_CKO             201
    

    Those are the values used by both the clock driver and the device tree.