2023-09-20 07:48:37

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 00/11] Add Milk-V Pioneer RISC-V board support

Milk-V Pioneer [1] is a developer motherboard based on SOPHON SG2042 [2]
in a standard mATX form factor. Add minimal device
tree files for the SG2042 SOC and the Milk-V Pioneer board.

Now only support basic uart drivers to boot up into a basic console.

Thanks,
Chen

---

Changes in v2:
The patch series is based on v6.6-rc1. You can simply review or test
the patches at the link [4].
- Improve format for comment of commitments as per input from last review.
- Improve format of DTS as per input from last review.
- Remove numa related stuff from DTS. This part is just for optimization, may
add it later if really needed.

Previous versions:
v1: due to it is not sent in thread, I have listed permlinks of the patchset
[v1-0/12] ~ [v1-12/12] here for quick reference. You can simply review or
test the patches at the link [3].

[1]: https://milkv.io/pioneer
[2]: https://en.sophgo.com/product/introduce/sg2042.html
[3]: https://github.com/unicornx/linux-riscv/commits/milkv-pioneer-minimal
[4]: https://github.com/unicornx/linux-riscv/commits/milkv-pioneer-minimal-v2
[v1-0/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-1/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-2/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-3/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-4/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-5/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-6/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-7/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-8/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-9/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-10/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-11/12]:https://lore.kernel.org/linux-riscv/[email protected]/
[v1-12/12]:https://lore.kernel.org/linux-riscv/[email protected]/

---

Chen Wang (8):
riscv: Add SOPHGO SOC family Kconfig support
dt-bindings: vendor-prefixes: add milkv/sophgo
dt-bindings: riscv: add sophgo sg2042 bindings
dt-bindings: riscv: Add T-HEAD C920 compatibles
dt-bindings: interrupt-controller: Add SOPHGO's SG2042 PLIC
riscv: dts: add initial SOPHGO SG2042 SoC device tree
riscv: dts: sophgo: add Milk-V Pioneer board device tree
riscv: defconfig: enable SOPHGO SoC

Emil Renner Berthing (2):
dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2042 uarts
serial: 8250_dw: Add Sophgo SG2042 support

Inochi Amaoto (1):
dt-bindings: timer: Add Sophgo sg2042 clint

.../sifive,plic-1.0.0.yaml | 1 +
.../devicetree/bindings/riscv/cpus.yaml | 1 +
.../devicetree/bindings/riscv/sophgo.yaml | 28 +
.../bindings/serial/snps-dw-apb-uart.yaml | 1 +
.../bindings/timer/sifive,clint.yaml | 8 +
.../devicetree/bindings/vendor-prefixes.yaml | 4 +
MAINTAINERS | 7 +
arch/riscv/Kconfig.socs | 5 +
arch/riscv/boot/dts/Makefile | 1 +
arch/riscv/boot/dts/sophgo/Makefile | 3 +
arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 1744 +++++++++++++++++
.../boot/dts/sophgo/sg2042-milkv-pioneer.dts | 19 +
arch/riscv/boot/dts/sophgo/sg2042.dtsi | 439 +++++
arch/riscv/configs/defconfig | 1 +
drivers/tty/serial/8250/8250_dw.c | 5 +-
15 files changed, 2265 insertions(+), 2 deletions(-)
create mode 100644 Documentation/devicetree/bindings/riscv/sophgo.yaml
create mode 100644 arch/riscv/boot/dts/sophgo/Makefile
create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
create mode 100644 arch/riscv/boot/dts/sophgo/sg2042.dtsi


base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d
--
2.25.1


2023-09-20 07:56:31

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

From: Inochi Amaoto <[email protected]>

Add two new compatible string formatted like `C9xx-clint-xxx` to identify
the timer and ipi device separately, and do not allow c900-clint as the
fallback to avoid conflict.

Signed-off-by: Inochi Amaoto <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
Documentation/devicetree/bindings/timer/sifive,clint.yaml | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/timer/sifive,clint.yaml b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
index a0185e15a42f..ae69696c5c75 100644
--- a/Documentation/devicetree/bindings/timer/sifive,clint.yaml
+++ b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
@@ -39,6 +39,14 @@ properties:
- allwinner,sun20i-d1-clint
- thead,th1520-clint
- const: thead,c900-clint
+ - items:
+ - enum:
+ - sophgo,sg2042-clint-mtimer
+ - const: thead,c900-clint-mtimer
+ - items:
+ - enum:
+ - sophgo,sg2042-clint-mswi
+ - const: thead,c900-clint-mswi
- items:
- const: sifive,clint0
- const: riscv,clint0
--
2.25.1

2023-09-20 08:11:40

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 04/11] dt-bindings: riscv: Add T-HEAD C920 compatibles

The C920 is RISC-V CPU cores from T-HEAD Semiconductor.
Notably, the C920 core is used in the SOPHGO SG2042 SoC.

Acked-by: Xiaoguang Xing <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
Documentation/devicetree/bindings/riscv/cpus.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
index 38c0b5213736..185a0191bad6 100644
--- a/Documentation/devicetree/bindings/riscv/cpus.yaml
+++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
@@ -47,6 +47,7 @@ properties:
- sifive,u74-mc
- thead,c906
- thead,c910
+ - thead,c920
- const: riscv
- items:
- enum:
--
2.25.1

2023-09-20 08:28:27

by Guo Ren

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Wed, Sep 20, 2023 at 2:39 PM Chen Wang <[email protected]> wrote:
>
> From: Inochi Amaoto <[email protected]>
>
> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> the timer and ipi device separately, and do not allow c900-clint as the
> fallback to avoid conflict.
Please explain more about the c900-clint mtimer & mswi, why do we need
to separate the c900-clint into two pieces? When could we use
c900-clint which eases dts design?

>
> Signed-off-by: Inochi Amaoto <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>
> ---
> Documentation/devicetree/bindings/timer/sifive,clint.yaml | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/timer/sifive,clint.yaml b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
> index a0185e15a42f..ae69696c5c75 100644
> --- a/Documentation/devicetree/bindings/timer/sifive,clint.yaml
> +++ b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
> @@ -39,6 +39,14 @@ properties:
> - allwinner,sun20i-d1-clint
> - thead,th1520-clint
> - const: thead,c900-clint
> + - items:
> + - enum:
> + - sophgo,sg2042-clint-mtimer
> + - const: thead,c900-clint-mtimer
> + - items:
> + - enum:
> + - sophgo,sg2042-clint-mswi
> + - const: thead,c900-clint-mswi
> - items:
> - const: sifive,clint0
> - const: riscv,clint0
> --
> 2.25.1
>


--
Best Regards
Guo Ren

2023-09-20 08:28:56

by Guo Ren

[permalink] [raw]
Subject: Re: [PATCH v2 04/11] dt-bindings: riscv: Add T-HEAD C920 compatibles

On Wed, Sep 20, 2023 at 2:38 PM Chen Wang <[email protected]> wrote:
>
> The C920 is RISC-V CPU cores from T-HEAD Semiconductor.
> Notably, the C920 core is used in the SOPHGO SG2042 SoC.
>
> Acked-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>
> ---
> Documentation/devicetree/bindings/riscv/cpus.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
> index 38c0b5213736..185a0191bad6 100644
> --- a/Documentation/devicetree/bindings/riscv/cpus.yaml
> +++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
> @@ -47,6 +47,7 @@ properties:
> - sifive,u74-mc
> - thead,c906
> - thead,c910
> + - thead,c920
Reviewed-by: Guo Ren <[email protected]>

> - const: riscv
> - items:
> - enum:
> --
> 2.25.1
>


--
Best Regards
Guo Ren

2023-09-20 09:32:41

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 02/11] dt-bindings: vendor-prefixes: add milkv/sophgo

Add new vendor strings to dt bindings.
These new vendor strings are used by
- Sophgo SG2042 SoC [1]
- Milk-V Pioneer board [2], which uses SG2042 chip.

[1]: https://en.sophgo.com/product/introduce/sg2042.html
[2]: https://milkv.io/pioneer

Acked-by: Xiaoguang Xing <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
Documentation/devicetree/bindings/vendor-prefixes.yaml | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 573578db9509..fcca9e070a9a 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -863,6 +863,8 @@ patternProperties:
description: MikroElektronika d.o.o.
"^mikrotik,.*":
description: MikroTik
+ "^milkv,.*":
+ description: MilkV Technology Co., Ltd
"^miniand,.*":
description: Miniand Tech
"^minix,.*":
@@ -1273,6 +1275,8 @@ patternProperties:
description: Solomon Systech Limited
"^sony,.*":
description: Sony Corporation
+ "^sophgo,.*":
+ description: Sophgo Technology Inc.
"^sourceparts,.*":
description: Source Parts Inc.
"^spansion,.*":
--
2.25.1

2023-09-20 11:35:18

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>
>Yo,
>
>On Wed, Sep 20, 2023 at 05:08:41PM +0800, Inochi Amaoto wrote:
>>> On Wed, Sep 20, 2023 at 02:39:39PM +0800, Chen Wang wrote:
>>>> From: Inochi Amaoto <[email protected]>
>>>>
>>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>>>> the timer and ipi device separately, and do not allow c900-clint as the
>>>> fallback to avoid conflict.
>>>>
>>>> Signed-off-by: Inochi Amaoto <[email protected]>
>>>> Signed-off-by: Chen Wang <[email protected]>
>>>
>>> Have you ignored Krzysztof's comments on this? I don't see a response or
>>> a reaction to his comments about the compatibles on the last version.
>>> Additionally, where is the user for these? I don't see any drivers that
>>> actually make use of these.
>>>
>>
>> Sorry for late reply and wrong message-id.
>>
>> The clint is parsed by sbi.
>
>That needs to go in the commit message.

Yes, it will.

>
>> As use the same compatible, the opensbi will
>> parse the device twice. This will cause a fault.
>
>Then only have one compatible with 2 register ranges? Then your SBI
>implementation can use those two register ranges to find out the base
>address for the mtimer bits and for the mswi bits.
>I don't understand why this cannot be done, could you please explain.

That is a good idea, but now SBI use the second register ranges as
mtimecmp address for aclint. And there is a aclint-mswi in the SBI.
Maybe a change is needed?

>I also don't see anything in the opensbi repo right now that is using
>these (nor could I easily see any patches for opensbi adding this).
>Is there another SBI implementation that you are using that I can take
>a look at to try and understand this better?
>

This will be sumbit in a short time.
Now we only use it is sophgo vendor SBI, which url is [1].

[1] https://github.com/sophgo/opensbi

>>> Why do you need to have 2 compatibles (and therefore 2 devices) for the
>>> clint? I thought the clint was a single device, of which the mtimer and
>>> mswi bits were just "features"? Having split register ranges isn't a
>>> reason to have two compatibles, so I must be missing something here...
>
>> Sorry for late reply, The clint consists of mtimer and ipi devices, which
>> is defined in [1].
>
>Yes, I have looked at the spec. I went to check it again before replying
>here in case there was something immediately obvious that I was missing.
>

I think nothing missed.

>> This standard shows clint(or the aclint) has two device,
>
>The wording used here doesn't really matter. It's one interrupt
>controller that does mtimer and mswi.
>
>> but not one. In another word, there is no need to defined mtimer and ipi
>> device on the same base address.
>
>There's also no need to have two compatibles for the same interrupt
>controller, so I do not get this reasoning. What actually _requires_
>them to be split?
>

Yes, it is one, but can be mapped into different address. So I think we
need two.

>> So we need two compatibles to allow sbi to identify them correctly.
>
>Why is it not sufficient to identify the individual memory regions?
>

FYI, Anup. As I have no idea for aclint implementation.

>Thanks,
>Conor.
>

2023-09-20 12:29:13

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>On 20/09/2023 08:39, Chen Wang wrote:
>> From: Inochi Amaoto <[email protected]>
>>
>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>> the timer and ipi device separately, and do not allow c900-clint as the
>
>Why?
>

If use the same compatible, SBI will process this twice in both ipi and
timer, use different compatible will allow SBI to treat these as different.
AFAIK, the aclint in SBI use the same concepts, which make hard to use the
second register range. I have explained in another response.

https://lore.kernel.org/all/IA1PR20MB495313B7E9B2FC529BE0BB2ABBF9A@IA1PR20MB4953.namprd20.prod.outlook.com/

>You received comment about it, so please provide proper explanation in
>the commit msg.
>
>Same device does not get two different compatibles.
>
>You also did not respond to my comments, so you basically ignored it and
>send the same.
>
>NAK
>
>Best regards,
>Krzysztof
>

Sorry for this, as I mistake the idea of the last message. All of this
will be fixed in the next patch.

2023-09-20 13:05:54

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 09/11] riscv: dts: add initial SOPHGO SG2042 SoC device tree

Milk-V Pioneer motherboard is powered by SOPHON's SG2042.

SG2042 is server grade chip with high performance, low power
consumption and high data throughput.
Key features:
- 64 RISC-V cpu cores which implements IMAFDC
- 4 cores per cluster, 16 clusters on chip
- ......

More info is available at [1].

[1]: https://en.sophgo.com/product/introduce/sg2042.html

Currently only support booting into console with only uart,
other features will be added soon later.

Acked-by: Xiaoguang Xing <[email protected]>
Signed-off-by: Xiaoguang Xing <[email protected]>
Signed-off-by: Inochi Amaoto <[email protected]>
Signed-off-by: Emil Renner Berthing <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 1744 +++++++++++++++++++
arch/riscv/boot/dts/sophgo/sg2042.dtsi | 439 +++++
2 files changed, 2183 insertions(+)
create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
create mode 100644 arch/riscv/boot/dts/sophgo/sg2042.dtsi

diff --git a/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi b/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
new file mode 100644
index 000000000000..9fc79b1cf3bf
--- /dev/null
+++ b/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
@@ -0,0 +1,1744 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Copyright (C) 2022 Sophgo Technology Inc. All rights reserved.
+ */
+
+/ {
+ cpus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ timebase-frequency = <50000000>;
+
+ cpu-map {
+ socket0 {
+ cluster0 {
+ core0 {
+ cpu = <&cpu0>;
+ };
+ core1 {
+ cpu = <&cpu1>;
+ };
+ core2 {
+ cpu = <&cpu2>;
+ };
+ core3 {
+ cpu = <&cpu3>;
+ };
+ };
+
+ cluster1 {
+ core0 {
+ cpu = <&cpu4>;
+ };
+ core1 {
+ cpu = <&cpu5>;
+ };
+ core2 {
+ cpu = <&cpu6>;
+ };
+ core3 {
+ cpu = <&cpu7>;
+ };
+ };
+
+ cluster2 {
+ core0 {
+ cpu = <&cpu16>;
+ };
+ core1 {
+ cpu = <&cpu17>;
+ };
+ core2 {
+ cpu = <&cpu18>;
+ };
+ core3 {
+ cpu = <&cpu19>;
+ };
+ };
+
+ cluster3 {
+ core0 {
+ cpu = <&cpu20>;
+ };
+ core1 {
+ cpu = <&cpu21>;
+ };
+ core2 {
+ cpu = <&cpu22>;
+ };
+ core3 {
+ cpu = <&cpu23>;
+ };
+ };
+
+ cluster4 {
+ core0 {
+ cpu = <&cpu8>;
+ };
+ core1 {
+ cpu = <&cpu9>;
+ };
+ core2 {
+ cpu = <&cpu10>;
+ };
+ core3 {
+ cpu = <&cpu11>;
+ };
+ };
+
+ cluster5 {
+ core0 {
+ cpu = <&cpu12>;
+ };
+ core1 {
+ cpu = <&cpu13>;
+ };
+ core2 {
+ cpu = <&cpu14>;
+ };
+ core3 {
+ cpu = <&cpu15>;
+ };
+ };
+
+ cluster6 {
+ core0 {
+ cpu = <&cpu24>;
+ };
+ core1 {
+ cpu = <&cpu25>;
+ };
+ core2 {
+ cpu = <&cpu26>;
+ };
+ core3 {
+ cpu = <&cpu27>;
+ };
+ };
+
+ cluster7 {
+ core0 {
+ cpu = <&cpu28>;
+ };
+ core1 {
+ cpu = <&cpu29>;
+ };
+ core2 {
+ cpu = <&cpu30>;
+ };
+ core3 {
+ cpu = <&cpu31>;
+ };
+ };
+
+ cluster8 {
+ core0 {
+ cpu = <&cpu32>;
+ };
+ core1 {
+ cpu = <&cpu33>;
+ };
+ core2 {
+ cpu = <&cpu34>;
+ };
+ core3 {
+ cpu = <&cpu35>;
+ };
+ };
+
+ cluster9 {
+ core0 {
+ cpu = <&cpu36>;
+ };
+ core1 {
+ cpu = <&cpu37>;
+ };
+ core2 {
+ cpu = <&cpu38>;
+ };
+ core3 {
+ cpu = <&cpu39>;
+ };
+ };
+
+ cluster10 {
+ core0 {
+ cpu = <&cpu48>;
+ };
+ core1 {
+ cpu = <&cpu49>;
+ };
+ core2 {
+ cpu = <&cpu50>;
+ };
+ core3 {
+ cpu = <&cpu51>;
+ };
+ };
+
+ cluster11 {
+ core0 {
+ cpu = <&cpu52>;
+ };
+ core1 {
+ cpu = <&cpu53>;
+ };
+ core2 {
+ cpu = <&cpu54>;
+ };
+ core3 {
+ cpu = <&cpu55>;
+ };
+ };
+
+ cluster12 {
+ core0 {
+ cpu = <&cpu40>;
+ };
+ core1 {
+ cpu = <&cpu41>;
+ };
+ core2 {
+ cpu = <&cpu42>;
+ };
+ core3 {
+ cpu = <&cpu43>;
+ };
+ };
+
+ cluster13 {
+ core0 {
+ cpu = <&cpu44>;
+ };
+ core1 {
+ cpu = <&cpu45>;
+ };
+ core2 {
+ cpu = <&cpu46>;
+ };
+ core3 {
+ cpu = <&cpu47>;
+ };
+ };
+
+ cluster14 {
+ core0 {
+ cpu = <&cpu56>;
+ };
+ core1 {
+ cpu = <&cpu57>;
+ };
+ core2 {
+ cpu = <&cpu58>;
+ };
+ core3 {
+ cpu = <&cpu59>;
+ };
+ };
+
+ cluster15 {
+ core0 {
+ cpu = <&cpu60>;
+ };
+ core1 {
+ cpu = <&cpu61>;
+ };
+ core2 {
+ cpu = <&cpu62>;
+ };
+ core3 {
+ cpu = <&cpu63>;
+ };
+ };
+ };
+ };
+
+ cpu0: cpu@0 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <0>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache0>;
+ mmu-type = "riscv,sv39";
+
+ cpu0_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu1: cpu@1 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <1>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache0>;
+ mmu-type = "riscv,sv39";
+
+ cpu1_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu2: cpu@2 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <2>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache0>;
+ mmu-type = "riscv,sv39";
+
+ cpu2_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu3: cpu@3 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <3>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache0>;
+ mmu-type = "riscv,sv39";
+
+ cpu3_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu4: cpu@4 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <4>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache1>;
+ mmu-type = "riscv,sv39";
+
+ cpu4_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu5: cpu@5 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <5>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache1>;
+ mmu-type = "riscv,sv39";
+
+ cpu5_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu6: cpu@6 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <6>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache1>;
+ mmu-type = "riscv,sv39";
+
+ cpu6_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu7: cpu@7 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <7>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache1>;
+ mmu-type = "riscv,sv39";
+
+ cpu7_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu8: cpu@8 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <8>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache4>;
+ mmu-type = "riscv,sv39";
+
+ cpu8_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu9: cpu@9 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <9>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache4>;
+ mmu-type = "riscv,sv39";
+
+ cpu9_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu10: cpu@10 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <10>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache4>;
+ mmu-type = "riscv,sv39";
+
+ cpu10_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu11: cpu@11 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <11>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache4>;
+ mmu-type = "riscv,sv39";
+
+ cpu11_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu12: cpu@12 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <12>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache5>;
+ mmu-type = "riscv,sv39";
+
+ cpu12_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu13: cpu@13 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <13>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache5>;
+ mmu-type = "riscv,sv39";
+
+ cpu13_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu14: cpu@14 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <14>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache5>;
+ mmu-type = "riscv,sv39";
+
+ cpu14_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu15: cpu@15 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <15>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache5>;
+ mmu-type = "riscv,sv39";
+
+ cpu15_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu16: cpu@16 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <16>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache2>;
+ mmu-type = "riscv,sv39";
+
+ cpu16_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu17: cpu@17 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <17>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache2>;
+ mmu-type = "riscv,sv39";
+
+ cpu17_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu18: cpu@18 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <18>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache2>;
+ mmu-type = "riscv,sv39";
+
+ cpu18_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu19: cpu@19 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <19>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache2>;
+ mmu-type = "riscv,sv39";
+
+ cpu19_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu20: cpu@20 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <20>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache3>;
+ mmu-type = "riscv,sv39";
+
+ cpu20_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu21: cpu@21 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <21>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache3>;
+ mmu-type = "riscv,sv39";
+
+ cpu21_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu22: cpu@22 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <22>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache3>;
+ mmu-type = "riscv,sv39";
+
+ cpu22_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu23: cpu@23 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <23>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache3>;
+ mmu-type = "riscv,sv39";
+
+ cpu23_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu24: cpu@24 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <24>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache6>;
+ mmu-type = "riscv,sv39";
+
+ cpu24_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu25: cpu@25 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <25>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache6>;
+ mmu-type = "riscv,sv39";
+
+ cpu25_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu26: cpu@26 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <26>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache6>;
+ mmu-type = "riscv,sv39";
+
+ cpu26_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu27: cpu@27 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <27>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache6>;
+ mmu-type = "riscv,sv39";
+
+ cpu27_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu28: cpu@28 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <28>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache7>;
+ mmu-type = "riscv,sv39";
+
+ cpu28_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu29: cpu@29 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <29>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache7>;
+ mmu-type = "riscv,sv39";
+
+ cpu29_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu30: cpu@30 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <30>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache7>;
+ mmu-type = "riscv,sv39";
+
+ cpu30_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu31: cpu@31 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <31>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache7>;
+ mmu-type = "riscv,sv39";
+
+ cpu31_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu32: cpu@32 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <32>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache8>;
+ mmu-type = "riscv,sv39";
+
+ cpu32_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu33: cpu@33 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <33>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache8>;
+ mmu-type = "riscv,sv39";
+
+ cpu33_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu34: cpu@34 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <34>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache8>;
+ mmu-type = "riscv,sv39";
+
+ cpu34_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu35: cpu@35 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <35>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache8>;
+ mmu-type = "riscv,sv39";
+
+ cpu35_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu36: cpu@36 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <36>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache9>;
+ mmu-type = "riscv,sv39";
+
+ cpu36_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu37: cpu@37 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <37>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache9>;
+ mmu-type = "riscv,sv39";
+
+ cpu37_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu38: cpu@38 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <38>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache9>;
+ mmu-type = "riscv,sv39";
+
+ cpu38_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu39: cpu@39 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <39>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache9>;
+ mmu-type = "riscv,sv39";
+
+ cpu39_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu40: cpu@40 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <40>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache12>;
+ mmu-type = "riscv,sv39";
+
+ cpu40_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu41: cpu@41 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <41>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache12>;
+ mmu-type = "riscv,sv39";
+
+ cpu41_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu42: cpu@42 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <42>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache12>;
+ mmu-type = "riscv,sv39";
+
+ cpu42_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu43: cpu@43 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <43>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache12>;
+ mmu-type = "riscv,sv39";
+
+ cpu43_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu44: cpu@44 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <44>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache13>;
+ mmu-type = "riscv,sv39";
+
+ cpu44_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu45: cpu@45 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <45>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache13>;
+ mmu-type = "riscv,sv39";
+
+ cpu45_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu46: cpu@46 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <46>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache13>;
+ mmu-type = "riscv,sv39";
+
+ cpu46_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu47: cpu@47 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <47>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache13>;
+ mmu-type = "riscv,sv39";
+
+ cpu47_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu48: cpu@48 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <48>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache10>;
+ mmu-type = "riscv,sv39";
+
+ cpu48_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu49: cpu@49 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <49>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache10>;
+ mmu-type = "riscv,sv39";
+
+ cpu49_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu50: cpu@50 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <50>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache10>;
+ mmu-type = "riscv,sv39";
+
+ cpu50_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu51: cpu@51 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <51>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache10>;
+ mmu-type = "riscv,sv39";
+
+ cpu51_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu52: cpu@52 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <52>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache11>;
+ mmu-type = "riscv,sv39";
+
+ cpu52_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu53: cpu@53 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <53>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache11>;
+ mmu-type = "riscv,sv39";
+
+ cpu53_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu54: cpu@54 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <54>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache11>;
+ mmu-type = "riscv,sv39";
+
+ cpu54_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu55: cpu@55 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <55>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache11>;
+ mmu-type = "riscv,sv39";
+
+ cpu55_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu56: cpu@56 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <56>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache14>;
+ mmu-type = "riscv,sv39";
+
+ cpu56_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu57: cpu@57 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <57>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache14>;
+ mmu-type = "riscv,sv39";
+
+ cpu57_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu58: cpu@58 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <58>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache14>;
+ mmu-type = "riscv,sv39";
+
+ cpu58_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu59: cpu@59 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <59>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache14>;
+ mmu-type = "riscv,sv39";
+
+ cpu59_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu60: cpu@60 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <60>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache15>;
+ mmu-type = "riscv,sv39";
+
+ cpu60_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu61: cpu@61 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <61>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache15>;
+ mmu-type = "riscv,sv39";
+
+ cpu61_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu62: cpu@62 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <62>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache15>;
+ mmu-type = "riscv,sv39";
+
+ cpu62_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ cpu63: cpu@63 {
+ compatible = "thead,c920", "riscv";
+ device_type = "cpu";
+ riscv,isa = "rv64imafdc";
+ reg = <63>;
+ i-cache-block-size = <64>;
+ i-cache-size = <65536>;
+ i-cache-sets = <512>;
+ d-cache-block-size = <64>;
+ d-cache-size = <65536>;
+ d-cache-sets = <512>;
+ next-level-cache = <&l2_cache15>;
+ mmu-type = "riscv,sv39";
+
+ cpu63_intc: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ };
+ };
+
+ l2_cache0: l2-cache@0 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache1: l2-cache@1 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache2: l2-cache@2 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache3: l2-cache@3 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache4: l2-cache@4 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache5: l2-cache@5 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache6: l2-cache@6 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache7: l2-cache@7 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache8: l2-cache@8 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache9: l2-cache@9 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache10: l2-cache@10 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache11: l2-cache@11 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache12: l2-cache@12 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache13: l2-cache@13 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache14: l2-cache@14 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+
+ l2_cache15: l2-cache@15 {
+ compatible = "cache";
+ cache-block-size = <64>;
+ cache-level = <2>;
+ cache-size = <1048576>;
+ cache-sets = <1024>;
+ cache-unified;
+ };
+ };
+};
diff --git a/arch/riscv/boot/dts/sophgo/sg2042.dtsi b/arch/riscv/boot/dts/sophgo/sg2042.dtsi
new file mode 100644
index 000000000000..747fd9764c95
--- /dev/null
+++ b/arch/riscv/boot/dts/sophgo/sg2042.dtsi
@@ -0,0 +1,439 @@
+// SPDX-License-Identifier: GPL-2.0 OR MIT
+/*
+ * Copyright (C) 2022 Sophgo Technology Inc. All rights reserved.
+ */
+
+/dts-v1/;
+#include <dt-bindings/interrupt-controller/irq.h>
+
+#include "sg2042-cpus.dtsi"
+
+#define SOC_PERIPHERAL_IRQ(nr) (nr)
+
+/ {
+ compatible = "sophgo,sg2042";
+ #address-cells = <2>;
+ #size-cells = <2>;
+ dma-noncoherent;
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ /* the mem node will be updated by ZSBL. */
+ memory@0 {
+ device_type = "memory";
+ reg = <0x00000000 0x00000000 0x00000000 0x00000000>;
+ };
+
+ memory@1 {
+ device_type = "memory";
+ reg = <0x00000000 0x00000001 0x00000000 0x00000000>;
+ };
+
+ memory@2 {
+ device_type = "memory";
+ reg = <0x00000000 0x00000002 0x00000000 0x00000000>;
+ };
+
+ memory@3 {
+ device_type = "memory";
+ reg = <0x00000000 0x00000003 0x00000000 0x00000000>;
+ };
+
+ pmu {
+ compatible = "riscv,pmu";
+ riscv,event-to-mhpmevent =
+ <0x00003 0x00000000 0x00000010>,
+ <0x00004 0x00000000 0x00000011>,
+ <0x00005 0x00000000 0x00000007>,
+ <0x00006 0x00000000 0x00000006>,
+ <0x00008 0x00000000 0x00000027>,
+ <0x00009 0x00000000 0x00000028>,
+ <0x10000 0x00000000 0x0000000c>,
+ <0x10001 0x00000000 0x0000000d>,
+ <0x10002 0x00000000 0x0000000e>,
+ <0x10003 0x00000000 0x0000000f>,
+ <0x10008 0x00000000 0x00000001>,
+ <0x10009 0x00000000 0x00000002>,
+ <0x10010 0x00000000 0x00000010>,
+ <0x10011 0x00000000 0x00000011>,
+ <0x10012 0x00000000 0x00000012>,
+ <0x10013 0x00000000 0x00000013>,
+ <0x10019 0x00000000 0x00000004>,
+ <0x10021 0x00000000 0x00000003>,
+ <0x10030 0x00000000 0x0000001c>,
+ <0x10031 0x00000000 0x0000001b>;
+ riscv,event-to-mhpmcounters =
+ <0x00003 0x00003 0xfffffff8>,
+ <0x00004 0x00004 0xfffffff8>,
+ <0x00005 0x00005 0xfffffff8>,
+ <0x00006 0x00006 0xfffffff8>,
+ <0x00007 0x00007 0xfffffff8>,
+ <0x00008 0x00008 0xfffffff8>,
+ <0x00009 0x00009 0xfffffff8>,
+ <0x0000a 0x0000a 0xfffffff8>,
+ <0x10000 0x10000 0xfffffff8>,
+ <0x10001 0x10001 0xfffffff8>,
+ <0x10002 0x10002 0xfffffff8>,
+ <0x10003 0x10003 0xfffffff8>,
+ <0x10008 0x10008 0xfffffff8>,
+ <0x10009 0x10009 0xfffffff8>,
+ <0x10010 0x10010 0xfffffff8>,
+ <0x10011 0x10011 0xfffffff8>,
+ <0x10012 0x10012 0xfffffff8>,
+ <0x10013 0x10013 0xfffffff8>,
+ <0x10019 0x10019 0xfffffff8>,
+ <0x10021 0x10021 0xfffffff8>,
+ <0x10030 0x10030 0xfffffff8>,
+ <0x10031 0x10031 0xfffffff8>;
+ riscv,raw-event-to-mhpmcounters =
+ <0x00000000 0x00000001 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000002 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000003 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000004 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000005 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000006 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000007 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000008 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000009 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000000a 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000000b 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000000c 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000000d 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000000e 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000000f 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000010 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000011 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000012 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000013 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000014 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000015 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000016 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000017 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000018 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000019 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000001a 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000001b 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000001c 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000001d 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000001e 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000001f 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000020 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000021 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000022 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000023 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000024 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000025 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000026 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000027 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000028 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x00000029 0xffffffff 0xffffffff 0xfffffff8>,
+ <0x00000000 0x0000002a 0xffffffff 0xffffffff 0xfffffff8>;
+ };
+
+ soc: soc {
+ compatible = "simple-bus";
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ clint_mswi: interrupt-controller@7094000000 {
+ compatible = "sophgo,sg2042-clint-mswi", "thead,c900-clint-mswi";
+ reg = <0x00000070 0x94000000 0x00000000 0x00004000>;
+ interrupts-extended = <&cpu0_intc 3>,
+ <&cpu1_intc 3>,
+ <&cpu2_intc 3>,
+ <&cpu3_intc 3>,
+ <&cpu4_intc 3>,
+ <&cpu5_intc 3>,
+ <&cpu6_intc 3>,
+ <&cpu7_intc 3>,
+ <&cpu8_intc 3>,
+ <&cpu9_intc 3>,
+ <&cpu10_intc 3>,
+ <&cpu11_intc 3>,
+ <&cpu12_intc 3>,
+ <&cpu13_intc 3>,
+ <&cpu14_intc 3>,
+ <&cpu15_intc 3>,
+ <&cpu16_intc 3>,
+ <&cpu17_intc 3>,
+ <&cpu18_intc 3>,
+ <&cpu19_intc 3>,
+ <&cpu20_intc 3>,
+ <&cpu21_intc 3>,
+ <&cpu22_intc 3>,
+ <&cpu23_intc 3>,
+ <&cpu24_intc 3>,
+ <&cpu25_intc 3>,
+ <&cpu26_intc 3>,
+ <&cpu27_intc 3>,
+ <&cpu28_intc 3>,
+ <&cpu29_intc 3>,
+ <&cpu30_intc 3>,
+ <&cpu31_intc 3>,
+ <&cpu32_intc 3>,
+ <&cpu33_intc 3>,
+ <&cpu34_intc 3>,
+ <&cpu35_intc 3>,
+ <&cpu36_intc 3>,
+ <&cpu37_intc 3>,
+ <&cpu38_intc 3>,
+ <&cpu39_intc 3>,
+ <&cpu40_intc 3>,
+ <&cpu41_intc 3>,
+ <&cpu42_intc 3>,
+ <&cpu43_intc 3>,
+ <&cpu44_intc 3>,
+ <&cpu45_intc 3>,
+ <&cpu46_intc 3>,
+ <&cpu47_intc 3>,
+ <&cpu48_intc 3>,
+ <&cpu49_intc 3>,
+ <&cpu50_intc 3>,
+ <&cpu51_intc 3>,
+ <&cpu52_intc 3>,
+ <&cpu53_intc 3>,
+ <&cpu54_intc 3>,
+ <&cpu55_intc 3>,
+ <&cpu56_intc 3>,
+ <&cpu57_intc 3>,
+ <&cpu58_intc 3>,
+ <&cpu59_intc 3>,
+ <&cpu60_intc 3>,
+ <&cpu61_intc 3>,
+ <&cpu62_intc 3>,
+ <&cpu63_intc 3>;
+ };
+
+ clint_mtimer0: timer@70ac000000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac000000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu0_intc 7>,
+ <&cpu1_intc 7>,
+ <&cpu2_intc 7>,
+ <&cpu3_intc 7>;
+ };
+
+ clint_mtimer1: timer@70ac010000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac010000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu4_intc 7>,
+ <&cpu5_intc 7>,
+ <&cpu6_intc 7>,
+ <&cpu7_intc 7>;
+ };
+
+ clint_mtimer2: timer@70ac020000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac020000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu8_intc 7>,
+ <&cpu9_intc 7>,
+ <&cpu10_intc 7>,
+ <&cpu11_intc 7>;
+ };
+
+ clint_mtimer3: timer@70ac030000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac030000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu12_intc 7>,
+ <&cpu13_intc 7>,
+ <&cpu14_intc 7>,
+ <&cpu15_intc 7>;
+ };
+
+ clint_mtimer4: timer@70ac040000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac040000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu16_intc 7>,
+ <&cpu17_intc 7>,
+ <&cpu18_intc 7>,
+ <&cpu19_intc 7>;
+ };
+
+ clint_mtimer5: timer@70ac050000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac050000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu20_intc 7>,
+ <&cpu21_intc 7>,
+ <&cpu22_intc 7>,
+ <&cpu23_intc 7>;
+ };
+
+ clint_mtimer6: timer@70ac060000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac060000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu24_intc 7>,
+ <&cpu25_intc 7>,
+ <&cpu26_intc 7>,
+ <&cpu27_intc 7>;
+ };
+
+ clint_mtimer7: timer@70ac070000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac070000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu28_intc 7>,
+ <&cpu29_intc 7>,
+ <&cpu30_intc 7>,
+ <&cpu31_intc 7>;
+ };
+
+ clint_mtimer8: timer@70ac080000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac080000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu32_intc 7>,
+ <&cpu33_intc 7>,
+ <&cpu34_intc 7>,
+ <&cpu35_intc 7>;
+ };
+
+ clint_mtimer9: timer@70ac090000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac090000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu36_intc 7>,
+ <&cpu37_intc 7>,
+ <&cpu38_intc 7>,
+ <&cpu39_intc 7>;
+ };
+
+ clint_mtimer10: timer@70ac0a0000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac0a0000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu40_intc 7>,
+ <&cpu41_intc 7>,
+ <&cpu42_intc 7>,
+ <&cpu43_intc 7>;
+ };
+
+ clint_mtimer11: timer@70ac0b0000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac0b0000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu44_intc 7>,
+ <&cpu45_intc 7>,
+ <&cpu46_intc 7>,
+ <&cpu47_intc 7>;
+ };
+
+ clint_mtimer12: timer@70ac0c0000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac0c0000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu48_intc 7>,
+ <&cpu49_intc 7>,
+ <&cpu50_intc 7>,
+ <&cpu51_intc 7>;
+ };
+
+ clint_mtimer13: timer@70ac0d0000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac0d0000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu52_intc 7>,
+ <&cpu53_intc 7>,
+ <&cpu54_intc 7>,
+ <&cpu55_intc 7>;
+ };
+
+ clint_mtimer14: timer@70ac0e0000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac0e0000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu56_intc 7>,
+ <&cpu57_intc 7>,
+ <&cpu58_intc 7>,
+ <&cpu59_intc 7>;
+ };
+
+ clint_mtimer15: timer@70ac0f0000 {
+ compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
+ reg = <0x00000070 0xac0f0000 0x00000000 0x00007ff8>;
+ interrupts-extended = <&cpu60_intc 7>,
+ <&cpu61_intc 7>,
+ <&cpu62_intc 7>,
+ <&cpu63_intc 7>;
+ };
+
+ intc: interrupt-controller@7090000000 {
+ compatible = "sophgo,sg2042-plic", "thead,c900-plic";
+ #address-cells = <0>;
+ #interrupt-cells = <2>;
+ reg = <0x00000070 0x90000000 0x00000000 0x04000000>;
+ interrupt-controller;
+ interrupts-extended =
+ <&cpu0_intc 0xffffffff>, <&cpu0_intc 9>,
+ <&cpu1_intc 0xffffffff>, <&cpu1_intc 9>,
+ <&cpu2_intc 0xffffffff>, <&cpu2_intc 9>,
+ <&cpu3_intc 0xffffffff>, <&cpu3_intc 9>,
+ <&cpu4_intc 0xffffffff>, <&cpu4_intc 9>,
+ <&cpu5_intc 0xffffffff>, <&cpu5_intc 9>,
+ <&cpu6_intc 0xffffffff>, <&cpu6_intc 9>,
+ <&cpu7_intc 0xffffffff>, <&cpu7_intc 9>,
+ <&cpu8_intc 0xffffffff>, <&cpu8_intc 9>,
+ <&cpu9_intc 0xffffffff>, <&cpu9_intc 9>,
+ <&cpu10_intc 0xffffffff>, <&cpu10_intc 9>,
+ <&cpu11_intc 0xffffffff>, <&cpu11_intc 9>,
+ <&cpu12_intc 0xffffffff>, <&cpu12_intc 9>,
+ <&cpu13_intc 0xffffffff>, <&cpu13_intc 9>,
+ <&cpu14_intc 0xffffffff>, <&cpu14_intc 9>,
+ <&cpu15_intc 0xffffffff>, <&cpu15_intc 9>,
+ <&cpu16_intc 0xffffffff>, <&cpu16_intc 9>,
+ <&cpu17_intc 0xffffffff>, <&cpu17_intc 9>,
+ <&cpu18_intc 0xffffffff>, <&cpu18_intc 9>,
+ <&cpu19_intc 0xffffffff>, <&cpu19_intc 9>,
+ <&cpu20_intc 0xffffffff>, <&cpu20_intc 9>,
+ <&cpu21_intc 0xffffffff>, <&cpu21_intc 9>,
+ <&cpu22_intc 0xffffffff>, <&cpu22_intc 9>,
+ <&cpu23_intc 0xffffffff>, <&cpu23_intc 9>,
+ <&cpu24_intc 0xffffffff>, <&cpu24_intc 9>,
+ <&cpu25_intc 0xffffffff>, <&cpu25_intc 9>,
+ <&cpu26_intc 0xffffffff>, <&cpu26_intc 9>,
+ <&cpu27_intc 0xffffffff>, <&cpu27_intc 9>,
+ <&cpu28_intc 0xffffffff>, <&cpu28_intc 9>,
+ <&cpu29_intc 0xffffffff>, <&cpu29_intc 9>,
+ <&cpu30_intc 0xffffffff>, <&cpu30_intc 9>,
+ <&cpu31_intc 0xffffffff>, <&cpu31_intc 9>,
+ <&cpu32_intc 0xffffffff>, <&cpu32_intc 9>,
+ <&cpu33_intc 0xffffffff>, <&cpu33_intc 9>,
+ <&cpu34_intc 0xffffffff>, <&cpu34_intc 9>,
+ <&cpu35_intc 0xffffffff>, <&cpu35_intc 9>,
+ <&cpu36_intc 0xffffffff>, <&cpu36_intc 9>,
+ <&cpu37_intc 0xffffffff>, <&cpu37_intc 9>,
+ <&cpu38_intc 0xffffffff>, <&cpu38_intc 9>,
+ <&cpu39_intc 0xffffffff>, <&cpu39_intc 9>,
+ <&cpu40_intc 0xffffffff>, <&cpu40_intc 9>,
+ <&cpu41_intc 0xffffffff>, <&cpu41_intc 9>,
+ <&cpu42_intc 0xffffffff>, <&cpu42_intc 9>,
+ <&cpu43_intc 0xffffffff>, <&cpu43_intc 9>,
+ <&cpu44_intc 0xffffffff>, <&cpu44_intc 9>,
+ <&cpu45_intc 0xffffffff>, <&cpu45_intc 9>,
+ <&cpu46_intc 0xffffffff>, <&cpu46_intc 9>,
+ <&cpu47_intc 0xffffffff>, <&cpu47_intc 9>,
+ <&cpu48_intc 0xffffffff>, <&cpu48_intc 9>,
+ <&cpu49_intc 0xffffffff>, <&cpu49_intc 9>,
+ <&cpu50_intc 0xffffffff>, <&cpu50_intc 9>,
+ <&cpu51_intc 0xffffffff>, <&cpu51_intc 9>,
+ <&cpu52_intc 0xffffffff>, <&cpu52_intc 9>,
+ <&cpu53_intc 0xffffffff>, <&cpu53_intc 9>,
+ <&cpu54_intc 0xffffffff>, <&cpu54_intc 9>,
+ <&cpu55_intc 0xffffffff>, <&cpu55_intc 9>,
+ <&cpu56_intc 0xffffffff>, <&cpu56_intc 9>,
+ <&cpu57_intc 0xffffffff>, <&cpu57_intc 9>,
+ <&cpu58_intc 0xffffffff>, <&cpu58_intc 9>,
+ <&cpu59_intc 0xffffffff>, <&cpu59_intc 9>,
+ <&cpu60_intc 0xffffffff>, <&cpu60_intc 9>,
+ <&cpu61_intc 0xffffffff>, <&cpu61_intc 9>,
+ <&cpu62_intc 0xffffffff>, <&cpu62_intc 9>,
+ <&cpu63_intc 0xffffffff>, <&cpu63_intc 9>;
+ riscv,ndev = <224>;
+ };
+
+ uart0: serial@7040000000 {
+ compatible = "sophgo,sg2042-uart", "snps,dw-apb-uart";
+ reg = <0x00000070 0x40000000 0x00000000 0x00001000>;
+ interrupt-parent = <&intc>;
+ interrupts = <SOC_PERIPHERAL_IRQ(112) IRQ_TYPE_LEVEL_HIGH>;
+ clock-frequency = <500000000>;
+ reg-shift = <2>;
+ reg-io-width = <4>;
+ status = "disabled";
+ };
+ };
+};
--
2.25.1

2023-09-20 13:38:18

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Wed, Sep 20, 2023 at 07:24:21PM +0800, Inochi Amaoto wrote:
> >
> >Yo,
> >
> >On Wed, Sep 20, 2023 at 05:08:41PM +0800, Inochi Amaoto wrote:
> >>> On Wed, Sep 20, 2023 at 02:39:39PM +0800, Chen Wang wrote:
> >>>> From: Inochi Amaoto <[email protected]>
> >>>>
> >>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> >>>> the timer and ipi device separately, and do not allow c900-clint as the
> >>>> fallback to avoid conflict.
> >>>>
> >>>> Signed-off-by: Inochi Amaoto <[email protected]>
> >>>> Signed-off-by: Chen Wang <[email protected]>
> >>>
> >>> Have you ignored Krzysztof's comments on this? I don't see a response or
> >>> a reaction to his comments about the compatibles on the last version.
> >>> Additionally, where is the user for these? I don't see any drivers that
> >>> actually make use of these.
> >>>
> >>
> >> Sorry for late reply and wrong message-id.
> >>
> >> The clint is parsed by sbi.
> >
> >That needs to go in the commit message.
>
> Yes, it will.

Thanks.

> >> As use the same compatible, the opensbi will
> >> parse the device twice. This will cause a fault.
> >
> >Then only have one compatible with 2 register ranges? Then your SBI
> >implementation can use those two register ranges to find out the base
> >address for the mtimer bits and for the mswi bits.
> >I don't understand why this cannot be done, could you please explain.
>
> That is a good idea, but now SBI use the second register ranges as
> mtimecmp address for aclint. And there is a aclint-mswi in the SBI.
> Maybe a change is needed?

Yeah, I don't think the model for this in OpenSBI at the moment (and
since I checked, in QEMU too) is correct. I think we should re-do things
correctly and it'd be great if things didn't get merged to those
projects that end up being objected to by dt-binding people.
I've started keeping a closer eye on QEMU recently in that regard, but I
am not super attentive. I'll try to be better at that going forward!

>
> >I also don't see anything in the opensbi repo right now that is using
> >these (nor could I easily see any patches for opensbi adding this).
> >Is there another SBI implementation that you are using that I can take
> >a look at to try and understand this better?
> >
>
> This will be sumbit in a short time.
> Now we only use it is sophgo vendor SBI, which url is [1].
>
> [1] https://github.com/sophgo/opensbi

Thanks.

> >>> Why do you need to have 2 compatibles (and therefore 2 devices) for the
> >>> clint? I thought the clint was a single device, of which the mtimer and
> >>> mswi bits were just "features"? Having split register ranges isn't a
> >>> reason to have two compatibles, so I must be missing something here...
> >
> >> Sorry for late reply, The clint consists of mtimer and ipi devices, which
> >> is defined in [1].
> >
> >Yes, I have looked at the spec. I went to check it again before replying
> >here in case there was something immediately obvious that I was missing.
> >
>
> I think nothing missed.
>
> >> This standard shows clint(or the aclint) has two device,
> >
> >The wording used here doesn't really matter. It's one interrupt
> >controller that does mtimer and mswi.
> >
> >> but not one. In another word, there is no need to defined mtimer and ipi
> >> device on the same base address.
> >
> >There's also no need to have two compatibles for the same interrupt
> >controller, so I do not get this reasoning. What actually _requires_
> >them to be split?
> >
>
> Yes, it is one, but can be mapped into different address. So I think we
> need two.

