public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation
@ 2023-07-04 11:13 Yu Chien Peter Lin
  2023-07-04 11:13 ` [PATCH 2/2] board: ae350: Add missing env variables for booti Yu Chien Peter Lin
  2023-07-05  2:09 ` [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation Leo Liang
  0 siblings, 2 replies; 4+ messages in thread
From: Yu Chien Peter Lin @ 2023-07-04 11:13 UTC (permalink / raw)
  To: u-boot; +Cc: ycliang, Yu Chien Peter Lin

On some AE350 boards, we need to explicitly initialize the priority
registers to a non-zero value so the boot hart can instruct secondary
harts to jump to OpenSBI.

This patch also updates the information about PLICSW.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 arch/riscv/lib/andes_plicsw.c | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/lib/andes_plicsw.c b/arch/riscv/lib/andes_plicsw.c
index 324eb445aaa..75184080890 100644
--- a/arch/riscv/lib/andes_plicsw.c
+++ b/arch/riscv/lib/andes_plicsw.c
@@ -2,9 +2,10 @@
 /*
  * Copyright (C) 2019, Rick Chen <rick@andestech.com>
  *
- * U-Boot syscon driver for Andes's Platform Level Interrupt Controller (PLIC).
- * The PLIC block holds memory-mapped claim and pending registers
- * associated with software interrupt.
+ * U-Boot syscon driver for Andes' PLICSW
+ * The PLICSW block is an Andes-specific design for software interrupts,
+ * contains memory-mapped priority, enable, claim and pending registers
+ * similar to RISC-V PLIC.
  */
 
 #include <common.h>
@@ -26,9 +27,13 @@
 #define ENABLE_REG(base, hart)	((ulong)(base) + 0x2000 + (hart) * 0x80)
 /* claim register */
 #define CLAIM_REG(base, hart)	((ulong)(base) + 0x200004 + (hart) * 0x1000)
+/* priority register */
+#define PRIORITY_REG(base)	((ulong)(base) + PLICSW_PRIORITY_BASE)
 
 #define ENABLE_HART_IPI         (0x01010101)
 #define SEND_IPI_TO_HART(hart)  (0x1 << (hart))
+#define PLICSW_PRIORITY_BASE        0x4
+#define PLICSW_INTERRUPT_PER_HART   0x8
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -43,9 +48,21 @@ static int enable_ipi(int hart)
 	return 0;
 }
 
+static void init_priority_ipi(int hart_num)
+{
+    uint32_t *priority = (void *)PRIORITY_REG(gd->arch.plicsw);
+
+    for (int i = 0; i < hart_num * PLICSW_INTERRUPT_PER_HART; i++) {
+        writel(1, &priority[i]);
+    }
+
+    return;
+}
+
 int riscv_init_ipi(void)
 {
 	int ret;
+	int hart_num = 0;
 	long *base = syscon_get_first_range(RISCV_SYSCON_PLICSW);
 	ofnode node;
 	struct udevice *dev;
@@ -79,8 +96,10 @@ int riscv_init_ipi(void)
 		ret = ofnode_read_u32(node, "reg", &reg);
 		if (ret == 0)
 			enable_ipi(reg);
+		hart_num++;
 	}
 
+	init_priority_ipi(hart_num);
 	return 0;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] board: ae350: Add missing env variables for booti
  2023-07-04 11:13 [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation Yu Chien Peter Lin
@ 2023-07-04 11:13 ` Yu Chien Peter Lin
  2023-07-05  2:10   ` Leo Liang
  2023-07-05  2:09 ` [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation Leo Liang
  1 sibling, 1 reply; 4+ messages in thread
From: Yu Chien Peter Lin @ 2023-07-04 11:13 UTC (permalink / raw)
  To: u-boot; +Cc: ycliang, Yu Chien Peter Lin

The 'booti' command is unable to boot Image.gz due to the absence
of required environment variables 'kernel_comp_addr_r' and
'kernel_comp_size'.

This commit adds these variables and reorganizes the memory layout
to prevent any overlap between binaries and files.

Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
---
 include/configs/ae350.h | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/include/configs/ae350.h b/include/configs/ae350.h
index b566ecf296f..23e4801379d 100644
--- a/include/configs/ae350.h
+++ b/include/configs/ae350.h
@@ -83,11 +83,15 @@
 #include <config_distro_bootcmd.h>
 
 #define CFG_EXTRA_ENV_SETTINGS	\
-				"kernel_addr_r=0x00080000\0" \
-				"pxefile_addr_r=0x01f00000\0" \
-				"scriptaddr=0x01f00000\0" \
-				"fdt_addr_r=0x02000000\0" \
-				"ramdisk_addr_r=0x02800000\0" \
+				"fdt_high=0xffffffffffffffff\0" \
+				"initrd_high=0xffffffffffffffff\0" \
+				"kernel_addr_r=0x00600000\0" \
+				"kernel_comp_addr_r=0x04600000\0" \
+				"kernel_comp_size=0x04000000\0" \
+				"pxefile_addr_r=0x08600000\0" \
+				"scriptaddr=0x08700000\0" \
+				"fdt_addr_r=0x08800000\0" \
+				"ramdisk_addr_r=0x08900000\0" \
 				BOOTENV
 
 #endif /* __CONFIG_H */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation
  2023-07-04 11:13 [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation Yu Chien Peter Lin
  2023-07-04 11:13 ` [PATCH 2/2] board: ae350: Add missing env variables for booti Yu Chien Peter Lin
@ 2023-07-05  2:09 ` Leo Liang
  1 sibling, 0 replies; 4+ messages in thread
From: Leo Liang @ 2023-07-05  2:09 UTC (permalink / raw)
  To: Yu Chien Peter Lin; +Cc: u-boot

On Tue, Jul 04, 2023 at 07:13:20PM +0800, Yu Chien Peter Lin wrote:
> On some AE350 boards, we need to explicitly initialize the priority
> registers to a non-zero value so the boot hart can instruct secondary
> harts to jump to OpenSBI.
> 
> This patch also updates the information about PLICSW.
> 
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
>  arch/riscv/lib/andes_plicsw.c | 25 ++++++++++++++++++++++---
>  1 file changed, 22 insertions(+), 3 deletions(-)
> 

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] board: ae350: Add missing env variables for booti
  2023-07-04 11:13 ` [PATCH 2/2] board: ae350: Add missing env variables for booti Yu Chien Peter Lin
@ 2023-07-05  2:10   ` Leo Liang
  0 siblings, 0 replies; 4+ messages in thread
From: Leo Liang @ 2023-07-05  2:10 UTC (permalink / raw)
  To: Yu Chien Peter Lin; +Cc: u-boot

On Tue, Jul 04, 2023 at 07:13:21PM +0800, Yu Chien Peter Lin wrote:
> The 'booti' command is unable to boot Image.gz due to the absence
> of required environment variables 'kernel_comp_addr_r' and
> 'kernel_comp_size'.
> 
> This commit adds these variables and reorganizes the memory layout
> to prevent any overlap between binaries and files.
> 
> Signed-off-by: Yu Chien Peter Lin <peterlin@andestech.com>
> ---
>  include/configs/ae350.h | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 

Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-07-05  2:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-04 11:13 [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation Yu Chien Peter Lin
2023-07-04 11:13 ` [PATCH 2/2] board: ae350: Add missing env variables for booti Yu Chien Peter Lin
2023-07-05  2:10   ` Leo Liang
2023-07-05  2:09 ` [PATCH 1/2] riscv: andes_plicsw: Fix IPI during OpenSBI invocation Leo Liang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox