Skip to contentSkip to conversation

AE350 SMP support RISC-V

PATCH Superseded Andes 4 participants 27 messages Apr 1, 2019 – Apr 8, 2019 1 message not in the archive RISC-V

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Andes

author
#0 lore raw

v3 cover AE350 SMP support RISC-V

From: Rick Chen <[email protected]>

Changes in v3:
Patch 1
- Rename plic_init() as enable_ipi()
- Remove PLIC_BASE_GET() from enable_ipi()
Patch 2
- Add a space before (PLMT)
Patch 6
- Fix some mis-alignments
- Recovery isa string of CPU1

Changes in v2:
- Drop patch1 and replace by simple-bus driver
- Rename nds_plic as andes_plic
- Move initialize plic to PLIC_BASE_GET() and called automatically
- Rename nds_plmt as andes_plmt
- Recovery dts isa string

Rick Chen (7):
riscv: Add a SYSCON driver for Andestech's PLIC
riscv: Add a SYSCON driver for Andestech's PLMT
riscv: ae350: disable ATCPIT100 timer
riscv: ax25: Add platform-specific Kconfig options
riscv: ax25: Andes specific cache shall only support in M-mode
riscv: dts: ae350 support SMP
riscv: ae350: enable SMP

 arch/riscv/Kconfig                   |  18 ++++++
 arch/riscv/cpu/ax25/Kconfig          |   7 +++
 arch/riscv/dts/ae350_32.dts          |  81 +++++++++++++++++++-------
 arch/riscv/dts/ae350_64.dts          |  81 +++++++++++++++++++-------
 arch/riscv/include/asm/global_data.h |   6 ++
 arch/riscv/include/asm/syscon.h      |   3 +-
 arch/riscv/lib/Makefile              |   2 +
 arch/riscv/lib/andes_plic.c          | 110 +++++++++++++++++++++++++++++++++++
 arch/riscv/lib/andes_plmt.c          |  53 +++++++++++++++++
 board/AndesTech/ax25-ae350/Kconfig   |   1 +
 configs/ae350_rv32_defconfig         |   1 -
 configs/ae350_rv64_defconfig         |   1 -
 12 files changed, 317 insertions(+), 47 deletions(-)
 create mode 100644 arch/riscv/lib/andes_plic.c
 create mode 100644 arch/riscv/lib/andes_plmt.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v3 1/7 riscv: Add a SYSCON driver for Andestech's PLIC

From: Rick Chen <[email protected]>

The Platform-Level Interrupt Controller (PLIC) block holds memory-mapped claim and pending registers associated with software interrupt. It is required for handling IPI.

Cc Greentime Hu <[email protected]>

---
V3:
- Rename plic_init() as enable_ipi().
- Declase as static.
- Remove PLIC_BASE_GET() from enable_ipi().

 arch/riscv/Kconfig                   |   9 +++
 arch/riscv/include/asm/global_data.h |   3 +
 arch/riscv/include/asm/syscon.h      |   2 +-
 arch/riscv/lib/Makefile              |   1 +
 arch/riscv/lib/andes_plic.c          | 110 +++++++++++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/lib/andes_plic.c
arch/riscv/Kconfig +9 -0
index 3a4470d..511768b 100644
@@ -109,6 +109,15 @@ config SIFIVE_CLINT
 	  The SiFive CLINT block holds memory-mapped control and status registers
 	  associated with software and timer interrupts.
 
+config ANDES_PLIC
+	bool
+	depends on RISCV_MMODE
+	select REGMAP
+	select SYSCON
+	help
+	  The Andes PLIC block holds memory-mapped claim and pending registers
+	  associated with software interrupt.
+
 config RISCV_RDTIME
 	bool
 	default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index 80e3165..b867910 100644