Not two compatibles though, just two memory addresses that you need to
locate (or maybe even 3, for SSWI?)

>
> >> So we need two compatibles to allow sbi to identify them correctly.
> >
> >Why is it not sufficient to identify the individual memory regions?
> >
>
> FYI, Anup. As I have no idea for aclint implementation.
>
> >Thanks,
> >Conor.
> >


Attachments:
(No filename) (3.95 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 13:56:12

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 07/11] dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2042 uarts

From: Emil Renner Berthing <[email protected]>

Add compatible for the uarts on the Sophgo SG2042 RISC-V SoC.

Signed-off-by: Emil Renner Berthing <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
index 17c553123f96..011d89e6df0f 100644
--- a/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
+++ b/Documentation/devicetree/bindings/serial/snps-dw-apb-uart.yaml
@@ -45,6 +45,7 @@ properties:
- const: snps,dw-apb-uart
- items:
- enum:
+ - sophgo,sg2042-uart
- starfive,jh7100-hsuart
- starfive,jh7100-uart
- const: snps,dw-apb-uart
--
2.25.1

2023-09-20 14:10:08

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Wed, Sep 20, 2023 at 08:40:07PM +0800, Inochi Amaoto wrote:
> >On 20/09/2023 14:15, Inochi Amaoto wrote:
> >>> On 20/09/2023 08:39, Chen Wang wrote:
> >>>> From: Inochi Amaoto <[email protected]>
> >>>>
> >>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> >>>> the timer and ipi device separately, and do not allow c900-clint as the
> >>>
> >>> Why?
> >>>
> >>
> >> If use the same compatible, SBI will process this twice in both ipi and
> >> timer, use different compatible will allow SBI to treat these as different.
> >> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
> >> second register range. I have explained in another response.
> >
> >What is a SBI? Linux driver? If so, why some intermediate Linux driver
> >choice should affect bindings?
> >Best regards,
> >Krzysztof
> >
>
> SBI (Supervisor Binary Interface) is defined by riscv, which is an interface
> between the Supervisor Execution Environment (SEE) and the supervisor. The
> detailed documentation can be found in [1].
>
> The implement of SBI needs fdt info of the platform, which is provided by
> kernel. So we need a dt-bindings for these devices, and these will be
> processed by SBI.
>
> [1] https://github.com/riscv-non-isa/riscv-sbi-doc

Yeah, this is the unfortunate problem of half-baked bindings (IMO)
ending up in OpenSBI (which likely means they also ended up in QEMU).
This T-Head stuff is coming across our (metaphorical) desks, so we are
obviously going to try to do things correctly. I may end up speaking to
Anup later today, if I do I will point him at this thread (if he hasn't
seen it already).


