Hello,
I am trying to get 32Khz on CCM_CLKO2.
CCM_CLKO2 is connected to SD1_WP of IMX7D .
My question is..how to write the device tree to generate 32khz clock on CCM_CLKO2.
Thanks
Surya
Hi surya,
As you may know each pin on i.MX devices has up to 8 potential functions, and on the other side, one function can be available in different pins.
I assume you are aware that CCM_CLKO2 can be mapped to 2 output pins.
Well, you must configure one of these output pins to take CCM_CLKO2 functionality. E.g.
You need to do this through the Device Tree (dts file).
The Device Tree is a data structure for describing hardware that is passed to the operating system at boot time. The data structure can hold any kind of data as internally it is a tree of named nodes and properties. Nodes contain properties and child nodes, while properties are name–value pairs.
Example:
pinctrl_uart2: uart2grp {
fsl,pins = <
MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1
MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1
>;
};
So, how to configure what you need?
1) In the IO Pinmux chapter of Reference Manual you can find following registers:
IOMUXC_SW_MUX_CTL_PAD_<xxx> which indicates the mux function associated with the pin
IOMUXC_SW_PAD_CTL_PAD_<xxx> that is responsible for configuring the physical drive characteristic of the pin, which could be mapped to any of the pin functions.
Here <xxx> is the corresponding pin name.
In the example above the Hex number indicates the value of IOMUXC_SW_PAD_CTL_PAD_<xxx>.
2) Somewhere in you build directory you will find a file named imx6q-pinfuc.h here you will find macros with the following format:
<device>_PAD_<pin name>__<function> (please note double underscore between pin name and function)
In the example above the macro indicates the value of IOMUXC_SW_MUX_CTL_PAD_<xxx>
3) Finally just write/modify the appropriate node in the device tree with the appropriate macro and the desired pin characteristics
For more information about Device Tree and IO pins config you can see the following links:
Definitive GPIO guide - Studio Kousagi Wiki
Device Tree Tutorial (ARM) | Linux Kernel For Newbies
https://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf
Best regards,
TIC
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hello Carlos,
Thanks for the reply.
As per your instruction, i have muxed CCM_CLKO2 to sd1_wp in device tree.
"MX7D_PAD_SD1_WP__CCM_CLKO2 0x14".
Now, i got 24Mhz clock on the CCM_CLKO2 . But my requirement is to get 32Khz.
The file need to be modified is "arch/arm/mach-imx/clk-imx7d.c".
Thanks & regards
Surya
Answer here:
32Khz output on CCM_CLKO2 pin of imx7
Best regards,
Carlos
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------