@@ -18,6 +18,9 @@ struct arch_global_data {
 #ifdef CONFIG_SIFIVE_CLINT
 	void __iomem *clint;	/* clint base address */
 #endif
+#ifdef CONFIG_ANDES_PLIC
+	void __iomem *plic;	/* plic base address */
+#endif
 #ifdef CONFIG_SMP
 	struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +1 -1
index d311ee6..c1b4b86 100644
@@ -9,11 +9,11 @@
 /*
  * System controllers in a RISC-V system
  *
- * So far only SiFive's Core Local Interruptor (CLINT) is defined.
  */
 enum {
 	RISCV_NONE,
 	RISCV_SYSCON_CLINT,	/* Core Local Interruptor (CLINT) */
+	RISCV_SYSCON_PLIC,	/* Platform Level Interrupt Controller (PLIC) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 35dbf64..1bf554b 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_GO) += boot.o
 obj-y	+= cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
+obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
 obj-y	+= interrupts.o
 obj-y	+= reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plic.c new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
2.7.4
#2 lore raw

PATCH v3 1/7 riscv: Add a SYSCON driver for Andestech's PLIC

Quoted 16 lines · Andes

From: Rick Chen <[email protected]>

The Platform-Level Interrupt Controller (PLIC) block holds memory-mapped claim and pending registers associated with software interrupt. It is required for handling IPI.

Cc Greentime Hu <[email protected]>

---
V3:
- Rename plic_init() as enable_ipi().
- Declase as static.
- Remove PLIC_BASE_GET() from enable_ipi().

Quoted 8 lines
 arch/riscv/Kconfig                   |   9 +++
 arch/riscv/include/asm/global_data.h |   3 +
 arch/riscv/include/asm/syscon.h      |   2 +-
 arch/riscv/lib/Makefile              |   1 +
 arch/riscv/lib/andes_plic.c          | 110 +++++++++++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/lib/andes_plic.c
#3 lore raw

PATCH v3 1/7 riscv: Add a SYSCON driver for Andestech's PLIC

In reply to Andes

Hi Rick,

Quoted 7 lines · Andes

From: Rick Chen <[email protected]>

The Platform-Level Interrupt Controller (PLIC) block holds memory-mapped claim and pending registers associated with software interrupt. It is required for handling IPI.

Quoted 8 lines
Cc Greentime Hu <[email protected]>

---
V3:
- Rename plic_init() as enable_ipi().
- Declase as static.
- Remove PLIC_BASE_GET() from enable_ipi().

Take a look at patman [1], it makes it really easy to handle different versions of a patch series. :)

[1]: https://github.com/u-boot/u-boot/blob/master/tools/patman/README

Quoted 47 lines
 arch/riscv/Kconfig                   |   9 +++
 arch/riscv/include/asm/global_data.h |   3 +
 arch/riscv/include/asm/syscon.h      |   2 +-
 arch/riscv/lib/Makefile              |   1 +
 arch/riscv/lib/andes_plic.c          | 110 +++++++++++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/lib/andes_plic.c
arch/riscv/Kconfig +9 -0
index 3a4470d..511768b 100644
@@ -109,6 +109,15 @@ config SIFIVE_CLINT
 	  The SiFive CLINT block holds memory-mapped control and status registers
 	  associated with software and timer interrupts.
 
+config ANDES_PLIC
+	bool
+	depends on RISCV_MMODE
+	select REGMAP
+	select SYSCON
+	help
+	  The Andes PLIC block holds memory-mapped claim and pending registers
+	  associated with software interrupt.
+
 config RISCV_RDTIME
 	bool
 	default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index 80e3165..b867910 100644
@@ -18,6 +18,9 @@ struct arch_global_data {
 #ifdef CONFIG_SIFIVE_CLINT
 	void __iomem *clint;	/* clint base address */
 #endif
+#ifdef CONFIG_ANDES_PLIC
+	void __iomem *plic;	/* plic base address */
+#endif
 #ifdef CONFIG_SMP
 	struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +0 -0
index d311ee6..c1b4b86 100644

arch/riscv/include/asm/syscon.h line 11

Quoted 3 lines
arch/riscv/include/asm/syscon.h +0 -0
@@ -9,11 +9,11 @@
 /*
  * System controllers in a RISC-V system
  *

nit: can you also drop the empty comment line above?

Quoted 88 lines
arch/riscv/include/asm/syscon.h +1 -1
- * So far only SiFive's Core Local Interruptor (CLINT) is defined.
  */
 enum {
 	RISCV_NONE,
 	RISCV_SYSCON_CLINT,	/* Core Local Interruptor (CLINT) */
+	RISCV_SYSCON_PLIC,	/* Platform Level Interrupt Controller (PLIC) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 35dbf64..1bf554b 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_GO) += boot.o
 obj-y	+= cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
+obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
 obj-y	+= interrupts.o
 obj-y	+= reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plic.c new file +61 -0
new file mode 100644
index 0000000..67ab561
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019, Rick Chen <[email protected]>
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
+#include <dm/uclass-internal.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/syscon.h>
+#include <cpu.h>
+
+/* pending register */
+#define PENDING_REG(base, hart)	((ulong)(base) + 0x1000 + (hart) * 8)
+/* enable register */
+#define ENABLE_REG(base, hart)	((ulong)(base) + 0x2000 + (hart) * 0x80)
+/* claim register */
+#define CLAIM_REG(base, hart)	((ulong)(base) + 0x200004 + (hart) * 0x1000)
+
+#define ENABLE_HART_IPI         (0x80808080)
+#define SEND_IPI_TO_HART(hart)  (0x80>>hart)
+
+DECLARE_GLOBAL_DATA_PTR;
+static int init_plic(void);
+
+#define PLIC_BASE_GET(void)						\
+	do {								\
+		long *ret;						\
+									\
+		if (!gd->arch.plic) {					\
+			ret = syscon_get_first_range(RISCV_SYSCON_PLIC); \
+			if (IS_ERR(ret))				\
+				return PTR_ERR(ret);			\
+			gd->arch.plic = ret;				\
+			init_plic();					\
+		}							\
+	} while (0)
+
+static int enable_ipi(int harts)
+{
+	int i;
+	int en = ENABLE_HART_IPI;
+
+	for (i = 0; i < harts ;i++)
+	{
+		en = en >> i;
+		writel(en, (void __iomem *)ENABLE_REG(gd->arch.plic, i));
+	}
+
+	return 0;
+}
+
+static int init_plic(void)

arch/riscv/lib/andes_plic.c line 71

Quoted 10 lines
arch/riscv/lib/andes_plic.c new file +10 -0
+{
+	struct udevice *dev;
+	int ret;
+
+	ret = uclass_find_first_device(UCLASS_CPU, &dev);
+	if (ret)
+		return ret;
+
+	if (ret == 0 && dev != NULL) {
+		ret = cpu_get_count(dev);

You should check first, if cpu_get_count() has returned an error before using its return value.

Quoted 20 lines
arch/riscv/lib/andes_plic.c new file +20 -0
+		enable_ipi(ret);
+		return 0;
+	}
+
+	return -ENODEV;
+}
+
+int riscv_send_ipi(int hart)
+{
+	PLIC_BASE_GET();
+
+	writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd->arch.plic, gd->arch.boot_hart));
+
+	return 0;
+}
+
+int riscv_clear_ipi(int hart)
+{
+	u32 source_id;
+

arch/riscv/lib/andes_plic.c line 101

Quoted 10 lines
arch/riscv/lib/andes_plic.c new file +10 -0
+	PLIC_BASE_GET();
+
+	source_id = readl((void __iomem *)CLAIM_REG(gd->arch.plic, hart));
+	writel(source_id, (void __iomem *)CLAIM_REG(gd->arch.plic, hart));
+
+	return 0;
+}
+
+static const struct udevice_id andes_plic_ids[] = {
+	{ .compatible = "riscv,plic1", .data = RISCV_SYSCON_PLIC },

Would a compatible string of "andes,plic1" be more suitable?

arch/riscv/lib/andes_plic.c line 105

Quoted 4 lines
arch/riscv/lib/andes_plic.c new file +4 -0
+	{ }
+};
+
+U_BOOT_DRIVER(nds_plic) = {

nit: andes_plic

arch/riscv/lib/andes_plic.c line 110

Quoted 5 lines
arch/riscv/lib/andes_plic.c new file +5 -0
+	.name		= "andes_plic",
+	.id		= UCLASS_SYSCON,
+	.of_match	= andes_plic_ids,
+	.flags		= DM_FLAG_PRE_RELOC,
+};

There are a couple of checkpatch issues in this patch. I have copied the relevant ones below.

CHECK: spaces preferred around that '>>' (ctx:VxV) #135: FILE: arch/riscv/lib/andes_plic.c:29:
+#define SEND_IPI_TO_HART(hart) (0x80>>hart)

ERROR: that open brace { should be on the previous line #158: FILE: arch/riscv/lib/andes_plic.c:52:
+ for (i = 0; i < harts ;i++)
+ {

ERROR: space required after that ';' (ctx:WxV)
#158: FILE: arch/riscv/lib/andes_plic.c:52:
+ for (i = 0; i < harts ;i++)

CHECK: Comparison to NULL could be written "dev"
#176: FILE: arch/riscv/lib/andes_plic.c:70:
+ if (ret == 0 && dev != NULL) {

WARNING: line over 80 characters
#189: FILE: arch/riscv/lib/andes_plic.c:83:
+ writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd-

Quoted 1 line

arch.plic, gd->arch.boot_hart));

Thanks,
Lukas

#4 lore raw

PATCH v3 1/7 riscv: Add a SYSCON driver for Andestech's PLIC

Hi Lukas,

Quoted 220 lines · Lukas

Hi Rick,

Quoted 7 lines · Andes

From: Rick Chen <[email protected]>

The Platform-Level Interrupt Controller (PLIC) block holds memory-mapped claim and pending registers associated with software interrupt. It is required for handling IPI.

Quoted 8 lines
Cc Greentime Hu <[email protected]>

---
V3:
- Rename plic_init() as enable_ipi().
- Declase as static.
- Remove PLIC_BASE_GET() from enable_ipi().

Take a look at patman [1], it makes it really easy to handle different versions of a patch series. :)

[1]: https://github.com/u-boot/u-boot/blob/master/tools/patman/README

Quoted 47 lines
 arch/riscv/Kconfig                   |   9 +++
 arch/riscv/include/asm/global_data.h |   3 +
 arch/riscv/include/asm/syscon.h      |   2 +-
 arch/riscv/lib/Makefile              |   1 +
 arch/riscv/lib/andes_plic.c          | 110 +++++++++++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/lib/andes_plic.c
arch/riscv/Kconfig +9 -0
index 3a4470d..511768b 100644
@@ -109,6 +109,15 @@ config SIFIVE_CLINT
        The SiFive CLINT block holds memory-mapped control and status registers
        associated with software and timer interrupts.
 
+config ANDES_PLIC
+     bool
+     depends on RISCV_MMODE
+     select REGMAP
+     select SYSCON
+     help
+       The Andes PLIC block holds memory-mapped claim and pending registers
+       associated with software interrupt.
+
 config RISCV_RDTIME
      bool
      default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index 80e3165..b867910 100644
@@ -18,6 +18,9 @@ struct arch_global_data {
 #ifdef CONFIG_SIFIVE_CLINT
      void __iomem *clint;    /* clint base address */
 #endif
+#ifdef CONFIG_ANDES_PLIC
+     void __iomem *plic;     /* plic base address */
+#endif
 #ifdef CONFIG_SMP
      struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +0 -0
index d311ee6..c1b4b86 100644

arch/riscv/include/asm/syscon.h line 11

Quoted 3 lines
arch/riscv/include/asm/syscon.h +0 -0
@@ -9,11 +9,11 @@
 /*
  * System controllers in a RISC-V system
  *

nit: can you also drop the empty comment line above?

Quoted 88 lines
arch/riscv/include/asm/syscon.h +1 -1
- * So far only SiFive's Core Local Interruptor (CLINT) is defined.
  */
 enum {
      RISCV_NONE,
      RISCV_SYSCON_CLINT,     /* Core Local Interruptor (CLINT) */
+     RISCV_SYSCON_PLIC,      /* Platform Level Interrupt Controller (PLIC) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 35dbf64..1bf554b 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_GO) += boot.o
 obj-y        += cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
+obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
 obj-y        += interrupts.o
 obj-y        += reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plic.c new file +61 -0
new file mode 100644
index 0000000..67ab561
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019, Rick Chen <[email protected]>
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
+#include <dm/uclass-internal.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/syscon.h>
+#include <cpu.h>
+
+/* pending register */
+#define PENDING_REG(base, hart)      ((ulong)(base) + 0x1000 + (hart) * 8)
+/* enable register */
+#define ENABLE_REG(base, hart)       ((ulong)(base) + 0x2000 + (hart) * 0x80)
+/* claim register */
+#define CLAIM_REG(base, hart)        ((ulong)(base) + 0x200004 + (hart) * 0x1000)
+
+#define ENABLE_HART_IPI         (0x80808080)
+#define SEND_IPI_TO_HART(hart)  (0x80>>hart)
+
+DECLARE_GLOBAL_DATA_PTR;
+static int init_plic(void);
+
+#define PLIC_BASE_GET(void)                                          \
+     do {                                                            \
+             long *ret;                                              \
+                                                                     \
+             if (!gd->arch.plic) {                                   \
+                     ret = syscon_get_first_range(RISCV_SYSCON_PLIC); \
+                     if (IS_ERR(ret))                                \
+                             return PTR_ERR(ret);                    \
+                     gd->arch.plic = ret;                            \
+                     init_plic();                                    \
+             }                                                       \
+     } while (0)
+
+static int enable_ipi(int harts)
+{
+     int i;
+     int en = ENABLE_HART_IPI;
+
+     for (i = 0; i < harts ;i++)
+     {
+             en = en >> i;
+             writel(en, (void __iomem *)ENABLE_REG(gd->arch.plic, i));
+     }
+
+     return 0;
+}
+
+static int init_plic(void)

arch/riscv/lib/andes_plic.c line 71

Quoted 10 lines
arch/riscv/lib/andes_plic.c new file +10 -0
+{
+     struct udevice *dev;
+     int ret;
+
+     ret = uclass_find_first_device(UCLASS_CPU, &dev);
+     if (ret)
+             return ret;
+
+     if (ret == 0 && dev != NULL) {
+             ret = cpu_get_count(dev);

You should check first, if cpu_get_count() has returned an error before using its return value.

Quoted 20 lines
arch/riscv/lib/andes_plic.c new file +20 -0
+             enable_ipi(ret);
+             return 0;
+     }
+
+     return -ENODEV;
+}
+
+int riscv_send_ipi(int hart)
+{
+     PLIC_BASE_GET();
+
+     writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd->arch.plic, gd->arch.boot_hart));
+
+     return 0;
+}
+
+int riscv_clear_ipi(int hart)
+{
+     u32 source_id;
+

arch/riscv/lib/andes_plic.c line 101

Quoted 10 lines
arch/riscv/lib/andes_plic.c new file +10 -0
+     PLIC_BASE_GET();
+
+     source_id = readl((void __iomem *)CLAIM_REG(gd->arch.plic, hart));
+     writel(source_id, (void __iomem *)CLAIM_REG(gd->arch.plic, hart));
+
+     return 0;
+}
+
+static const struct udevice_id andes_plic_ids[] = {
+     { .compatible = "riscv,plic1", .data = RISCV_SYSCON_PLIC },

Would a compatible string of "andes,plic1" be more suitable?

arch/riscv/lib/andes_plic.c line 105

Quoted 4 lines
arch/riscv/lib/andes_plic.c new file +4 -0
+     { }
+};
+
+U_BOOT_DRIVER(nds_plic) = {

nit: andes_plic

Quoted 9 lines

arch/riscv/lib/andes_plic.c line 110

Quoted 5 lines
arch/riscv/lib/andes_plic.c new file +5 -0
+     .name           = "andes_plic",
+     .id             = UCLASS_SYSCON,
+     .of_match       = andes_plic_ids,
+     .flags          = DM_FLAG_PRE_RELOC,
+};

There are a couple of checkpatch issues in this patch. I have copied the relevant ones below.

Thanks for the checking the issues by yourself. I was under the impression that patman checks will be performed in the travis, but looks it isn't.

Rick, please use patman, as Lukas suggested, to help your custodian work!

Quoted 13 lines

CHECK: spaces preferred around that '>>' (ctx:VxV) #135: FILE: arch/riscv/lib/andes_plic.c:29:
+#define SEND_IPI_TO_HART(hart) (0x80>>hart)

ERROR: that open brace { should be on the previous line #158: FILE: arch/riscv/lib/andes_plic.c:52:

(quoted diff) +2 -0
+       for (i = 0; i < harts ;i++)
+       {

ERROR: space required after that ';' (ctx:WxV)
#158: FILE: arch/riscv/lib/andes_plic.c:52:
+ for (i = 0; i < harts ;i++)

Quoted 9 lines

CHECK: Comparison to NULL could be written "dev"
#176: FILE: arch/riscv/lib/andes_plic.c:70:
+ if (ret == 0 && dev != NULL) {

WARNING: line over 80 characters
#189: FILE: arch/riscv/lib/andes_plic.c:83:
+ writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd-

Quoted 1 line

arch.plic, gd->arch.boot_hart));

Regards,
Bin

A message that is not in the archive (sent off-list or not yet received): CAN5B=e+jJ69ip4dxuitgDjGzV4QLVLLps2XzTcdbku18UL6RmA@mail.gmail.com

#6 lore raw

PATCH v3 1/7 riscv: Add a SYSCON driver for Andestech's PLIC

Hi Lukas

Quoted 21 lines

Auer, Lukas <[email protected]> 於 2019年4月1日 週一 下午5:08寫道:

Hi Rick,

Quoted 7 lines · Andes

From: Rick Chen <[email protected]>

The Platform-Level Interrupt Controller (PLIC) block holds memory-mapped claim and pending registers associated with software interrupt. It is required for handling IPI.

Quoted 8 lines
Cc Greentime Hu <[email protected]>

---
V3:
- Rename plic_init() as enable_ipi().
- Declase as static.
- Remove PLIC_BASE_GET() from enable_ipi().

Quoted 2 lines

Take a look at patman [1], it makes it really easy to handle different versions of a patch series. :)

OK
Thanks :)