Attachments:
(No filename) (1.65 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 15:04:36

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Wed, Sep 20, 2023 at 08:08:49PM +0530, Anup Patel wrote:
> On Wed, Sep 20, 2023 at 6:28 PM Conor Dooley <[email protected]> wrote:
> >
> > On Wed, Sep 20, 2023 at 08:40:07PM +0800, Inochi Amaoto wrote:
> > > >On 20/09/2023 14:15, Inochi Amaoto wrote:
> > > >>> On 20/09/2023 08:39, Chen Wang wrote:
> > > >>>> From: Inochi Amaoto <[email protected]>
> > > >>>>
> > > >>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> > > >>>> the timer and ipi device separately, and do not allow c900-clint as the
> > > >>>
> > > >>> Why?
> > > >>>
> > > >>
> > > >> If use the same compatible, SBI will process this twice in both ipi and
> > > >> timer, use different compatible will allow SBI to treat these as different.
> > > >> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
> > > >> second register range. I have explained in another response.
> > > >
> > > >What is a SBI? Linux driver? If so, why some intermediate Linux driver
> > > >choice should affect bindings?
> > > >Best regards,
> > > >Krzysztof
> > > >
> > >
> > > SBI (Supervisor Binary Interface) is defined by riscv, which is an interface
> > > between the Supervisor Execution Environment (SEE) and the supervisor. The
> > > detailed documentation can be found in [1].
> > >
> > > The implement of SBI needs fdt info of the platform, which is provided by
> > > kernel. So we need a dt-bindings for these devices, and these will be
> > > processed by SBI.
> > >
> > > [1] https://github.com/riscv-non-isa/riscv-sbi-doc
> >
> > Yeah, this is the unfortunate problem of half-baked bindings (IMO)
> > ending up in OpenSBI (which likely means they also ended up in QEMU).
> > This T-Head stuff is coming across our (metaphorical) desks, so we are
> > obviously going to try to do things correctly. I may end up speaking to
> > Anup later today, if I do I will point him at this thread (if he hasn't
> > seen it already).
>
> RISC-V ACLINT is one of those unfortunate non-ISA specs (like
> SiFive PLIC) which is implemented by various organizations but
> not officially ratified by RVI.

Yeah, I brought this stuff up at the weekly pw sync call, and Paul
pointed that out.

> The SiFive CLINT has flexibility related limitations which makes it
> not useful for multi-socket and mult-die systems. The SiFive CLINT
> is also not useful for systems with AIA because with AIA M-mode has
> a new way of doing M-mode IPIs. Due to this reasons, the RISC-V
> ACLINT spec breaks down traditional SiFive CLINT into two separate
> devices namely mtimer and mswi. This allows platforms to implement
> only the required set of devices. The mtimer as defined by the ACLINT
> specifications also allows platforms to place mtime and mtimecmp
> registers at different locations.
>
> Refer, https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc
>
> We need a separate DT bindings document for ACLINT MTIMER
> and ACLINT MSWI because these are separate devices. The
> Sophgo sg2042 SoC should add their implementation specific
> compatible strings in this document.

If the spec isn't frozen, I'm not accepting a binding for the "generic"
version of it. Bindings for this specific implemtnation are okay.
For sure though, squeezing this into the sifive,plic binding isn't
appropriate.

What was pointed out, I think by Samuel, that the reason that this may
need to be split is the fact that there are many possible MTIMER
register ranges & possibly sswi stuff too that would need to be
differentiated.

>
> Regards,
> Anup


Attachments:
(No filename) (3.53 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 15:10:42

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 00/11] Add Milk-V Pioneer RISC-V board support

On Wed, Sep 20, 2023 at 02:33:48PM +0800, Chen Wang wrote:
> Milk-V Pioneer [1] is a developer motherboard based on SOPHON SG2042 [2]
> in a standard mATX form factor. Add minimal device
> tree files for the SG2042 SOC and the Milk-V Pioneer board.

Please run dtbs_check with W=1 set & fix the below issues:

sg2042-cpus.dtsi:1600.25-1607.5: Warning (unit_address_vs_reg): /cpus/l2-cache@0: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1609.25-1616.5: Warning (unit_address_vs_reg): /cpus/l2-cache@1: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1618.25-1625.5: Warning (unit_address_vs_reg): /cpus/l2-cache@2: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1627.25-1634.5: Warning (unit_address_vs_reg): /cpus/l2-cache@3: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1636.25-1643.5: Warning (unit_address_vs_reg): /cpus/l2-cache@4: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1645.25-1652.5: Warning (unit_address_vs_reg): /cpus/l2-cache@5: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1654.25-1661.5: Warning (unit_address_vs_reg): /cpus/l2-cache@6: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1663.25-1670.5: Warning (unit_address_vs_reg): /cpus/l2-cache@7: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1672.25-1679.5: Warning (unit_address_vs_reg): /cpus/l2-cache@8: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1681.25-1688.5: Warning (unit_address_vs_reg): /cpus/l2-cache@9: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1690.27-1697.5: Warning (unit_address_vs_reg): /cpus/l2-cache@10: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1699.27-1706.5: Warning (unit_address_vs_reg): /cpus/l2-cache@11: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1708.27-1715.5: Warning (unit_address_vs_reg): /cpus/l2-cache@12: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1717.27-1724.5: Warning (unit_address_vs_reg): /cpus/l2-cache@13: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1726.27-1733.5: Warning (unit_address_vs_reg): /cpus/l2-cache@14: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:1735.27-1742.5: Warning (unit_address_vs_reg): /cpus/l2-cache@15: node has a unit name, but no reg or ranges property
sg2042-cpus.dtsi:256.15-275.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@0: duplicate unit-address (also used in node /cpus/l2-cache@0)
sg2042-cpus.dtsi:277.15-296.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@1: duplicate unit-address (also used in node /cpus/l2-cache@1)
sg2042-cpus.dtsi:298.15-317.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@2: duplicate unit-address (also used in node /cpus/l2-cache@2)
sg2042-cpus.dtsi:319.15-338.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@3: duplicate unit-address (also used in node /cpus/l2-cache@3)
sg2042-cpus.dtsi:340.15-359.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@4: duplicate unit-address (also used in node /cpus/l2-cache@4)
sg2042-cpus.dtsi:361.15-380.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@5: duplicate unit-address (also used in node /cpus/l2-cache@5)
sg2042-cpus.dtsi:382.15-401.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@6: duplicate unit-address (also used in node /cpus/l2-cache@6)
sg2042-cpus.dtsi:403.15-422.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@7: duplicate unit-address (also used in node /cpus/l2-cache@7)
sg2042-cpus.dtsi:424.15-443.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@8: duplicate unit-address (also used in node /cpus/l2-cache@8)
sg2042-cpus.dtsi:445.15-464.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@9: duplicate unit-address (also used in node /cpus/l2-cache@9)
sg2042-cpus.dtsi:466.17-485.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@10: duplicate unit-address (also used in node /cpus/l2-cache@10)
sg2042-cpus.dtsi:487.17-506.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@11: duplicate unit-address (also used in node /cpus/l2-cache@11)
sg2042-cpus.dtsi:508.17-527.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@12: duplicate unit-address (also used in node /cpus/l2-cache@12)
sg2042-cpus.dtsi:529.17-548.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@13: duplicate unit-address (also used in node /cpus/l2-cache@13)
sg2042-cpus.dtsi:550.17-569.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@14: duplicate unit-address (also used in node /cpus/l2-cache@14)
sg2042-cpus.dtsi:571.17-590.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@15: duplicate unit-address (also used in node /cpus/l2-cache@15)

Thanks,
Conor.


Attachments:
(No filename) (4.75 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 15:30:25

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 05/11] dt-bindings: interrupt-controller: Add SOPHGO's SG2042 PLIC

Add compatible string for SOPHGO SG2042 plic.

Acked-by: Xiaoguang Xing <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
.../bindings/interrupt-controller/sifive,plic-1.0.0.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml b/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml
index dc1f28e55266..16f9c4760c0f 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml
+++ b/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml
@@ -65,6 +65,7 @@ properties:
- items:
- enum:
- allwinner,sun20i-d1-plic
+ - sophgo,sg2042-plic
- thead,th1520-plic
- const: thead,c900-plic
- items:
--
2.25.1

2023-09-20 15:33:08

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

Yo,

On Wed, Sep 20, 2023 at 05:08:41PM +0800, Inochi Amaoto wrote:
> >On Wed, Sep 20, 2023 at 02:39:39PM +0800, Chen Wang wrote:
> >> From: Inochi Amaoto <[email protected]>
> >>
> >> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> >> the timer and ipi device separately, and do not allow c900-clint as the
> >> fallback to avoid conflict.
> >>
> >> Signed-off-by: Inochi Amaoto <[email protected]>
> >> Signed-off-by: Chen Wang <[email protected]>
> >
> >Have you ignored Krzysztof's comments on this? I don't see a response or
> >a reaction to his comments about the compatibles on the last version.
> >Additionally, where is the user for these? I don't see any drivers that
> >actually make use of these.
> >
>
> Sorry for late reply and wrong message-id.
>
> The clint is parsed by sbi.

That needs to go in the commit message.

> As use the same compatible, the opensbi will
> parse the device twice. This will cause a fault.

Then only have one compatible with 2 register ranges? Then your SBI
implementation can use those two register ranges to find out the base
address for the mtimer bits and for the mswi bits.
I don't understand why this cannot be done, could you please explain.
I also don't see anything in the opensbi repo right now that is using
these (nor could I easily see any patches for opensbi adding this).
Is there another SBI implementation that you are using that I can take
a look at to try and understand this better?

> >Why do you need to have 2 compatibles (and therefore 2 devices) for the
> >clint? I thought the clint was a single device, of which the mtimer and
> >mswi bits were just "features"? Having split register ranges isn't a
> >reason to have two compatibles, so I must be missing something here...

> Sorry for late reply, The clint consists of mtimer and ipi devices, which
> is defined in [1].

Yes, I have looked at the spec. I went to check it again before replying
here in case there was something immediately obvious that I was missing.

> This standard shows clint(or the aclint) has two device,

The wording used here doesn't really matter. It's one interrupt
controller that does mtimer and mswi.

> but not one. In another word, there is no need to defined mtimer and ipi
> device on the same base address.

There's also no need to have two compatibles for the same interrupt
controller, so I do not get this reasoning. What actually _requires_
them to be split?

> So we need two compatibles to allow sbi to identify them correctly.

Why is it not sufficient to identify the individual memory regions?

Thanks,
Conor.


Attachments:
(No filename) (2.62 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 15:38:26

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 04/11] dt-bindings: riscv: Add T-HEAD C920 compatibles

On Wed, Sep 20, 2023 at 02:38:08PM +0800, Chen Wang wrote:
> The C920 is RISC-V CPU cores from T-HEAD Semiconductor.
> Notably, the C920 core is used in the SOPHGO SG2042 SoC.
>
> Acked-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>

Reviewed-by: Conor Dooley <[email protected]>

Thanks,
Conor.

> ---
> Documentation/devicetree/bindings/riscv/cpus.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/riscv/cpus.yaml b/Documentation/devicetree/bindings/riscv/cpus.yaml
> index 38c0b5213736..185a0191bad6 100644
> --- a/Documentation/devicetree/bindings/riscv/cpus.yaml
> +++ b/Documentation/devicetree/bindings/riscv/cpus.yaml
> @@ -47,6 +47,7 @@ properties:
> - sifive,u74-mc
> - thead,c906
> - thead,c910
> + - thead,c920
> - const: riscv
> - items:
> - enum:
> --
> 2.25.1
>


Attachments:
(No filename) (0.98 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 15:53:09

by Anup Patel

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Wed, Sep 20, 2023 at 6:28 PM Conor Dooley <[email protected]> wrote:
>
> On Wed, Sep 20, 2023 at 08:40:07PM +0800, Inochi Amaoto wrote:
> > >On 20/09/2023 14:15, Inochi Amaoto wrote:
> > >>> On 20/09/2023 08:39, Chen Wang wrote:
> > >>>> From: Inochi Amaoto <[email protected]>
> > >>>>
> > >>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> > >>>> the timer and ipi device separately, and do not allow c900-clint as the
> > >>>
> > >>> Why?
> > >>>
> > >>
> > >> If use the same compatible, SBI will process this twice in both ipi and
> > >> timer, use different compatible will allow SBI to treat these as different.
> > >> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
> > >> second register range. I have explained in another response.
> > >
> > >What is a SBI? Linux driver? If so, why some intermediate Linux driver
> > >choice should affect bindings?
> > >Best regards,
> > >Krzysztof
> > >
> >
> > SBI (Supervisor Binary Interface) is defined by riscv, which is an interface
> > between the Supervisor Execution Environment (SEE) and the supervisor. The
> > detailed documentation can be found in [1].
> >
> > The implement of SBI needs fdt info of the platform, which is provided by
> > kernel. So we need a dt-bindings for these devices, and these will be
> > processed by SBI.
> >
> > [1] https://github.com/riscv-non-isa/riscv-sbi-doc
>
> Yeah, this is the unfortunate problem of half-baked bindings (IMO)
> ending up in OpenSBI (which likely means they also ended up in QEMU).
> This T-Head stuff is coming across our (metaphorical) desks, so we are
> obviously going to try to do things correctly. I may end up speaking to
> Anup later today, if I do I will point him at this thread (if he hasn't
> seen it already).

RISC-V ACLINT is one of those unfortunate non-ISA specs (like
SiFive PLIC) which is implemented by various organizations but
not officially ratified by RVI.

The SiFive CLINT has flexibility related limitations which makes it
not useful for multi-socket and mult-die systems. The SiFive CLINT
is also not useful for systems with AIA because with AIA M-mode has
a new way of doing M-mode IPIs. Due to this reasons, the RISC-V
ACLINT spec breaks down traditional SiFive CLINT into two separate
devices namely mtimer and mswi. This allows platforms to implement
only the required set of devices. The mtimer as defined by the ACLINT
specifications also allows platforms to place mtime and mtimecmp
registers at different locations.

Refer, https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc

We need a separate DT bindings document for ACLINT MTIMER
and ACLINT MSWI because these are separate devices. The
Sophgo sg2042 SoC should add their implementation specific
compatible strings in this document.

Regards,
Anup

2023-09-20 16:00:14

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 09/11] riscv: dts: add initial SOPHGO SG2042 SoC device tree

On Wed, Sep 20, 2023 at 08:19:59AM -0700, Palmer Dabbelt wrote:
> On Tue, 19 Sep 2023 23:40:32 PDT (-0700), [email protected] wrote:
> > Milk-V Pioneer motherboard is powered by SOPHON's SG2042.
> >
> > SG2042 is server grade chip with high performance, low power
> > consumption and high data throughput.
> > Key features:
> > - 64 RISC-V cpu cores which implements IMAFDC
> > - 4 cores per cluster, 16 clusters on chip
> > - ......
> >
> > More info is available at [1].
> >
> > [1]: https://en.sophgo.com/product/introduce/sg2042.html
> >
> > Currently only support booting into console with only uart,
> > other features will be added soon later.
> >
> > Acked-by: Xiaoguang Xing <[email protected]>
> > Signed-off-by: Xiaoguang Xing <[email protected]>
> > Signed-off-by: Inochi Amaoto <[email protected]>
> > Signed-off-by: Emil Renner Berthing <[email protected]>
> > Signed-off-by: Chen Wang <[email protected]>
> > ---
> > arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 1744 +++++++++++++++++++
> > arch/riscv/boot/dts/sophgo/sg2042.dtsi | 439 +++++
> > 2 files changed, 2183 insertions(+)
> > create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> > create mode 100644 arch/riscv/boot/dts/sophgo/sg2042.dtsi
>
> Just an FYI: a handful of replies to this are getting blocked by the lists
> as they end up being too big. I just went and allowed what was there, but
> future replies will probably require someone to be away as well and thus
> might be slow.

95% of this patch is the same, if people that reply are good citizens
& trim, it'll not be too bad. btw, if you want, you can add me as
someone that can click the "not spam" button.


Attachments:
(No filename) (1.72 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 16:01:07

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On 20/09/2023 08:39, Chen Wang wrote:
> From: Inochi Amaoto <[email protected]>
>
> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> the timer and ipi device separately, and do not allow c900-clint as the

Why?

You received comment about it, so please provide proper explanation in
the commit msg.

Same device does not get two different compatibles.

You also did not respond to my comments, so you basically ignored it and
send the same.

NAK

Best regards,
Krzysztof

2023-09-20 16:02:30

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>On 20/09/2023 14:15, Inochi Amaoto wrote:
>>> On 20/09/2023 08:39, Chen Wang wrote:
>>>> From: Inochi Amaoto <[email protected]>
>>>>
>>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>>>> the timer and ipi device separately, and do not allow c900-clint as the
>>>
>>> Why?
>>>
>>
>> If use the same compatible, SBI will process this twice in both ipi and
>> timer, use different compatible will allow SBI to treat these as different.
>> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
>> second register range. I have explained in another response.
>
>What is a SBI? Linux driver? If so, why some intermediate Linux driver
>choice should affect bindings?
>Best regards,
>Krzysztof
>

SBI (Supervisor Binary Interface) is defined by riscv, which is an interface
between the Supervisor Execution Environment (SEE) and the supervisor. The
detailed documentation can be found in [1].

The implement of SBI needs fdt info of the platform, which is provided by
kernel. So we need a dt-bindings for these devices, and these will be
processed by SBI.

[1] https://github.com/riscv-non-isa/riscv-sbi-doc

2023-09-20 16:21:46

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 11/11] riscv: defconfig: enable SOPHGO SoC

Enable SOPHGO SoC config in defconfig to allow the default
upstream kernel to boot on Milk-V Pioneer board.

Signed-off-by: Chen Wang <[email protected]>
---
arch/riscv/configs/defconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/arch/riscv/configs/defconfig b/arch/riscv/configs/defconfig
index ab86ec3b9eab..bf737cfa1d2c 100644
--- a/arch/riscv/configs/defconfig
+++ b/arch/riscv/configs/defconfig
@@ -32,6 +32,7 @@ CONFIG_SOC_SIFIVE=y
CONFIG_SOC_STARFIVE=y
CONFIG_ARCH_SUNXI=y
CONFIG_SOC_VIRT=y
+CONFIG_ARCH_SOPHGO=y
CONFIG_SMP=y
CONFIG_HOTPLUG_CPU=y
CONFIG_PM=y
--
2.25.1

2023-09-20 16:34:03

by Emil Renner Berthing

[permalink] [raw]
Subject: Re: [PATCH v2 09/11] riscv: dts: add initial SOPHGO SG2042 SoC device tree

Chen Wang wrote:
> Milk-V Pioneer motherboard is powered by SOPHON's SG2042.

Hi,

I'm just wondering what is the relation between SOPHON and SOPHGO?
I think most of the content refers to the SoC as Sophgo SG2042 or SOPHGO
SG2042, but here you're using SOPHON.

Also it would be great if you could decide if it's spelled SOPHGO or Sophgo and
be consistent in all these patches.

/Emil

>
> SG2042 is server grade chip with high performance, low power
> consumption and high data throughput.
> Key features:
> - 64 RISC-V cpu cores which implements IMAFDC
> - 4 cores per cluster, 16 clusters on chip
> - ......
>
> More info is available at [1].
>
> [1]: https://en.sophgo.com/product/introduce/sg2042.html
>
> Currently only support booting into console with only uart,
> other features will be added soon later.
>
> Acked-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Inochi Amaoto <[email protected]>
> Signed-off-by: Emil Renner Berthing <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>
> ---
> arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 1744 +++++++++++++++++++
> arch/riscv/boot/dts/sophgo/sg2042.dtsi | 439 +++++
> 2 files changed, 2183 insertions(+)
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2042.dtsi
>
> diff --git a/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi b/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> new file mode 100644
> index 000000000000..9fc79b1cf3bf
> --- /dev/null
> +++ b/arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> @@ -0,0 +1,1744 @@
> +// SPDX-License-Identifier: GPL-2.0 OR MIT
> +/*
> + * Copyright (C) 2022 Sophgo Technology Inc. All rights reserved.
> + */
> +
> +/ {
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + timebase-frequency = <50000000>;
> +
> + cpu-map {
> + socket0 {
> + cluster0 {
> + core0 {
> + cpu = <&cpu0>;
> + };
> + core1 {
> + cpu = <&cpu1>;
> + };
> + core2 {
> + cpu = <&cpu2>;
> + };
> + core3 {
> + cpu = <&cpu3>;
> + };
> + };
> +
> + cluster1 {
> + core0 {
> + cpu = <&cpu4>;
> + };
> + core1 {
> + cpu = <&cpu5>;
> + };
> + core2 {
> + cpu = <&cpu6>;
> + };
> + core3 {
> + cpu = <&cpu7>;
> + };
> + };
> +
> + cluster2 {
> + core0 {
> + cpu = <&cpu16>;
> + };
> + core1 {
> + cpu = <&cpu17>;
> + };
> + core2 {
> + cpu = <&cpu18>;
> + };
> + core3 {
> + cpu = <&cpu19>;
> + };
> + };
> +
> + cluster3 {
> + core0 {
> + cpu = <&cpu20>;
> + };
> + core1 {
> + cpu = <&cpu21>;
> + };
> + core2 {
> + cpu = <&cpu22>;
> + };
> + core3 {
> + cpu = <&cpu23>;
> + };
> + };
> +
> + cluster4 {
> + core0 {
> + cpu = <&cpu8>;
> + };
> + core1 {
> + cpu = <&cpu9>;
> + };
> + core2 {
> + cpu = <&cpu10>;
> + };
> + core3 {
> + cpu = <&cpu11>;
> + };
> + };
> +
> + cluster5 {
> + core0 {
> + cpu = <&cpu12>;
> + };
> + core1 {
> + cpu = <&cpu13>;
> + };
> + core2 {
> + cpu = <&cpu14>;
> + };
> + core3 {
> + cpu = <&cpu15>;
> + };
> + };
> +
> + cluster6 {
> + core0 {
> + cpu = <&cpu24>;
> + };
> + core1 {
> + cpu = <&cpu25>;
> + };
> + core2 {
> + cpu = <&cpu26>;
> + };
> + core3 {
> + cpu = <&cpu27>;
> + };
> + };
> +
> + cluster7 {
> + core0 {
> + cpu = <&cpu28>;
> + };
> + core1 {
> + cpu = <&cpu29>;
> + };
> + core2 {
> + cpu = <&cpu30>;
> + };
> + core3 {
> + cpu = <&cpu31>;
> + };
> + };
> +
> + cluster8 {
> + core0 {
> + cpu = <&cpu32>;
> + };
> + core1 {
> + cpu = <&cpu33>;
> + };
> + core2 {
> + cpu = <&cpu34>;
> + };
> + core3 {
> + cpu = <&cpu35>;
> + };
> + };
> +
> + cluster9 {
> + core0 {
> + cpu = <&cpu36>;
> + };
> + core1 {
> + cpu = <&cpu37>;
> + };
> + core2 {
> + cpu = <&cpu38>;
> + };
> + core3 {
> + cpu = <&cpu39>;
> + };
> + };
> +
> + cluster10 {
> + core0 {
> + cpu = <&cpu48>;
> + };
> + core1 {
> + cpu = <&cpu49>;
> + };
> + core2 {
> + cpu = <&cpu50>;
> + };
> + core3 {
> + cpu = <&cpu51>;
> + };
> + };
> +
> + cluster11 {
> + core0 {
> + cpu = <&cpu52>;
> + };
> + core1 {
> + cpu = <&cpu53>;
> + };
> + core2 {
> + cpu = <&cpu54>;
> + };
> + core3 {
> + cpu = <&cpu55>;
> + };
> + };
> +
> + cluster12 {
> + core0 {
> + cpu = <&cpu40>;
> + };
> + core1 {
> + cpu = <&cpu41>;
> + };
> + core2 {
> + cpu = <&cpu42>;
> + };
> + core3 {
> + cpu = <&cpu43>;
> + };
> + };
> +
> + cluster13 {
> + core0 {
> + cpu = <&cpu44>;
> + };
> + core1 {
> + cpu = <&cpu45>;
> + };
> + core2 {
> + cpu = <&cpu46>;
> + };
> + core3 {
> + cpu = <&cpu47>;
> + };
> + };
> +
> + cluster14 {
> + core0 {
> + cpu = <&cpu56>;
> + };
> + core1 {
> + cpu = <&cpu57>;
> + };
> + core2 {
> + cpu = <&cpu58>;
> + };
> + core3 {
> + cpu = <&cpu59>;
> + };
> + };
> +
> + cluster15 {
> + core0 {
> + cpu = <&cpu60>;
> + };
> + core1 {
> + cpu = <&cpu61>;
> + };
> + core2 {
> + cpu = <&cpu62>;
> + };
> + core3 {
> + cpu = <&cpu63>;
> + };
> + };
> + };
> + };
> +
> + cpu0: cpu@0 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <0>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache0>;
> + mmu-type = "riscv,sv39";
> +
> + cpu0_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu1: cpu@1 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <1>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache0>;
> + mmu-type = "riscv,sv39";
> +
> + cpu1_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu2: cpu@2 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <2>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache0>;
> + mmu-type = "riscv,sv39";
> +
> + cpu2_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu3: cpu@3 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <3>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache0>;
> + mmu-type = "riscv,sv39";
> +
> + cpu3_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu4: cpu@4 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <4>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache1>;
> + mmu-type = "riscv,sv39";
> +
> + cpu4_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu5: cpu@5 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <5>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache1>;
> + mmu-type = "riscv,sv39";
> +
> + cpu5_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu6: cpu@6 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <6>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache1>;
> + mmu-type = "riscv,sv39";
> +
> + cpu6_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu7: cpu@7 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <7>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache1>;
> + mmu-type = "riscv,sv39";
> +
> + cpu7_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu8: cpu@8 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <8>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache4>;
> + mmu-type = "riscv,sv39";
> +
> + cpu8_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu9: cpu@9 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <9>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache4>;
> + mmu-type = "riscv,sv39";
> +
> + cpu9_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu10: cpu@10 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <10>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache4>;
> + mmu-type = "riscv,sv39";
> +
> + cpu10_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu11: cpu@11 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <11>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache4>;
> + mmu-type = "riscv,sv39";
> +
> + cpu11_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu12: cpu@12 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <12>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache5>;
> + mmu-type = "riscv,sv39";
> +
> + cpu12_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu13: cpu@13 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <13>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache5>;
> + mmu-type = "riscv,sv39";
> +
> + cpu13_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu14: cpu@14 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <14>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache5>;
> + mmu-type = "riscv,sv39";
> +
> + cpu14_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu15: cpu@15 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <15>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache5>;
> + mmu-type = "riscv,sv39";
> +
> + cpu15_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu16: cpu@16 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <16>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache2>;
> + mmu-type = "riscv,sv39";
> +
> + cpu16_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu17: cpu@17 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <17>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache2>;
> + mmu-type = "riscv,sv39";
> +
> + cpu17_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu18: cpu@18 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <18>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache2>;
> + mmu-type = "riscv,sv39";
> +
> + cpu18_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu19: cpu@19 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <19>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache2>;
> + mmu-type = "riscv,sv39";
> +
> + cpu19_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu20: cpu@20 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <20>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache3>;
> + mmu-type = "riscv,sv39";
> +
> + cpu20_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu21: cpu@21 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <21>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache3>;
> + mmu-type = "riscv,sv39";
> +
> + cpu21_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu22: cpu@22 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <22>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache3>;
> + mmu-type = "riscv,sv39";
> +
> + cpu22_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu23: cpu@23 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <23>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache3>;
> + mmu-type = "riscv,sv39";
> +
> + cpu23_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu24: cpu@24 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <24>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache6>;
> + mmu-type = "riscv,sv39";
> +
> + cpu24_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu25: cpu@25 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <25>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache6>;
> + mmu-type = "riscv,sv39";
> +
> + cpu25_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu26: cpu@26 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <26>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache6>;
> + mmu-type = "riscv,sv39";
> +
> + cpu26_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu27: cpu@27 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <27>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache6>;
> + mmu-type = "riscv,sv39";
> +
> + cpu27_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu28: cpu@28 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <28>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache7>;
> + mmu-type = "riscv,sv39";
> +
> + cpu28_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu29: cpu@29 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <29>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache7>;
> + mmu-type = "riscv,sv39";
> +
> + cpu29_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu30: cpu@30 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <30>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache7>;
> + mmu-type = "riscv,sv39";
> +
> + cpu30_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu31: cpu@31 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <31>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache7>;
> + mmu-type = "riscv,sv39";
> +
> + cpu31_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu32: cpu@32 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <32>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache8>;
> + mmu-type = "riscv,sv39";
> +
> + cpu32_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu33: cpu@33 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <33>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache8>;
> + mmu-type = "riscv,sv39";
> +
> + cpu33_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu34: cpu@34 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <34>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache8>;
> + mmu-type = "riscv,sv39";
> +
> + cpu34_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu35: cpu@35 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <35>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache8>;
> + mmu-type = "riscv,sv39";
> +
> + cpu35_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu36: cpu@36 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <36>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache9>;
> + mmu-type = "riscv,sv39";
> +
> + cpu36_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu37: cpu@37 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <37>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache9>;
> + mmu-type = "riscv,sv39";
> +
> + cpu37_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu38: cpu@38 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <38>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache9>;
> + mmu-type = "riscv,sv39";
> +
> + cpu38_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu39: cpu@39 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <39>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache9>;
> + mmu-type = "riscv,sv39";
> +
> + cpu39_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu40: cpu@40 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <40>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache12>;
> + mmu-type = "riscv,sv39";
> +
> + cpu40_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu41: cpu@41 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <41>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache12>;
> + mmu-type = "riscv,sv39";
> +
> + cpu41_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu42: cpu@42 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <42>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache12>;
> + mmu-type = "riscv,sv39";
> +
> + cpu42_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu43: cpu@43 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <43>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache12>;
> + mmu-type = "riscv,sv39";
> +
> + cpu43_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu44: cpu@44 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <44>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache13>;
> + mmu-type = "riscv,sv39";
> +
> + cpu44_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu45: cpu@45 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <45>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache13>;
> + mmu-type = "riscv,sv39";
> +
> + cpu45_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu46: cpu@46 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <46>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache13>;
> + mmu-type = "riscv,sv39";
> +
> + cpu46_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu47: cpu@47 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <47>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache13>;
> + mmu-type = "riscv,sv39";
> +
> + cpu47_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu48: cpu@48 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <48>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache10>;
> + mmu-type = "riscv,sv39";
> +
> + cpu48_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu49: cpu@49 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <49>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache10>;
> + mmu-type = "riscv,sv39";
> +
> + cpu49_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu50: cpu@50 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <50>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache10>;
> + mmu-type = "riscv,sv39";
> +
> + cpu50_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu51: cpu@51 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <51>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache10>;
> + mmu-type = "riscv,sv39";
> +
> + cpu51_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu52: cpu@52 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <52>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache11>;
> + mmu-type = "riscv,sv39";
> +
> + cpu52_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu53: cpu@53 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <53>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache11>;
> + mmu-type = "riscv,sv39";
> +
> + cpu53_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu54: cpu@54 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <54>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache11>;
> + mmu-type = "riscv,sv39";
> +
> + cpu54_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu55: cpu@55 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <55>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache11>;
> + mmu-type = "riscv,sv39";
> +
> + cpu55_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu56: cpu@56 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <56>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache14>;
> + mmu-type = "riscv,sv39";
> +
> + cpu56_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu57: cpu@57 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <57>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache14>;
> + mmu-type = "riscv,sv39";
> +
> + cpu57_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu58: cpu@58 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <58>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache14>;
> + mmu-type = "riscv,sv39";
> +
> + cpu58_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu59: cpu@59 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <59>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache14>;
> + mmu-type = "riscv,sv39";
> +
> + cpu59_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu60: cpu@60 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <60>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache15>;
> + mmu-type = "riscv,sv39";
> +
> + cpu60_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu61: cpu@61 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <61>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache15>;
> + mmu-type = "riscv,sv39";
> +
> + cpu61_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu62: cpu@62 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <62>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache15>;
> + mmu-type = "riscv,sv39";
> +
> + cpu62_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + cpu63: cpu@63 {
> + compatible = "thead,c920", "riscv";
> + device_type = "cpu";
> + riscv,isa = "rv64imafdc";
> + reg = <63>;
> + i-cache-block-size = <64>;
> + i-cache-size = <65536>;
> + i-cache-sets = <512>;
> + d-cache-block-size = <64>;
> + d-cache-size = <65536>;
> + d-cache-sets = <512>;
> + next-level-cache = <&l2_cache15>;
> + mmu-type = "riscv,sv39";
> +
> + cpu63_intc: interrupt-controller {
> + compatible = "riscv,cpu-intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + };
> + };
> +
> + l2_cache0: l2-cache@0 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache1: l2-cache@1 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache2: l2-cache@2 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache3: l2-cache@3 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache4: l2-cache@4 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache5: l2-cache@5 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache6: l2-cache@6 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache7: l2-cache@7 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache8: l2-cache@8 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache9: l2-cache@9 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache10: l2-cache@10 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache11: l2-cache@11 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache12: l2-cache@12 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache13: l2-cache@13 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache14: l2-cache@14 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> +
> + l2_cache15: l2-cache@15 {
> + compatible = "cache";
> + cache-block-size = <64>;
> + cache-level = <2>;
> + cache-size = <1048576>;
> + cache-sets = <1024>;
> + cache-unified;
> + };
> + };
> +};
> diff --git a/arch/riscv/boot/dts/sophgo/sg2042.dtsi b/arch/riscv/boot/dts/sophgo/sg2042.dtsi
> new file mode 100644
> index 000000000000..747fd9764c95
> --- /dev/null
> +++ b/arch/riscv/boot/dts/sophgo/sg2042.dtsi
> @@ -0,0 +1,439 @@
> +// SPDX-License-Identifier: GPL-2.0 OR MIT
> +/*
> + * Copyright (C) 2022 Sophgo Technology Inc. All rights reserved.
> + */
> +
> +/dts-v1/;
> +#include <dt-bindings/interrupt-controller/irq.h>
> +
> +#include "sg2042-cpus.dtsi"
> +
> +#define SOC_PERIPHERAL_IRQ(nr) (nr)
> +
> +/ {
> + compatible = "sophgo,sg2042";
> + #address-cells = <2>;
> + #size-cells = <2>;
> + dma-noncoherent;
> +
> + aliases {
> + serial0 = &uart0;
> + };
> +
> + /* the mem node will be updated by ZSBL. */
> + memory@0 {
> + device_type = "memory";
> + reg = <0x00000000 0x00000000 0x00000000 0x00000000>;
> + };
> +
> + memory@1 {
> + device_type = "memory";
> + reg = <0x00000000 0x00000001 0x00000000 0x00000000>;
> + };
> +
> + memory@2 {
> + device_type = "memory";
> + reg = <0x00000000 0x00000002 0x00000000 0x00000000>;
> + };
> +
> + memory@3 {
> + device_type = "memory";
> + reg = <0x00000000 0x00000003 0x00000000 0x00000000>;
> + };
> +
> + pmu {
> + compatible = "riscv,pmu";
> + riscv,event-to-mhpmevent =
> + <0x00003 0x00000000 0x00000010>,
> + <0x00004 0x00000000 0x00000011>,
> + <0x00005 0x00000000 0x00000007>,
> + <0x00006 0x00000000 0x00000006>,
> + <0x00008 0x00000000 0x00000027>,
> + <0x00009 0x00000000 0x00000028>,
> + <0x10000 0x00000000 0x0000000c>,
> + <0x10001 0x00000000 0x0000000d>,
> + <0x10002 0x00000000 0x0000000e>,
> + <0x10003 0x00000000 0x0000000f>,
> + <0x10008 0x00000000 0x00000001>,
> + <0x10009 0x00000000 0x00000002>,
> + <0x10010 0x00000000 0x00000010>,
> + <0x10011 0x00000000 0x00000011>,
> + <0x10012 0x00000000 0x00000012>,
> + <0x10013 0x00000000 0x00000013>,
> + <0x10019 0x00000000 0x00000004>,
> + <0x10021 0x00000000 0x00000003>,
> + <0x10030 0x00000000 0x0000001c>,
> + <0x10031 0x00000000 0x0000001b>;
> + riscv,event-to-mhpmcounters =
> + <0x00003 0x00003 0xfffffff8>,
> + <0x00004 0x00004 0xfffffff8>,
> + <0x00005 0x00005 0xfffffff8>,
> + <0x00006 0x00006 0xfffffff8>,
> + <0x00007 0x00007 0xfffffff8>,
> + <0x00008 0x00008 0xfffffff8>,
> + <0x00009 0x00009 0xfffffff8>,
> + <0x0000a 0x0000a 0xfffffff8>,
> + <0x10000 0x10000 0xfffffff8>,
> + <0x10001 0x10001 0xfffffff8>,
> + <0x10002 0x10002 0xfffffff8>,
> + <0x10003 0x10003 0xfffffff8>,
> + <0x10008 0x10008 0xfffffff8>,
> + <0x10009 0x10009 0xfffffff8>,
> + <0x10010 0x10010 0xfffffff8>,
> + <0x10011 0x10011 0xfffffff8>,
> + <0x10012 0x10012 0xfffffff8>,
> + <0x10013 0x10013 0xfffffff8>,
> + <0x10019 0x10019 0xfffffff8>,
> + <0x10021 0x10021 0xfffffff8>,
> + <0x10030 0x10030 0xfffffff8>,
> + <0x10031 0x10031 0xfffffff8>;
> + riscv,raw-event-to-mhpmcounters =
> + <0x00000000 0x00000001 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000002 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000003 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000004 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000005 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000006 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000007 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000008 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000009 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000000a 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000000b 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000000c 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000000d 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000000e 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000000f 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000010 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000011 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000012 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000013 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000014 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000015 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000016 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000017 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000018 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000019 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000001a 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000001b 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000001c 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000001d 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000001e 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000001f 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000020 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000021 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000022 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000023 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000024 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000025 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000026 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000027 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000028 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x00000029 0xffffffff 0xffffffff 0xfffffff8>,
> + <0x00000000 0x0000002a 0xffffffff 0xffffffff 0xfffffff8>;
> + };
> +
> + soc: soc {
> + compatible = "simple-bus";
> + #address-cells = <2>;
> + #size-cells = <2>;
> + ranges;
> +
> + clint_mswi: interrupt-controller@7094000000 {
> + compatible = "sophgo,sg2042-clint-mswi", "thead,c900-clint-mswi";
> + reg = <0x00000070 0x94000000 0x00000000 0x00004000>;
> + interrupts-extended = <&cpu0_intc 3>,
> + <&cpu1_intc 3>,
> + <&cpu2_intc 3>,
> + <&cpu3_intc 3>,
> + <&cpu4_intc 3>,
> + <&cpu5_intc 3>,
> + <&cpu6_intc 3>,
> + <&cpu7_intc 3>,
> + <&cpu8_intc 3>,
> + <&cpu9_intc 3>,
> + <&cpu10_intc 3>,
> + <&cpu11_intc 3>,
> + <&cpu12_intc 3>,
> + <&cpu13_intc 3>,
> + <&cpu14_intc 3>,
> + <&cpu15_intc 3>,
> + <&cpu16_intc 3>,
> + <&cpu17_intc 3>,
> + <&cpu18_intc 3>,
> + <&cpu19_intc 3>,
> + <&cpu20_intc 3>,
> + <&cpu21_intc 3>,
> + <&cpu22_intc 3>,
> + <&cpu23_intc 3>,
> + <&cpu24_intc 3>,
> + <&cpu25_intc 3>,
> + <&cpu26_intc 3>,
> + <&cpu27_intc 3>,
> + <&cpu28_intc 3>,
> + <&cpu29_intc 3>,
> + <&cpu30_intc 3>,
> + <&cpu31_intc 3>,
> + <&cpu32_intc 3>,
> + <&cpu33_intc 3>,
> + <&cpu34_intc 3>,
> + <&cpu35_intc 3>,
> + <&cpu36_intc 3>,
> + <&cpu37_intc 3>,
> + <&cpu38_intc 3>,
> + <&cpu39_intc 3>,
> + <&cpu40_intc 3>,
> + <&cpu41_intc 3>,
> + <&cpu42_intc 3>,
> + <&cpu43_intc 3>,
> + <&cpu44_intc 3>,
> + <&cpu45_intc 3>,
> + <&cpu46_intc 3>,
> + <&cpu47_intc 3>,
> + <&cpu48_intc 3>,
> + <&cpu49_intc 3>,
> + <&cpu50_intc 3>,
> + <&cpu51_intc 3>,
> + <&cpu52_intc 3>,
> + <&cpu53_intc 3>,
> + <&cpu54_intc 3>,
> + <&cpu55_intc 3>,
> + <&cpu56_intc 3>,
> + <&cpu57_intc 3>,
> + <&cpu58_intc 3>,
> + <&cpu59_intc 3>,
> + <&cpu60_intc 3>,
> + <&cpu61_intc 3>,
> + <&cpu62_intc 3>,
> + <&cpu63_intc 3>;
> + };
> +
> + clint_mtimer0: timer@70ac000000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac000000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu0_intc 7>,
> + <&cpu1_intc 7>,
> + <&cpu2_intc 7>,
> + <&cpu3_intc 7>;
> + };
> +
> + clint_mtimer1: timer@70ac010000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac010000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu4_intc 7>,
> + <&cpu5_intc 7>,
> + <&cpu6_intc 7>,
> + <&cpu7_intc 7>;
> + };
> +
> + clint_mtimer2: timer@70ac020000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac020000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu8_intc 7>,
> + <&cpu9_intc 7>,
> + <&cpu10_intc 7>,
> + <&cpu11_intc 7>;
> + };
> +
> + clint_mtimer3: timer@70ac030000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac030000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu12_intc 7>,
> + <&cpu13_intc 7>,
> + <&cpu14_intc 7>,
> + <&cpu15_intc 7>;
> + };
> +
> + clint_mtimer4: timer@70ac040000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac040000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu16_intc 7>,
> + <&cpu17_intc 7>,
> + <&cpu18_intc 7>,
> + <&cpu19_intc 7>;
> + };
> +
> + clint_mtimer5: timer@70ac050000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac050000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu20_intc 7>,
> + <&cpu21_intc 7>,
> + <&cpu22_intc 7>,
> + <&cpu23_intc 7>;
> + };
> +
> + clint_mtimer6: timer@70ac060000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac060000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu24_intc 7>,
> + <&cpu25_intc 7>,
> + <&cpu26_intc 7>,
> + <&cpu27_intc 7>;
> + };
> +
> + clint_mtimer7: timer@70ac070000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac070000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu28_intc 7>,
> + <&cpu29_intc 7>,
> + <&cpu30_intc 7>,
> + <&cpu31_intc 7>;
> + };
> +
> + clint_mtimer8: timer@70ac080000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac080000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu32_intc 7>,
> + <&cpu33_intc 7>,
> + <&cpu34_intc 7>,
> + <&cpu35_intc 7>;
> + };
> +
> + clint_mtimer9: timer@70ac090000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac090000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu36_intc 7>,
> + <&cpu37_intc 7>,
> + <&cpu38_intc 7>,
> + <&cpu39_intc 7>;
> + };
> +
> + clint_mtimer10: timer@70ac0a0000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac0a0000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu40_intc 7>,
> + <&cpu41_intc 7>,
> + <&cpu42_intc 7>,
> + <&cpu43_intc 7>;
> + };
> +
> + clint_mtimer11: timer@70ac0b0000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac0b0000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu44_intc 7>,
> + <&cpu45_intc 7>,
> + <&cpu46_intc 7>,
> + <&cpu47_intc 7>;
> + };
> +
> + clint_mtimer12: timer@70ac0c0000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac0c0000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu48_intc 7>,
> + <&cpu49_intc 7>,
> + <&cpu50_intc 7>,
> + <&cpu51_intc 7>;
> + };
> +
> + clint_mtimer13: timer@70ac0d0000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac0d0000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu52_intc 7>,
> + <&cpu53_intc 7>,
> + <&cpu54_intc 7>,
> + <&cpu55_intc 7>;
> + };
> +
> + clint_mtimer14: timer@70ac0e0000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac0e0000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu56_intc 7>,
> + <&cpu57_intc 7>,
> + <&cpu58_intc 7>,
> + <&cpu59_intc 7>;
> + };
> +
> + clint_mtimer15: timer@70ac0f0000 {
> + compatible = "sophgo,sg2042-clint-mtimer", "thead,c900-clint-mtimer";
> + reg = <0x00000070 0xac0f0000 0x00000000 0x00007ff8>;
> + interrupts-extended = <&cpu60_intc 7>,
> + <&cpu61_intc 7>,
> + <&cpu62_intc 7>,
> + <&cpu63_intc 7>;
> + };
> +
> + intc: interrupt-controller@7090000000 {
> + compatible = "sophgo,sg2042-plic", "thead,c900-plic";
> + #address-cells = <0>;
> + #interrupt-cells = <2>;
> + reg = <0x00000070 0x90000000 0x00000000 0x04000000>;
> + interrupt-controller;
> + interrupts-extended =
> + <&cpu0_intc 0xffffffff>, <&cpu0_intc 9>,
> + <&cpu1_intc 0xffffffff>, <&cpu1_intc 9>,
> + <&cpu2_intc 0xffffffff>, <&cpu2_intc 9>,
> + <&cpu3_intc 0xffffffff>, <&cpu3_intc 9>,
> + <&cpu4_intc 0xffffffff>, <&cpu4_intc 9>,
> + <&cpu5_intc 0xffffffff>, <&cpu5_intc 9>,
> + <&cpu6_intc 0xffffffff>, <&cpu6_intc 9>,
> + <&cpu7_intc 0xffffffff>, <&cpu7_intc 9>,
> + <&cpu8_intc 0xffffffff>, <&cpu8_intc 9>,
> + <&cpu9_intc 0xffffffff>, <&cpu9_intc 9>,
> + <&cpu10_intc 0xffffffff>, <&cpu10_intc 9>,
> + <&cpu11_intc 0xffffffff>, <&cpu11_intc 9>,
> + <&cpu12_intc 0xffffffff>, <&cpu12_intc 9>,
> + <&cpu13_intc 0xffffffff>, <&cpu13_intc 9>,
> + <&cpu14_intc 0xffffffff>, <&cpu14_intc 9>,
> + <&cpu15_intc 0xffffffff>, <&cpu15_intc 9>,
> + <&cpu16_intc 0xffffffff>, <&cpu16_intc 9>,
> + <&cpu17_intc 0xffffffff>, <&cpu17_intc 9>,
> + <&cpu18_intc 0xffffffff>, <&cpu18_intc 9>,
> + <&cpu19_intc 0xffffffff>, <&cpu19_intc 9>,
> + <&cpu20_intc 0xffffffff>, <&cpu20_intc 9>,
> + <&cpu21_intc 0xffffffff>, <&cpu21_intc 9>,
> + <&cpu22_intc 0xffffffff>, <&cpu22_intc 9>,
> + <&cpu23_intc 0xffffffff>, <&cpu23_intc 9>,
> + <&cpu24_intc 0xffffffff>, <&cpu24_intc 9>,
> + <&cpu25_intc 0xffffffff>, <&cpu25_intc 9>,
> + <&cpu26_intc 0xffffffff>, <&cpu26_intc 9>,
> + <&cpu27_intc 0xffffffff>, <&cpu27_intc 9>,
> + <&cpu28_intc 0xffffffff>, <&cpu28_intc 9>,
> + <&cpu29_intc 0xffffffff>, <&cpu29_intc 9>,
> + <&cpu30_intc 0xffffffff>, <&cpu30_intc 9>,
> + <&cpu31_intc 0xffffffff>, <&cpu31_intc 9>,
> + <&cpu32_intc 0xffffffff>, <&cpu32_intc 9>,
> + <&cpu33_intc 0xffffffff>, <&cpu33_intc 9>,
> + <&cpu34_intc 0xffffffff>, <&cpu34_intc 9>,
> + <&cpu35_intc 0xffffffff>, <&cpu35_intc 9>,
> + <&cpu36_intc 0xffffffff>, <&cpu36_intc 9>,
> + <&cpu37_intc 0xffffffff>, <&cpu37_intc 9>,
> + <&cpu38_intc 0xffffffff>, <&cpu38_intc 9>,
> + <&cpu39_intc 0xffffffff>, <&cpu39_intc 9>,
> + <&cpu40_intc 0xffffffff>, <&cpu40_intc 9>,
> + <&cpu41_intc 0xffffffff>, <&cpu41_intc 9>,
> + <&cpu42_intc 0xffffffff>, <&cpu42_intc 9>,
> + <&cpu43_intc 0xffffffff>, <&cpu43_intc 9>,
> + <&cpu44_intc 0xffffffff>, <&cpu44_intc 9>,
> + <&cpu45_intc 0xffffffff>, <&cpu45_intc 9>,
> + <&cpu46_intc 0xffffffff>, <&cpu46_intc 9>,
> + <&cpu47_intc 0xffffffff>, <&cpu47_intc 9>,
> + <&cpu48_intc 0xffffffff>, <&cpu48_intc 9>,
> + <&cpu49_intc 0xffffffff>, <&cpu49_intc 9>,
> + <&cpu50_intc 0xffffffff>, <&cpu50_intc 9>,
> + <&cpu51_intc 0xffffffff>, <&cpu51_intc 9>,
> + <&cpu52_intc 0xffffffff>, <&cpu52_intc 9>,
> + <&cpu53_intc 0xffffffff>, <&cpu53_intc 9>,
> + <&cpu54_intc 0xffffffff>, <&cpu54_intc 9>,
> + <&cpu55_intc 0xffffffff>, <&cpu55_intc 9>,
> + <&cpu56_intc 0xffffffff>, <&cpu56_intc 9>,
> + <&cpu57_intc 0xffffffff>, <&cpu57_intc 9>,
> + <&cpu58_intc 0xffffffff>, <&cpu58_intc 9>,
> + <&cpu59_intc 0xffffffff>, <&cpu59_intc 9>,
> + <&cpu60_intc 0xffffffff>, <&cpu60_intc 9>,
> + <&cpu61_intc 0xffffffff>, <&cpu61_intc 9>,
> + <&cpu62_intc 0xffffffff>, <&cpu62_intc 9>,
> + <&cpu63_intc 0xffffffff>, <&cpu63_intc 9>;
> + riscv,ndev = <224>;
> + };
> +
> + uart0: serial@7040000000 {
> + compatible = "sophgo,sg2042-uart", "snps,dw-apb-uart";
> + reg = <0x00000070 0x40000000 0x00000000 0x00001000>;
> + interrupt-parent = <&intc>;
> + interrupts = <SOC_PERIPHERAL_IRQ(112) IRQ_TYPE_LEVEL_HIGH>;
> + clock-frequency = <500000000>;
> + reg-shift = <2>;
> + reg-io-width = <4>;
> + status = "disabled";
> + };
> + };
> +};
> --
> 2.25.1

