2019-08-19 02:18 PM
I need to provide 32kHz clock at MCO1 output pin on STM32MP157.
I have successfully configured u-boot to provide this clock but as soon as kernel is started clock disappears.
After some checks I have found that clock is disabled.
My question is if it is possible to create device tree entry to force kernel to enable MCO1 output ?
Regards
Arkadiusz
Solved! Go to Solution.
2021-11-24 07:31 AM
Hello @Marie-Christine CAYALE ,
Thanks for your useful hints. As this is still not resolved in the 5.10 STM-Kernel, I made a small platform driver based on your suggestions. For anyone having this issue you can take a look at this thread for a reference implementation:
Kind regards,
Moises
2019-08-20 01:39 AM
Hi @AKacp
Did you have a look to wiki user guide ?
https://wiki.st.com/stm32mpu/wiki/Clock_device_tree_configuration
https://wiki.st.com/stm32mpu/wiki/Clock_device_tree_configuration_-_Bootloader_specific
Let me know if it help
Olivier
2019-08-20 02:13 AM
Hello Olivier,
unfortunatelly this does not help.
As I wrote already, I have configured u-boot device tree to generate 32kHz on MCO1 output and it works well as long as bootloader is running. But, when Linux is starting and begins drivers initialization MCO1 output is disabled - MCO1ON bit in register RCC_MCO1CFG is 0. I have checked also 32k quartz - it is working while Linux is running.
Regards
Arkadiusz
2019-08-26 12:43 PM
Hello Olivier,
do you have any idea if this can be handled by configuring just device tree or I need to change some code in Linuc clock driver ?
Regards
Arkadiusz
2019-08-27 05:58 AM
Hi @AKacp
Are you using CubeMX to generate the Device Tree ?
MCO1 pin configuration should be also present in your kernel Device Tree. Is it the case ?
Olivier
2019-08-28 01:30 PM
Hi Olivier,
configuration is present:
here are parts of config from u-boot device tree:
&rcc {
u-boot,dm-pre-reloc;
st,clksrc = <
CLK_MPU_PLL1P_DIV
CLK_AXI_PLL2P
CLK_MCU_PLL3P
CLK_PLL12_HSE
CLK_PLL3_HSE
CLK_PLL4_HSE
CLK_RTC_LSE
CLK_MCO1_LSE
CLK_MCO2_DISABLED
>;
&rcc{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&rcc_pins_mx>;
pinctrl-1 = <&rcc_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN rcc */
/* USER CODE END rcc */
};
rcc_pins_mx: rcc_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('A', 13, AF2)>; /* RCC_MCO_1 */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
And here parts of dts file from kernel:
&rcc{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&rcc_pins_mx>;
pinctrl-1 = <&rcc_sleep_pins_mx>;
status = "okay";
/* USER CODE BEGIN rcc */
/* USER CODE END rcc */
};
rcc_pins_mx: rcc_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('A', 13, AF2)>; /* RCC_MCO_1 */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
Regards
Arkadiusz
2020-05-24 08:03 AM
I am actually having the very same issue over here. Was this solved and in that case, how?
I can manually enable the clock from Linux, but it would be much nicer if this could be sorted out from the device tree.
BR
RO
2021-01-24 10:58 PM
I know this post is quite old, but this is for reference solution
You can create a dummy device node to declare the clock.
Then in this device, you create some functions to switch on/off the clock (enable/disable).
in dts file in node describing simple driver (wifi or any "dummy" one)
add new clock
clocks = , ;
clock-names = , "my_mco1";
in probe function of same driver
calling clock enable on clock using
devm_clk_get(&pdev->dev, "my_mco1");
(can reuse clock enabling examples from other drivers)
Another solution can be changing clock to CRITICAL in kernel
linux-stm32mp-***/linux-***/drivers/clk/clk-stm32mp1.c
(if the clock is set to critical like described, it will be always ON.
But it is not optimized for power consumption in this case)
You can see clock status with
cat /sys/kernel/debug/clk/clk_summary
https://wiki.st.com/stm32mpu/wiki/Debugfs#How_to_visualize_debugfs_information
2021-11-24 07:31 AM
Hello @Marie-Christine CAYALE ,
Thanks for your useful hints. As this is still not resolved in the 5.10 STM-Kernel, I made a small platform driver based on your suggestions. For anyone having this issue you can take a look at this thread for a reference implementation:
Kind regards,
Moises