Quoted 47 lines

[1]: https://github.com/u-boot/u-boot/blob/master/tools/patman/README

Quoted 44 lines
 arch/riscv/Kconfig                   |   9 +++
 arch/riscv/include/asm/global_data.h |   3 +
 arch/riscv/include/asm/syscon.h      |   2 +-
 arch/riscv/lib/Makefile              |   1 +
 arch/riscv/lib/andes_plic.c          | 110 +++++++++++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/lib/andes_plic.c
arch/riscv/Kconfig +9 -0
index 3a4470d..511768b 100644
@@ -109,6 +109,15 @@ config SIFIVE_CLINT
        The SiFive CLINT block holds memory-mapped control and status registers
        associated with software and timer interrupts.
 
+config ANDES_PLIC
+     bool
+     depends on RISCV_MMODE
+     select REGMAP
+     select SYSCON
+     help
+       The Andes PLIC block holds memory-mapped claim and pending registers
+       associated with software interrupt.
+
 config RISCV_RDTIME
      bool
      default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index 80e3165..b867910 100644
@@ -18,6 +18,9 @@ struct arch_global_data {
 #ifdef CONFIG_SIFIVE_CLINT
      void __iomem *clint;    /* clint base address */
 #endif
+#ifdef CONFIG_ANDES_PLIC
+     void __iomem *plic;     /* plic base address */
+#endif
 #ifdef CONFIG_SMP
      struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +0 -0
index d311ee6..c1b4b86 100644
Quoted 8 lines

arch/riscv/include/asm/syscon.h line 11

Quoted 6 lines
arch/riscv/include/asm/syscon.h +0 -0
@@ -9,11 +9,11 @@
 /*
  * System controllers in a RISC-V system
  *

nit: can you also drop the empty comment line above?

OK

Quoted 94 lines
Quoted 94 lines
arch/riscv/include/asm/syscon.h +1 -1
- * So far only SiFive's Core Local Interruptor (CLINT) is defined.
  */
 enum {
      RISCV_NONE,
      RISCV_SYSCON_CLINT,     /* Core Local Interruptor (CLINT) */
+     RISCV_SYSCON_PLIC,      /* Platform Level Interrupt Controller (PLIC) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 35dbf64..1bf554b 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_GO) += boot.o
 obj-y        += cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
+obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
 obj-y        += interrupts.o
 obj-y        += reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plic.c new file +66 -0
new file mode 100644
index 0000000..67ab561
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019, Rick Chen <[email protected]>
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
+#include <dm/uclass-internal.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/syscon.h>
+#include <cpu.h>
+
+/* pending register */
+#define PENDING_REG(base, hart)      ((ulong)(base) + 0x1000 + (hart) * 8)
+/* enable register */
+#define ENABLE_REG(base, hart)       ((ulong)(base) + 0x2000 + (hart) * 0x80)
+/* claim register */
+#define CLAIM_REG(base, hart)        ((ulong)(base) + 0x200004 + (hart) * 0x1000)
+
+#define ENABLE_HART_IPI         (0x80808080)
+#define SEND_IPI_TO_HART(hart)  (0x80>>hart)
+
+DECLARE_GLOBAL_DATA_PTR;
+static int init_plic(void);
+
+#define PLIC_BASE_GET(void)                                          \
+     do {                                                            \
+             long *ret;                                              \
+                                                                     \
+             if (!gd->arch.plic) {                                   \
+                     ret = syscon_get_first_range(RISCV_SYSCON_PLIC); \
+                     if (IS_ERR(ret))                                \
+                             return PTR_ERR(ret);                    \
+                     gd->arch.plic = ret;                            \
+                     init_plic();                                    \
+             }                                                       \
+     } while (0)
+
+static int enable_ipi(int harts)
+{
+     int i;
+     int en = ENABLE_HART_IPI;
+
+     for (i = 0; i < harts ;i++)
+     {
+             en = en >> i;
+             writel(en, (void __iomem *)ENABLE_REG(gd->arch.plic, i));
+     }
+
+     return 0;
+}
+
+static int init_plic(void)
+{
+     struct udevice *dev;
+     int ret;
+
+     ret = uclass_find_first_device(UCLASS_CPU, &dev);
Quoted 8 lines

arch/riscv/lib/andes_plic.c line 71

Quoted 5 lines
arch/riscv/lib/andes_plic.c new file +5 -0
+     if (ret)
+             return ret;
+
+     if (ret == 0 && dev != NULL) {
+             ret = cpu_get_count(dev);

You should check first, if cpu_get_count() has returned an error before using its return value.

OK
I will check the return value from cpu_get_count().

Quoted 25 lines
Quoted 25 lines
arch/riscv/lib/andes_plic.c new file +24 -0
+             enable_ipi(ret);
+             return 0;
+     }
+
+     return -ENODEV;
+}
+
+int riscv_send_ipi(int hart)
+{
+     PLIC_BASE_GET();
+
+     writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd->arch.plic, gd->arch.boot_hart));
+
+     return 0;
+}
+
+int riscv_clear_ipi(int hart)
+{
+     u32 source_id;
+
+     PLIC_BASE_GET();
+
+     source_id = readl((void __iomem *)CLAIM_REG(gd->arch.plic, hart));
+     writel(source_id, (void __iomem *)CLAIM_REG(gd->arch.plic, hart));
Quoted 8 lines

arch/riscv/lib/andes_plic.c line 101

Quoted 6 lines
arch/riscv/lib/andes_plic.c new file +6 -0
+
+     return 0;
+}
+
+static const struct udevice_id andes_plic_ids[] = {
+     { .compatible = "riscv,plic1", .data = RISCV_SYSCON_PLIC },

Would a compatible string of "andes,plic1" be more suitable?

I got and sync the dts from our kernel team.
If I shall change the string, I need to discuss with them. Some of them are not in office this week.
So I prefer not change in this series.

Quoted 7 lines

arch/riscv/lib/andes_plic.c line 105

Quoted 5 lines
arch/riscv/lib/andes_plic.c new file +4 -0
+     { }
+};
+
+U_BOOT_DRIVER(nds_plic) = {

nit: andes_plic

OK

Quoted 9 lines

+ .name = "andes_plic",

arch/riscv/lib/andes_plic.c line 110

Quoted 4 lines
arch/riscv/lib/andes_plic.c new file +4 -0
+     .id             = UCLASS_SYSCON,
+     .of_match       = andes_plic_ids,
+     .flags          = DM_FLAG_PRE_RELOC,
+};

