2022-12-31 02:17 AM
I have custom board based on STM32MP153C.
This board has 7 serial ports. I configuring these ports with STM32MP1Cube.
After linux boot 4 of these serial ports become disabled Driver doesn't probe them and they are in "disabled" state in /sys/firmware/devicetree. Enabled only serial0, serial 3 and serial5 ports
i tried to make a devicetree dump with dd if=/dev/mem at adress in which devicetree was loaded by uboot and in this dump these ports are disabled as well.
DTB If I convert my DTB file (which is loading by UBOOT I see my correct devicetree, but in memory dump is edited and I don't know why.
Also my board has I2C and SPI interfaces and they have the same behavior.
Below I give part of my device tree in terms of serial ports:
#include <dt-bindings/pinctrl/stm32-pinfunc.h>
#include "stm32mp153.dtsi"
#include "stm32mp15xc.dtsi"
#include "stm32mp15xxab-pinctrl.dtsi"
#include "stm32mp15-m4-srm.dtsi"
/ {
aliases
{
serial0 = &usart6;
serial1 = &uart8;
serial2 = &usart3;
serial3 = &uart4;
serial4 = &uart7;
serial5 = &usart1;
serial6 = &usart2;
ethernet0 = ðernet0;
};
uart4_pins_mx: uart4_mx-0 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 0, AF8)>; /* UART4_RX */
bias-disable;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 1, AF8)>; /* UART4_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
uart4_sleep_pins_mx: uart4_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 0, ANALOG)>, /* UART4_RX */
<STM32_PINMUX('D', 1, ANALOG)>; /* UART4_TX */
};
};
uart7_pins_mx: uart7_mx-0 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('E', 7, AF7)>; /* UART7_RX */
bias-disable;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('E', 8, AF7)>; /* UART7_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
uart7_sleep_pins_mx: uart7_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('E', 7, ANALOG)>, /* UART7_RX */
<STM32_PINMUX('E', 8, ANALOG)>; /* UART7_TX */
};
};
uart8_pins_mx: uart8_mx-0 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('E', 0, AF8)>; /* UART8_RX */
bias-disable;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('E', 1, AF8)>; /* UART8_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
};
uart8_sleep_pins_mx: uart8_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('E', 0, ANALOG)>, /* UART8_RX */
<STM32_PINMUX('E', 1, ANALOG)>; /* UART8_TX */
};
};
usart1_pins_mx: usart1_mx-0 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('A', 9, AF7)>; /* USART1_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('B', 15, AF4)>; /* USART1_RX */
bias-disable;
};
};
usart1_sleep_pins_mx: usart1_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('A', 9, ANALOG)>, /* USART1_TX */
<STM32_PINMUX('B', 15, ANALOG)>; /* USART1_RX */
};
};
usart2_pins_mx: usart2_mx-0 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 4, AF7)>, /* USART2_RTS */
<STM32_PINMUX('D', 5, AF7)>; /* USART2_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 6, AF7)>, /* USART2_RX */
<STM32_PINMUX('E', 15, AF7)>; /* USART2_CTS */
bias-disable;
};
};
usart2_sleep_pins_mx: usart2_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 4, ANALOG)>, /* USART2_RTS */
<STM32_PINMUX('D', 5, ANALOG)>, /* USART2_TX */
<STM32_PINMUX('D', 6, ANALOG)>, /* USART2_RX */
<STM32_PINMUX('E', 15, ANALOG)>; /* USART2_CTS */
};
};
usart3_pins_mx: usart3_mx-0 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 8, AF7)>; /* USART3_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 9, AF7)>; /* USART3_RX */
bias-disable;
};
};
usart3_sleep_pins_mx: usart3_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('D', 8, ANALOG)>, /* USART3_TX */
<STM32_PINMUX('D', 9, ANALOG)>; /* USART3_RX */
};
};
usart6_pins_mx: usart6_mx-0 {
u-boot,dm-pre-reloc;
pins1 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('C', 6, AF7)>; /* USART6_TX */
bias-disable;
drive-push-pull;
slew-rate = <0>;
};
pins2 {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('C', 7, AF7)>; /* USART6_RX */
bias-disable;
};
};
usart6_sleep_pins_mx: usart6_sleep_mx-0 {
u-boot,dm-pre-reloc;
pins {
u-boot,dm-pre-reloc;
pinmux = <STM32_PINMUX('C', 6, ANALOG)>, /* USART6_TX */
<STM32_PINMUX('C', 7, ANALOG)>; /* USART6_RX */
};
};
};
&uart4{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart4_pins_mx>;
pinctrl-1 = <&uart4_sleep_pins_mx>;
status = "okay";
};
&uart7{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart7_pins_mx>;
pinctrl-1 = <&uart7_sleep_pins_mx>;
status = "okay";
};
&uart8{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&uart8_pins_mx>;
pinctrl-1 = <&uart8_sleep_pins_mx>;
status = "okay";
};
&usart1{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&usart1_pins_mx>;
pinctrl-1 = <&usart1_sleep_pins_mx>;
status = "okay";
};
&usart2{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&usart2_pins_mx>;
pinctrl-1 = <&usart2_sleep_pins_mx>;
status = "okay";
};
&usart3{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&usart3_pins_mx>;
pinctrl-1 = <&usart3_sleep_pins_mx>;
status = "okay";
};
&usart6{
u-boot,dm-pre-reloc;
pinctrl-names = "default", "sleep";
pinctrl-0 = <&usart6_pins_mx>;
pinctrl-1 = <&usart6_sleep_pins_mx>;
status = "okay";
};
Solved! Go to Solution.
2023-01-04 02:15 AM
In some reason these ports were locked in ATF via TrustZone Controller with following devicetree node:
&etzpc{
secure-status = "okay";
st,decprot = <
DECPROT(STM32MP1_ETZPC_I2C1_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_SPI3_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART7_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART8_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART2_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART3_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
>;
};
After replacing these lines by
DECPROT(STM32MP1_ETZPC_I2C1_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_SPI3_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART7_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART8_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART2_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART3_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
all works fine
2023-01-04 02:15 AM
In some reason these ports were locked in ATF via TrustZone Controller with following devicetree node:
&etzpc{
secure-status = "okay";
st,decprot = <
DECPROT(STM32MP1_ETZPC_I2C1_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_SPI3_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART7_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART8_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART2_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART3_ID, DECPROT_MCU_ISOLATION, DECPROT_UNLOCK)
>;
};
After replacing these lines by
DECPROT(STM32MP1_ETZPC_I2C1_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_SPI3_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART7_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_UART8_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART2_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
DECPROT(STM32MP1_ETZPC_USART3_ID, DECPROT_NS_RW, DECPROT_UNLOCK)
all works fine