cancel
Showing results for 
Search instead for 
Did you mean: 

TF-A: "Clock 85 can't be enabled"

AMurr.2282
Associate III

I'm having trouble with TF-A. I'm trying to build a custom distribution for the STM32MP153AAC, but I can reproduce the issue I'm having by using STM32MP157C-DK2 as a base.

The differences between DK2 and my board is that the PMIC is connected to I2C4 on pins B7 and E2 instead of GPIOZ. Another difference is that the serial port is connected to UART7 instead of UART4.

So, using devtool, I modified the TF-A DTS file stm32mp157c-dk2.dts to include these changes:

/ {
    model = "STMicroelectronics STM32MP157C-DK2 Discovery Board";
    compatible = "st,stm32mp157c-dk2", "st,stm32mp157";
 
    aliases {
        serial0 = &uart7;
    };
 
    chosen {
        stdout-path = "serial0:115200n8";
    };
};
 
&pinctrl {
    i2c4_pins_a: i2c4-0 {
        pins {
            pinmux = <STM32_PINMUX('B', 7, AF6)>, /* I2C4_SDA */
                     <STM32_PINMUX('E', 2, AF4)>; /* I2C4_SCL */
            bias-disable;
            drive-open-drain;
            slew-rate = <0>;
        };
    };
 
    uart7_pins_mx: uart7_mx-0 {
        pins1 {
            pinmux = <STM32_PINMUX('F', 6, AF7)>; /* UART7_RX */
            bias-disable;
        };
        pins2 {
            pinmux = <STM32_PINMUX('F', 7, AF7)>; /* UART7_TX */
            bias-disable;
            drive-push-pull;
            slew-rate = <0>;
        };
    };
};
 
&uart7{
    pinctrl-names = "default";
    pinctrl-0 = <&uart7_pins_mx>;
    status = "okay";
};
 
/* --- SNIP --- */

Compiling and running this, I get the following output:

NOTICE:  Model: STMicroelectronics STM32MP157C-DK2 Discovery Board
INFO:    Reset reason (0x14):
INFO:      Pad Reset from NRST
INFO:    PMIC version = 0x21
INFO:    Using USB                     
INFO:      Instance 2
INFO:    Boot used partition fsbl1
NOTICE:  BL2: v2.2-r1.0(debug):devtool-patched-dirty
NOTICE:  BL2: Built : 10:28:59, Sep 24 2020
INFO:    Using crypto library 'stm32_crypto_lib'
INFO:    BL2: Doing platform setup
INFO:    RAM: DDR3-DDR3L 16bits 533000Khz
INFO:    Memory size = 0x10000000 (256 MB)
INFO:    BL2 runs SP_MIN setup
INFO:    BL2: Loading image id 4
INFO:    Loading image id=4 at address 0x2ffed000
INFO:    Image id=4 loaded: 0x2ffed000 - 0x2ffff000
INFO:    BL2: Loading image id 5
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :                      
INFO:                   Phase ID : 0
INFO:                   address 0x2ffe7988
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :                      
INFO:                   Phase ID : 0
INFO:                   address 0x2ffe7988
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    Start Download partition 0 to address 0xc0000000 length 0
INFO:    USB : DFU : end of download partition : 0
INFO:    Loading image id=5 at address 0xc0100000
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :                      
INFO:                   Phase ID : 3
INFO:                   address 0x2ffe7988
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    receive request 6
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :                      
INFO:                   Phase ID : 3
INFO:                   address 0x2ffe7988
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    usb_partition_size: partition size : 0xd481c
INFO:    Start Download partition 3 to address 0xc0100000 length 870428
INFO:    USB : DFU : end of download partition : 3
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    UPLOAD :                      
INFO:                   Phase ID : 0
INFO:                   address 0xffffffff
INFO:    Send detach request
INFO:    GETSTATUS :
INFO:                   DFU_STATE_IDLE
INFO:    Receive Detach
INFO:    Image id=5 loaded: 0xc0100000 - 0xc01d481c
WARNING: Skip signature check (header option)
NOTICE:  ROTPK is not deployed on platform. Skipping ROTPK verification.
NOTICE:  BL2: Booting BL32
INFO:    Entry point address = 0x2ffed000
INFO:    SPSR = 0x1d3
ERROR:   stm32mp1_clk_get_gated_id: clk id 85 not found
ERROR:   Clock 85 can't be enabled

As far as I understand, clock 85 is the GPIOB clock. By inserting a few debug statements in the TF-A source code, I can verify that BL2 successfully is able to enable clock 85, but BL32 fails to enable clock 85.

If you look at the source code in drivers/st/clk/stm32mp1_clk.c (after yocto patches stuff on top) I notice that the table "stm32mp1_clk_gate" has the GPIO clocks surrounded by the IMAGE_BL2 define:

/* --- SNIP --- */
 
#if defined(IMAGE_BL2)
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 0, GPIOA, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 1, GPIOB, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 2, GPIOC, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 3, GPIOD, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 4, GPIOE, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 5, GPIOF, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 6, GPIOG, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 7, GPIOH, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 8, GPIOI, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 9, GPIOJ, _UNKNOWN_SEL),
    _CLK_SC_SELEC(N_S, RCC_MP_AHB4ENSETR, 10, GPIOK, _UNKNOWN_SEL),
#endif
 
/* --- SNIP --- */

Removing this #ifdef fixes it.

So I guess my question is: What are all of these #ifdefs doing here? I am certain that this is a more recent addition because we were able to successfully build "thud" with the same device tree.

How do I fix this problem with clock 85?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @AMurr.2282​ 

Sorry for inconvenience. Some problem while pushing tag on Github.

Now fixed :

https://github.com/STMicroelectronics/arm-trusted-firmware/releases/tag/v2.2-stm32mp-r1.3

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

View solution in original post

4 REPLIES 4
Olivier GALLIEN
ST Employee

Hi @AMurr.2282​ ,

Congrats ! ... and sorry for inconvenience.

You actually well catch and fix a recently detected regression in latest TF-A release.

The fix ( what you did) is on going for integration ?

Let you posted here when available on github

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @AMurr.2282​ ,

Fixed released is available : https://github.com/STMicroelectronics/arm-trusted-firmware/tree/v2.2-stm32mp-r1.3

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.

Hi @Community member​ 

Thanks, but your link is broken (and that tag does not exist).

Can you update the meta-st-stmp32 layer to include this fix?

Hi @AMurr.2282​ 

Sorry for inconvenience. Some problem while pushing tag on Github.

Now fixed :

https://github.com/STMicroelectronics/arm-trusted-firmware/releases/tag/v2.2-stm32mp-r1.3

Olivier

Olivier GALLIEN
In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.