2023-09-20 17:28:05

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 02/11] dt-bindings: vendor-prefixes: add milkv/sophgo

Yo,

On Wed, Sep 20, 2023 at 02:37:28PM +0800, Chen Wang wrote:
> Add new vendor strings to dt bindings.
> These new vendor strings are used by
> - Sophgo SG2042 SoC [1]
> - Milk-V Pioneer board [2], which uses SG2042 chip.
>
> [1]: https://en.sophgo.com/product/introduce/sg2042.html
> [2]: https://milkv.io/pioneer

If you resend, make these link tags please. Otherwise,
Reviewed-by: Conor Dooley <[email protected]>

Thanks,
Conor.

> Acked-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>
> ---
> Documentation/devicetree/bindings/vendor-prefixes.yaml | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> index 573578db9509..fcca9e070a9a 100644
> --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> @@ -863,6 +863,8 @@ patternProperties:
> description: MikroElektronika d.o.o.
> "^mikrotik,.*":
> description: MikroTik
> + "^milkv,.*":
> + description: MilkV Technology Co., Ltd
> "^miniand,.*":
> description: Miniand Tech
> "^minix,.*":
> @@ -1273,6 +1275,8 @@ patternProperties:
> description: Solomon Systech Limited
> "^sony,.*":
> description: Sony Corporation
> + "^sophgo,.*":
> + description: Sophgo Technology Inc.
> "^sourceparts,.*":
> description: Source Parts Inc.
> "^spansion,.*":
> --
> 2.25.1
>


Attachments:
(No filename) (1.54 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 17:31:17

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 08/11] serial: 8250_dw: Add Sophgo SG2042 support

From: Emil Renner Berthing <[email protected]>

Add quirk to skip setting the input clock rate for the uarts on the
Sophgo SG2042 SoC similar to the StarFive JH7100.

Signed-off-by: Emil Renner Berthing <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
drivers/tty/serial/8250/8250_dw.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index f4cafca1a7da..6c344877a07f 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -770,7 +770,7 @@ static const struct dw8250_platform_data dw8250_renesas_rzn1_data = {
.quirks = DW_UART_QUIRK_IS_DMA_FC,
};

-static const struct dw8250_platform_data dw8250_starfive_jh7100_data = {
+static const struct dw8250_platform_data dw8250_skip_set_rate_data = {
.usr_reg = DW_UART_USR,
.quirks = DW_UART_QUIRK_SKIP_SET_RATE,
};
@@ -780,7 +780,8 @@ static const struct of_device_id dw8250_of_match[] = {
{ .compatible = "cavium,octeon-3860-uart", .data = &dw8250_octeon_3860_data },
{ .compatible = "marvell,armada-38x-uart", .data = &dw8250_armada_38x_data },
{ .compatible = "renesas,rzn1-uart", .data = &dw8250_renesas_rzn1_data },
- { .compatible = "starfive,jh7100-uart", .data = &dw8250_starfive_jh7100_data },
+ { .compatible = "sophgo,sg2042-uart", .data = &dw8250_skip_set_rate_data },
+ { .compatible = "starfive,jh7100-uart", .data = &dw8250_skip_set_rate_data },
{ /* Sentinel */ }
};
MODULE_DEVICE_TABLE(of, dw8250_of_match);
--
2.25.1

2023-09-20 17:45:49

by Chen Wang

[permalink] [raw]
Subject: [PATCH v2 03/11] dt-bindings: riscv: add sophgo sg2042 bindings

Add DT binding documentation for the Sophgo SG2042 Soc [1] and the
Milk-V Pioneer board [2].

[1]: https://en.sophgo.com/product/introduce/sg2042.html
[2]: https://milkv.io/pioneer

Acked-by: Chao Wei <[email protected]>
Acked-by: Xiaoguang Xing <[email protected]>
Signed-off-by: Chen Wang <[email protected]>
---
.../devicetree/bindings/riscv/sophgo.yaml | 28 +++++++++++++++++++
MAINTAINERS | 7 +++++
2 files changed, 35 insertions(+)
create mode 100644 Documentation/devicetree/bindings/riscv/sophgo.yaml

diff --git a/Documentation/devicetree/bindings/riscv/sophgo.yaml b/Documentation/devicetree/bindings/riscv/sophgo.yaml
new file mode 100644
index 000000000000..82468ae915db
--- /dev/null
+++ b/Documentation/devicetree/bindings/riscv/sophgo.yaml
@@ -0,0 +1,28 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/riscv/sophgo.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo SoC-based boards
+
+maintainers:
+ - Chao Wei <[email protected]>
+ - Xiaoguang Xing <[email protected]>
+
+description:
+ Sophgo SoC-based boards
+
+properties:
+ $nodename:
+ const: '/'
+ compatible:
+ oneOf:
+ - items:
+ - enum:
+ - milkv,pioneer
+ - const: sophgo,sg2042
+
+additionalProperties: true
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 90f13281d297..b74d505003e2 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20063,6 +20063,13 @@ F: drivers/char/sonypi.c
F: drivers/platform/x86/sony-laptop.c
F: include/linux/sony-laptop.h

+SOPHGO DEVICETREES
+M: Xiaoguang Xing <[email protected]>
+M: Chao Wei <[email protected]>
+S: Maintained
+F: Documentation/devicetree/bindings/riscv/sophgo.yaml
+F: arch/riscv/boot/dts/sophgo/
+
SOUND
M: Jaroslav Kysela <[email protected]>
M: Takashi Iwai <[email protected]>
--
2.25.1

2023-09-20 18:26:01

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Wed, Sep 20, 2023 at 02:39:39PM +0800, Chen Wang wrote:
> From: Inochi Amaoto <[email protected]>
>
> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
> the timer and ipi device separately, and do not allow c900-clint as the
> fallback to avoid conflict.
>
> Signed-off-by: Inochi Amaoto <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>

Have you ignored Krzysztof's comments on this? I don't see a response or
a reaction to his comments about the compatibles on the last version.
Additionally, where is the user for these? I don't see any drivers that
actually make use of these.

Why do you need to have 2 compatibles (and therefore 2 devices) for the
clint? I thought the clint was a single device, of which the mtimer and
mswi bits were just "features"? Having split register ranges isn't a
reason to have two compatibles, so I must be missing something here...

Thanks,
Conor.

> ---
> Documentation/devicetree/bindings/timer/sifive,clint.yaml | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/timer/sifive,clint.yaml b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
> index a0185e15a42f..ae69696c5c75 100644
> --- a/Documentation/devicetree/bindings/timer/sifive,clint.yaml
> +++ b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
> @@ -39,6 +39,14 @@ properties:
> - allwinner,sun20i-d1-clint
> - thead,th1520-clint
> - const: thead,c900-clint
> + - items:
> + - enum:
> + - sophgo,sg2042-clint-mtimer
> + - const: thead,c900-clint-mtimer
> + - items:
> + - enum:
> + - sophgo,sg2042-clint-mswi
> + - const: thead,c900-clint-mswi
> - items:
> - const: sifive,clint0
> - const: riscv,clint0
> --
> 2.25.1
>


Attachments:
(No filename) (1.89 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 18:49:24

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 05/11] dt-bindings: interrupt-controller: Add SOPHGO's SG2042 PLIC

On Wed, Sep 20, 2023 at 02:39:03PM +0800, Chen Wang wrote:
> Add compatible string for SOPHGO SG2042 plic.
>
> Acked-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>

Acked-by: Conor Dooley <[email protected]>

> ---
> .../bindings/interrupt-controller/sifive,plic-1.0.0.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml b/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml
> index dc1f28e55266..16f9c4760c0f 100644
> --- a/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml
> +++ b/Documentation/devicetree/bindings/interrupt-controller/sifive,plic-1.0.0.yaml
> @@ -65,6 +65,7 @@ properties:
> - items:
> - enum:
> - allwinner,sun20i-d1-plic
> + - sophgo,sg2042-plic
> - thead,th1520-plic
> - const: thead,c900-plic
> - items:
> --
> 2.25.1
>


Attachments:
(No filename) (1.04 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-20 19:46:04

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v2 09/11] riscv: dts: add initial SOPHGO SG2042 SoC device tree

On Tue, 19 Sep 2023 23:40:32 PDT (-0700), [email protected] wrote:
> Milk-V Pioneer motherboard is powered by SOPHON's SG2042.
>
> SG2042 is server grade chip with high performance, low power
> consumption and high data throughput.
> Key features:
> - 64 RISC-V cpu cores which implements IMAFDC
> - 4 cores per cluster, 16 clusters on chip
> - ......
>
> More info is available at [1].
>
> [1]: https://en.sophgo.com/product/introduce/sg2042.html
>
> Currently only support booting into console with only uart,
> other features will be added soon later.
>
> Acked-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Xiaoguang Xing <[email protected]>
> Signed-off-by: Inochi Amaoto <[email protected]>
> Signed-off-by: Emil Renner Berthing <[email protected]>
> Signed-off-by: Chen Wang <[email protected]>
> ---
> arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 1744 +++++++++++++++++++
> arch/riscv/boot/dts/sophgo/sg2042.dtsi | 439 +++++
> 2 files changed, 2183 insertions(+)
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2042.dtsi

Just an FYI: a handful of replies to this are getting blocked by the
lists as they end up being too big. I just went and allowed what was
there, but future replies will probably require someone to be away as
well and thus might be slow.

2023-09-20 20:56:46

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 03/11] dt-bindings: riscv: add sophgo sg2042 bindings

On 20/09/2023 08:37, Chen Wang wrote:
> Add DT binding documentation for the Sophgo SG2042 Soc [1] and the
> Milk-V Pioneer board [2].
>
> [1]: https://en.sophgo.com/product/introduce/sg2042.html
> [2]: https://milkv.io/pioneer

This is a friendly reminder during the review process.

It looks like you received a tag and forgot to add it.

If you do not know the process, here is a short explanation:
Please add Acked-by/Reviewed-by/Tested-by tags when posting new
versions, under or above your Signed-off-by tag. Tag is "received", when
provided in a message replied to you on the mailing list. Tools like b4
can help here. However, there's no need to repost patches *only* to add
the tags. The upstream maintainer will do that for tags received on the
version they apply.

https://elixir.bootlin.com/linux/v6.5-rc3/source/Documentation/process/submitting-patches.rst#L577

If a tag was not added on purpose, please state why and what changed.

Best regards,
Krzysztof

2023-09-20 21:11:06

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On 20/09/2023 14:15, Inochi Amaoto wrote:
>> On 20/09/2023 08:39, Chen Wang wrote:
>>> From: Inochi Amaoto <[email protected]>
>>>
>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>>> the timer and ipi device separately, and do not allow c900-clint as the
>>
>> Why?
>>
>
> If use the same compatible, SBI will process this twice in both ipi and
> timer, use different compatible will allow SBI to treat these as different.
> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
> second register range. I have explained in another response.

What is a SBI? Linux driver? If so, why some intermediate Linux driver
choice should affect bindings?
Best regards,
Krzysztof

2023-09-20 21:51:17

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>On Wed, Sep 20, 2023 at 02:39:39PM +0800, Chen Wang wrote:
>> From: Inochi Amaoto <[email protected]>
>>
>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>> the timer and ipi device separately, and do not allow c900-clint as the
>> fallback to avoid conflict.
>>
>> Signed-off-by: Inochi Amaoto <[email protected]>
>> Signed-off-by: Chen Wang <[email protected]>
>
>Have you ignored Krzysztof's comments on this? I don't see a response or
>a reaction to his comments about the compatibles on the last version.
>Additionally, where is the user for these? I don't see any drivers that
>actually make use of these.
>

Sorry for late reply and wrong message-id.

The clint is parsed by sbi. As use the same compatible, the opensbi will
parse the device twice. This will cause a fault.

>Why do you need to have 2 compatibles (and therefore 2 devices) for the
>clint? I thought the clint was a single device, of which the mtimer and
>mswi bits were just "features"? Having split register ranges isn't a
>reason to have two compatibles, so I must be missing something here...
>
>Thanks,
>Conor.
>

Sorry for late reply, The clint consists of mtimer and ipi devices, which
is defined in [1]. This standard shows clint(or the aclint) has two device,
but not one. In another word, there is no need to defined mtimer and ipi
device on the same base address. So we need two compatibles to allow sbi
to identify them correctly.

[1] https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc

>> ---
>> Documentation/devicetree/bindings/timer/sifive,clint.yaml | 8 ++++++++
>> 1 file changed, 8 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/timer/sifive,clint.yaml b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
>> index a0185e15a42f..ae69696c5c75 100644
>> --- a/Documentation/devicetree/bindings/timer/sifive,clint.yaml
>> +++ b/Documentation/devicetree/bindings/timer/sifive,clint.yaml
>> @@ -39,6 +39,14 @@ properties:
>> - allwinner,sun20i-d1-clint
>> - thead,th1520-clint
>> - const: thead,c900-clint
>> + - items:
>> + - enum:
>> + - sophgo,sg2042-clint-mtimer
>> + - const: thead,c900-clint-mtimer
>> + - items:
>> + - enum:
>> + - sophgo,sg2042-clint-mswi
>> + - const: thead,c900-clint-mswi
>> - items:
>> - const: sifive,clint0
>> - const: riscv,clint0
>> --
>> 2.25.1
>>
>

2023-09-20 22:26:32

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>On Wed, Sep 20, 2023 at 08:08:49PM +0530, Anup Patel wrote:
>> On Wed, Sep 20, 2023 at 6:28 PM Conor Dooley <[email protected]> wrote:
>>>
>>> On Wed, Sep 20, 2023 at 08:40:07PM +0800, Inochi Amaoto wrote:
>>>>> On 20/09/2023 14:15, Inochi Amaoto wrote:
>>>>>>> On 20/09/2023 08:39, Chen Wang wrote:
>>>>>>>> From: Inochi Amaoto <[email protected]>
>>>>>>>>
>>>>>>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>>>>>>>> the timer and ipi device separately, and do not allow c900-clint as the
>>>>>>>
>>>>>>> Why?
>>>>>>>
>>>>>>
>>>>>> If use the same compatible, SBI will process this twice in both ipi and
>>>>>> timer, use different compatible will allow SBI to treat these as different.
>>>>>> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
>>>>>> second register range. I have explained in another response.
>>>>>
>>>>> What is a SBI? Linux driver? If so, why some intermediate Linux driver
>>>>> choice should affect bindings?
>>>>> Best regards,
>>>>> Krzysztof
>>>>>
>>>>
>>>> SBI (Supervisor Binary Interface) is defined by riscv, which is an interface
>>>> between the Supervisor Execution Environment (SEE) and the supervisor. The
>>>> detailed documentation can be found in [1].
>>>>
>>>> The implement of SBI needs fdt info of the platform, which is provided by
>>>> kernel. So we need a dt-bindings for these devices, and these will be
>>>> processed by SBI.
>>>>
>>>> [1] https://github.com/riscv-non-isa/riscv-sbi-doc
>>>
>>> Yeah, this is the unfortunate problem of half-baked bindings (IMO)
>>> ending up in OpenSBI (which likely means they also ended up in QEMU).
>>> This T-Head stuff is coming across our (metaphorical) desks, so we are
>>> obviously going to try to do things correctly. I may end up speaking to
>>> Anup later today, if I do I will point him at this thread (if he hasn't
>>> seen it already).
>>
>> RISC-V ACLINT is one of those unfortunate non-ISA specs (like
>> SiFive PLIC) which is implemented by various organizations but
>> not officially ratified by RVI.
>
>Yeah, I brought this stuff up at the weekly pw sync call, and Paul
>pointed that out.
>
>> The SiFive CLINT has flexibility related limitations which makes it
>> not useful for multi-socket and mult-die systems. The SiFive CLINT
>> is also not useful for systems with AIA because with AIA M-mode has
>> a new way of doing M-mode IPIs. Due to this reasons, the RISC-V
>> ACLINT spec breaks down traditional SiFive CLINT into two separate
>> devices namely mtimer and mswi. This allows platforms to implement
>> only the required set of devices. The mtimer as defined by the ACLINT
>> specifications also allows platforms to place mtime and mtimecmp
>> registers at different locations.
>>
>> Refer, https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc
>>
>> We need a separate DT bindings document for ACLINT MTIMER
>> and ACLINT MSWI because these are separate devices. The
>> Sophgo sg2042 SoC should add their implementation specific
>> compatible strings in this document.
>
>If the spec isn't frozen, I'm not accepting a binding for the "generic"
>version of it. Bindings for this specific implemtnation are okay.
>For sure though, squeezing this into the sifive,plic binding isn't
>appropriate.
>

A specific implemtnation sounds like a good idea, as the clint layout
of sg2042 is wired and hard to merge (ipi is continous but the timer is
per cluster).

For a specific implemtnation, I wonder if it is better to use two files to
identify these device each, instead of one for all?

