Skip to content

Commit c515d55

Browse files
committed
ARCv3: Add cluster peripheral checking
Added checks for the presence of various ports and apertures before setting them up. Otherwise, when accessing the tuning registers, a bus error may occur if the peripheral is not presented in the system.
1 parent 84f4841 commit c515d55

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

arch/arc/mm/cluster.c

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,36 @@
66

77
void arc_cluster_mumbojumbo()
88
{
9+
struct bcr_clustv3_cfg cbcr;
10+
struct bcr_cln_0_cfg cln0;
11+
12+
READ_BCR(ARC_REG_CLUSTER_BCR, cbcr);
13+
if (cbcr.ver_maj == 0)
14+
return;
15+
16+
READ_BCR(ARC_REG_CLNR_BCR_0, cln0);
17+
918
/*
1019
* Region -> Base -> Size
1120
*
1221
* NOC- > 0x8z–> 1Gb
1322
* Per 0 -> 0xFz -> 1Mb
1423
* SCM -> 0xFz+1MB -> 1Mb
1524
*/
25+
if (cln0.mst_noc) {
26+
arc_cln_write_reg(ARC_CLN_MST_NOC_0_0_ADDR, 0x000); //0x800
27+
arc_cln_write_reg(ARC_CLN_MST_NOC_0_0_SIZE, 0x800); //0x400
28+
}
1629

17-
arc_cln_write_reg(ARC_CLN_MST_NOC_0_0_ADDR, 0x000); //0x800
18-
arc_cln_write_reg(ARC_CLN_MST_NOC_0_0_SIZE, 0x800); //0x400
19-
20-
arc_cln_write_reg(ARC_CLN_PER_0_BASE, 0xf00);
21-
arc_cln_write_reg(ARC_CLN_PER_0_SIZE, 0x1);
30+
if (cln0.mst_per) {
31+
arc_cln_write_reg(ARC_CLN_PER_0_BASE, 0xf00);
32+
arc_cln_write_reg(ARC_CLN_PER_0_SIZE, 0x1);
33+
}
2234

23-
arc_cln_write_reg(ARC_CLN_SHMEM_ADDR, 0xf01);
24-
arc_cln_write_reg(ARC_CLN_SHMEM_SIZE, 0x1);
35+
if (cln0.has_scm) {
36+
arc_cln_write_reg(ARC_CLN_SHMEM_ADDR, 0xf01);
37+
arc_cln_write_reg(ARC_CLN_SHMEM_SIZE, 0x1);
38+
}
2539
}
2640

2741
void arc_cluster_scm_enable()

0 commit comments

Comments
 (0)