use BBNSM RTC from U-Boot on i.MX 8ULP

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

use BBNSM RTC from U-Boot on i.MX 8ULP

Jump to solution
274 Views
daisukemizobuch
Contributor II

Hello,

I want to use BBNSM(Battery-Backed Non-Secure Module) RTC from U-Boot on i.MX 8ULP.

The smart way would be to use RPMsg, but it's not implemented in U-Boot.

However, I can't access the BBNSM register from the Arm Cortex A35. Is there an exclusive lock with the Arm Cortex-M33? Since the power_mode_switch is working on the M33, the BBNSM RTC is used.


BBNSM is mapped to PBRIDGE0(Peripheral Bridge 0) on A35. I tried to see if I could use BBNSM with the A35.

I tried to read BBNSM_RTC_LS(BBNSM Real-Time Counter LS Register) but couldn't.

<pre>
=> md.l 0x28038040 1
"Synchronous Abort" handler, esr 0x96000210
elr: 000000008029b2a4 lr : 000000008029b1f4 (reloc)
elr: 00000000a5eef2a4 lr : 00000000a5eef1f4
x0 : 0000000000000009 x1 : 00000000fffffffe
x2 : 00000000a4e49458 x3 : 0000000000000020
x4 : 00000000ffffffff x5 : 00000000a4e491e8
x6 : 0000000000000030 x7 : 00000000a4e493a0
x8 : 0000000000000010 x9 : 0000000090a65063
x10: 00000000ffffffd8 x11: 0000000000000010
x12: 0000000000000006 x13: 000000000001869f
x14: 00000000a4e497c0 x15: 0000000000000021
x16: 00000000a5e6eb0c x17: 0000000000000000
x18: 00000000a4e51d40 x19: 0000000000000004
x20: 0000000000000004 x21: 0000000000000001
x22: 0000000028038040 x23: 00000000a4e49459
x24: 0000000000000000 x25: 00000000a4e49408
x26: 00000000a5f0ec2b x27: 0000000000000008
x28: 0000000000000004 x29: 00000000a4e493a0

Code: 2a0403f3 17ffffcb 7100129f 54000181 (b94002c3)
Resetting CPU ...

resetting ...
</pre>


PCC_BBNSM(PCC BBNSM Register) is 0xC0000000(PR=1, CGC=1), so it's
ready to use.

<pre>
=> md.l 0x280300e0 1 280300e0: c0000000 ....
</pre>


I've also tried using a Linux kernel, but I'm unable to access it
either. The driver used was rtc-nxp-bbnsm.c below.

https://lore.kernel.org/linux-arm-kernel/20230215024117.3357341-1-ping.bai@nxp.com/T/

Thanks,

mizo

0 Kudos
Reply
1 Solution
168 Views
jimmychan
NXP TechSupport
NXP TechSupport

Please add the following TRDC configuration to BOARD_SetTrdcGlobalConfig() in SDK : /boards/evkmimx8ulp/demo_apps/power_mode_switch/board.c. Then try to read 0x28038040 in uboot.

 

        mbcBlockConfig.memoryAccessControlSelect = TRDC_MBC_ACCESS_CONTROL_POLICY_ALL_INDEX;
        mbcBlockConfig.nseEnable                 = true; /* non secure state can access the block for cortex-A35 */
        mbcBlockConfig.mbcIdx                    = 2U;   /* MBC2 */
        mbcBlockConfig.domainIdx                 = 7U;   /* MBC2_DOM7 */
        mbcBlockConfig.slaveMemoryIdx            = 0U;   /* MBC2_DOM7_MEM0 */
        mbcBlockConfig.memoryBlockIdx            = 56U;  /* MBC2_DOM7_MEM0_BLK_CFG_W56 */
        TRDC_MbcSetMemoryBlockConfig(TRDC, &mbcBlockConfig);

 

 

For example, It can be added at line 401.

jimmychan_0-1721798486942.png

 

 

View solution in original post

0 Kudos
Reply
4 Replies
227 Views
jimmychan
NXP TechSupport
NXP TechSupport

Could you tell me which version of BSP are you using?

0 Kudos
Reply
195 Views
daisukemizobuch
Contributor II

<p>Thank you for reply!</p>
<p>The BSP versions are as follows:</p>
<ul>
<li>imx-optee-os: lf-6.1.22-2.0.0</li>
<li>imx-atf: lf-6.1.22-2.0.0</li>
<li>uboot-imx: lf-6.1.22-2.0.0</li>
<li>linux-imx: lf-5.10.72-2.2.3</li>
</ul>
<p>Best regards,<br />mizo</p>

 

0 Kudos
Reply
169 Views
jimmychan
NXP TechSupport
NXP TechSupport

Please add the following TRDC configuration to BOARD_SetTrdcGlobalConfig() in SDK : /boards/evkmimx8ulp/demo_apps/power_mode_switch/board.c. Then try to read 0x28038040 in uboot.

 

        mbcBlockConfig.memoryAccessControlSelect = TRDC_MBC_ACCESS_CONTROL_POLICY_ALL_INDEX;
        mbcBlockConfig.nseEnable                 = true; /* non secure state can access the block for cortex-A35 */
        mbcBlockConfig.mbcIdx                    = 2U;   /* MBC2 */
        mbcBlockConfig.domainIdx                 = 7U;   /* MBC2_DOM7 */
        mbcBlockConfig.slaveMemoryIdx            = 0U;   /* MBC2_DOM7_MEM0 */
        mbcBlockConfig.memoryBlockIdx            = 56U;  /* MBC2_DOM7_MEM0_BLK_CFG_W56 */
        TRDC_MbcSetMemoryBlockConfig(TRDC, &mbcBlockConfig);

 

 

For example, It can be added at line 401.

jimmychan_0-1721798486942.png

 

 

0 Kudos
Reply
160 Views
daisukemizobuch
Contributor II
Hello @jimmychan

Thanks for response,

I was able to use BBNSM RTC using the method I was taught!

Thanks,
mizo
0 Kudos
Reply