There are a couple of checkpatch issues in this patch. I have copied the relevant ones below.

I will check patchs in the next patchsets

Thanks
Rick

Quoted 24 lines

CHECK: spaces preferred around that '>>' (ctx:VxV) #135: FILE: arch/riscv/lib/andes_plic.c:29:
+#define SEND_IPI_TO_HART(hart) (0x80>>hart)

ERROR: that open brace { should be on the previous line #158: FILE: arch/riscv/lib/andes_plic.c:52:

(quoted diff) +2 -0
+       for (i = 0; i < harts ;i++)
+       {

ERROR: space required after that ';' (ctx:WxV)
#158: FILE: arch/riscv/lib/andes_plic.c:52:
+ for (i = 0; i < harts ;i++)

CHECK: Comparison to NULL could be written "dev"
#176: FILE: arch/riscv/lib/andes_plic.c:70:
+ if (ret == 0 && dev != NULL) {

WARNING: line over 80 characters
#189: FILE: arch/riscv/lib/andes_plic.c:83:
+ writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd-

Quoted 1 line

arch.plic, gd->arch.boot_hart));

Thanks,
Lukas

#7 lore raw

PATCH v3 1/7 riscv: Add a SYSCON driver for Andestech's PLIC

Hi Rick,

Quoted 224 lines · Rick Chen

Hi Lukas

Quoted 21 lines

Auer, Lukas <[email protected]> 於 2019年4月1日 週一 下午5:08寫道:

Hi Rick,

Quoted 7 lines · Andes

From: Rick Chen <[email protected]>

The Platform-Level Interrupt Controller (PLIC) block holds memory-mapped claim and pending registers associated with software interrupt. It is required for handling IPI.

Quoted 8 lines
Cc Greentime Hu <[email protected]>

---
V3:
- Rename plic_init() as enable_ipi().
- Declase as static.
- Remove PLIC_BASE_GET() from enable_ipi().

Quoted 2 lines

Take a look at patman [1], it makes it really easy to handle different versions of a patch series. :)

OK
Thanks :)

Quoted 46 lines

[1]: https://github.com/u-boot/u-boot/blob/master/tools/patman/README

Quoted 44 lines
 arch/riscv/Kconfig                   |   9 +++
 arch/riscv/include/asm/global_data.h |   3 +
 arch/riscv/include/asm/syscon.h      |   2 +-
 arch/riscv/lib/Makefile              |   1 +
 arch/riscv/lib/andes_plic.c          | 110 +++++++++++++++++++++++++++++++++++
 5 files changed, 124 insertions(+), 1 deletion(-)
 create mode 100644 arch/riscv/lib/andes_plic.c
arch/riscv/Kconfig +9 -0
index 3a4470d..511768b 100644
@@ -109,6 +109,15 @@ config SIFIVE_CLINT
        The SiFive CLINT block holds memory-mapped control and status registers
        associated with software and timer interrupts.
 
+config ANDES_PLIC
+     bool
+     depends on RISCV_MMODE
+     select REGMAP
+     select SYSCON
+     help
+       The Andes PLIC block holds memory-mapped claim and pending registers
+       associated with software interrupt.
+
 config RISCV_RDTIME
      bool
      default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index 80e3165..b867910 100644
@@ -18,6 +18,9 @@ struct arch_global_data {
 #ifdef CONFIG_SIFIVE_CLINT
      void __iomem *clint;    /* clint base address */
 #endif
+#ifdef CONFIG_ANDES_PLIC
+     void __iomem *plic;     /* plic base address */
+#endif
 #ifdef CONFIG_SMP
      struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +0 -0
index d311ee6..c1b4b86 100644
Quoted 8 lines

arch/riscv/include/asm/syscon.h line 11

Quoted 6 lines
arch/riscv/include/asm/syscon.h +0 -0
@@ -9,11 +9,11 @@
 /*
  * System controllers in a RISC-V system
  *

nit: can you also drop the empty comment line above?

OK

Quoted 93 lines
Quoted 93 lines
arch/riscv/include/asm/syscon.h +1 -1
- * So far only SiFive's Core Local Interruptor (CLINT) is defined.
  */
 enum {
      RISCV_NONE,
      RISCV_SYSCON_CLINT,     /* Core Local Interruptor (CLINT) */
+     RISCV_SYSCON_PLIC,      /* Platform Level Interrupt Controller (PLIC) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 35dbf64..1bf554b 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_CMD_GO) += boot.o
 obj-y        += cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
+obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
 obj-y        += interrupts.o
 obj-y        += reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plic.c new file +66 -0
new file mode 100644
index 0000000..67ab561
@@ -0,0 +1,110 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019, Rick Chen <[email protected]>
+ *
+ * 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.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/device-internal.h>
+#include <dm/lists.h>
+#include <dm/uclass-internal.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/syscon.h>
+#include <cpu.h>
+
+/* pending register */
+#define PENDING_REG(base, hart)      ((ulong)(base) + 0x1000 + (hart) * 8)
+/* enable register */
+#define ENABLE_REG(base, hart)       ((ulong)(base) + 0x2000 + (hart) * 0x80)
+/* claim register */
+#define CLAIM_REG(base, hart)        ((ulong)(base) + 0x200004 + (hart) * 0x1000)
+
+#define ENABLE_HART_IPI         (0x80808080)
+#define SEND_IPI_TO_HART(hart)  (0x80>>hart)
+
+DECLARE_GLOBAL_DATA_PTR;
+static int init_plic(void);
+
+#define PLIC_BASE_GET(void)                                          \
+     do {                                                            \
+             long *ret;                                              \
+                                                                     \
+             if (!gd->arch.plic) {                                   \
+                     ret = syscon_get_first_range(RISCV_SYSCON_PLIC); \
+                     if (IS_ERR(ret))                                \
+                             return PTR_ERR(ret);                    \
+                     gd->arch.plic = ret;                            \
+                     init_plic();                                    \
+             }                                                       \
+     } while (0)
+
+static int enable_ipi(int harts)
+{
+     int i;
+     int en = ENABLE_HART_IPI;
+
+     for (i = 0; i < harts ;i++)
+     {
+             en = en >> i;
+             writel(en, (void __iomem *)ENABLE_REG(gd->arch.plic, i));
+     }
+
+     return 0;
+}
+
+static int init_plic(void)
+{
+     struct udevice *dev;
+     int ret;
+
+     ret = uclass_find_first_device(UCLASS_CPU, &dev);
Quoted 8 lines

arch/riscv/lib/andes_plic.c line 71

Quoted 5 lines
arch/riscv/lib/andes_plic.c new file +5 -0
+     if (ret)
+             return ret;
+
+     if (ret == 0 && dev != NULL) {
+             ret = cpu_get_count(dev);

You should check first, if cpu_get_count() has returned an error before using its return value.

OK
I will check the return value from cpu_get_count().

Quoted 24 lines
Quoted 24 lines
arch/riscv/lib/andes_plic.c new file +24 -0
+             enable_ipi(ret);
+             return 0;
+     }
+
+     return -ENODEV;
+}
+
+int riscv_send_ipi(int hart)
+{
+     PLIC_BASE_GET();
+
+     writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd->arch.plic, gd->arch.boot_hart));
+
+     return 0;
+}
+
+int riscv_clear_ipi(int hart)
+{
+     u32 source_id;
+
+     PLIC_BASE_GET();
+
+     source_id = readl((void __iomem *)CLAIM_REG(gd->arch.plic, hart));
+     writel(source_id, (void __iomem *)CLAIM_REG(gd->arch.plic, hart));
Quoted 8 lines

arch/riscv/lib/andes_plic.c line 101

Quoted 6 lines
arch/riscv/lib/andes_plic.c new file +6 -0
+
+     return 0;
+}
+
+static const struct udevice_id andes_plic_ids[] = {
+     { .compatible = "riscv,plic1", .data = RISCV_SYSCON_PLIC },

Would a compatible string of "andes,plic1" be more suitable?

Quoted 5 lines

I got and sync the dts from our kernel team.
If I shall change the string, I need to discuss with them. Some of them are not in office this week.
So I prefer not change in this series.

That makes sense. I think it's fine, if you sync the device tree once it is included in the upstream kernel.

Thanks,
Lukas

Quoted 48 lines
Quoted 6 lines

arch/riscv/lib/andes_plic.c line 105

Quoted 4 lines
arch/riscv/lib/andes_plic.c new file +4 -0
+     { }
+};
+
+U_BOOT_DRIVER(nds_plic) = {

nit: andes_plic

OK

Quoted 9 lines

+ .name = "andes_plic",

arch/riscv/lib/andes_plic.c line 110

Quoted 4 lines
arch/riscv/lib/andes_plic.c new file +4 -0
+     .id             = UCLASS_SYSCON,
+     .of_match       = andes_plic_ids,
+     .flags          = DM_FLAG_PRE_RELOC,
+};

