How to configure Device Trees (TF-A/UBoot/Kernel) to output the MCO2 clock on an external pin of the STM32MP15x?
Here the relevant parts of my device trees:
******************TF-A*******************
&pinctrl {
rcc_pins_mx: rcc_mx-0 {
pins {
pinmux = <STM32_PINMUX('G', 2, AF1)>; /* RCC_MCO_2 */
bias-disable;
drive-push-pull;
slew-rate = <2>;
};
};
&rcc {
st,hsi-cal;
st,cal-sec = <60>;
st,clksrc = <
CLK_MPU_PLL1P
CLK_AXI_PLL2P
CLK_MCU_PLL3P
CLK_PLL12_HSE
CLK_PLL3_HSE
CLK_PLL4_HSE
CLK_RTC_LSI
CLK_MCO1_DISABLED
CLK_MCO2_HSE
>;
st,clkdiv = <
1 /*MPU*/
0 /*AXI*/
0 /*MCU*/
1 /*APB1*/
1 /*APB2*/
1 /*APB3*/
1 /*APB4*/
2 /*APB5*/
0 /*RTC*/
0 /*MCO1*/
0 /*MCO2*/
>;
};
&rcc{
pinctrl-names = "default";
pinctrl-0 = <&rcc_pins_mx>;
status = "okay";
secure-status = "okay";
};******************UBoot*****************
#ifndef CONFIG_TFABOOT
&rcc {
u-boot,dm-pre-reloc;
st,clksrc = <
CLK_MPU_PLL1P
CLK_AXI_PLL2P
CLK_MCU_PLL3P
CLK_PLL12_HSE
CLK_PLL3_HSE
CLK_PLL4_HSE
CLK_RTC_LSI
CLK_MCO1_DISABLED
CLK_MCO2_HSE
>;
st,clkdiv = <
1 /*MPU*/
0 /*AXI*/
0 /*MCU*/
1 /*APB1*/
1 /*APB2*/
1 /*APB3*/
1 /*APB4*/
2 /*APB5*/
0 /*RTC*/
0 /*MCO1*/
0 /*MCO2*/
>;
.
.
.There are no other appearances of &rcc in UBoot DT.
******************Linux Kernel*****************
&pinctrl {
u-boot,dm-pre-reloc;
rcc_pins_mx: rcc_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('G', 2, AF1)>; /* RCC_MCO_2 */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
rcc_sleep_pins_mx: rcc_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('G', 2, ANALOG)>; /* RCC_MCO_2 */
};
};
};
&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 */
};My questions:
- Despite of the device tree configuration, there is no MCO2 output (24MHz clock) at PG2 pin while running TF-A nor UBoot. Any idea why?
- If I pass the pinctrl-names, pinctrl-0 and pinctrl-1 properties to the rcc node in the kernel DT (see above) it just doesn't boot at all
at leastunless I remove those properties in &rcc. PG2 is not being used by any other node. Am I missing something?
Thanks in advance!
PS. I'm using the TFBGA361 Package
