mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-11-20 02:22:19 +00:00
platform: generic: spacemit: k1: refactor platform support
K3 shares cache-control CSRs, PMU idle fields, cluster sizing, and the CCI-550 programming sequence with K1. Keeping these definitions and the CCI helper in K1-specific files would either duplicate them or make K3 depend on K1 support. Add a hidden PLATFORM_SPACEMIT option and move the shared definitions to spacemit/common.h. Move cci_enable_snoop_dvm_reqs() to spacemit.c while keeping each SoC's CCI topology and boot flow in its own platform driver. Rename the PMU idle fields to match the K1 and K3 User Manuals. Keep the K1 power-down mask at 0x1b, so K1 power-management behavior remains unchanged. Keep the K1 HSM implementation K1-specific and switch it to the shared definitions. This is a non-functional refactoring that prepares the common support used by K3. Signed-off-by: Xianbin Zhu <xianbin.zhu@linux.spacemit.com> Tested-by: E Shattow <e@freeshell.de> Co-developed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20261028-spacemit-k3-v6-4-01d984f60941@linux.spacemit.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
1 parent
acc2508c47
commit
b223774f20
8 files changed
+169
-108
No files matched your search
@@ -12,37 +12,16 @@
|
||||
#include <sbi/riscv_io.h>
|
||||
#include <sbi/sbi_hsm.h>
|
||||
#include <spacemit/k1.h>
|
||||
#include <spacemit/spacemit.h>
|
||||
|
||||
#define PLATFORM_MAX_CPUS 8
|
||||
|
||||
/* only use 0-1 cluster in SpacemiT K1 */
|
||||
static const int cci_map[] = {
|
||||
PLAT_CCI_CLUSTER0_IFACE_IX,
|
||||
PLAT_CCI_CLUSTER1_IFACE_IX,
|
||||
PLAT_CCI_K1_CLUSTER0_IFACE_IX,
|
||||
PLAT_CCI_K1_CLUSTER1_IFACE_IX,
|
||||
};
|
||||
|
||||
static void cci_enable_snoop_dvm_reqs(unsigned int master_id)
|
||||
{
|
||||
int slave_if_id = cci_map[master_id];
|
||||
|
||||
/*
|
||||
* Enable Snoops and DVM messages, no need for Read/Modify/Write as
|
||||
* rest of bits are write ignore
|
||||
*/
|
||||
writel(CCI_550_SNOOP_CTRL_ENABLE_DVMS | CCI_550_SNOOP_CTRL_ENABLE_SNOOPS,
|
||||
(void *)(u64)CCI_550_PLATFORM_CCI_ADDR +
|
||||
CCI_550_SLAVE_IFACE_OFFSET(slave_if_id) + CCI_550_SNOOP_CTRL);
|
||||
|
||||
/*
|
||||
* Wait for the completion of the write to the Snoop Control Register
|
||||
* before testing the change_pending bit
|
||||
*/
|
||||
mb();
|
||||
|
||||
/* Wait for the dust to settle down */
|
||||
while ((readl((void *)(u64)CCI_550_PLATFORM_CCI_ADDR + CCI_550_STATUS) &
|
||||
CCI_550_STATUS_CHANGE_PENDING))
|
||||
;
|
||||
}
|
||||
|
||||
static void spacemit_k1_pre_init(void)
|
||||
{
|
||||
unsigned int clusterid, cluster_enabled = 0;
|
||||
@@ -62,7 +41,7 @@ static void spacemit_k1_pre_init(void)
|
||||
|
||||
if (!(cluster_enabled & (1 << clusterid))) {
|
||||
cluster_enabled |= 1 << clusterid;
|
||||
cci_enable_snoop_dvm_reqs(clusterid);
|
||||
cci_enable_snoop_dvm_reqs(cci_map, clusterid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user