>What was pointed out, I think by Samuel, that the reason that this may
>need to be split is the fact that there are many possible MTIMER
>register ranges & possibly sswi stuff too that would need to be
>differentiated.
>
>>
>> Regards,
>> Anup
>

2023-09-20 22:51:08

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On 20/09/2023 14:58, Conor Dooley wrote:
> On Wed, Sep 20, 2023 at 08:40:07PM +0800, Inochi Amaoto wrote:
>>> On 20/09/2023 14:15, Inochi Amaoto wrote:
>>>>> On 20/09/2023 08:39, Chen Wang wrote:
>>>>>> From: Inochi Amaoto <[email protected]>
>>>>>>
>>>>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>>>>>> the timer and ipi device separately, and do not allow c900-clint as the
>>>>>
>>>>> Why?
>>>>>
>>>>
>>>> If use the same compatible, SBI will process this twice in both ipi and
>>>> timer, use different compatible will allow SBI to treat these as different.
>>>> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
>>>> second register range. I have explained in another response.
>>>
>>> What is a SBI? Linux driver? If so, why some intermediate Linux driver
>>> choice should affect bindings?
>>> Best regards,
>>> Krzysztof
>>>
>>
>> SBI (Supervisor Binary Interface) is defined by riscv, which is an interface
>> between the Supervisor Execution Environment (SEE) and the supervisor. The
>> detailed documentation can be found in [1].
>>
>> The implement of SBI needs fdt info of the platform, which is provided by
>> kernel. So we need a dt-bindings for these devices, and these will be
>> processed by SBI.
>>
>> [1] https://github.com/riscv-non-isa/riscv-sbi-doc
>
> Yeah, this is the unfortunate problem of half-baked bindings (IMO)
> ending up in OpenSBI (which likely means they also ended up in QEMU).
> This T-Head stuff is coming across our (metaphorical) desks, so we are
> obviously going to try to do things correctly. I may end up speaking to
> Anup later today, if I do I will point him at this thread (if he hasn't
> seen it already).

If the OpenSBI started to work with some half-baked-bindings before
proper review, it's their loss. If we do not push back on such stuff,
how our review can ever matter?

Anyway, firmware/SBI/whatever parsing compatible twice is not really a
reason to model same thing with two different compatibles. Assuming of
course this is the same thing.

Best regards,
Krzysztof

2023-09-20 23:04:51

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 02/11] dt-bindings: vendor-prefixes: add milkv/sophgo

Regards,

unicornx

Conor Dooley <[email protected]> 于2023年9月20日周三 16:23写道:
>
> Yo,
>
> On Wed, Sep 20, 2023 at 02:37:28PM +0800, Chen Wang wrote:
> > Add new vendor strings to dt bindings.
> > These new vendor strings are used by
> > - Sophgo SG2042 SoC [1]
> > - Milk-V Pioneer board [2], which uses SG2042 chip.
> >
> > [1]: https://en.sophgo.com/product/introduce/sg2042.html
> > [2]: https://milkv.io/pioneer
>
> If you resend, make these link tags please. Otherwise,
> Reviewed-by: Conor Dooley <[email protected]>
>
Sure, I will correct them in next revision. Thanks.

> Thanks,
> Conor.
>
> > Acked-by: Xiaoguang Xing <[email protected]>
> > Signed-off-by: Chen Wang <[email protected]>
> > ---
> > Documentation/devicetree/bindings/vendor-prefixes.yaml | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > index 573578db9509..fcca9e070a9a 100644
> > --- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > +++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
> > @@ -863,6 +863,8 @@ patternProperties:
> > description: MikroElektronika d.o.o.
> > "^mikrotik,.*":
> > description: MikroTik
> > + "^milkv,.*":
> > + description: MilkV Technology Co., Ltd
> > "^miniand,.*":
> > description: Miniand Tech
> > "^minix,.*":
> > @@ -1273,6 +1275,8 @@ patternProperties:
> > description: Solomon Systech Limited
> > "^sony,.*":
> > description: Sony Corporation
> > + "^sophgo,.*":
> > + description: Sophgo Technology Inc.
> > "^sourceparts,.*":
> > description: Source Parts Inc.
> > "^spansion,.*":
> > --
> > 2.25.1
> >

2023-09-21 01:38:22

by Palmer Dabbelt

[permalink] [raw]
Subject: Re: [PATCH v2 00/11] Add Milk-V Pioneer RISC-V board support

On Tue, 19 Sep 2023 23:33:48 PDT (-0700), [email protected] wrote:
> Milk-V Pioneer [1] is a developer motherboard based on SOPHON SG2042 [2]
> in a standard mATX form factor. Add minimal device
> tree files for the SG2042 SOC and the Milk-V Pioneer board.
>
> Now only support basic uart drivers to boot up into a basic console.
>
> Thanks,
> Chen
>
> ---
>
> Changes in v2:
> The patch series is based on v6.6-rc1. You can simply review or test
> the patches at the link [4].
> - Improve format for comment of commitments as per input from last review.
> - Improve format of DTS as per input from last review.
> - Remove numa related stuff from DTS. This part is just for optimization, may
> add it later if really needed.
>
> Previous versions:
> v1: due to it is not sent in thread, I have listed permlinks of the patchset
> [v1-0/12] ~ [v1-12/12] here for quick reference. You can simply review or
> test the patches at the link [3].
>
> [1]: https://milkv.io/pioneer
> [2]: https://en.sophgo.com/product/introduce/sg2042.html
> [3]: https://github.com/unicornx/linux-riscv/commits/milkv-pioneer-minimal
> [4]: https://github.com/unicornx/linux-riscv/commits/milkv-pioneer-minimal-v2
> [v1-0/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-1/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-2/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-3/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-4/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-5/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-6/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-7/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-8/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-9/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-10/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-11/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> [v1-12/12]:https://lore.kernel.org/linux-riscv/[email protected]/
>
> ---
>
> Chen Wang (8):
> riscv: Add SOPHGO SOC family Kconfig support
> dt-bindings: vendor-prefixes: add milkv/sophgo
> dt-bindings: riscv: add sophgo sg2042 bindings
> dt-bindings: riscv: Add T-HEAD C920 compatibles
> dt-bindings: interrupt-controller: Add SOPHGO's SG2042 PLIC
> riscv: dts: add initial SOPHGO SG2042 SoC device tree
> riscv: dts: sophgo: add Milk-V Pioneer board device tree
> riscv: defconfig: enable SOPHGO SoC
>
> Emil Renner Berthing (2):
> dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2042 uarts
> serial: 8250_dw: Add Sophgo SG2042 support
>
> Inochi Amaoto (1):
> dt-bindings: timer: Add Sophgo sg2042 clint
>
> .../sifive,plic-1.0.0.yaml | 1 +
> .../devicetree/bindings/riscv/cpus.yaml | 1 +
> .../devicetree/bindings/riscv/sophgo.yaml | 28 +
> .../bindings/serial/snps-dw-apb-uart.yaml | 1 +
> .../bindings/timer/sifive,clint.yaml | 8 +
> .../devicetree/bindings/vendor-prefixes.yaml | 4 +
> MAINTAINERS | 7 +
> arch/riscv/Kconfig.socs | 5 +
> arch/riscv/boot/dts/Makefile | 1 +
> arch/riscv/boot/dts/sophgo/Makefile | 3 +
> arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 1744 +++++++++++++++++
> .../boot/dts/sophgo/sg2042-milkv-pioneer.dts | 19 +
> arch/riscv/boot/dts/sophgo/sg2042.dtsi | 439 +++++
> arch/riscv/configs/defconfig | 1 +
> drivers/tty/serial/8250/8250_dw.c | 5 +-
> 15 files changed, 2265 insertions(+), 2 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/riscv/sophgo.yaml
> create mode 100644 arch/riscv/boot/dts/sophgo/Makefile
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2042.dtsi

Given this is the first sg2042 and it appears to have a few errata (the
FP rounding issues and the special fence for starvation), I think we
want to make sure we figure out how to provide that information to
userspace.

> base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d

2023-09-21 05:11:37

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>On Wed, Sep 20, 2023 at 07:24:21PM +0800, Inochi Amaoto wrote:
>>>
>>> Yo,
>>>
>>> On Wed, Sep 20, 2023 at 05:08:41PM +0800, Inochi Amaoto wrote:
>>>>> On Wed, Sep 20, 2023 at 02:39:39PM +0800, Chen Wang wrote:
>>>>>> From: Inochi Amaoto <[email protected]>
>>>>>>
>>>>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>>>>>> the timer and ipi device separately, and do not allow c900-clint as the
>>>>>> fallback to avoid conflict.
>>>>>>
>>>>>> Signed-off-by: Inochi Amaoto <[email protected]>
>>>>>> Signed-off-by: Chen Wang <[email protected]>
>>>>>
>>>>> Have you ignored Krzysztof's comments on this? I don't see a response or
>>>>> a reaction to his comments about the compatibles on the last version.
>>>>> Additionally, where is the user for these? I don't see any drivers that
>>>>> actually make use of these.
>>>>>
>>>>
>>>> Sorry for late reply and wrong message-id.
>>>>
>>>> The clint is parsed by sbi.
>>>
>>> That needs to go in the commit message.
>>
>> Yes, it will.
>
>Thanks.
>
>>>> As use the same compatible, the opensbi will
>>>> parse the device twice. This will cause a fault.
>>>
>>> Then only have one compatible with 2 register ranges? Then your SBI
>>> implementation can use those two register ranges to find out the base
>>> address for the mtimer bits and for the mswi bits.
>>> I don't understand why this cannot be done, could you please explain.
>>
>> That is a good idea, but now SBI use the second register ranges as
>> mtimecmp address for aclint. And there is a aclint-mswi in the SBI.
>> Maybe a change is needed?
>
>Yeah, I don't think the model for this in OpenSBI at the moment (and
>since I checked, in QEMU too) is correct. I think we should re-do things
>correctly and it'd be great if things didn't get merged to those
>projects that end up being objected to by dt-binding people.
>I've started keeping a closer eye on QEMU recently in that regard, but I
>am not super attentive. I'll try to be better at that going forward!
>
>>
>>> I also don't see anything in the opensbi repo right now that is using
>>> these (nor could I easily see any patches for opensbi adding this).
>>> Is there another SBI implementation that you are using that I can take
>>> a look at to try and understand this better?
>>>
>>
>> This will be sumbit in a short time.
>> Now we only use it is sophgo vendor SBI, which url is [1].
>>
>> [1] https://github.com/sophgo/opensbi
>
>Thanks.
>
>>>>> Why do you need to have 2 compatibles (and therefore 2 devices) for the
>>>>> clint? I thought the clint was a single device, of which the mtimer and
>>>>> mswi bits were just "features"? Having split register ranges isn't a
>>>>> reason to have two compatibles, so I must be missing something here...
>>>
>>>> Sorry for late reply, The clint consists of mtimer and ipi devices, which
>>>> is defined in [1].
>>>
>>> Yes, I have looked at the spec. I went to check it again before replying
>>> here in case there was something immediately obvious that I was missing.
>>>
>>
>> I think nothing missed.
>>
>>>> This standard shows clint(or the aclint) has two device,
>>>
>>> The wording used here doesn't really matter. It's one interrupt
>>> controller that does mtimer and mswi.
>>>
>>>> but not one. In another word, there is no need to defined mtimer and ipi
>>>> device on the same base address.
>>>
>>> There's also no need to have two compatibles for the same interrupt
>>> controller, so I do not get this reasoning. What actually _requires_
>>> them to be split?
>>>
>>
>> Yes, it is one, but can be mapped into different address. So I think we
>> need two.
>
>Not two compatibles though, just two memory addresses that you need to
>locate (or maybe even 3, for SSWI?)
>

We may need four (mtime, mtimecmp, mswi, sswi) if use register range.

Anyway, I will use a vendor spec implementation as a temporary solution.
I hope this will be corrected in a predictable future, and we can use a
standard way to resolve this at that time. :)

>>
>>>> So we need two compatibles to allow sbi to identify them correctly.
>>>
>>> Why is it not sufficient to identify the individual memory regions?
>>>
>>
>> FYI, Anup. As I have no idea for aclint implementation.
>>
>>> Thanks,
>>> Conor.
>>>
>

2023-09-21 18:20:43

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 09/11] riscv: dts: add initial SOPHGO SG2042 SoC device tree

On Thu, Sep 21, 2023 at 06:27:09PM +0800, Chen Wang wrote:
> Conor Dooley <[email protected]> 于2023年9月21日周四 18:15写道:
> >
> > On Thu, Sep 21, 2023 at 05:56:28PM +0800, Chen Wang wrote:

> > > > > +
> > > > > +/ {
> > > > > + compatible = "sophgo,sg2042";
> > > > > + #address-cells = <2>;
> > > > > + #size-cells = <2>;
> > > > > + dma-noncoherent;
> > > > > +
> > > > > + aliases {
> > > > > + serial0 = &uart0;
> > > > > + };
> > > > > +
> > > > > + /* the mem node will be updated by ZSBL. */
> > > >
> > > > huh? So these are random numbers below? Either put something useful here
> > > > or delete it please.
> > >
> > > The memory for SG2042 is not fixed, the bootloader will detect memory
> > > installed on board during booting and fill the actual address and size
> > > in the memory node. The comment " /* the mem node will be updated by
> > > ZSBL. */" is telling this.
> >
> > Yes, I read the comment!
> >
> > > We write memory nodes like this to make them act just as placeholders
> > > and the value is by default written as zero.
> >
> > Why knowingly add something that is wrong, rather than omitting them
> > entirely?
>
> We learn this from arch/arm64/boot/dts/hisilicon/hi3660-hikey960.dts,
> it writes DTS as following:
>
> ```
> memory@0 {
> device_type = "memory";
> /* rewrite this at bootloader */
> reg = <0x0 0x0 0x0 0x0>;
> };
> ```
> So you mean we can totally remove the memory nodes in DTS and make
> bootloader add it by itself? That sounds a good idea, I will have a
> try. I used to think memory nodes are must-have in DTS.

AFAIR, the ones for the d1 based systems (like the nezha I have) don't
have a memory node at all.


Attachments:
(No filename) (1.79 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-21 19:24:37

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 03/11] dt-bindings: riscv: add sophgo sg2042 bindings

On Thu, Sep 21, 2023 at 06:21:08PM +0800, Chen Wang wrote:
> Conor Dooley <[email protected]> 于2023年9月20日周三 16:29写道:
> > On Wed, Sep 20, 2023 at 02:37:51PM +0800, Chen Wang wrote:
> > > Add DT binding documentation for the Sophgo SG2042 Soc [1] and the
> > > Milk-V Pioneer board [2].
> > >
> > > [1]: https://en.sophgo.com/product/introduce/sg2042.html
> > > [2]: https://milkv.io/pioneer
> >
> > Again, link tags please.
> >
> > > Acked-by: Chao Wei <[email protected]>
> > > Acked-by: Xiaoguang Xing <[email protected]>
> > > Signed-off-by: Chen Wang <[email protected]>
> > > ---
> > > .../devicetree/bindings/riscv/sophgo.yaml | 28 +++++++++++++++++++
> > > MAINTAINERS | 7 +++++
> > > 2 files changed, 35 insertions(+)
> > > create mode 100644 Documentation/devicetree/bindings/riscv/sophgo.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/riscv/sophgo.yaml b/Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > new file mode 100644
> > > index 000000000000..82468ae915db
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > @@ -0,0 +1,28 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/riscv/sophgo.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Sophgo SoC-based boards
> > > +
> > > +maintainers:
> > > + - Chao Wei <[email protected]>
> > > + - Xiaoguang Xing <[email protected]>
> > > +
> > > +description:
> > > + Sophgo SoC-based boards
> > > +
> > > +properties:
> > > + $nodename:
> > > + const: '/'
> > > + compatible:
> > > + oneOf:
> > > + - items:
> > > + - enum:
> > > + - milkv,pioneer
> > > + - const: sophgo,sg2042
> > > +
> > > +additionalProperties: true
> > > +
> > > +...
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index 90f13281d297..b74d505003e2 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -20063,6 +20063,13 @@ F: drivers/char/sonypi.c
> > > F: drivers/platform/x86/sony-laptop.c
> > > F: include/linux/sony-laptop.h
> > >
> > > +SOPHGO DEVICETREES
> > > +M: Xiaoguang Xing <[email protected]>
> > > +M: Chao Wei <[email protected]>
> > > +S: Maintained
> > > +F: Documentation/devicetree/bindings/riscv/sophgo.yaml
> >
> > > +F: arch/riscv/boot/dts/sophgo/
> >
> > Firstly, this directory does not exist at the time of this patch, so it
> > should not be added here, but rather at the time that you create it.
> >
> > Secondly, are Xiaoguang Xing and Chao Wei going to monitor the lists &
> > apply patches for these files? If so, you should add a git tree here
> > that they will apply patches to & add to linux-next. Also, I'd really
> > like to see some on-list signs of life from these people, otherwise
> > I'd rather see your name here instead of theirs.
> >
> > If they don't intend reviewing/testing/applying patches, I can do it as
> > a last resort but I would rather that someone who specifically cares for
> > this hardware does it.
>
> Please allow me to explain first. As a community volunteer, I actually
> had full discussions and testing with Sophgo people when submitting
> patches, so I added tag such "Acked-by: Xiaoguang Xing ..." to the
> signature part of most patches. Also if you think a formal email is
> required, I will talk them to send it.

No, I'm okay with the acks that are on these patches. I just want to
make sure that those who are acking know why they are & am wondering why
your name is not there, seeing as you're the one who has submitted these
patches.

> As for the issue of MAINTAINERS, I discussed it with the people from
> Sophgo. They (including me also) feel that we are not very familiar
> with the community process (especially as maintainer, and actually I
> modify the file MAINTAINERS is just to suppress warning information
> when running checkpatch.pl), so we sincerely hope to invite you, Mr.
> Conor,

Oh god, there's no need to call me "Mr. Conor". Conor will do perfectly
fine!

> to help us for a period of time on maintenance work, including
> checking relevant patches, merging and submitting PRs, we will learn
> together with you for a while, and then take over this part of the
> work when we become familiar with it. We know that you are also very
> busy at work, especially if you don't have the hardware at hand. I
> have the hardware here and I can take the responsibility to run
> testing. What do you think? I'm waiting for your reply. Thanks in
> advance.

That seems fine to me. In that case, you should add yourself to the
MAINTAINERS entry.

Thanks,
Conor.


Attachments:
(No filename) (4.76 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-21 19:38:38

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

Yo,

On Thu, Sep 21, 2023 at 04:18:57PM +0800, Inochi Amaoto wrote:
> >On Thu, Sep 21, 2023 at 08:43:47AM +0800, Inochi Amaoto wrote:

> >>>>>> but not one. In another word, there is no need to defined mtimer and ipi
> >>>>>> device on the same base address.
> >>>>>
> >>>>> There's also no need to have two compatibles for the same interrupt
> >>>>> controller, so I do not get this reasoning. What actually _requires_
> >>>>> them to be split?
> >>>>>
> >>>>
> >>>> Yes, it is one, but can be mapped into different address. So I think we
> >>>> need two.
> >>>
> >>> Not two compatibles though, just two memory addresses that you need to
> >>> locate (or maybe even 3, for SSWI?)
> >>>
> >>
> >> We may need four (mtime, mtimecmp, mswi, sswi) if use register range.
> >
> >Why would you need 4? The first two certainly could be individual
> >reg entries, no?
> >
>
> After reading the aclint doc again, I found the all of them can be mapped
> on the different address. (See the section 2.1 in that doc).

Right, that's what I meant by individual reg entries. If there's some
dynamic gap between them, then one reg entry would cover mtime and one
would cover the base of the mtimecmp region.

> But for now,
> the mtime and mtimecmp have the same base address in any platform.

How? The mtimecmp base address would have to be offset from the mtime
base address. Is what you mean that, for example, mtime is at an offset
of 0x0 from the base address & mtimecmp0 is at, for example, an offset
of 0x8 so a single reg entry can cover both?

Also, "any platform"? I figure you mean in this one specific platform?

> Anyway,
> the frozen spec in future will decided how many ranges we need.

Isn't the spec abandoned? There may well be no frozen spec.

> >> Anyway, I will use a vendor spec implementation as a temporary solution.
> >> I hope this will be corrected in a predictable future, and we can use a
> >> standard way to resolve this at that time. :)
> >
> >If the spec doesn't get frozen, there'll not be a standard way merged.
> >Hopefully not too many others go off an implement non-frozen specs, and
> >we will not really need to worry all that much about it.

Cheers,
Conor.


Attachments:
(No filename) (2.19 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-21 22:30:01

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Thu, Sep 21, 2023 at 08:43:47AM +0800, Inochi Amaoto wrote:

> >>>> but not one. In another word, there is no need to defined mtimer and ipi
> >>>> device on the same base address.
> >>>
> >>> There's also no need to have two compatibles for the same interrupt
> >>> controller, so I do not get this reasoning. What actually _requires_
> >>> them to be split?
> >>>
> >>
> >> Yes, it is one, but can be mapped into different address. So I think we
> >> need two.
> >
> >Not two compatibles though, just two memory addresses that you need to
> >locate (or maybe even 3, for SSWI?)
> >
>
> We may need four (mtime, mtimecmp, mswi, sswi) if use register range.

Why would you need 4? The first two certainly could be individual
reg entries, no?

> Anyway, I will use a vendor spec implementation as a temporary solution.
> I hope this will be corrected in a predictable future, and we can use a
> standard way to resolve this at that time. :)

If the spec doesn't get frozen, there'll not be a standard way merged.
Hopefully not too many others go off an implement non-frozen specs, and
we will not really need to worry all that much about it.

Cheers,
Conor.


Attachments:
(No filename) (1.17 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-21 23:15:14

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 03/11] dt-bindings: riscv: add sophgo sg2042 bindings

Regards,

unicornx

Conor Dooley <[email protected]> 于2023年9月21日周四 20:18写道:
>
> On Thu, Sep 21, 2023 at 06:21:08PM +0800, Chen Wang wrote:
> > Conor Dooley <[email protected]> 于2023年9月20日周三 16:29写道:
> > > On Wed, Sep 20, 2023 at 02:37:51PM +0800, Chen Wang wrote:
> > > > Add DT binding documentation for the Sophgo SG2042 Soc [1] and the
> > > > Milk-V Pioneer board [2].
> > > >
> > > > [1]: https://en.sophgo.com/product/introduce/sg2042.html
> > > > [2]: https://milkv.io/pioneer
> > >
> > > Again, link tags please.
> > >
> > > > Acked-by: Chao Wei <[email protected]>
> > > > Acked-by: Xiaoguang Xing <[email protected]>
> > > > Signed-off-by: Chen Wang <[email protected]>
> > > > ---
> > > > .../devicetree/bindings/riscv/sophgo.yaml | 28 +++++++++++++++++++
> > > > MAINTAINERS | 7 +++++
> > > > 2 files changed, 35 insertions(+)
> > > > create mode 100644 Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/riscv/sophgo.yaml b/Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > > new file mode 100644
> > > > index 000000000000..82468ae915db
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > > @@ -0,0 +1,28 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/riscv/sophgo.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Sophgo SoC-based boards
> > > > +
> > > > +maintainers:
> > > > + - Chao Wei <[email protected]>
> > > > + - Xiaoguang Xing <[email protected]>
> > > > +
> > > > +description:
> > > > + Sophgo SoC-based boards
> > > > +
> > > > +properties:
> > > > + $nodename:
> > > > + const: '/'
> > > > + compatible:
> > > > + oneOf:
> > > > + - items:
> > > > + - enum:
> > > > + - milkv,pioneer
> > > > + - const: sophgo,sg2042
> > > > +
> > > > +additionalProperties: true
> > > > +
> > > > +...
> > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > index 90f13281d297..b74d505003e2 100644
> > > > --- a/MAINTAINERS
> > > > +++ b/MAINTAINERS
> > > > @@ -20063,6 +20063,13 @@ F: drivers/char/sonypi.c
> > > > F: drivers/platform/x86/sony-laptop.c
> > > > F: include/linux/sony-laptop.h
> > > >
> > > > +SOPHGO DEVICETREES
> > > > +M: Xiaoguang Xing <[email protected]>
> > > > +M: Chao Wei <[email protected]>
> > > > +S: Maintained
> > > > +F: Documentation/devicetree/bindings/riscv/sophgo.yaml
> > >
> > > > +F: arch/riscv/boot/dts/sophgo/
> > >
> > > Firstly, this directory does not exist at the time of this patch, so it
> > > should not be added here, but rather at the time that you create it.
> > >
> > > Secondly, are Xiaoguang Xing and Chao Wei going to monitor the lists &
> > > apply patches for these files? If so, you should add a git tree here
> > > that they will apply patches to & add to linux-next. Also, I'd really
> > > like to see some on-list signs of life from these people, otherwise
> > > I'd rather see your name here instead of theirs.
> > >
> > > If they don't intend reviewing/testing/applying patches, I can do it as
> > > a last resort but I would rather that someone who specifically cares for
> > > this hardware does it.
> >
> > Please allow me to explain first. As a community volunteer, I actually
> > had full discussions and testing with Sophgo people when submitting
> > patches, so I added tag such "Acked-by: Xiaoguang Xing ..." to the
> > signature part of most patches. Also if you think a formal email is
> > required, I will talk them to send it.
>
> No, I'm okay with the acks that are on these patches. I just want to
> make sure that those who are acking know why they are & am wondering why
> your name is not there, seeing as you're the one who has submitted these
> patches.
>
> > As for the issue of MAINTAINERS, I discussed it with the people from
> > Sophgo. They (including me also) feel that we are not very familiar
> > with the community process (especially as maintainer, and actually I
> > modify the file MAINTAINERS is just to suppress warning information
> > when running checkpatch.pl), so we sincerely hope to invite you, Mr.
> > Conor,
>
> Oh god, there's no need to call me "Mr. Conor". Conor will do perfectly
> fine!
>
> > to help us for a period of time on maintenance work, including
> > checking relevant patches, merging and submitting PRs, we will learn
> > together with you for a while, and then take over this part of the
> > work when we become familiar with it. We know that you are also very
> > busy at work, especially if you don't have the hardware at hand. I
> > have the hardware here and I can take the responsibility to run
> > testing. What do you think? I'm waiting for your reply. Thanks in
> > advance.
>
> That seems fine to me. In that case, you should add yourself to the
> MAINTAINERS entry.
>
> Thanks,
> Conor.

Okay,I will add it in next revision, thank you again.

2023-09-21 23:57:22

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 03/11] dt-bindings: riscv: add sophgo sg2042 bindings

