Skip to content

Commit 163c802

Browse files
committed
Add fixup patches for u-boot and linux
Signed-off-by: Evgeniy Didin <[email protected]>
1 parent 68c0142 commit 163c802

5 files changed

+252
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
This is useful to make sure no stale data exists in caches after bootloaders.
2+
The worst thing could be some lines of cache were locked in a bootloader
3+
for example during DDR recalibration and never unlocked. This may lead
4+
to really unpredictable issues later down the line.
5+
6+
Signed-off-by: Eugeniy Paltsev <[email protected]>
7+
---
8+
arch/arc/kernel/head.S | 14 ++++++++++++++
9+
1 file changed, 14 insertions(+)
10+
11+
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S
12+
index 8b90d25..e16b007 100644
13+
--- a/arch/arc/kernel/head.S
14+
+++ b/arch/arc/kernel/head.S
15+
@@ -34,6 +34,13 @@
16+
#endif
17+
sr r5, [ARC_REG_IC_CTRL]
18+
19+
+ ; Invalidate entire I$
20+
+ mov r5, 1
21+
+ sr r5, [ARC_REG_IC_IVIC]
22+
+ nop
23+
+ nop
24+
+ nop
25+
+
26+
1:
27+
lr r5, [ARC_REG_DC_BCR]
28+
breq r5, 0, 1f ; D$ doesn't exist
29+
@@ -46,6 +53,13 @@
30+
#endif
31+
sr r5, [ARC_REG_DC_CTRL]
32+
33+
+ ; Invalidate entire D$
34+
+ mov r5, 1
35+
+ sr r5, [ARC_REG_DC_IVDC]
36+
+ nop
37+
+ nop
38+
+ nop
39+
+
40+
1:
41+
.endm
42+
43+
--
44+
2.9.3
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From ec1c022a3c80fe9bbd6f6e254767f58ecef72730 Mon Sep 17 00:00:00 2001
2+
From: Eugeniy Paltsev <[email protected]>
3+
Date: Fri, 12 Jan 2018 13:37:55 +0300
4+
Subject: [PATCH 60/62] ARC: HSDK: setup BOOT M_HS_CPU regiter too when setup
5+
AXI apertures
6+
7+
Signed-off-by: Eugeniy Paltsev <[email protected]>
8+
---
9+
board/synopsys/hsdk/hsdk-cmd.c | 12 +++++++++++-
10+
1 file changed, 11 insertions(+), 1 deletion(-)
11+
12+
diff --git a/board/synopsys/hsdk/hsdk-cmd.c b/board/synopsys/hsdk/hsdk-cmd.c
13+
index 970a43a0c9..ec14e8d7d1 100644
14+
--- a/board/synopsys/hsdk/hsdk-cmd.c
15+
+++ b/board/synopsys/hsdk/hsdk-cmd.c
16+
@@ -758,11 +758,21 @@ enum hsdk_axi_masters {
17+
#define CREG_AXI_M_OFT1(m) ((void __iomem *)(CREG_BASE + 0x020 * (m) + 0x00C))
18+
#define CREG_AXI_M_UPDT(m) ((void __iomem *)(CREG_BASE + 0x020 * (m) + 0x014))
19+
20+
+#define CREG_AXI_M_HS_CORE_BOOT ((void __iomem *)(CREG_BASE + 0x010))
21+
+
22+
#define CREG_PAE ((void __iomem *)(CREG_BASE + 0x180))
23+
#define CREG_PAE_UPDT ((void __iomem *)(CREG_BASE + 0x194))
24+
25+
-static void init_memory_bridge(void)
26+
+void init_memory_bridge(void)
27+
{
28+
+ u32 reg;
29+
+
30+
+ /*
31+
+ * M_HS_CORE has one unic register - BOOT.
32+
+ * We need to clean boot mirror (BOOT[1:0]) bits in them.
33+
+ */
34+
+ reg = readl(CREG_AXI_M_HS_CORE_BOOT) & (~0xFF);
35+
+ writel(reg, CREG_AXI_M_HS_CORE_BOOT);
36+
writel(0x11111111, CREG_AXI_M_SLV0(M_HS_CORE));
37+
writel(0x63111111, CREG_AXI_M_SLV1(M_HS_CORE));
38+
writel(0xFEDCBA98, CREG_AXI_M_OFT0(M_HS_CORE));
39+
--
40+
2.11.0
41+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From c87440540f94c1b5c8ea10761ca657830b268e0e Mon Sep 17 00:00:00 2001
2+
From: Eugeniy Paltsev <[email protected]>
3+
Date: Fri, 12 Jan 2018 13:44:24 +0300
4+
Subject: [PATCH 61/62] ARC: HSDK: Setup AXI apertures unconditionally
5+
6+
Setup AXI apertures unconditionally as we want to have DDR
7+
in 0x00000000 region when we are kicking slave cpus.
8+
9+
Signed-off-by: Eugeniy Paltsev <[email protected]>
10+
---
11+
board/synopsys/hsdk/hsdk.c | 7 +++++++
12+
1 file changed, 7 insertions(+)
13+
14+
diff --git a/board/synopsys/hsdk/hsdk.c b/board/synopsys/hsdk/hsdk.c
15+
index b2f9ef3cae..f97c010eb8 100644
16+
--- a/board/synopsys/hsdk/hsdk.c
17+
+++ b/board/synopsys/hsdk/hsdk.c
18+
@@ -16,6 +16,9 @@ DECLARE_GLOBAL_DATA_PTR;
19+
#define CREG_PAE_UPDATE (CREG_BASE + 0x194)
20+
#define CREG_CPU_START (CREG_BASE + 0x400)
21+
22+
+/* TODO: move AXI apertures setup code here from hsdk-cmd.c */
23+
+void init_memory_bridge(void);
24+
+
25+
int board_early_init_f(void)
26+
{
27+
/* In current chip PAE support for DMA is broken, disabling it. */
28+
@@ -24,6 +27,10 @@ int board_early_init_f(void)
29+
/* Really apply settings made above */
30+
writel(1, (void __iomem *) CREG_PAE_UPDATE);
31+
32+
+ /* Setup AXI apertures unconditionally as we want to have DDR
33+
+ * in 0x00000000 region when we are kicking slave cpus */
34+
+ init_memory_bridge();
35+
+
36+
return 0;
37+
}
38+
39+
--
40+
2.11.0
41+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
From 14fbd9c293366cfb87ffc2b2e9f3c84c77e2119a Mon Sep 17 00:00:00 2001
2+
From: Eugeniy Paltsev <[email protected]>
3+
Date: Fri, 12 Jan 2018 13:51:53 +0300
4+
Subject: [PATCH 62/62] ARC: HSDK: hsdk-cmd: remove unused slave cpu cache
5+
functions
6+
7+
Signed-off-by: Eugeniy Paltsev <[email protected]>
8+
---
9+
board/synopsys/hsdk/hsdk-cmd.c | 42 ++++--------------------------------------
10+
1 file changed, 4 insertions(+), 38 deletions(-)
11+
12+
diff --git a/board/synopsys/hsdk/hsdk-cmd.c b/board/synopsys/hsdk/hsdk-cmd.c
13+
index ec14e8d7d1..f565260bdb 100644
14+
--- a/board/synopsys/hsdk/hsdk-cmd.c
15+
+++ b/board/synopsys/hsdk/hsdk-cmd.c
16+
@@ -417,6 +417,9 @@ static int env_process_and_validate(const struct hsdk_env_map_common *common,
17+
}
18+
19+
/* TODO: move to explicit external cache header */
20+
+void __l1_ic_invalidate_all(void);
21+
+void __l1_dc_invalidate_all(void);
22+
+void __l1_dc_flush_all(void);
23+
24+
/* Bit values in IC_CTRL */
25+
#define IC_CTRL_CACHE_DISABLE (1 << 0)
26+
@@ -426,40 +429,6 @@ static int env_process_and_validate(const struct hsdk_env_map_common *common,
27+
#define DC_CTRL_FLUSH_STATUS (1 << 8)
28+
#define APT_SHIFT 28
29+
30+
-/* ********************* LOCAL CACHE: START ********************* */
31+
-static void smp_local_invalidate_icache_l1_all(void)
32+
-{
33+
- write_aux_reg(ARC_AUX_IC_IVIC, 1);
34+
- read_aux_reg(ARC_AUX_IC_CTRL); /* blocks */
35+
-}
36+
-
37+
-static void smp_local_invalidate_dcache_l1_all(void)
38+
-{
39+
- unsigned int reg;
40+
-
41+
- /*
42+
- * IM is set by default and implies Flush-n-inv
43+
- * Clear it here for vanilla inv
44+
- */
45+
- reg = read_aux_reg(ARC_AUX_DC_CTRL);
46+
- write_aux_reg(ARC_AUX_DC_CTRL, reg & ~DC_CTRL_INV_MODE_FLUSH);
47+
-
48+
- write_aux_reg(ARC_AUX_DC_IVDC, 0x1);
49+
-
50+
- /* Switch back to default Invalidate mode */
51+
- write_aux_reg(ARC_AUX_DC_CTRL, reg | DC_CTRL_INV_MODE_FLUSH);
52+
-}
53+
-
54+
-static void smp_local_flush_dcache_l1_all(void)
55+
-{
56+
- write_aux_reg(ARC_AUX_DC_FLSH, 0x1);
57+
-
58+
- /* flush / flush-n-inv both wait */
59+
- while (read_aux_reg(ARC_AUX_DC_CTRL) & DC_CTRL_FLUSH_STATUS);
60+
-}
61+
-
62+
-/* ********************* LOCAL CACHE: END ********************* */
63+
-
64+
// TODO: add xCCM runtime check
65+
static void smp_init_slave_cpu_func(u32 core)
66+
{
67+
@@ -648,9 +617,6 @@ __attribute__((naked, noreturn, flatten)) noinline void hsdk_core_init_f(void)
68+
__l1_ic_invalidate_all();
69+
__l1_dc_invalidate_all();
70+
71+
-// smp_local_invalidate_icache_l1_all();
72+
-// smp_local_invalidate_dcache_l1_all();
73+
-
74+
/* Run our program */
75+
((void (*)(void))(env_core.entry[CPU_ID_GET()].val))();
76+
77+
@@ -691,7 +657,7 @@ noinline static void do_init_slave_cpu(u32 cpu_id)
78+
/* we need L1d$ invalidation here, if we use slave CPUs with
79+
* disabled L1d$, as we configure master CPU caches later.
80+
* (master CPU L1d$ is possibly enabled here) */
81+
- __l1_dc_invalidate_all(0x1);
82+
+ __l1_dc_invalidate_all();
83+
}
84+
85+
/* We need to panic here as there is no option to halt slave cpu
86+
--
87+
2.11.0
88+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
From 1f63f503dd532b2ea228e4c85f0d10470bcf65f6 Mon Sep 17 00:00:00 2001
2+
From: Eugeniy Paltsev <[email protected]>
3+
Date: Fri, 12 Jan 2018 14:03:59 +0300
4+
Subject: [PATCH] ARC: HSDK: print hsdk pre-release command version
5+
conditionally
6+
7+
Signed-off-by: Eugeniy Paltsev <[email protected]>
8+
---
9+
board/synopsys/hsdk/hsdk-cmd.c | 4 ++++
10+
1 file changed, 4 insertions(+)
11+
12+
diff --git a/board/synopsys/hsdk/hsdk-cmd.c b/board/synopsys/hsdk/hsdk-cmd.c
13+
index f565260bdb..67160ee7df 100644
14+
--- a/board/synopsys/hsdk/hsdk-cmd.c
15+
+++ b/board/synopsys/hsdk/hsdk-cmd.c
16+
@@ -1003,7 +1003,9 @@ static int do_hsdk_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
17+
int ret;
18+
19+
/* TODO: delete after release */
20+
+#ifdef PRINT_HSDK_CMD_VERSION
21+
printf("HSDK: hsdk_go version: %s\n", HSDKGO_VERSION);
22+
+#endif
23+
24+
/* Check for 'halt' parameter. 'halt' = enter halt-mode just before
25+
* starting the application; can be used for debug */
26+
@@ -1041,7 +1043,9 @@ static int do_hsdk_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[
27+
int ret;
28+
29+
/* TODO: delete after release */
30+
+#ifdef PRINT_HSDK_CMD_VERSION
31+
printf("HSDK: hsdk_init version: %s\n", HSDKGO_VERSION);
32+
+#endif
33+
34+
/* hsdk_init can be run only once */
35+
if (done) {
36+
--
37+
2.11.0
38+

0 commit comments

Comments
 (0)