From: Andrew F. Davis <afd@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/7] arm: K3: Avoid use of MCU_PSRAM0 before SYSFW is loaded
Date: Thu, 14 Feb 2019 15:51:59 -0600 [thread overview]
Message-ID: <61d014cb-3717-25ef-37bd-bf34ad6edb32@ti.com> (raw)
In-Reply-To: <40f6bb6c-c530-9def-46c1-d47126a7043a@ti.com>
On 2/13/19 9:32 PM, Lokesh Vutla wrote:
>
>
> On 14/02/19 12:07 AM, Andrew F. Davis wrote:
>> On HS devices the 512b region of reset isolated memory called
>> MCU_PSRAM0 is firewalled by default. Until SYSFW is loaded we
>> cannot use this memory. It is only used to store a single value
>> left at the end of SRAM by ROM that will be needed later. Save
>> that value to a global variable stored in the .data section.
>> This section is used as .bss will be cleared between saving
>> this value and using it.
>>
>> Signed-off-by: Andrew F. Davis <afd@ti.com>
>> ---
>> arch/arm/mach-k3/am6_init.c | 8 +++-----
>> arch/arm/mach-k3/include/mach/am6_hardware.h | 3 ---
>> 2 files changed, 3 insertions(+), 8 deletions(-)
>>
>> diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c
>> index a5553190b4..462538e45d 100644
>> --- a/arch/arm/mach-k3/am6_init.c
>> +++ b/arch/arm/mach-k3/am6_init.c
>> @@ -49,11 +49,11 @@ static void ctrl_mmr_unlock(void)
>> mmr_unlock(CTRL_MMR0_BASE, 7);
>> }
>>
>> +u32 bootindex __attribute__((section(".data")));
>
> After thinking a bit more I realized that backup bootmode might fail. R5 SPL is
> fine but when it jumps to A53 SPL it is trying to read the bootindex again from
> K3_BOOT_PARAM_TABLE_INDEX_VAL(this is already the case and is wrong). It is not
> guaranteed that R5 SPL did not damage this ROM param table. We should somehow
> pass bootindex to A53 SPL using scratchpad space.
>
I don't know of any super good way to pass data from R5-SPL to A53-SPL,
but I don't think MCU_PSRAM0 will be the way to do it. For all we know
before A53-SPL has started the R5-SPL may have shutdown and something
else has booted, which could have used that MCU local RAM space. I think
we need something that gets passed to A53 anyway, maybe a DT fixup?
>> +
>> static void store_boot_index_from_rom(void)
>> {
>> - u32 *boot_index = (u32 *)K3_BOOT_PARAM_TABLE_INDEX_VAL;
>> -
>> - *boot_index = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
>> + bootindex = *(u32 *)(CONFIG_SYS_K3_BOOT_PARAM_TABLE_INDEX);
>> }
>>
>> void board_init_f(ulong dummy)
>> @@ -94,7 +94,6 @@ u32 spl_boot_mode(const u32 boot_device)
>> {
>> #if defined(CONFIG_SUPPORT_EMMC_BOOT)
>> u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);
>> - u32 bootindex = readl(K3_BOOT_PARAM_TABLE_INDEX_VAL);
>>
>> u32 bootmode = (devstat & CTRLMMR_MAIN_DEVSTAT_BOOTMODE_MASK) >>
>> CTRLMMR_MAIN_DEVSTAT_BOOTMODE_SHIFT;
>> @@ -170,7 +169,6 @@ static u32 __get_primary_bootmedia(u32 devstat)
>> u32 spl_boot_device(void)
>> {
>> u32 devstat = readl(CTRLMMR_MAIN_DEVSTAT);
>> - u32 bootindex = readl(K3_BOOT_PARAM_TABLE_INDEX_VAL);
>>
>> if (bootindex == K3_PRIMARY_BOOTMODE)
>> return __get_primary_bootmedia(devstat);
>> diff --git a/arch/arm/mach-k3/include/mach/am6_hardware.h b/arch/arm/mach-k3/include/mach/am6_hardware.h
>> index b5244609af..3343233aa3 100644
>> --- a/arch/arm/mach-k3/include/mach/am6_hardware.h
>> +++ b/arch/arm/mach-k3/include/mach/am6_hardware.h
>> @@ -44,7 +44,4 @@
>> #define CTRLMMR_LOCK_KICK1 0x0100c
>> #define CTRLMMR_LOCK_KICK1_UNLOCK_VAL 0xd172bc5a
>>
>> -/* MCU SCRATCHPAD usage */
>> -#define K3_BOOT_PARAM_TABLE_INDEX_VAL CONFIG_SYS_K3_MCU_SCRATCHPAD_BASE
>
> Can we move scratchpad base to a different location ? This will be used for
> eeprom storing also.
>
It's okay to use MCU_PSRAM0 after SYSFW has been loaded, does the EEPROM
data need to be moved between SPLs? Or is it local to each?
Andrew
> Thanks and regards,
> Lokesh
>
>> -
>> #endif /* __ASM_ARCH_AM6_HARDWARE_H */
>>
next prev parent reply other threads:[~2019-02-14 21:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-13 18:37 [U-Boot] [PATCH 0/7] AM65x HS device support Andrew F. Davis
2019-02-13 18:37 ` [U-Boot] [PATCH 1/7] arm: K3: Avoid use of MCU_PSRAM0 before SYSFW is loaded Andrew F. Davis
2019-02-13 20:27 ` Tom Rini
2019-02-13 21:16 ` Andrew F. Davis
2019-02-14 3:32 ` Lokesh Vutla
2019-02-14 21:51 ` Andrew F. Davis [this message]
2019-02-18 4:40 ` Lokesh Vutla
2019-02-13 18:37 ` [U-Boot] [PATCH 2/7] firmware: ti_sci: Add support for firewall management Andrew F. Davis
2019-02-13 20:27 ` Tom Rini
2019-02-14 3:43 ` Lokesh Vutla
2019-02-13 18:37 ` [U-Boot] [PATCH 3/7] firmware: ti_sci: Modify auth_boot TI-SCI API to match new version Andrew F. Davis
2019-02-13 20:27 ` Tom Rini
2019-02-13 18:37 ` [U-Boot] [PATCH 4/7] arm: mach-k3: Add secure device support Andrew F. Davis
2019-02-13 20:27 ` Tom Rini
2019-02-13 18:37 ` [U-Boot] [PATCH 5/7] arm: mach-k3: Add secure device build support Andrew F. Davis
2019-02-13 20:27 ` Tom Rini
2019-02-13 21:20 ` Andrew F. Davis
2019-02-14 3:46 ` Lokesh Vutla
2019-02-14 22:55 ` Andrew F. Davis
2019-02-15 12:13 ` Lokesh Vutla
2019-02-16 22:18 ` Tom Rini
2019-02-18 13:05 ` Andrew F. Davis
2019-02-13 18:37 ` [U-Boot] [PATCH 6/7] configs: Add a config for AM65x High Security EVM Andrew F. Davis
2019-02-13 20:27 ` Tom Rini
2019-02-13 18:37 ` [U-Boot] [PATCH 7/7] doc: Update info on using K3 secure devices Andrew F. Davis
2019-02-13 20:27 ` Tom Rini
2019-02-13 21:12 ` [U-Boot] [PATCH 0/7] AM65x HS device support Andreas Dannenberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=61d014cb-3717-25ef-37bd-bf34ad6edb32@ti.com \
--to=afd@ti.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox