md.jamal
md.jamal

Reputation: 4567

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

Upvotes: 0

Views: 551

Answers (2)

Sponge5
Sponge5

Reputation: 31

Alexandre's answer is sufficient, but I hope I'll shed some more light here.

imx6q by default routes internal 24MHz oscillator OSC to CKO since this commit (and before as well, in fact). CKO is bit 8 in CCM_CCOSR register.

We came to the conclusion that CKO string was used in linux kernel for CCM_CLKO1 output, because in the reference manual the CCM_CLKO1 identifier is overloaded:

CCM_CCOSR - CLK_OUT_SEL

It can mean both an output (gate in kernel) and a signal (mux in kernel). Here's a diagram of my mental model:

OSC -> CSI0_MCLK

Credit goes to my colleague Jan Š. for decrypting the code and manual.

Upvotes: 1

Alexandre Belloni
Alexandre Belloni

Reputation: 2304

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.

Upvotes: 1

Related Questions