summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
diff options
context:
space:
mode:
authorYork Sun <york.sun@nxp.com>2016-09-13 12:40:30 -0700
committerYork Sun <york.sun@nxp.com>2016-10-06 09:56:57 -0700
commitef9a5fd8643ebdd5f492a5b09725134999f428b9 (patch)
treeaae37bebfc242c7f0f63e8e2fa3b735440deb056 /arch/arm/cpu/armv8/fsl-layerscape/cpu.c
parent5d1a7a9d209fd9b8ffca1f3f27139f372a225e16 (diff)
downloadu-boot-ef9a5fd8643ebdd5f492a5b09725134999f428b9.tar.gz
u-boot-ef9a5fd8643ebdd5f492a5b09725134999f428b9.tar.xz
u-boot-ef9a5fd8643ebdd5f492a5b09725134999f428b9.zip
armv8: fsl-layerscape: Fix "cpu status" command
The core position is not continuous for some SoCs. For example, valid cores may present at position 0, 1, 4, 5, 8, 9, etc. Some registers (including boot release register) only count existing cores. Current implementation of cpu_mask() complies with the continuous numbering. However, command "cpu status" queries the spin table with actual core position. Add functions to calculate core position from core number, to correctly calculate offsets. Tested on LS2080ARDB and LS1043ARDB. Signed-off-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'arch/arm/cpu/armv8/fsl-layerscape/cpu.c')
-rw-r--r--arch/arm/cpu/armv8/fsl-layerscape/cpu.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 11e806ece0..b7a2e0c946 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -203,6 +203,27 @@ static inline u32 initiator_type(u32 cluster, int init_id)
return 0;
}
+u32 cpu_pos_mask(void)
+{
+ struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);
+ int i = 0;
+ u32 cluster, type, mask = 0;
+
+ do {
+ int j;
+
+ cluster = gur_in32(&gur->tp_cluster[i].lower);
+ for (j = 0; j < TP_INIT_PER_CLUSTER; j++) {
+ type = initiator_type(cluster, j);
+ if (type && (TP_ITYP_TYPE(type) == TP_ITYP_TYPE_ARM))
+ mask |= 1 << (i * TP_INIT_PER_CLUSTER + j);
+ }
+ i++;
+ } while ((cluster & TP_CLUSTER_EOC) == 0x0);
+
+ return mask;
+}
+
u32 cpu_mask(void)
{
struct ccsr_gur __iomem *gur = (void *)(CONFIG_SYS_FSL_GUTS_ADDR);