On Thu, Sep 21, 2023 at 09:51:58PM +0800, Chen Wang wrote:

> Conor, do you want me to add you to the MAINTAINERS entry too?

Nope, no need. My existing maintainers entries should cover it.

Thanks,
Conor.


Attachments:
(No filename) (214.00 B)
signature.asc (235.00 B)
Download all attachments

2023-09-22 01:14:03

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 03/11] dt-bindings: riscv: add sophgo sg2042 bindings

Regards,

unicornx

Conor Dooley <[email protected]> 于2023年9月21日周四 20:18写道:
>
> On Thu, Sep 21, 2023 at 06:21:08PM +0800, Chen Wang wrote:
> > Conor Dooley <[email protected]> 于2023年9月20日周三 16:29写道:
> > > On Wed, Sep 20, 2023 at 02:37:51PM +0800, Chen Wang wrote:
> > > > Add DT binding documentation for the Sophgo SG2042 Soc [1] and the
> > > > Milk-V Pioneer board [2].
> > > >
> > > > [1]: https://en.sophgo.com/product/introduce/sg2042.html
> > > > [2]: https://milkv.io/pioneer
> > >
> > > Again, link tags please.
> > >
> > > > Acked-by: Chao Wei <[email protected]>
> > > > Acked-by: Xiaoguang Xing <[email protected]>
> > > > Signed-off-by: Chen Wang <[email protected]>
> > > > ---
> > > > .../devicetree/bindings/riscv/sophgo.yaml | 28 +++++++++++++++++++
> > > > MAINTAINERS | 7 +++++
> > > > 2 files changed, 35 insertions(+)
> > > > create mode 100644 Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/riscv/sophgo.yaml b/Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > > new file mode 100644
> > > > index 000000000000..82468ae915db
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/riscv/sophgo.yaml
> > > > @@ -0,0 +1,28 @@
> > > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/riscv/sophgo.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Sophgo SoC-based boards
> > > > +
> > > > +maintainers:
> > > > + - Chao Wei <[email protected]>
> > > > + - Xiaoguang Xing <[email protected]>
> > > > +
> > > > +description:
> > > > + Sophgo SoC-based boards
> > > > +
> > > > +properties:
> > > > + $nodename:
> > > > + const: '/'
> > > > + compatible:
> > > > + oneOf:
> > > > + - items:
> > > > + - enum:
> > > > + - milkv,pioneer
> > > > + - const: sophgo,sg2042
> > > > +
> > > > +additionalProperties: true
> > > > +
> > > > +...
> > > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > > index 90f13281d297..b74d505003e2 100644
> > > > --- a/MAINTAINERS
> > > > +++ b/MAINTAINERS
> > > > @@ -20063,6 +20063,13 @@ F: drivers/char/sonypi.c
> > > > F: drivers/platform/x86/sony-laptop.c
> > > > F: include/linux/sony-laptop.h
> > > >
> > > > +SOPHGO DEVICETREES
> > > > +M: Xiaoguang Xing <[email protected]>
> > > > +M: Chao Wei <[email protected]>
> > > > +S: Maintained
> > > > +F: Documentation/devicetree/bindings/riscv/sophgo.yaml
> > >
> > > > +F: arch/riscv/boot/dts/sophgo/
> > >
> > > Firstly, this directory does not exist at the time of this patch, so it
> > > should not be added here, but rather at the time that you create it.
> > >
> > > Secondly, are Xiaoguang Xing and Chao Wei going to monitor the lists &
> > > apply patches for these files? If so, you should add a git tree here
> > > that they will apply patches to & add to linux-next. Also, I'd really
> > > like to see some on-list signs of life from these people, otherwise
> > > I'd rather see your name here instead of theirs.
> > >
> > > If they don't intend reviewing/testing/applying patches, I can do it as
> > > a last resort but I would rather that someone who specifically cares for
> > > this hardware does it.
> >
> > Please allow me to explain first. As a community volunteer, I actually
> > had full discussions and testing with Sophgo people when submitting
> > patches, so I added tag such "Acked-by: Xiaoguang Xing ..." to the
> > signature part of most patches. Also if you think a formal email is
> > required, I will talk them to send it.
>
> No, I'm okay with the acks that are on these patches. I just want to
> make sure that those who are acking know why they are & am wondering why
> your name is not there, seeing as you're the one who has submitted these
> patches.
>
> > As for the issue of MAINTAINERS, I discussed it with the people from
> > Sophgo. They (including me also) feel that we are not very familiar
> > with the community process (especially as maintainer, and actually I
> > modify the file MAINTAINERS is just to suppress warning information
> > when running checkpatch.pl), so we sincerely hope to invite you, Mr.
> > Conor,
>
> Oh god, there's no need to call me "Mr. Conor". Conor will do perfectly
> fine!
>
> > to help us for a period of time on maintenance work, including
> > checking relevant patches, merging and submitting PRs, we will learn
> > together with you for a while, and then take over this part of the
> > work when we become familiar with it. We know that you are also very
> > busy at work, especially if you don't have the hardware at hand. I
> > have the hardware here and I can take the responsibility to run
> > testing. What do you think? I'm waiting for your reply. Thanks in
> > advance.
>
> That seems fine to me. In that case, you should add yourself to the
> MAINTAINERS entry.
>
> Thanks,
> Conor.

Conor, do you want me to add you to the MAINTAINERS entry too?

2023-09-22 04:02:31

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>
>On Thu, Sep 21, 2023 at 08:43:47AM +0800, Inochi Amaoto wrote:
>
>>>>>> but not one. In another word, there is no need to defined mtimer and ipi
>>>>>> device on the same base address.
>>>>>
>>>>> There's also no need to have two compatibles for the same interrupt
>>>>> controller, so I do not get this reasoning. What actually _requires_
>>>>> them to be split?
>>>>>
>>>>
>>>> Yes, it is one, but can be mapped into different address. So I think we
>>>> need two.
>>>
>>> Not two compatibles though, just two memory addresses that you need to
>>> locate (or maybe even 3, for SSWI?)
>>>
>>
>> We may need four (mtime, mtimecmp, mswi, sswi) if use register range.
>
>Why would you need 4? The first two certainly could be individual
>reg entries, no?
>

After reading the aclint doc again, I found the all of them can be mapped
on the different address. (See the section 2.1 in that doc). But for now,
the mtime and mtimecmp have the same base address in any platform. Anyway,
the frozen spec in future will decided how many ranges we need.

>> Anyway, I will use a vendor spec implementation as a temporary solution.
>> I hope this will be corrected in a predictable future, and we can use a
>> standard way to resolve this at that time. :)
>
>If the spec doesn't get frozen, there'll not be a standard way merged.
>Hopefully not too many others go off an implement non-frozen specs, and
>we will not really need to worry all that much about it.
>
>Cheers,
>Conor.
>

2023-09-22 07:51:11

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

On Fri, Sep 22, 2023 at 01:16:35PM +0800, Inochi Amaoto wrote:

> >> The SiFive CLINT has flexibility related limitations which makes it
> >> not useful for multi-socket and mult-die systems. The SiFive CLINT
> >> is also not useful for systems with AIA because with AIA M-mode has
> >> a new way of doing M-mode IPIs. Due to this reasons, the RISC-V
> >> ACLINT spec breaks down traditional SiFive CLINT into two separate
> >> devices namely mtimer and mswi. This allows platforms to implement
> >> only the required set of devices. The mtimer as defined by the ACLINT
> >> specifications also allows platforms to place mtime and mtimecmp
> >> registers at different locations.
> >>
> >> Refer, https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc
> >>
> >> We need a separate DT bindings document for ACLINT MTIMER
> >> and ACLINT MSWI because these are separate devices. The
> >> Sophgo sg2042 SoC should add their implementation specific
> >> compatible strings in this document.
> >
> >If the spec isn't frozen, I'm not accepting a binding for the "generic"
> >version of it. Bindings for this specific implemtnation are okay.
> >For sure though, squeezing this into the sifive,plic binding isn't
> >appropriate.
> >
>
> It seems I have missed a point. I wonder whether it is better to add a
> "aclint" binding firstly and then add sg2042 to it, or just use sg2042
> specific binding?

sg2042 specific, being frozen is a requirement for merging patches
related to RVI specifications.

> If use "aclint" binding, I wonder it is OK to add
> thead quirks as compatible specific properties, or left this to the SBI to
> handle? e.g. T-HEAD timer is not 64bit timer, and we should identify this.

The compatible string alone should be sufficient to identify the width
of the timer etc.

Thanks,
Conor.


Attachments:
(No filename) (1.81 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-22 11:23:14

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v2 00/11] Add Milk-V Pioneer RISC-V board support

On Fri, Sep 22, 2023 at 06:24:25PM +0800, Chen Wang wrote:
> Regards,
>
> unicornx
>
> Conor Dooley <[email protected]> 于2023年9月20日周三 18:01写道:
> >
> > On Wed, Sep 20, 2023 at 02:33:48PM +0800, Chen Wang wrote:
> > > Milk-V Pioneer [1] is a developer motherboard based on SOPHON SG2042 [2]
> > > in a standard mATX form factor. Add minimal device
> > > tree files for the SG2042 SOC and the Milk-V Pioneer board.
> >
> > Please run dtbs_check with W=1 set & fix the below issues:
> >
> > sg2042-cpus.dtsi:1600.25-1607.5: Warning (unit_address_vs_reg): /cpus/l2-cache@0: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1609.25-1616.5: Warning (unit_address_vs_reg): /cpus/l2-cache@1: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1618.25-1625.5: Warning (unit_address_vs_reg): /cpus/l2-cache@2: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1627.25-1634.5: Warning (unit_address_vs_reg): /cpus/l2-cache@3: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1636.25-1643.5: Warning (unit_address_vs_reg): /cpus/l2-cache@4: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1645.25-1652.5: Warning (unit_address_vs_reg): /cpus/l2-cache@5: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1654.25-1661.5: Warning (unit_address_vs_reg): /cpus/l2-cache@6: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1663.25-1670.5: Warning (unit_address_vs_reg): /cpus/l2-cache@7: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1672.25-1679.5: Warning (unit_address_vs_reg): /cpus/l2-cache@8: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1681.25-1688.5: Warning (unit_address_vs_reg): /cpus/l2-cache@9: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1690.27-1697.5: Warning (unit_address_vs_reg): /cpus/l2-cache@10: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1699.27-1706.5: Warning (unit_address_vs_reg): /cpus/l2-cache@11: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1708.27-1715.5: Warning (unit_address_vs_reg): /cpus/l2-cache@12: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1717.27-1724.5: Warning (unit_address_vs_reg): /cpus/l2-cache@13: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1726.27-1733.5: Warning (unit_address_vs_reg): /cpus/l2-cache@14: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:1735.27-1742.5: Warning (unit_address_vs_reg): /cpus/l2-cache@15: node has a unit name, but no reg or ranges property
> > sg2042-cpus.dtsi:256.15-275.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@0: duplicate unit-address (also used in node /cpus/l2-cache@0)
> > sg2042-cpus.dtsi:277.15-296.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@1: duplicate unit-address (also used in node /cpus/l2-cache@1)
> > sg2042-cpus.dtsi:298.15-317.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@2: duplicate unit-address (also used in node /cpus/l2-cache@2)
> > sg2042-cpus.dtsi:319.15-338.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@3: duplicate unit-address (also used in node /cpus/l2-cache@3)
> > sg2042-cpus.dtsi:340.15-359.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@4: duplicate unit-address (also used in node /cpus/l2-cache@4)
> > sg2042-cpus.dtsi:361.15-380.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@5: duplicate unit-address (also used in node /cpus/l2-cache@5)
> > sg2042-cpus.dtsi:382.15-401.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@6: duplicate unit-address (also used in node /cpus/l2-cache@6)
> > sg2042-cpus.dtsi:403.15-422.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@7: duplicate unit-address (also used in node /cpus/l2-cache@7)
> > sg2042-cpus.dtsi:424.15-443.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@8: duplicate unit-address (also used in node /cpus/l2-cache@8)
> > sg2042-cpus.dtsi:445.15-464.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@9: duplicate unit-address (also used in node /cpus/l2-cache@9)
> > sg2042-cpus.dtsi:466.17-485.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@10: duplicate unit-address (also used in node /cpus/l2-cache@10)
> > sg2042-cpus.dtsi:487.17-506.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@11: duplicate unit-address (also used in node /cpus/l2-cache@11)
> > sg2042-cpus.dtsi:508.17-527.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@12: duplicate unit-address (also used in node /cpus/l2-cache@12)
> > sg2042-cpus.dtsi:529.17-548.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@13: duplicate unit-address (also used in node /cpus/l2-cache@13)
> > sg2042-cpus.dtsi:550.17-569.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@14: duplicate unit-address (also used in node /cpus/l2-cache@14)
> > sg2042-cpus.dtsi:571.17-590.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@15: duplicate unit-address (also used in node /cpus/l2-cache@15)
> >
> > Thanks,
> > Conor.
>
> I find the rootcause is due to following code in DTS:
> ```
> l2_cache0: l2-cache@0 {
> compatible = "cache";
> cache-block-size = <64>;
> cache-level = <2>;
> cache-size = <1048576>;
> cache-sets = <1024>;
> cache-unified;
> };
> ```
> To differ 16 l2-cache controller, we add <unit-address>, but due to
> the l2-cache controller on sg2042 has no address, no reg property is
> added here. That's why dtbs_check warns "node has a unit name, but no
> reg or ranges property". I just double-confirmed with sophgo
> engineers, they told me there is really no address for the cache
> controller for sg2042.
>
> One solution I use here is to provide unique name for the l2-cache
> node. I learn this from "arch/arm64/boot/dts/hisilicon/hi3660.dtsi"
> and seems this work and pass dtbs_check with W=1. For example:
> ```
> l2_cache0: l2-cache0 {
> compatible = "cache";
> cache-block-size = <64>;
> cache-level = <2>;
> cache-size = <1048576>;
> cache-sets = <1024>;
> cache-unified;
> };
>
> l2_cache1: l2-cache1 {
> compatible = "cache";
> cache-block-size = <64>;
> cache-level = <2>;
> cache-size = <1048576>;
> cache-sets = <1024>;
> cache-unified;
> };
> ......
> ```
> But I remember as mentioned in
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation,
> node names should be generic. So I have two questions here:
> - Should I use "cache-controller" instead of "l2-cache", though I see
> "l2-cache" is used in many places but not listed in
> devicetree-specification.
> - Even if I replace "l2-cache" with "cache-controller", I think
> "cache-controller0", "cache-controller1" ... are not generic name, but
> due to sg2042 does not have address for cache controller, how to
> handle this problem?

I would go for "cache-controller-0" "cache-controller-1". Close as
possible to the generic node name while having the required differences
between nodes. There's already some examples in-tree (eg renesas) that
do this.

Thanks,
Conor.


Attachments:
(No filename) (7.65 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-22 11:38:30

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>
>On Fri, Sep 22, 2023 at 01:16:35PM +0800, Inochi Amaoto wrote:
>
>>>> The SiFive CLINT has flexibility related limitations which makes it
>>>> not useful for multi-socket and mult-die systems. The SiFive CLINT
>>>> is also not useful for systems with AIA because with AIA M-mode has
>>>> a new way of doing M-mode IPIs. Due to this reasons, the RISC-V
>>>> ACLINT spec breaks down traditional SiFive CLINT into two separate
>>>> devices namely mtimer and mswi. This allows platforms to implement
>>>> only the required set of devices. The mtimer as defined by the ACLINT
>>>> specifications also allows platforms to place mtime and mtimecmp
>>>> registers at different locations.
>>>>
>>>> Refer, https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc
>>>>
>>>> We need a separate DT bindings document for ACLINT MTIMER
>>>> and ACLINT MSWI because these are separate devices. The
>>>> Sophgo sg2042 SoC should add their implementation specific
>>>> compatible strings in this document.
>>>
>>> If the spec isn't frozen, I'm not accepting a binding for the "generic"
>>> version of it. Bindings for this specific implemtnation are okay.
>>> For sure though, squeezing this into the sifive,plic binding isn't
>>> appropriate.
>>>
>>
>> It seems I have missed a point. I wonder whether it is better to add a
>> "aclint" binding firstly and then add sg2042 to it, or just use sg2042
>> specific binding?
>
>sg2042 specific, being frozen is a requirement for merging patches
>related to RVI specifications.
>

Thanks

>> If use "aclint" binding, I wonder it is OK to add
>> thead quirks as compatible specific properties, or left this to the SBI to
>> handle? e.g. T-HEAD timer is not 64bit timer, and we should identify this.
>
>The compatible string alone should be sufficient to identify the width
>of the timer etc.
>

OK, I will take it

>Thanks,
>Conor.
>

2023-09-22 12:58:23

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 08/11] serial: 8250_dw: Add Sophgo SG2042 support

Regards,

unicornx

Emil Renner Berthing <[email protected]> 于2023年9月22日周五 18:40写道:
>
> Ben Dooks wrote:
> > On 20/09/2023 07:40, Chen Wang wrote:
> > > From: Emil Renner Berthing <[email protected]>
> > >
> > > Add quirk to skip setting the input clock rate for the uarts on the
> > > Sophgo SG2042 SoC similar to the StarFive JH7100.
> >
> > I'd love an actual explanation of why this is necessary here.
>
> Makes sense. For the JH7100 the commit message is:
>
> On the StarFive JH7100 RISC-V SoC the UART core clocks can't be set to
> exactly 16 * 115200Hz and many other common bitrates. Trying this will
> only result in a higher input clock, but low enough that the UART's
> internal divisor can't come close enough to the baud rate target.
> So rather than try to set the input clock it's better to skip the
> clk_set_rate call and rely solely on the UART's internal divisor.
>
> @Chen Wang is this also true for the SG2042?
>
> /Emil

Emil & Ben,
I need to double-confirm this with sophgo engineers. Because they are
off work now, I will probably get back to you later next week.

2023-09-22 14:33:27

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 00/11] Add Milk-V Pioneer RISC-V board support

Regards,

unicornx

Conor Dooley <[email protected]> 于2023年9月20日周三 18:01写道:
>
> On Wed, Sep 20, 2023 at 02:33:48PM +0800, Chen Wang wrote:
> > Milk-V Pioneer [1] is a developer motherboard based on SOPHON SG2042 [2]
> > in a standard mATX form factor. Add minimal device
> > tree files for the SG2042 SOC and the Milk-V Pioneer board.
>
> Please run dtbs_check with W=1 set & fix the below issues:
>
> sg2042-cpus.dtsi:1600.25-1607.5: Warning (unit_address_vs_reg): /cpus/l2-cache@0: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1609.25-1616.5: Warning (unit_address_vs_reg): /cpus/l2-cache@1: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1618.25-1625.5: Warning (unit_address_vs_reg): /cpus/l2-cache@2: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1627.25-1634.5: Warning (unit_address_vs_reg): /cpus/l2-cache@3: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1636.25-1643.5: Warning (unit_address_vs_reg): /cpus/l2-cache@4: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1645.25-1652.5: Warning (unit_address_vs_reg): /cpus/l2-cache@5: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1654.25-1661.5: Warning (unit_address_vs_reg): /cpus/l2-cache@6: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1663.25-1670.5: Warning (unit_address_vs_reg): /cpus/l2-cache@7: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1672.25-1679.5: Warning (unit_address_vs_reg): /cpus/l2-cache@8: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1681.25-1688.5: Warning (unit_address_vs_reg): /cpus/l2-cache@9: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1690.27-1697.5: Warning (unit_address_vs_reg): /cpus/l2-cache@10: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1699.27-1706.5: Warning (unit_address_vs_reg): /cpus/l2-cache@11: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1708.27-1715.5: Warning (unit_address_vs_reg): /cpus/l2-cache@12: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1717.27-1724.5: Warning (unit_address_vs_reg): /cpus/l2-cache@13: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1726.27-1733.5: Warning (unit_address_vs_reg): /cpus/l2-cache@14: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:1735.27-1742.5: Warning (unit_address_vs_reg): /cpus/l2-cache@15: node has a unit name, but no reg or ranges property
> sg2042-cpus.dtsi:256.15-275.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@0: duplicate unit-address (also used in node /cpus/l2-cache@0)
> sg2042-cpus.dtsi:277.15-296.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@1: duplicate unit-address (also used in node /cpus/l2-cache@1)
> sg2042-cpus.dtsi:298.15-317.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@2: duplicate unit-address (also used in node /cpus/l2-cache@2)
> sg2042-cpus.dtsi:319.15-338.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@3: duplicate unit-address (also used in node /cpus/l2-cache@3)
> sg2042-cpus.dtsi:340.15-359.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@4: duplicate unit-address (also used in node /cpus/l2-cache@4)
> sg2042-cpus.dtsi:361.15-380.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@5: duplicate unit-address (also used in node /cpus/l2-cache@5)
> sg2042-cpus.dtsi:382.15-401.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@6: duplicate unit-address (also used in node /cpus/l2-cache@6)
> sg2042-cpus.dtsi:403.15-422.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@7: duplicate unit-address (also used in node /cpus/l2-cache@7)
> sg2042-cpus.dtsi:424.15-443.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@8: duplicate unit-address (also used in node /cpus/l2-cache@8)
> sg2042-cpus.dtsi:445.15-464.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@9: duplicate unit-address (also used in node /cpus/l2-cache@9)
> sg2042-cpus.dtsi:466.17-485.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@10: duplicate unit-address (also used in node /cpus/l2-cache@10)
> sg2042-cpus.dtsi:487.17-506.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@11: duplicate unit-address (also used in node /cpus/l2-cache@11)
> sg2042-cpus.dtsi:508.17-527.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@12: duplicate unit-address (also used in node /cpus/l2-cache@12)
> sg2042-cpus.dtsi:529.17-548.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@13: duplicate unit-address (also used in node /cpus/l2-cache@13)
> sg2042-cpus.dtsi:550.17-569.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@14: duplicate unit-address (also used in node /cpus/l2-cache@14)
> sg2042-cpus.dtsi:571.17-590.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@15: duplicate unit-address (also used in node /cpus/l2-cache@15)
>
> Thanks,
> Conor.

