-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add rk3588 support #7056
add rk3588 support #7056
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,6 +85,25 @@ | |
#define FIREWALL_DDR_BASE 0xff534000 | ||
#define FIREWALL_DDR_SIZE SIZE_K(16) | ||
|
||
#elif defined(PLATFORM_FLAVOR_rk3588) | ||
|
||
#define GIC_BASE 0xFE600000 | ||
#define GIC_SIZE SIZE_K(64) | ||
#define GICD_BASE GIC_BASE | ||
#define GICC_BASE 0 | ||
|
||
#define UART1_BASE 0xfeb40000 | ||
#define UART1_SIZE SIZE_K(64) | ||
|
||
#define UART2_BASE 0xfeb50000 | ||
#define UART2_SIZE SIZE_K(64) | ||
|
||
#define UART5_BASE 0xfeb80000 | ||
#define UART5_SIZE SIZE_K(64) | ||
|
||
#define FIREWALL_DDR_BASE 0xfe030000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see rk3588 has two firewalls: |
||
#define FIREWALL_DDR_SIZE SIZE_K(32) | ||
|
||
#else | ||
#error "Unknown platform flavor" | ||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
/* | ||
* Copyright (C) 2019, Theobroma Systems Design und Consulting GmbH | ||
*/ | ||
|
||
#include <common.h> | ||
#include <io.h> | ||
#include <kernel/panic.h> | ||
#include <mm/core_memprot.h> | ||
#include <platform.h> | ||
#include <platform_config.h> | ||
|
||
#define FIREWALL_DDR_FW_DDR_RGN(i) ((i) * 0x4) | ||
#define FIREWALL_DDR_FW_DDR_MST(i) (0x20 + (i) * 0x4) | ||
#define FIREWALL_DDR_FW_DDR_CON_REG 0x40 | ||
#define FIREWALL_DDR_FW_DDR_RGN_NUM 8 | ||
#define FIREWALL_DDR_FW_DDR_MST_NUM 6 | ||
|
||
#define RG_MAP_SECURE(top, base) ((((top) - 1) << 16) | (base)) | ||
|
||
register_phys_mem_pgdir(MEM_AREA_IO_SEC, FIREWALL_DDR_BASE, FIREWALL_DDR_SIZE); | ||
|
||
int platform_secure_ddr_region(int rgn, paddr_t st, size_t sz) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How have you been able to find out how to set MMU configuration for this SoC? I cannot find any exact MMU register mappings in SoC's TRM. |
||
{ | ||
vaddr_t fw_base = (vaddr_t)phys_to_virt_io(FIREWALL_DDR_BASE, | ||
FIREWALL_DDR_SIZE); | ||
paddr_t ed = st + sz; | ||
uint32_t st_mb = st / SIZE_M(1); | ||
uint32_t ed_mb = ed / SIZE_M(1); | ||
|
||
if (!fw_base) | ||
panic(); | ||
|
||
assert(rgn <= 7); | ||
assert(st < ed); | ||
|
||
/* Check aligned 1MB */ | ||
assert(st % SIZE_M(1) == 0); | ||
assert(ed % SIZE_M(1) == 0); | ||
|
||
DMSG("protecting region %d: 0x%lx-0x%lx", rgn, st, ed); | ||
|
||
/* Map top and base */ | ||
io_write32(fw_base + FIREWALL_DDR_FW_DDR_RGN(rgn), | ||
RG_MAP_SECURE(ed_mb, st_mb)); | ||
|
||
/* Enable secure setting */ | ||
io_setbits32(fw_base + FIREWALL_DDR_FW_DDR_CON_REG, BIT(rgn)); | ||
|
||
return 0; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having a SoC as the name of the flavor is not a good idea IMO. How would you name different boards using the same SoC? Although yes, ideally if we use DT and runtime detection etc. it may be possible but it doesn't seem to apply here.