There are a couple of checkpatch issues in this patch. I have copied the relevant ones below.

I will check patchs in the next patchsets

Thanks
Rick

Quoted 24 lines

CHECK: spaces preferred around that '>>' (ctx:VxV) #135: FILE: arch/riscv/lib/andes_plic.c:29:
+#define SEND_IPI_TO_HART(hart) (0x80>>hart)

ERROR: that open brace { should be on the previous line #158: FILE: arch/riscv/lib/andes_plic.c:52:

(quoted diff) +2 -0
+       for (i = 0; i < harts ;i++)
+       {

ERROR: space required after that ';' (ctx:WxV)
#158: FILE: arch/riscv/lib/andes_plic.c:52:
+ for (i = 0; i < harts ;i++)

CHECK: Comparison to NULL could be written "dev"
#176: FILE: arch/riscv/lib/andes_plic.c:70:
+ if (ret == 0 && dev != NULL) {

WARNING: line over 80 characters
#189: FILE: arch/riscv/lib/andes_plic.c:83:
+ writel(SEND_IPI_TO_HART(hart), (void __iomem *)PENDING_REG(gd-

Quoted 1 line

arch.plic, gd->arch.boot_hart));

Thanks,
Lukas

author
#8 lore raw

PATCH v3 2/7 riscv: Add a SYSCON driver for Andestech's PLMT

In reply to Andes

From: Rick Chen <[email protected]>

The platform-Level Machine Timer (PLMT) block
holds memory-mapped mtime register associated
with timer tick.

This driver implements the riscv_get_time() which
is required by the generic RISC-V timer driver.

---
V3:
- Add a space before (PLMT).

 arch/riscv/Kconfig                   |  9 ++++++
 arch/riscv/include/asm/global_data.h |  3 ++
 arch/riscv/include/asm/syscon.h      |  1 +
 arch/riscv/lib/Makefile              |  1 +
 arch/riscv/lib/andes_plmt.c          | 53 ++++++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 arch/riscv/lib/andes_plmt.c
arch/riscv/Kconfig +9 -0
index 511768b..ae8ff7b 100644
@@ -118,6 +118,15 @@ config ANDES_PLIC
 	  The Andes PLIC block holds memory-mapped claim and pending registers
 	  associated with software interrupt.
 
+config ANDES_PLMT
+	bool
+	depends on RISCV_MMODE
+	select REGMAP
+	select SYSCON
+	help
+	  The Andes PLMT block holds memory-mapped mtime register
+	  associated with timer tick.
+
 config RISCV_RDTIME
 	bool
 	default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index b867910..dffcd45 100644
@@ -21,6 +21,9 @@ struct arch_global_data {
 #ifdef CONFIG_ANDES_PLIC
 	void __iomem *plic;	/* plic base address */
 #endif
+#ifdef CONFIG_ANDES_PLMT
+	void __iomem *plmt;	/* plmt base address */
+#endif
 #ifdef CONFIG_SMP
 	struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +1 -0
index c1b4b86..6e12574 100644
@@ -14,6 +14,7 @@ enum {
 	RISCV_NONE,
 	RISCV_SYSCON_CLINT,	/* Core Local Interruptor (CLINT) */
 	RISCV_SYSCON_PLIC,	/* Platform Level Interrupt Controller (PLIC) */
+	RISCV_SYSCON_PLMT,	/* Platform Level Machine Timer (PLMT) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 1bf554b..1c332db 100644
@@ -12,6 +12,7 @@ obj-y	+= cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
 obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
+obj-$(CONFIG_ANDES_PLMT) += andes_plmt.o
 obj-y	+= interrupts.o
 obj-y	+= reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plmt.c new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.7.4
#9 lore raw

PATCH v3 2/7 riscv: Add a SYSCON driver for Andestech's PLMT

Hi Rick,

Quoted 122 lines · Andes

From: Rick Chen <[email protected]>

The platform-Level Machine Timer (PLMT) block
holds memory-mapped mtime register associated
with timer tick.

This driver implements the riscv_get_time() which
is required by the generic RISC-V timer driver.

---
V3:
- Add a space before (PLMT).

 arch/riscv/Kconfig                   |  9 ++++++
 arch/riscv/include/asm/global_data.h |  3 ++
 arch/riscv/include/asm/syscon.h      |  1 +
 arch/riscv/lib/Makefile              |  1 +
 arch/riscv/lib/andes_plmt.c          | 53 ++++++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 arch/riscv/lib/andes_plmt.c
arch/riscv/Kconfig +9 -0
index 511768b..ae8ff7b 100644
@@ -118,6 +118,15 @@ config ANDES_PLIC
 	  The Andes PLIC block holds memory-mapped claim and pending registers
 	  associated with software interrupt.
 
+config ANDES_PLMT
+	bool
+	depends on RISCV_MMODE
+	select REGMAP
+	select SYSCON
+	help
+	  The Andes PLMT block holds memory-mapped mtime register
+	  associated with timer tick.
+
 config RISCV_RDTIME
 	bool
 	default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index b867910..dffcd45 100644
@@ -21,6 +21,9 @@ struct arch_global_data {
 #ifdef CONFIG_ANDES_PLIC
 	void __iomem *plic;	/* plic base address */
 #endif
+#ifdef CONFIG_ANDES_PLMT
+	void __iomem *plmt;	/* plmt base address */
+#endif
 #ifdef CONFIG_SMP
 	struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +1 -0
index c1b4b86..6e12574 100644
@@ -14,6 +14,7 @@ enum {
 	RISCV_NONE,
 	RISCV_SYSCON_CLINT,	/* Core Local Interruptor (CLINT) */
 	RISCV_SYSCON_PLIC,	/* Platform Level Interrupt Controller (PLIC) */
+	RISCV_SYSCON_PLMT,	/* Platform Level Machine Timer (PLMT) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 1bf554b..1c332db 100644
@@ -12,6 +12,7 @@ obj-y	+= cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
 obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
+obj-$(CONFIG_ANDES_PLMT) += andes_plmt.o
 obj-y	+= interrupts.o
 obj-y	+= reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plmt.c new file +34 -0
new file mode 100644
index 0000000..12d7e0e
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019, Rick Chen <[email protected]>
+ *
+ * U-Boot syscon driver for Andes's Platform Level Machine Timer (PLMT).
+ * The PLMT block holds memory-mapped mtime register
+ * associated with timer tick.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/syscon.h>
+
+/* mtime register */
+#define MTIME_REG(base)			((ulong)(base))
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define PLMT_BASE_GET(void)						\
+	do {								\
+		long *ret;						\
+									\
+		if (!gd->arch.plmt) {					\
+			ret = syscon_get_first_range(RISCV_SYSCON_PLMT); \
+			if (IS_ERR(ret))				\
+				return PTR_ERR(ret);			\
+			gd->arch.plmt = ret;				\
+		}							\
+	} while (0)
+
+int riscv_get_time(u64 *time)

arch/riscv/lib/andes_plmt.c line 44

Quoted 10 lines
arch/riscv/lib/andes_plmt.c new file +10 -0
+{
+	PLMT_BASE_GET();
+
+	*time = readq((void __iomem *)MTIME_REG(gd->arch.plmt));
+
+	return 0;
+}
+
+static const struct udevice_id nds_plmt_ids[] = {
+	{ .compatible = "riscv,plmt0", .data = RISCV_SYSCON_PLMT },

Would a compatible string of "andes,plmt0" be more suitable?

arch/riscv/lib/andes_plmt.c line 49

Quoted 5 lines
arch/riscv/lib/andes_plmt.c new file +5 -0
+	{ }
+};
+
+U_BOOT_DRIVER(nds_plmt) = {
+	.name		= "nds_plmt",

nit: andes_plmt

Thanks,
Lukas

Quoted 4 lines
arch/riscv/lib/andes_plmt.c new file +4 -0
+	.id		= UCLASS_SYSCON,
+	.of_match	= nds_plmt_ids,
+	.flags		= DM_FLAG_PRE_RELOC,
+};
#10 lore raw

PATCH v3 2/7 riscv: Add a SYSCON driver for Andestech's PLMT

Hi Lukas

Auer, Lukas <[email protected]> 於 2019年4月1日 週一 下午5:09寫道:

Quoted 139 lines

Hi Rick,

Quoted 122 lines · Andes

From: Rick Chen <[email protected]>

The platform-Level Machine Timer (PLMT) block
holds memory-mapped mtime register associated
with timer tick.

This driver implements the riscv_get_time() which
is required by the generic RISC-V timer driver.

---
V3:
- Add a space before (PLMT).

 arch/riscv/Kconfig                   |  9 ++++++
 arch/riscv/include/asm/global_data.h |  3 ++
 arch/riscv/include/asm/syscon.h      |  1 +
 arch/riscv/lib/Makefile              |  1 +
 arch/riscv/lib/andes_plmt.c          | 53 ++++++++++++++++++++++++++++++++++++
 5 files changed, 67 insertions(+)
 create mode 100644 arch/riscv/lib/andes_plmt.c
arch/riscv/Kconfig +9 -0
index 511768b..ae8ff7b 100644
@@ -118,6 +118,15 @@ config ANDES_PLIC
        The Andes PLIC block holds memory-mapped claim and pending registers
        associated with software interrupt.
 
+config ANDES_PLMT
+     bool
+     depends on RISCV_MMODE
+     select REGMAP
+     select SYSCON
+     help
+       The Andes PLMT block holds memory-mapped mtime register
+       associated with timer tick.
+
 config RISCV_RDTIME
      bool
      default y if RISCV_SMODE
arch/riscv/include/asm/global_data.h +3 -0
index b867910..dffcd45 100644
@@ -21,6 +21,9 @@ struct arch_global_data {
 #ifdef CONFIG_ANDES_PLIC
      void __iomem *plic;     /* plic base address */
 #endif
+#ifdef CONFIG_ANDES_PLMT
+     void __iomem *plmt;     /* plmt base address */
+#endif
 #ifdef CONFIG_SMP
      struct ipi_data ipi[CONFIG_NR_CPUS];
 #endif
arch/riscv/include/asm/syscon.h +1 -0
index c1b4b86..6e12574 100644
@@ -14,6 +14,7 @@ enum {
      RISCV_NONE,
      RISCV_SYSCON_CLINT,     /* Core Local Interruptor (CLINT) */
      RISCV_SYSCON_PLIC,      /* Platform Level Interrupt Controller (PLIC) */
+     RISCV_SYSCON_PLMT,      /* Platform Level Machine Timer (PLMT) */
 };
 
 #endif /* _ASM_SYSCON_H */
arch/riscv/lib/Makefile +1 -0
index 1bf554b..1c332db 100644
@@ -12,6 +12,7 @@ obj-y       += cache.o
 obj-$(CONFIG_RISCV_RDTIME) += rdtime.o
 obj-$(CONFIG_SIFIVE_CLINT) += sifive_clint.o
 obj-$(CONFIG_ANDES_PLIC) += andes_plic.o
+obj-$(CONFIG_ANDES_PLMT) += andes_plmt.o
 obj-y        += interrupts.o
 obj-y        += reset.o
 obj-$(CONFIG_SBI_IPI) += sbi_ipi.o
arch/riscv/lib/andes_plmt.c new file +34 -0
new file mode 100644
index 0000000..12d7e0e
@@ -0,0 +1,53 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2019, Rick Chen <[email protected]>
+ *
+ * U-Boot syscon driver for Andes's Platform Level Machine Timer (PLMT).
+ * The PLMT block holds memory-mapped mtime register
+ * associated with timer tick.
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <regmap.h>
+#include <syscon.h>
+#include <asm/io.h>
+#include <asm/syscon.h>
+
+/* mtime register */
+#define MTIME_REG(base)                      ((ulong)(base))
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#define PLMT_BASE_GET(void)                                          \
+     do {                                                            \
+             long *ret;                                              \
+                                                                     \
+             if (!gd->arch.plmt) {                                   \
+                     ret = syscon_get_first_range(RISCV_SYSCON_PLMT); \
+                     if (IS_ERR(ret))                                \
+                             return PTR_ERR(ret);                    \
+                     gd->arch.plmt = ret;                            \
+             }                                                       \
+     } while (0)
+
+int riscv_get_time(u64 *time)

arch/riscv/lib/andes_plmt.c line 44

Quoted 10 lines
arch/riscv/lib/andes_plmt.c new file +10 -0
+{
+     PLMT_BASE_GET();
+
+     *time = readq((void __iomem *)MTIME_REG(gd->arch.plmt));
+
+     return 0;
+}
+
+static const struct udevice_id nds_plmt_ids[] = {
+     { .compatible = "riscv,plmt0", .data = RISCV_SYSCON_PLMT },

Would a compatible string of "andes,plmt0" be more suitable?

Quoted 7 lines

arch/riscv/lib/andes_plmt.c line 49

Quoted 5 lines
arch/riscv/lib/andes_plmt.c new file +5 -0
+     { }
+};
+
+U_BOOT_DRIVER(nds_plmt) = {
+     .name           = "nds_plmt",

nit: andes_plmt

OK
I will rename it.

Thanks
Rick

Quoted 8 lines

Thanks,
Lukas

Quoted 4 lines
arch/riscv/lib/andes_plmt.c new file +4 -0
+     .id             = UCLASS_SYSCON,
+     .of_match       = nds_plmt_ids,
+     .flags          = DM_FLAG_PRE_RELOC,
+};
author
#11 lore raw

PATCH v3 3/7 riscv: ae350: disable ATCPIT100 timer

In reply to Andes

From: Rick Chen <[email protected]>

Disable ATCPIT100 SoC timer and replace by PLMT.

---
 configs/ae350_rv32_defconfig | 1 -
 configs/ae350_rv64_defconfig | 1 -
 2 files changed, 2 deletions(-)
configs/ae350_rv32_defconfig +0 -1
index 5837b48..e13c7de 100644
@@ -33,4 +33,3 @@ CONFIG_BAUDRATE=38400
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_ATCSPI200_SPI=y
-CONFIG_ATCPIT100_TIMER=y
configs/ae350_rv64_defconfig +0 -1
index b250d3f..a41f918 100644
@@ -34,4 +34,3 @@ CONFIG_BAUDRATE=38400
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_ATCSPI200_SPI=y
-CONFIG_ATCPIT100_TIMER=y
Signature · 1 line
2.7.4
#12 lore raw

PATCH v3 3/7 riscv: ae350: disable ATCPIT100 timer

Hi Rick,

Quoted 26 lines · Andes

From: Rick Chen <[email protected]>

Disable ATCPIT100 SoC timer and replace by PLMT.

---
 configs/ae350_rv32_defconfig | 1 -
 configs/ae350_rv64_defconfig | 1 -
 2 files changed, 2 deletions(-)
configs/ae350_rv32_defconfig +0 -1
index 5837b48..e13c7de 100644
@@ -33,4 +33,3 @@ CONFIG_BAUDRATE=38400
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_ATCSPI200_SPI=y
-CONFIG_ATCPIT100_TIMER=y
configs/ae350_rv64_defconfig +0 -0
index b250d3f..a41f918 100644

configs/ae350_rv64_defconfig CONFIG_BAUDRATE=38400 · line 37

Quoted 4 lines
configs/ae350_rv64_defconfig +0 -1
@@ -34,4 +34,3 @@ CONFIG_BAUDRATE=38400
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_ATCSPI200_SPI=y
-CONFIG_ATCPIT100_TIMER=y

This may break bisectability, since the board won't have a working timer until the next patch. You may consider squashing them.

Other than that.

Thanks,
Lukas

#13 lore raw

PATCH v3 3/7 riscv: ae350: disable ATCPIT100 timer

Hi Lukas

Auer, Lukas <[email protected]> 於 2019年4月1日 週一 下午5:13寫道:

Quoted 29 lines

Hi Rick,

Quoted 25 lines · Andes

From: Rick Chen <[email protected]>

Disable ATCPIT100 SoC timer and replace by PLMT.

---
 configs/ae350_rv32_defconfig | 1 -
 configs/ae350_rv64_defconfig | 1 -
 2 files changed, 2 deletions(-)
configs/ae350_rv32_defconfig +0 -1
index 5837b48..e13c7de 100644
@@ -33,4 +33,3 @@ CONFIG_BAUDRATE=38400
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_ATCSPI200_SPI=y
-CONFIG_ATCPIT100_TIMER=y
configs/ae350_rv64_defconfig +0 -0
index b250d3f..a41f918 100644
Quoted 8 lines

configs/ae350_rv64_defconfig CONFIG_BAUDRATE=38400 · line 37

Quoted 5 lines
configs/ae350_rv64_defconfig +0 -1
@@ -34,4 +34,3 @@ CONFIG_BAUDRATE=38400
 CONFIG_SYS_NS16550=y
 CONFIG_SPI=y
 CONFIG_ATCSPI200_SPI=y
-CONFIG_ATCPIT100_TIMER=y

This may break bisectability, since the board won't have a working timer until the next patch. You may consider squashing them.

OK
I will combine them as one.

Thanks
Rick

Quoted 7 lines

Other than that.

Thanks,
Lukas

author
#14 lore raw

PATCH v3 4/7 riscv: ax25: Add platform-specific Kconfig options

In reply to Andes

From: Rick Chen <[email protected]>

Add ax25 RISC-V platform-specific Kconfig options, to include CPU and timer drivers.

---
 arch/riscv/cpu/ax25/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)
arch/riscv/cpu/ax25/Kconfig +6 -0
index e9dbca2..68bd4e9 100644
@@ -1,5 +1,11 @@
 config RISCV_NDS
 	bool
+	select ARCH_EARLY_INIT_R
+	imply CPU
+	imply CPU_RISCV
+	imply RISCV_TIMER
+	imply ANDES_PLIC if RISCV_MMODE
+	imply ANDES_PLMT if RISCV_MMODE
 	help
 	  Run U-Boot on AndeStar V5 platforms and use some specific features
 	  which are provided by Andes Technology AndeStar V5 families.
Signature · 1 line
2.7.4
#15 lore raw

PATCH v3 4/7 riscv: ax25: Add platform-specific Kconfig options

Quoted 5 lines · Andes

From: Rick Chen <[email protected]>

Add ax25 RISC-V platform-specific Kconfig options, to include CPU and timer drivers.

Quoted 7 lines
---
 arch/riscv/cpu/ax25/Kconfig | 6 ++++++
 1 file changed, 6 insertions(+)
author
#16 lore raw

PATCH v3 5/7 riscv: ax25: Andes specific cache shall only support in M-mode

In reply to Andes

From: Rick Chen <[email protected]>

Limit the cache configuration only can be supported in M mode. It can not be manipulated in S mode.

---
 arch/riscv/cpu/ax25/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/riscv/cpu/ax25/Kconfig +1 -0
index 68bd4e9..6b4b92e 100644
@@ -14,6 +14,7 @@ if RISCV_NDS
 
 config RISCV_NDS_CACHE
 	bool "AndeStar V5 families specific cache support"
+	depends on RISCV_MMODE
 	help
 	  Provide Andes Technology AndeStar V5 families specific cache support.
 
Signature · 1 line
2.7.4
#17 lore raw

PATCH v3 5/7 riscv: ax25: Andes specific cache shall only support in M-mode

Quoted 5 lines · Andes

From: Rick Chen <[email protected]>

Limit the cache configuration only can be supported in M mode. It can not be manipulated in S mode.

Quoted 7 lines
---
 arch/riscv/cpu/ax25/Kconfig | 1 +
 1 file changed, 1 insertion(+)
author
#18 lore raw

PATCH v3 6/7 riscv: dts: ae350 support SMP

In reply to Andes

From: Rick Chen <[email protected]>

Cc Greentime Hu <[email protected]>

---
V3:
- Fix some mis-alignments.
- Recovery isa string of CPU1.

 arch/riscv/dts/ae350_32.dts | 81 +++++++++++++++++++++++++++++++++------------
 arch/riscv/dts/ae350_64.dts | 81 +++++++++++++++++++++++++++++++++------------
 2 files changed, 118 insertions(+), 44 deletions(-)
arch/riscv/dts/ae350_32.dts +59 -22
index 0679827..2ec01a5 100644
@@ -26,16 +26,49 @@
 			status = "okay";
 			compatible = "riscv";
 			riscv,isa = "rv32imafdc";
+			riscv,priv-major = <1>;
+			riscv,priv-minor = <10>;
 			mmu-type = "riscv,sv32";
 			clock-frequency = <60000000>;
+			i-cache-size = <0x8000>;
+			i-cache-line-size = <32>;
 			d-cache-size = <0x8000>;
 			d-cache-line-size = <32>;
+			next-level-cache = <&L2>;
 			CPU0_intc: interrupt-controller {
 				#interrupt-cells = <1>;
 				interrupt-controller;
 				compatible = "riscv,cpu-intc";
 			};
 		};
+		CPU1: cpu at 1 {
+			device_type = "cpu";
+			reg = <1>;
+			status = "okay";
+			compatible = "riscv";
+			riscv,isa = "rv32imafdc";
+			riscv,priv-major = <1>;
+			riscv,priv-minor = <10>;
+			mmu-type = "riscv,sv32";
+			clock-frequency = <60000000>;
+			i-cache-size = <0x8000>;
+			i-cache-line-size = <32>;
+			d-cache-size = <0x8000>;
+			d-cache-line-size = <32>;
+			next-level-cache = <&L2>;
+			CPU1_intc: interrupt-controller {
+				#interrupt-cells = <1>;
+				interrupt-controller;
+				compatible = "riscv,cpu-intc";
+			};
+		};
+
+		L2: l2-cache at e0500000 {
+			compatible = "cache";
+			cache-level = <2>;
+			cache-size = <0x40000>;
+			reg = <0x0 0xe0500000 0x0 0x40000>;
+		};
 	};
 
 	memory at 0 {
@@ -46,32 +79,32 @@
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-		compatible = "andestech,riscv-ae350-soc";
+		compatible = "simple-bus";
 		ranges;
 
-	plic0: interrupt-controller at e4000000 {
-		compatible = "riscv,plic0";
-		#address-cells = <1>;
-		#interrupt-cells = <1>;
-		interrupt-controller;
-		reg = <0xe4000000 0x2000000>;
-		riscv,ndev=<71>;
-		interrupts-extended = <&CPU0_intc 11 &CPU0_intc 9>;
-	};
+		plic0: interrupt-controller at e4000000 {
+			compatible = "riscv,plic0";
+			#address-cells = <1>;
+			#interrupt-cells = <1>;
+			interrupt-controller;
+			reg = <0xe4000000 0x2000000>;
+			riscv,ndev=<71>;
+			interrupts-extended = <&CPU0_intc 11 &CPU0_intc 9 &CPU1_intc 11 &CPU1_intc 9>;
+		};
 
-	plic1: interrupt-controller at e6400000 {
-		compatible = "riscv,plic1";
-		#address-cells = <1>;
-		#interrupt-cells = <1>;
-		interrupt-controller;
-		reg = <0xe6400000 0x400000>;
-		riscv,ndev=<1>;
-		interrupts-extended = <&CPU0_intc 3>;
-	};
+		plic1: interrupt-controller at e6400000 {
+			compatible = "riscv,plic1";
+			#address-cells = <1>;
+			#interrupt-cells = <1>;
+			interrupt-controller;
+			reg = <0xe6400000 0x400000>;
+			riscv,ndev=<2>;
+			interrupts-extended = <&CPU0_intc 3 &CPU1_intc 3>;
+		};
 
-	plmt0 at e6000000 {
-		compatible = "riscv,plmt0";
-			interrupts-extended = <&CPU0_intc 7>;
+		plmt0 at e6000000 {
+			compatible = "riscv,plmt0";
+			interrupts-extended = <&CPU0_intc 7 &CPU1_intc 7>;
 			reg = <0xe6000000 0x100000>;
 		};
 	};
@@ -146,6 +179,10 @@
 		interrupt-parent = <&plic0>;
 	};
 
+	pmu {
+		compatible = "riscv,base-pmu";
+	};
+
 	virtio_mmio at fe007000 {
 		interrupts = <0x17 0x4>;
 		interrupt-parent = <0x2>;
arch/riscv/dts/ae350_64.dts +59 -22

113 lines not on this page · raw message

Signature · 1 line
2.7.4
#19 lore raw

PATCH v3 6/7 riscv: dts: ae350 support SMP

Quoted 5 lines · Andes

From: Rick Chen <[email protected]>

Cc Greentime Hu <[email protected]>
Quoted 9 lines

---
V3:
- Fix some mis-alignments.
- Recovery isa string of CPU1.

 arch/riscv/dts/ae350_32.dts | 81 +++++++++++++++++++++++++++++++++------------
 arch/riscv/dts/ae350_64.dts | 81 +++++++++++++++++++++++++++++++++------------
 2 files changed, 118 insertions(+), 44 deletions(-)
#20 lore raw

PATCH v3 6/7 riscv: dts: ae350 support SMP

In reply to Andes
Quoted 4 lines · Andes

From: Rick Chen <[email protected]>

Cc Greentime Hu <[email protected]>
Quoted 9 lines

---
V3:
- Fix some mis-alignments.
- Recovery isa string of CPU1.

 arch/riscv/dts/ae350_32.dts | 81 +++++++++++++++++++++++++++++++++------------
 arch/riscv/dts/ae350_64.dts | 81 +++++++++++++++++++++++++++++++++------------
 2 files changed, 118 insertions(+), 44 deletions(-)
author
#21 lore raw

PATCH v3 7/7 riscv: ae350: enable SMP

In reply to Andes

From: Rick Chen <[email protected]>

---
 board/AndesTech/ax25-ae350/Kconfig | 1 +
 1 file changed, 1 insertion(+)
board/AndesTech/ax25-ae350/Kconfig +1 -0
index 44cb302..5e682b6 100644
@@ -24,5 +24,6 @@ config ENV_OFFSET
 config BOARD_SPECIFIC_OPTIONS # dummy
 	def_bool y
 	select RISCV_NDS
+	imply SMP
 
 endif
Signature · 1 line
2.7.4
#23 lore raw

v3 cover AE350 SMP support RISC-V

In reply to Andes

Hi Rick,

Quoted 20 lines · Andes

From: Rick Chen <[email protected]>

Changes in v3:
Patch 1
- Rename plic_init() as enable_ipi()
- Remove PLIC_BASE_GET() from enable_ipi()
Patch 2
- Add a space before (PLMT)
Patch 6
- Fix some mis-alignments
- Recovery isa string of CPU1

Changes in v2:
- Drop patch1 and replace by simple-bus driver
- Rename nds_plic as andes_plic
- Move initialize plic to PLIC_BASE_GET() and called automatically
- Rename nds_plmt as andes_plmt
- Recovery dts isa string

Quoted 9 lines

Rick Chen (7):
riscv: Add a SYSCON driver for Andestech's PLIC
riscv: Add a SYSCON driver for Andestech's PLMT
riscv: ae350: disable ATCPIT100 timer
riscv: ax25: Add platform-specific Kconfig options
riscv: ax25: Andes specific cache shall only support in M-mode
riscv: dts: ae350 support SMP
riscv: ae350: enable SMP

Looks good to me. Are you going to send PR to Tom to include SMP series in v2019.04?

Regards,
Bin

#24 lore raw

v3 cover AE350 SMP support RISC-V

Hi Bin

Bin Meng <[email protected]> 於 2019年4月1日 週一 下午5:01寫道:

Quoted 34 lines

Hi Rick,

Quoted 20 lines · Andes

From: Rick Chen <[email protected]>

Changes in v3:
Patch 1
- Rename plic_init() as enable_ipi()
- Remove PLIC_BASE_GET() from enable_ipi()
Patch 2
- Add a space before (PLMT)
Patch 6
- Fix some mis-alignments
- Recovery isa string of CPU1

Changes in v2:
- Drop patch1 and replace by simple-bus driver
- Rename nds_plic as andes_plic
- Move initialize plic to PLIC_BASE_GET() and called automatically
- Rename nds_plmt as andes_plmt
- Recovery dts isa string

Quoted 9 lines

Rick Chen (7):
riscv: Add a SYSCON driver for Andestech's PLIC
riscv: Add a SYSCON driver for Andestech's PLMT
riscv: ae350: disable ATCPIT100 timer
riscv: ax25: Add platform-specific Kconfig options
riscv: ax25: Andes specific cache shall only support in M-mode
riscv: dts: ae350 support SMP
riscv: ae350: enable SMP

Quoted 3 lines

Looks good to me. Are you going to send PR to Tom to include SMP series in v2019.04?

Thanks for your review.
But there seem have some suggestions from Lukas to be fixed. After that I will send PR to Tom ASAP.

Thanks
Rick

Quoted 2 lines

Regards,
Bin

#25 lore raw

v3 cover AE350 SMP support RISC-V

Hi Bin and Lukas

Rick Chen <[email protected]> 於 2019年4月2日 週二 上午9:22寫道:

Quoted 38 lines

Hi Bin

Bin Meng <[email protected]> 於 2019年4月1日 週一 下午5:01寫道:

Quoted 34 lines

Hi Rick,

Quoted 29 lines · Andes

From: Rick Chen <[email protected]>

Changes in v3:
Patch 1
- Rename plic_init() as enable_ipi()
- Remove PLIC_BASE_GET() from enable_ipi()
Patch 2
- Add a space before (PLMT)
Patch 6
- Fix some mis-alignments
- Recovery isa string of CPU1

Changes in v2:
- Drop patch1 and replace by simple-bus driver
- Rename nds_plic as andes_plic
- Move initialize plic to PLIC_BASE_GET() and called automatically
- Rename nds_plmt as andes_plmt
- Recovery dts isa string

Rick Chen (7):
riscv: Add a SYSCON driver for Andestech's PLIC
riscv: Add a SYSCON driver for Andestech's PLMT
riscv: ae350: disable ATCPIT100 timer
riscv: ax25: Add platform-specific Kconfig options
riscv: ax25: Andes specific cache shall only support in M-mode
riscv: dts: ae350 support SMP
riscv: ae350: enable SMP

Quoted 8 lines
Quoted 3 lines

Looks good to me. Are you going to send PR to Tom to include SMP series in v2019.04?

Thanks for your review.
But there seem have some suggestions from Lukas to be fixed. After that I will send PR to Tom ASAP.

I have send V4 and Lukas have reviewed it.
When I try to sync to master, I found that there seem have CONFIG_DEFAULT_DEVICE_TREE failures issue in u-boot.git master. Troy have reported it actually. But u-boot-riscv.git is fine. So I am not sure if I shall sync to master now.
Or I shall wait until it has been fixed.

Rick

Quoted 4 lines

Thanks
Rick

Quoted 2 lines

Regards,
Bin

#26 lore raw

v3 cover AE350 SMP support RISC-V

Hi Rick,

Quoted 51 lines · Rick Chen

Hi Bin and Lukas

Rick Chen <[email protected]> 於 2019年4月2日 週二 上午9:22寫道:

Quoted 38 lines

Hi Bin

Bin Meng <[email protected]> 於 2019年4月1日 週一 下午5:01寫道:

Quoted 34 lines

Hi Rick,

Quoted 29 lines · Andes

From: Rick Chen <[email protected]>

Changes in v3:
Patch 1
- Rename plic_init() as enable_ipi()
- Remove PLIC_BASE_GET() from enable_ipi()
Patch 2
- Add a space before (PLMT)
Patch 6
- Fix some mis-alignments
- Recovery isa string of CPU1

Changes in v2:
- Drop patch1 and replace by simple-bus driver
- Rename nds_plic as andes_plic
- Move initialize plic to PLIC_BASE_GET() and called automatically
- Rename nds_plmt as andes_plmt
- Recovery dts isa string

Rick Chen (7):
riscv: Add a SYSCON driver for Andestech's PLIC
riscv: Add a SYSCON driver for Andestech's PLMT
riscv: ae350: disable ATCPIT100 timer
riscv: ax25: Add platform-specific Kconfig options
riscv: ax25: Andes specific cache shall only support in M-mode
riscv: dts: ae350 support SMP
riscv: ae350: enable SMP

Quoted 8 lines
Quoted 3 lines

Looks good to me. Are you going to send PR to Tom to include SMP series in v2019.04?

Thanks for your review.
But there seem have some suggestions from Lukas to be fixed. After that I will send PR to Tom ASAP.

Quoted 7 lines

I have send V4 and Lukas have reviewed it.
When I try to sync to master, I found that there seem have CONFIG_DEFAULT_DEVICE_TREE failures issue in u-boot.git master. Troy have reported it actually. But u-boot-riscv.git is fine. So I am not sure if I shall sync to master now.
Or I shall wait until it has been fixed.

The CONFIG_DEFAULT_DEVICE_TREE fix was reviewed by Lukas and me. I suppose it's good to send PR now?

Regards,
Bin

#27 lore raw

v3 cover AE350 SMP support RISC-V

Hi Bin

Bin Meng <[email protected]> 於 2019年4月4日 週四 下午9:49寫道:

Quoted 63 lines

Hi Rick,

Quoted 51 lines · Rick Chen

Hi Bin and Lukas

Rick Chen <[email protected]> 於 2019年4月2日 週二 上午9:22寫道:

Quoted 38 lines

Hi Bin

Bin Meng <[email protected]> 於 2019年4月1日 週一 下午5:01寫道:

Quoted 34 lines

Hi Rick,

Quoted 29 lines · Andes

From: Rick Chen <[email protected]>

Changes in v3:
Patch 1
- Rename plic_init() as enable_ipi()
- Remove PLIC_BASE_GET() from enable_ipi()
Patch 2
- Add a space before (PLMT)
Patch 6
- Fix some mis-alignments
- Recovery isa string of CPU1

Changes in v2:
- Drop patch1 and replace by simple-bus driver
- Rename nds_plic as andes_plic
- Move initialize plic to PLIC_BASE_GET() and called automatically
- Rename nds_plmt as andes_plmt
- Recovery dts isa string

Rick Chen (7):
riscv: Add a SYSCON driver for Andestech's PLIC
riscv: Add a SYSCON driver for Andestech's PLMT
riscv: ae350: disable ATCPIT100 timer
riscv: ax25: Add platform-specific Kconfig options
riscv: ax25: Andes specific cache shall only support in M-mode
riscv: dts: ae350 support SMP
riscv: ae350: enable SMP

Quoted 8 lines
Quoted 3 lines

Looks good to me. Are you going to send PR to Tom to include SMP series in v2019.04?

Thanks for your review.
But there seem have some suggestions from Lukas to be fixed. After that I will send PR to Tom ASAP.

Quoted 7 lines

I have send V4 and Lukas have reviewed it.
When I try to sync to master, I found that there seem have CONFIG_DEFAULT_DEVICE_TREE failures issue in u-boot.git master. Troy have reported it actually. But u-boot-riscv.git is fine. So I am not sure if I shall sync to master now.
Or I shall wait until it has been fixed.

Quoted 3 lines

The CONFIG_DEFAULT_DEVICE_TREE fix was reviewed by Lukas and me. I suppose it's good to send PR now?

Yes
I was on Ching-Ming festival last week.
After re-sync to master and travis verification.
I will send a PR right away.

Thanks
Rick

Quoted 2 lines

Regards,
Bin