I find the rootcause is due to following code in DTS:
```
l2_cache0: l2-cache@0 {
compatible = "cache";
cache-block-size = <64>;
cache-level = <2>;
cache-size = <1048576>;
cache-sets = <1024>;
cache-unified;
};
```
To differ 16 l2-cache controller, we add <unit-address>, but due to
the l2-cache controller on sg2042 has no address, no reg property is
added here. That's why dtbs_check warns "node has a unit name, but no
reg or ranges property". I just double-confirmed with sophgo
engineers, they told me there is really no address for the cache
controller for sg2042.

One solution I use here is to provide unique name for the l2-cache
node. I learn this from "arch/arm64/boot/dts/hisilicon/hi3660.dtsi"
and seems this work and pass dtbs_check with W=1. For example:
```
l2_cache0: l2-cache0 {
compatible = "cache";
cache-block-size = <64>;
cache-level = <2>;
cache-size = <1048576>;
cache-sets = <1024>;
cache-unified;
};

l2_cache1: l2-cache1 {
compatible = "cache";
cache-block-size = <64>;
cache-level = <2>;
cache-size = <1048576>;
cache-sets = <1024>;
cache-unified;
};
......
```
But I remember as mentioned in
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation,
node names should be generic. So I have two questions here:
- Should I use "cache-controller" instead of "l2-cache", though I see
"l2-cache" is used in many places but not listed in
devicetree-specification.
- Even if I replace "l2-cache" with "cache-controller", I think
"cache-controller0", "cache-controller1" ... are not generic name, but
due to sg2042 does not have address for cache controller, how to
handle this problem?

2023-09-22 14:38:58

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>
>On Wed, Sep 20, 2023 at 08:08:49PM +0530, Anup Patel wrote:
>> On Wed, Sep 20, 2023 at 6:28 PM Conor Dooley <[email protected]> wrote:
>>>
>>> On Wed, Sep 20, 2023 at 08:40:07PM +0800, Inochi Amaoto wrote:
>>>>> On 20/09/2023 14:15, Inochi Amaoto wrote:
>>>>>>> On 20/09/2023 08:39, Chen Wang wrote:
>>>>>>>> From: Inochi Amaoto <[email protected]>
>>>>>>>>
>>>>>>>> Add two new compatible string formatted like `C9xx-clint-xxx` to identify
>>>>>>>> the timer and ipi device separately, and do not allow c900-clint as the
>>>>>>>
>>>>>>> Why?
>>>>>>>
>>>>>>
>>>>>> If use the same compatible, SBI will process this twice in both ipi and
>>>>>> timer, use different compatible will allow SBI to treat these as different.
>>>>>> AFAIK, the aclint in SBI use the same concepts, which make hard to use the
>>>>>> second register range. I have explained in another response.
>>>>>
>>>>> What is a SBI? Linux driver? If so, why some intermediate Linux driver
>>>>> choice should affect bindings?
>>>>> Best regards,
>>>>> Krzysztof
>>>>>
>>>>
>>>> SBI (Supervisor Binary Interface) is defined by riscv, which is an interface
>>>> between the Supervisor Execution Environment (SEE) and the supervisor. The
>>>> detailed documentation can be found in [1].
>>>>
>>>> The implement of SBI needs fdt info of the platform, which is provided by
>>>> kernel. So we need a dt-bindings for these devices, and these will be
>>>> processed by SBI.
>>>>
>>>> [1] https://github.com/riscv-non-isa/riscv-sbi-doc
>>>
>>> Yeah, this is the unfortunate problem of half-baked bindings (IMO)
>>> ending up in OpenSBI (which likely means they also ended up in QEMU).
>>> This T-Head stuff is coming across our (metaphorical) desks, so we are
>>> obviously going to try to do things correctly. I may end up speaking to
>>> Anup later today, if I do I will point him at this thread (if he hasn't
>>> seen it already).
>>
>> RISC-V ACLINT is one of those unfortunate non-ISA specs (like
>> SiFive PLIC) which is implemented by various organizations but
>> not officially ratified by RVI.
>
>Yeah, I brought this stuff up at the weekly pw sync call, and Paul
>pointed that out.
>
>> The SiFive CLINT has flexibility related limitations which makes it
>> not useful for multi-socket and mult-die systems. The SiFive CLINT
>> is also not useful for systems with AIA because with AIA M-mode has
>> a new way of doing M-mode IPIs. Due to this reasons, the RISC-V
>> ACLINT spec breaks down traditional SiFive CLINT into two separate
>> devices namely mtimer and mswi. This allows platforms to implement
>> only the required set of devices. The mtimer as defined by the ACLINT
>> specifications also allows platforms to place mtime and mtimecmp
>> registers at different locations.
>>
>> Refer, https://github.com/riscv/riscv-aclint/blob/main/riscv-aclint.adoc
>>
>> We need a separate DT bindings document for ACLINT MTIMER
>> and ACLINT MSWI because these are separate devices. The
>> Sophgo sg2042 SoC should add their implementation specific
>> compatible strings in this document.
>
>If the spec isn't frozen, I'm not accepting a binding for the "generic"
>version of it. Bindings for this specific implemtnation are okay.
>For sure though, squeezing this into the sifive,plic binding isn't
>appropriate.
>

It seems I have missed a point. I wonder whether it is better to add a
"aclint" binding firstly and then add sg2042 to it, or just use sg2042
specific binding? If use "aclint" binding, I wonder it is OK to add
thead quirks as compatible specific properties, or left this to the SBI to
handle? e.g. T-HEAD timer is not 64bit timer, and we should identify this.

>What was pointed out, I think by Samuel, that the reason that this may
>need to be split is the fact that there are many possible MTIMER
>register ranges & possibly sswi stuff too that would need to be
>differentiated.
>
>>
>> Regards,
>> Anup
>

2023-09-22 15:24:52

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 00/11] Add Milk-V Pioneer RISC-V board support

Regards,

unicornx

Conor Dooley <[email protected]> 于2023年9月22日周五 18:50写道:
>
> On Fri, Sep 22, 2023 at 06:24:25PM +0800, Chen Wang wrote:
> > Regards,
> >
> > unicornx
> >
> > Conor Dooley <[email protected]> 于2023年9月20日周三 18:01写道:
> > >
> > > On Wed, Sep 20, 2023 at 02:33:48PM +0800, Chen Wang wrote:
> > > > Milk-V Pioneer [1] is a developer motherboard based on SOPHON SG2042 [2]
> > > > in a standard mATX form factor. Add minimal device
> > > > tree files for the SG2042 SOC and the Milk-V Pioneer board.
> > >
> > > Please run dtbs_check with W=1 set & fix the below issues:
> > >
> > > sg2042-cpus.dtsi:1600.25-1607.5: Warning (unit_address_vs_reg): /cpus/l2-cache@0: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1609.25-1616.5: Warning (unit_address_vs_reg): /cpus/l2-cache@1: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1618.25-1625.5: Warning (unit_address_vs_reg): /cpus/l2-cache@2: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1627.25-1634.5: Warning (unit_address_vs_reg): /cpus/l2-cache@3: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1636.25-1643.5: Warning (unit_address_vs_reg): /cpus/l2-cache@4: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1645.25-1652.5: Warning (unit_address_vs_reg): /cpus/l2-cache@5: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1654.25-1661.5: Warning (unit_address_vs_reg): /cpus/l2-cache@6: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1663.25-1670.5: Warning (unit_address_vs_reg): /cpus/l2-cache@7: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1672.25-1679.5: Warning (unit_address_vs_reg): /cpus/l2-cache@8: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1681.25-1688.5: Warning (unit_address_vs_reg): /cpus/l2-cache@9: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1690.27-1697.5: Warning (unit_address_vs_reg): /cpus/l2-cache@10: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1699.27-1706.5: Warning (unit_address_vs_reg): /cpus/l2-cache@11: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1708.27-1715.5: Warning (unit_address_vs_reg): /cpus/l2-cache@12: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1717.27-1724.5: Warning (unit_address_vs_reg): /cpus/l2-cache@13: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1726.27-1733.5: Warning (unit_address_vs_reg): /cpus/l2-cache@14: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:1735.27-1742.5: Warning (unit_address_vs_reg): /cpus/l2-cache@15: node has a unit name, but no reg or ranges property
> > > sg2042-cpus.dtsi:256.15-275.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@0: duplicate unit-address (also used in node /cpus/l2-cache@0)
> > > sg2042-cpus.dtsi:277.15-296.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@1: duplicate unit-address (also used in node /cpus/l2-cache@1)
> > > sg2042-cpus.dtsi:298.15-317.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@2: duplicate unit-address (also used in node /cpus/l2-cache@2)
> > > sg2042-cpus.dtsi:319.15-338.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@3: duplicate unit-address (also used in node /cpus/l2-cache@3)
> > > sg2042-cpus.dtsi:340.15-359.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@4: duplicate unit-address (also used in node /cpus/l2-cache@4)
> > > sg2042-cpus.dtsi:361.15-380.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@5: duplicate unit-address (also used in node /cpus/l2-cache@5)
> > > sg2042-cpus.dtsi:382.15-401.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@6: duplicate unit-address (also used in node /cpus/l2-cache@6)
> > > sg2042-cpus.dtsi:403.15-422.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@7: duplicate unit-address (also used in node /cpus/l2-cache@7)
> > > sg2042-cpus.dtsi:424.15-443.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@8: duplicate unit-address (also used in node /cpus/l2-cache@8)
> > > sg2042-cpus.dtsi:445.15-464.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@9: duplicate unit-address (also used in node /cpus/l2-cache@9)
> > > sg2042-cpus.dtsi:466.17-485.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@10: duplicate unit-address (also used in node /cpus/l2-cache@10)
> > > sg2042-cpus.dtsi:487.17-506.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@11: duplicate unit-address (also used in node /cpus/l2-cache@11)
> > > sg2042-cpus.dtsi:508.17-527.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@12: duplicate unit-address (also used in node /cpus/l2-cache@12)
> > > sg2042-cpus.dtsi:529.17-548.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@13: duplicate unit-address (also used in node /cpus/l2-cache@13)
> > > sg2042-cpus.dtsi:550.17-569.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@14: duplicate unit-address (also used in node /cpus/l2-cache@14)
> > > sg2042-cpus.dtsi:571.17-590.5: Warning (unique_unit_address_if_enabled): /cpus/cpu@15: duplicate unit-address (also used in node /cpus/l2-cache@15)
> > >
> > > Thanks,
> > > Conor.
> >
> > I find the rootcause is due to following code in DTS:
> > ```
> > l2_cache0: l2-cache@0 {
> > compatible = "cache";
> > cache-block-size = <64>;
> > cache-level = <2>;
> > cache-size = <1048576>;
> > cache-sets = <1024>;
> > cache-unified;
> > };
> > ```
> > To differ 16 l2-cache controller, we add <unit-address>, but due to
> > the l2-cache controller on sg2042 has no address, no reg property is
> > added here. That's why dtbs_check warns "node has a unit name, but no
> > reg or ranges property". I just double-confirmed with sophgo
> > engineers, they told me there is really no address for the cache
> > controller for sg2042.
> >
> > One solution I use here is to provide unique name for the l2-cache
> > node. I learn this from "arch/arm64/boot/dts/hisilicon/hi3660.dtsi"
> > and seems this work and pass dtbs_check with W=1. For example:
> > ```
> > l2_cache0: l2-cache0 {
> > compatible = "cache";
> > cache-block-size = <64>;
> > cache-level = <2>;
> > cache-size = <1048576>;
> > cache-sets = <1024>;
> > cache-unified;
> > };
> >
> > l2_cache1: l2-cache1 {
> > compatible = "cache";
> > cache-block-size = <64>;
> > cache-level = <2>;
> > cache-size = <1048576>;
> > cache-sets = <1024>;
> > cache-unified;
> > };
> > ......
> > ```
> > But I remember as mentioned in
> > https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation,
> > node names should be generic. So I have two questions here:
> > - Should I use "cache-controller" instead of "l2-cache", though I see
> > "l2-cache" is used in many places but not listed in
> > devicetree-specification.
> > - Even if I replace "l2-cache" with "cache-controller", I think
> > "cache-controller0", "cache-controller1" ... are not generic name, but
> > due to sg2042 does not have address for cache controller, how to
> > handle this problem?
>
> I would go for "cache-controller-0" "cache-controller-1". Close as
> possible to the generic node name while having the required differences
> between nodes. There's already some examples in-tree (eg renesas) that
> do this.
>
> Thanks,
> Conor.

Got, thanks.

2023-09-22 15:25:15

by Emil Renner Berthing

[permalink] [raw]
Subject: Re: [PATCH v2 08/11] serial: 8250_dw: Add Sophgo SG2042 support

Ben Dooks wrote:
> On 20/09/2023 07:40, Chen Wang wrote:
> > From: Emil Renner Berthing <[email protected]>
> >
> > Add quirk to skip setting the input clock rate for the uarts on the
> > Sophgo SG2042 SoC similar to the StarFive JH7100.
>
> I'd love an actual explanation of why this is necessary here.

Makes sense. For the JH7100 the commit message is:

On the StarFive JH7100 RISC-V SoC the UART core clocks can't be set to
exactly 16 * 115200Hz and many other common bitrates. Trying this will
only result in a higher input clock, but low enough that the UART's
internal divisor can't come close enough to the baud rate target.
So rather than try to set the input clock it's better to skip the
clk_set_rate call and rely solely on the UART's internal divisor.

@Chen Wang is this also true for the SG2042?

/Emil

2023-09-23 17:13:22

by Inochi Amaoto

[permalink] [raw]
Subject: Re: [PATCH v2 06/11] dt-bindings: timer: Add Sophgo sg2042 clint

>Yo,
>
>On Thu, Sep 21, 2023 at 04:18:57PM +0800, Inochi Amaoto wrote:
>>> On Thu, Sep 21, 2023 at 08:43:47AM +0800, Inochi Amaoto wrote:
>
>>>>>>>> but not one. In another word, there is no need to defined mtimer and ipi
>>>>>>>> device on the same base address.
>>>>>>>
>>>>>>> There's also no need to have two compatibles for the same interrupt
>>>>>>> controller, so I do not get this reasoning. What actually _requires_
>>>>>>> them to be split?
>>>>>>>
>>>>>>
>>>>>> Yes, it is one, but can be mapped into different address. So I think we
>>>>>> need two.
>>>>>
>>>>> Not two compatibles though, just two memory addresses that you need to
>>>>> locate (or maybe even 3, for SSWI?)
>>>>>
>>>>
>>>> We may need four (mtime, mtimecmp, mswi, sswi) if use register range.
>>>
>>> Why would you need 4? The first two certainly could be individual
>>> reg entries, no?
>>>
>>
>> After reading the aclint doc again, I found the all of them can be mapped
>> on the different address. (See the section 2.1 in that doc).
>
>Right, that's what I meant by individual reg entries. If there's some
>dynamic gap between them, then one reg entry would cover mtime and one
>would cover the base of the mtimecmp region.
>

Thanks.

>> But for now,
>> the mtime and mtimecmp have the same base address in any platform.
>
>How? The mtimecmp base address would have to be offset from the mtime
>base address. Is what you mean that, for example, mtime is at an offset
>of 0x0 from the base address & mtimecmp0 is at, for example, an offset
>of 0x8 so a single reg entry can cover both?
>

I mean "the same" is just what you said: use the offset to access mtime
and mtimecmp, and left one register range in the DT.
In your example, using a offset of 0x4 to mark the mtimecmp will allow us
to use one register range like DTs already in the riscv arch. But this way
does have problems when the timer is more complex.
In fact, I think two register range could do better, and will give us
more freedom to cover these regs.

>Also, "any platform"? I figure you mean in this one specific platform?
>

I mean the platforms already upstreamed in both of kernel and OpenSBI.
Not for this one.

>> Anyway,
>> the frozen spec in future will decided how many ranges we need.
>
>Isn't the spec abandoned? There may well be no frozen spec.
>

I guess it is. That is not a good thing.

>>>> Anyway, I will use a vendor spec implementation as a temporary solution.
>>>> I hope this will be corrected in a predictable future, and we can use a
>>>> standard way to resolve this at that time. :)
>>>
>>> If the spec doesn't get frozen, there'll not be a standard way merged.
>>> Hopefully not too many others go off an implement non-frozen specs, and
>>> we will not really need to worry all that much about it.
>
>Cheers,
>Conor.
>

2023-09-26 13:16:52

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 00/11] Add Milk-V Pioneer RISC-V board support

Palmer Dabbelt <[email protected]> 于2023年9月20日周三 23:22写道:
>
> On Tue, 19 Sep 2023 23:33:48 PDT (-0700), [email protected] wrote:
> > Milk-V Pioneer [1] is a developer motherboard based on SOPHON SG2042 [2]
> > in a standard mATX form factor. Add minimal device
> > tree files for the SG2042 SOC and the Milk-V Pioneer board.
> >
> > Now only support basic uart drivers to boot up into a basic console.
> >
> > Thanks,
> > Chen
> >
> > ---
> >
> > Changes in v2:
> > The patch series is based on v6.6-rc1. You can simply review or test
> > the patches at the link [4].
> > - Improve format for comment of commitments as per input from last review.
> > - Improve format of DTS as per input from last review.
> > - Remove numa related stuff from DTS. This part is just for optimization, may
> > add it later if really needed.
> >
> > Previous versions:
> > v1: due to it is not sent in thread, I have listed permlinks of the patchset
> > [v1-0/12] ~ [v1-12/12] here for quick reference. You can simply review or
> > test the patches at the link [3].
> >
> > [1]: https://milkv.io/pioneer
> > [2]: https://en.sophgo.com/product/introduce/sg2042.html
> > [3]: https://github.com/unicornx/linux-riscv/commits/milkv-pioneer-minimal
> > [4]: https://github.com/unicornx/linux-riscv/commits/milkv-pioneer-minimal-v2
> > [v1-0/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-1/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-2/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-3/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-4/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-5/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-6/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-7/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-8/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-9/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-10/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-11/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> > [v1-12/12]:https://lore.kernel.org/linux-riscv/[email protected]/
> >
> > ---
> >
> > Chen Wang (8):
> > riscv: Add SOPHGO SOC family Kconfig support
> > dt-bindings: vendor-prefixes: add milkv/sophgo
> > dt-bindings: riscv: add sophgo sg2042 bindings
> > dt-bindings: riscv: Add T-HEAD C920 compatibles
> > dt-bindings: interrupt-controller: Add SOPHGO's SG2042 PLIC
> > riscv: dts: add initial SOPHGO SG2042 SoC device tree
> > riscv: dts: sophgo: add Milk-V Pioneer board device tree
> > riscv: defconfig: enable SOPHGO SoC
> >
> > Emil Renner Berthing (2):
> > dt-bindings: serial: snps-dw-apb-uart: Add Sophgo SG2042 uarts
> > serial: 8250_dw: Add Sophgo SG2042 support
> >
> > Inochi Amaoto (1):
> > dt-bindings: timer: Add Sophgo sg2042 clint
> >
> > .../sifive,plic-1.0.0.yaml | 1 +
> > .../devicetree/bindings/riscv/cpus.yaml | 1 +
> > .../devicetree/bindings/riscv/sophgo.yaml | 28 +
> > .../bindings/serial/snps-dw-apb-uart.yaml | 1 +
> > .../bindings/timer/sifive,clint.yaml | 8 +
> > .../devicetree/bindings/vendor-prefixes.yaml | 4 +
> > MAINTAINERS | 7 +
> > arch/riscv/Kconfig.socs | 5 +
> > arch/riscv/boot/dts/Makefile | 1 +
> > arch/riscv/boot/dts/sophgo/Makefile | 3 +
> > arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi | 1744 +++++++++++++++++
> > .../boot/dts/sophgo/sg2042-milkv-pioneer.dts | 19 +
> > arch/riscv/boot/dts/sophgo/sg2042.dtsi | 439 +++++
> > arch/riscv/configs/defconfig | 1 +
> > drivers/tty/serial/8250/8250_dw.c | 5 +-
> > 15 files changed, 2265 insertions(+), 2 deletions(-)
> > create mode 100644 Documentation/devicetree/bindings/riscv/sophgo.yaml
> > create mode 100644 arch/riscv/boot/dts/sophgo/Makefile
> > create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-cpus.dtsi
> > create mode 100644 arch/riscv/boot/dts/sophgo/sg2042-milkv-pioneer.dts
> > create mode 100644 arch/riscv/boot/dts/sophgo/sg2042.dtsi
>
> Given this is the first sg2042 and it appears to have a few errata (the
> FP rounding issues and the special fence for starvation), I think we
> want to make sure we figure out how to provide that information to
> userspace.
>

Hi, Palmer,
I don't understand well what's your meaning of "provide that
information to userspace", can you please clarify more?
And for this patchset, do we still lack something else? This patchset
is the first one for sg2042, but I don't see those issues you
mentioned would block it, becasue the target of this first patchset we
just want to make sure the kernel can boot up and work with a uart
console.

Thanks in adv.
Chen


> > base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d

2023-09-26 14:31:49

by Chen Wang

[permalink] [raw]
Subject: Re: [PATCH v2 08/11] serial: 8250_dw: Add Sophgo SG2042 support

Emil Renner Berthing <[email protected]> 于2023年9月22日周五 18:40写道:
>
> Ben Dooks wrote:
> > On 20/09/2023 07:40, Chen Wang wrote:
> > > From: Emil Renner Berthing <[email protected]>
> > >
> > > Add quirk to skip setting the input clock rate for the uarts on the
> > > Sophgo SG2042 SoC similar to the StarFive JH7100.
> >
> > I'd love an actual explanation of why this is necessary here.
>
> Makes sense. For the JH7100 the commit message is:
>
> On the StarFive JH7100 RISC-V SoC the UART core clocks can't be set to
> exactly 16 * 115200Hz and many other common bitrates. Trying this will
> only result in a higher input clock, but low enough that the UART's
> internal divisor can't come close enough to the baud rate target.
> So rather than try to set the input clock it's better to skip the
> clk_set_rate call and rely solely on the UART's internal divisor.
>
> @Chen Wang is this also true for the SG2042?
>
> /Emil

Emil & Ben,
After double-checking with Sophgo engineers and doing more
investigation, we think the original changes(quirk to skip setting the
input clock) on UART may not be required. Due to currently, the
target of this patchset is just to enable a minimal system and no
clock relateding changes are included yet. I will first remove this
quirk change on UART and use the fixed frequence - 500M - and reply
solely on the UART's internal divisor to work. We will re-evaluate
this quirk change in next patchset when we involve clock related
stuff.
Looping Haijiao, engineer from Sophgo, who is working on clock on sg2042.

Regards,
Chen