Skip to contentSkip to conversation

arch: riscv: add DT file support, starting with the SiFive HiFive-U

PATCH In review Paul Walmsley 5 participants 18 messages Dec 15, 2018 – Apr 6, 2019

Subsystems (4)
lore
Share & tools
lore
#2 lore raw

PATCH 2/7 dt-bindings: riscv: sifive: add documentation for the SiFive FU540

In reply to Paul Walmsley

Add DT binding documentation for the SiFive FU540 SoC. This SoC is documented at:

https://static.dev.sifive.com/FU540-C000-v1.0.pdf

This file is originally based on
Documentation/devicetree/bindings/arm/ti/k3.txt.

---
 .../devicetree/bindings/riscv/sifive/fu540.txt     | 14 ++++++++++++++
 MAINTAINERS                                        |  9 +++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/riscv/sifive/fu540.txt
Documentation/devicetree/bindings/riscv/sifive/fu540.txt new file +14 -0
new file mode 100644
index 000000000000..b5cf2b9f9a75
@@ -0,0 +1,14 @@
+SiFive FU540 SoC architecture device tree bindings
+--------------------------------------------------
+
+Platforms based on the SiFive FU540 RISC-V SoC should follow the
+scheme described below:
+
+SoCs
+----
+
+Each device tree root node must specify one of the following
+compatible-string values:
+
+- Freedom Unleashed 540 rev. C000, or "FU540"
+  compatible = "sifive,fu540-c000", "sifive,fu540"
MAINTAINERS +9 -0
index 8119141a926f..dee555ceb175 100644
@@ -13626,6 +13626,15 @@ S:	Supported
 K:	sifive
 N:	sifive
 
+SIFIVE FU540 SYSTEM-ON-CHIP
+M:	Paul Walmsley <[email protected]>
+M:	Palmer Dabbelt <[email protected]>
+L:	[email protected]
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/pjw/sifive.git
+S:	Supported
+K:	fu540
+N:	fu540
+
 SILEAD TOUCHSCREEN DRIVER
 M:	Hans de Goede <[email protected]>
 L:	[email protected]
Signature · 1 line
2.20.0
#4 lore raw

PATCH 3/7 dt-bindings: riscv: cpus: add E51 cores to the list of documented CPUs

In reply to Paul Walmsley

Add compatible strings for the SiFive E51 family of CPU cores to the RISC-V CPU compatible string documentation. The E51 CPU core is described in:

https://static.dev.sifive.com/FU540-C000-v1.0.pdf

---
 Documentation/devicetree/bindings/riscv/cpus.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/riscv/cpus.txt +3 -2
index adf7b7af5dc3..fb9d4f86f41f 100644
@@ -68,8 +68,9 @@ described below.
         - compatible:
                 Usage: required
                 Value type: <stringlist>
-                Definition: must contain "riscv", may contain one of
-                            "sifive,rocket0"
+                Definition: must contain "riscv", may contain one or
+			    more of "sifive,rocket0", "sifive,e51",
+			    "sifive,e5"
         - mmu-type:
                 Usage: optional
                 Value type: <string>
Signature · 1 line
2.20.0
#8 lore raw

PATCH 4/7 dt-bindings: riscv: cpus: add U54 cores to the list of documented CPUs

In reply to Paul Walmsley

Add compatible strings for the SiFive U54 family of CPU cores to the RISC-V CPU compatible string documentation. The U54 CPU cores are described in:

https://static.dev.sifive.com/FU540-C000-v1.0.pdf

---
 Documentation/devicetree/bindings/riscv/cpus.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/riscv/cpus.txt +2 -1
index fb9d4f86f41f..d8d99b6b5386 100644
@@ -70,7 +70,8 @@ described below.
                 Value type: <stringlist>
                 Definition: must contain "riscv", may contain one or
 			    more of "sifive,rocket0", "sifive,e51",
-			    "sifive,e5"
+			    "sifive,e5", "sifive,u54-mc", "sifive,u54",
+			    "sifive,u5"
         - mmu-type:
                 Usage: optional
                 Value type: <string>
Signature · 1 line
2.20.0
#9 lore raw

PATCH 5/7 riscv: dts: add initial support for the SiFive FU540-C000 SoC

In reply to Paul Walmsley

Add initial support for the SiFive FU540-C000 SoC. This is a 28nm SoC based around the SiFive U54-MC core complex and a TileLink interconnect.

This file is expected to grow considerably as more device drivers are added to the kernel.

---
 arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 182 +++++++++++++++++++++
 1 file changed, 182 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sifive/fu540-c000.dtsi
arch/riscv/boot/dts/sifive/fu540-c000.dtsi new file +182 -0
new file mode 100644
index 000000000000..0ef314cf17b6
@@ -0,0 +1,182 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) 2018 SiFive, Inc */
+/* See the file LICENSE for further information */
+
+/dts-v1/;
+
+#include <linux/clk/sifive-fu540-prci.h>
+
+/ {
+	#address-cells = <2>;
+	#size-cells = <2>;
+	compatible = "sifive,fu540-c000", "sifive,fu540";
+
+	aliases {
+		serial0 = &uart0;
+		serial1 = &uart1;
+	};
+
+	chosen {
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		timebase-frequency = <1000000>;
+		cpu0: cpu@0 {
+			clock-frequency = <0>;
+			compatible = "sifive,e51", "sifive,rocket0";
+			device_type = "cpu";
+			i-cache-block-size = <64>;
+			i-cache-sets = <128>;
+			i-cache-size = <16384>;
+			reg = <0>;
+			riscv,isa = "rv64imac";
+			status = "okay";
+			cpu0_intc: interrupt-controller {
+				#interrupt-cells = <1>;
+				compatible = "riscv,cpu-intc";
+				interrupt-controller;
+			};
+		};
+		cpu1: cpu@1 {
+			clock-frequency = <0>;
+			compatible = "sifive,u54-mc", "sifive,rocket0";
+			d-cache-block-size = <64>;
+			d-cache-sets = <64>;
+			d-cache-size = <32768>;
+			d-tlb-sets = <1>;
+			d-tlb-size = <32>;
+			device_type = "cpu";
+			i-cache-block-size = <64>;
+			i-cache-sets = <64>;
+			i-cache-size = <32768>;
+			i-tlb-sets = <1>;
+			i-tlb-size = <32>;
+			mmu-type = "riscv,sv39";
+			reg = <1>;
+			riscv,isa = "rv64imafdc";
+			status = "okay";
+			tlb-split;
+			cpu1_intc: interrupt-controller {
+				#interrupt-cells = <1>;
+				compatible = "riscv,cpu-intc";
+				interrupt-controller;
+			};
+		};
+		cpu2: cpu@2 {
+			clock-frequency = <0>;
+			compatible = "sifive,u54-mc", "sifive,rocket0";
+			d-cache-block-size = <64>;
+			d-cache-sets = <64>;
+			d-cache-size = <32768>;
+			d-tlb-sets = <1>;
+			d-tlb-size = <32>;
+			device_type = "cpu";
+			i-cache-block-size = <64>;
+			i-cache-sets = <64>;
+			i-cache-size = <32768>;
+			i-tlb-sets = <1>;
+			i-tlb-size = <32>;
+			mmu-type = "riscv,sv39";
+			reg = <2>;
+			riscv,isa = "rv64imafdc";
+			status = "okay";
+			tlb-split;
+			cpu2_intc: interrupt-controller {
+				#interrupt-cells = <1>;
+				compatible = "riscv,cpu-intc";
+				interrupt-controller;
+			};
+		};
+		cpu3: cpu@3 {
+			clock-frequency = <0>;
+			compatible = "sifive,u54-mc", "sifive,rocket0";
+			d-cache-block-size = <64>;
+			d-cache-sets = <64>;
+			d-cache-size = <32768>;
+			d-tlb-sets = <1>;
+			d-tlb-size = <32>;
+			device_type = "cpu";
+			i-cache-block-size = <64>;
+			i-cache-sets = <64>;
+			i-cache-size = <32768>;
+			i-tlb-sets = <1>;
+			i-tlb-size = <32>;
+			mmu-type = "riscv,sv39";
+			reg = <3>;
+			riscv,isa = "rv64imafdc";
+			status = "okay";
+			tlb-split;
+			cpu3_intc: interrupt-controller {
+				#interrupt-cells = <1>;
+				compatible = "riscv,cpu-intc";
+				interrupt-controller;
+			};
+		};
+		cpu4: cpu@4 {
+			clock-frequency = <0>;
+			compatible = "sifive,u54-mc", "sifive,rocket0";
+			d-cache-block-size = <64>;
+			d-cache-sets = <64>;
+			d-cache-size = <32768>;
+			d-tlb-sets = <1>;
+			d-tlb-size = <32>;
+			device_type = "cpu";
+			i-cache-block-size = <64>;
+			i-cache-sets = <64>;
+			i-cache-size = <32768>;
+			i-tlb-sets = <1>;
+			i-tlb-size = <32>;
+			mmu-type = "riscv,sv39";
+			reg = <4>;
+			riscv,isa = "rv64imafdc";
+			status = "okay";
+			tlb-split;
+			cpu4_intc: interrupt-controller {
+				#interrupt-cells = <1>;
+				compatible = "riscv,cpu-intc";
+				interrupt-controller;
+			};
+		};
+	};
+	soc {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		compatible = "sifive,fu540-c000", "sifive,fu540", "simple-bus";
+		ranges;
+		prci: prci@10000000 {
+			compatible = "sifive,fu540-c000-prci";
+			reg = <0x0 0x10000000 0x0 0x1000>;
+			clocks = <&hfclk>, <&rtcclk>;
+			#clock-cells = <1>;
+		};
+		uart0: serial@10010000 {
+			compatible = "sifive,fu540-c000-uart", "sifive,uart0";
+			interrupt-parent = <&plic0>;
+			interrupts = <4>;
+			reg = <0x0 0x10010000 0x0 0x1000>;
+			clocks = <&prci PRCI_CLK_TLCLK>;
+		};
+		uart1: serial@10011000 {
+			compatible = "sifive,fu540-c000-uart", "sifive,uart0";
+			interrupt-parent = <&plic0>;
+			interrupts = <5>;
+			reg = <0x0 0x10011000 0x0 0x1000>;
+			clocks = <&prci PRCI_CLK_TLCLK>;
+		};
+		plic0: interrupt-controller@c000000 {
+			#interrupt-cells = <1>;
+			compatible = "riscv,plic0";
+			interrupt-controller;
+			interrupts-extended = <
+				&cpu0_intc 11
+				&cpu1_intc 11 &cpu1_intc 9
+				&cpu2_intc 11 &cpu2_intc 9
+				&cpu3_intc 11 &cpu3_intc 9
+				&cpu4_intc 11 &cpu4_intc 9>;
+			reg = <0x0 0xc000000 0x0 0x4000000>;
+		};
+	};
+};
Signature · 1 line
2.20.0
#12 lore raw

PATCH 6/7 dt-binding: riscv: sifive: add documentation for FU540-based boards

In reply to Paul Walmsley

Add DT binding documentation for boards based on the SiFive FU540 SoC. The first board, the HiFive Unleashed A00 (FU540), is described here:

https://static.dev.sifive.com/HiFive-Unleashed-Getting-Started-Guide-v1p1.pdf

---
 .../devicetree/bindings/riscv/sifive/fu540.txt         | 10 ++++++++++
 1 file changed, 10 insertions(+)
Documentation/devicetree/bindings/riscv/sifive/fu540.txt +10 -0
index b5cf2b9f9a75..20119cc54964 100644
@@ -12,3 +12,13 @@ compatible-string values:
 
 - Freedom Unleashed 540 rev. C000, or "FU540"
   compatible = "sifive,fu540-c000", "sifive,fu540"
+
+Boards
+------
+
+Boards based on the FU540 SoC should specify the following
+compatible-string values:
+
+- HiFive-Unleashed rev. A00 board
+  compatible = "sifive,hifive-unleashed-a00-fu540",
+	       "sifive,hifive-unleashed-fu540"
Signature · 1 line
2.20.0
#14 lore raw

PATCH 7/7 riscv: dts: add initial board data for the SiFive HiFive Unleashed

In reply to Paul Walmsley

Add initial board data for the SiFive HiFive Unleashed A00.

Currently the data populated in this DT file describes the board DRAM configuration and the external clock sources that supply the PRCI.

---
 arch/riscv/boot/dts/Makefile                  |  2 +
 arch/riscv/boot/dts/sifive/Makefile           |  4 ++
 .../dts/sifive/hifive-unleashed-a00-fu540.dts | 39 +++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 arch/riscv/boot/dts/Makefile
 create mode 100644 arch/riscv/boot/dts/sifive/Makefile
 create mode 100644 arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts
arch/riscv/boot/dts/Makefile new file +2 -0
new file mode 100644
index 000000000000..dcc3ada78455
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+subdir-y += sifive
arch/riscv/boot/dts/sifive/Makefile new file +4 -0
new file mode 100644
index 000000000000..e120ccf5649c
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_SIFIVE) += hifive-unleashed-a00-fu540.dtb
+
+
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +39 -0
new file mode 100644
index 000000000000..0c6afabe69e3
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-License-Identifier: GPL-2.0-or-later
+/* Copyright (c) 2018 SiFive, Inc */
+/* See the file LICENSE for further information */
+
+/dts-v1/;
+
+#include "fu540-c000.dtsi"
+
+/ {
+	#address-cells = <2>;
+	#size-cells = <2>;
+	model = "SiFive HiFive Unleashed A00 (FU540-C000)"
+	compatible = "sifive,hifive-unleashed-a00-fu540",
+		"sifive,hifive-unleashed-fu540";
+
+	chosen {
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x0 0x80000000 0x1f 0x80000000>;
+	};
+
+	soc {
+		hfclk: hfclk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <33333333>;
+			clock-output-names = "hfclk";
+		};
+		rtcclk: rtcclk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <1000000>;
+			clock-output-names = "rtcclk";
+		};
+	};
+};
Signature · 1 line
2.20.0
#0 lore raw

cover arch: riscv: add DT file support, starting with the SiFive HiFive-U

Add support for building flattened DT files from DT source files under arch/riscv/boot/dts. Follow existing kernel precedent from other SoC architectures.

Start by adding initial support for the SiFive FU540 SoC, and the development board that uses it, the SiFive HiFive Unleashed A00.

Applies on v4.20-rc6.

- Paul

Paul Walmsley (7):
arch: riscv: add support for building DTB files from DT source data
dt-bindings: riscv: sifive: add documentation for the SiFive FU540
dt-bindings: riscv: cpus: add E51 cores to the list of documented CPUs
dt-bindings: riscv: cpus: add U54 cores to the list of documented CPUs
riscv: dts: add initial support for the SiFive FU540-C000 SoC
dt-binding: riscv: sifive: add documentation for FU540-based boards
riscv: dts: add initial board data for the SiFive HiFive Unleashed

 .../devicetree/bindings/riscv/cpus.txt        |   6 +-
 .../bindings/riscv/sifive/fu540.txt           |  24 +++
 MAINTAINERS                                   |   9 +
 arch/riscv/Kconfig                            |   2 +
 arch/riscv/Kconfig.platforms                  |   8 +
 arch/riscv/boot/dts/Makefile                  |   2 +
 arch/riscv/boot/dts/sifive/Makefile           |   4 +
 arch/riscv/boot/dts/sifive/fu540-c000.dtsi    | 182 ++++++++++++++++++
 .../dts/sifive/hifive-unleashed-a00-fu540.dts |  39 ++++
 9 files changed, 274 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/riscv/sifive/fu540.txt
 create mode 100644 arch/riscv/Kconfig.platforms
 create mode 100644 arch/riscv/boot/dts/Makefile
 create mode 100644 arch/riscv/boot/dts/sifive/Makefile
 create mode 100644 arch/riscv/boot/dts/sifive/fu540-c000.dtsi
 create mode 100644 arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts
Signature · 1 line
2.20.0
#1 lore raw

PATCH 1/7 arch: riscv: add support for building DTB files from DT source data

Similar to what's implemented for ARM64, add support for building DTB files from DT source data for RISC-V boards.

This patch starts with the infrastructure needed for SiFive boards.

---
 arch/riscv/Kconfig           | 2 ++
 arch/riscv/Kconfig.platforms | 8 ++++++++
 2 files changed, 10 insertions(+)
 create mode 100644 arch/riscv/Kconfig.platforms
arch/riscv/Kconfig +2 -0
index 55da93f4e818..dc9f1afa4ad9 100644
@@ -121,6 +121,8 @@ config ARCH_RV64I
 
 endchoice
 
+source "arch/riscv/Kconfig.platforms"
+
 # We must be able to map all physical memory into the kernel, but the compiler
 # is still a bit more efficient when generating code if it's setup in a manner
 # such that it can only map 2GiB of memory.
arch/riscv/Kconfig.platforms new file +8 -0
new file mode 100644
index 000000000000..bd3d2642bcff
@@ -0,0 +1,8 @@
+menu "Platform selection"
+
+config ARCH_SIFIVE
+        bool "SiFive platforms"
+        help
+          This enables direct support for SiFive SoC platform hardware.
+
+endmenu
Signature · 1 line
2.20.0
#10 lore raw

Re: [PATCH 5/7] riscv: dts: add initial support for the SiFive FU540-C000 SoC

In reply to Paul Walmsley
I love your patch! Yet something to improve:

Hi Paul,

I love your patch! Yet something to improve:

[auto build test ERROR on robh/for-next]
[also build test ERROR on v4.20-rc6 next-20181214]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Paul-Walmsley/arch-riscv-add-DT-file-support-starting-with-the-SiFive-HiFive-U/20181216-103926
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: riscv-tinyconfig (attached as .config)
compiler: riscv64-linux-gcc (GCC) 8.1.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=riscv

Note: the linux-review/Paul-Walmsley/arch-riscv-add-DT-file-support-starting-with-the-SiFive-HiFive-U/20181216-103926 HEAD bd72c6c6fec694776fceb1c4f4cf7c6415a6e8e3 builds fine.
It only hurts bisectibility.

All errors (new ones prefixed by >>):

>> scripts/Makefile.build:42: arch/riscv/boot/dts/Makefile: No such file or directory
>> make[2]: *** No rule to make target 'arch/riscv/boot/dts/Makefile'.

make[2]: Failed to remake makefile 'arch/riscv/boot/dts/Makefile'.

vim +42 scripts/Makefile.build

20a468b51 Sam Ravnborg   2006-01-22  38  
2a6914703 Sam Ravnborg   2005-07-25  39  # The filename Kbuild has precedence over Makefile
db8c1a7b2 Sam Ravnborg   2005-07-27  40  kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
0c53c8e6e Sam Ravnborg   2007-10-14  41  kbuild-file := $(if $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Kbuild,$(kbuild-dir)/Makefile)
0c53c8e6e Sam Ravnborg   2007-10-14 @42  include $(kbuild-file)

^1da177e4 Linus Torvalds 2005-04-16 43

:::::: The code at line 42 was first introduced by commit
:::::: 0c53c8e6eb456cde30f2305421c605713856abc8 kbuild: check for wrong use of CFLAGS

:::::: TO: Sam Ravnborg <sam@neptun.(none)> :::::: CC: Sam Ravnborg <sam@neptun.(none)>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#17 lore raw
In reply to Paul Walmsley

.. along with the PRCI patches which are under review.

Will repost these such that the files that depend on the new clock headers are at the end of this series.  Then we can send those last two patches after the clock merge in the merge window, assuming the PRCI patches make it.

- Paul

Quoted 1 line · Paul Walmsley

Applies on v4.20-rc6.

maintainer Reviewed-by on v1 2/7
#3 lore raw

Re: [PATCH 2/7] dt-bindings: riscv: sifive: add documentation for the SiFive FU540

In reply to Paul Walmsley
Quoted 17 lines · Paul Walmsley

Add DT binding documentation for the SiFive FU540 SoC. This SoC is documented at:

https://static.dev.sifive.com/FU540-C000-v1.0.pdf

This file is originally based on
Documentation/devicetree/bindings/arm/ti/k3.txt.

Quoted 5 lines
---
 .../devicetree/bindings/riscv/sifive/fu540.txt     | 14 ++++++++++++++
 MAINTAINERS                                        |  9 +++++++++
 2 files changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/riscv/sifive/fu540.txt

However, with 4.21 we're starting to use json-schema and top-level SoC/board bindings. Not requiring it yet, but feel free to convert to that if you want. Then we don't have to do it later.

Rob

maintainer
#5 lore raw

Re: [PATCH 3/7] dt-bindings: riscv: cpus: add E51 cores to the list of documented CPUs

In reply to Paul Walmsley
Quoted 24 lines · Paul Walmsley

Add compatible strings for the SiFive E51 family of CPU cores to the RISC-V CPU compatible string documentation. The E51 CPU core is described in:

https://static.dev.sifive.com/FU540-C000-v1.0.pdf

---
 Documentation/devicetree/bindings/riscv/cpus.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/riscv/cpus.txt +0 -0
index adf7b7af5dc3..fb9d4f86f41f 100644

Documentation/devicetree/bindings/riscv/cpus.txt described below. · line 73

Quoted 8 lines
Documentation/devicetree/bindings/riscv/cpus.txt +3 -2
@@ -68,8 +68,9 @@ described below.
         - compatible:
                 Usage: required
                 Value type: <stringlist>
-                Definition: must contain "riscv", may contain one of
-                            "sifive,rocket0"
+                Definition: must contain "riscv", may contain one or
+			    more of "sifive,rocket0", "sifive,e51",
+			    "sifive,e5"

I can't really tell what are valid combinations from this. It reads that I could list every string here and that would be valid. It is basically 'riscv' plus any other combinations of strings.

Rob

maintainer Reviewed-by on v1 6/7
#13 lore raw

Re: [PATCH 6/7] dt-binding: riscv: sifive: add documentation for FU540-based boards

In reply to Paul Walmsley
Quoted 14 lines · Paul Walmsley

Add DT binding documentation for boards based on the SiFive FU540 SoC. The first board, the HiFive Unleashed A00 (FU540), is described here:

https://static.dev.sifive.com/HiFive-Unleashed-Getting-Started-Guide-v1p1.pdf

Quoted 4 lines
---
 .../devicetree/bindings/riscv/sifive/fu540.txt         | 10 ++++++++++
 1 file changed, 10 insertions(+)
maintainer
#15 lore raw

Re: [PATCH 7/7] riscv: dts: add initial board data for the SiFive HiFive Unleashed

In reply to Paul Walmsley
Quoted 48 lines · Paul Walmsley

Add initial board data for the SiFive HiFive Unleashed A00.

Currently the data populated in this DT file describes the board DRAM configuration and the external clock sources that supply the PRCI.

---
 arch/riscv/boot/dts/Makefile                  |  2 +
 arch/riscv/boot/dts/sifive/Makefile           |  4 ++
 .../dts/sifive/hifive-unleashed-a00-fu540.dts | 39 +++++++++++++++++++
 3 files changed, 45 insertions(+)
 create mode 100644 arch/riscv/boot/dts/Makefile
 create mode 100644 arch/riscv/boot/dts/sifive/Makefile
 create mode 100644 arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts
arch/riscv/boot/dts/Makefile new file +2 -0
new file mode 100644
index 000000000000..dcc3ada78455
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0
+subdir-y += sifive
arch/riscv/boot/dts/sifive/Makefile new file +4 -0
new file mode 100644
index 000000000000..e120ccf5649c
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+dtb-$(CONFIG_ARCH_SIFIVE) += hifive-unleashed-a00-fu540.dtb
+
+
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +0 -0
new file mode 100644
index 000000000000..0c6afabe69e3

arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts line 2

Quoted 2 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +2 -0
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-License-Identifier: GPL-2.0-or-later

This should be a single line with: (Apache-2.0 OR GPL-2.0+)

arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts line 15

Quoted 13 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +13 -0
+/* Copyright (c) 2018 SiFive, Inc */
+/* See the file LICENSE for further information */
+
+/dts-v1/;
+
+#include "fu540-c000.dtsi"
+
+/ {
+	#address-cells = <2>;
+	#size-cells = <2>;
+	model = "SiFive HiFive Unleashed A00 (FU540-C000)"
+	compatible = "sifive,hifive-unleashed-a00-fu540",
+		"sifive,hifive-unleashed-fu540";

SoC compatible should be here too.

Quoted 12 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +12 -0
+
+	chosen {
+	};
+
+	memory@80000000 {
+		device_type = "memory";
+		reg = <0x0 0x80000000 0x1f 0x80000000>;
+	};
+
+	soc {
+		hfclk: hfclk {
+			#clock-cells = <0>;

arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts line 37

Quoted 10 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +10 -0
+			compatible = "fixed-clock";
+			clock-frequency = <33333333>;
+			clock-output-names = "hfclk";
+		};
+		rtcclk: rtcclk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <1000000>;
+			clock-output-names = "rtcclk";
+		};

Are these the clock inputs to the SoC or dummy clocks until you write a proper clock driver? If the former, they should be at the top level.

Rob

#6 lore raw

Re: [PATCH 3/7] dt-bindings: riscv: cpus: add E51 cores to the list of documented CPUs

In reply to Rob Herring
Quoted 29 lines · On Thu, 20 Dec 2018 13:01:41 PST (-0800), [email protected] wrote:
Quoted 28 lines · Paul Walmsley

Add compatible strings for the SiFive E51 family of CPU cores to the RISC-V CPU compatible string documentation. The E51 CPU core is described in:

https://static.dev.sifive.com/FU540-C000-v1.0.pdf

---
 Documentation/devicetree/bindings/riscv/cpus.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/riscv/cpus.txt +0 -1
index adf7b7af5dc3..fb9d4f86f41f 100644
@@ -68,8 +68,9 @@ described below.
         - compatible:
                 Usage: required
                 Value type: <stringlist>
-                Definition: must contain "riscv", may contain one of
Quoted 8 lines

Documentation/devicetree/bindings/riscv/cpus.txt described below. · line 73

Quoted 4 lines
Documentation/devicetree/bindings/riscv/cpus.txt +3 -1
-                            "sifive,rocket0"
+                Definition: must contain "riscv", may contain one or
+			    more of "sifive,rocket0", "sifive,e51",
+			    "sifive,e5"

I can't really tell what are valid combinations from this. It reads that I could list every string here and that would be valid. It is basically 'riscv' plus any other combinations of strings.

I think that's actually the correct interpretation: if it's a RISC-V CPU then it must have "riscv" listed in compatible, but it can also be anything else. There's some concrete examples here (a "sifive,e51" is a type of "riscv"), but I don't think it's realistic to count on us being able to enumerate all RISC-V implementations here.

maintainer
#7 lore raw

Re: [PATCH 3/7] dt-bindings: riscv: cpus: add E51 cores to the list of documented CPUs

Quoted 40 lines · Palmer Dabbelt
Quoted 29 lines · On Thu, 20 Dec 2018 13:01:41 PST (-0800), [email protected] wrote:
Quoted 28 lines · Paul Walmsley

Add compatible strings for the SiFive E51 family of CPU cores to the RISC-V CPU compatible string documentation. The E51 CPU core is described in:

https://static.dev.sifive.com/FU540-C000-v1.0.pdf

---
 Documentation/devicetree/bindings/riscv/cpus.txt | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/riscv/cpus.txt +0 -1
index adf7b7af5dc3..fb9d4f86f41f 100644
@@ -68,8 +68,9 @@ described below.
         - compatible:
                 Usage: required
                 Value type: <stringlist>
-                Definition: must contain "riscv", may contain one of
Quoted 8 lines

Documentation/devicetree/bindings/riscv/cpus.txt described below. · line 73

Quoted 4 lines
Documentation/devicetree/bindings/riscv/cpus.txt +3 -1
-                            "sifive,rocket0"
+                Definition: must contain "riscv", may contain one or
+                        more of "sifive,rocket0", "sifive,e51",
+                        "sifive,e5"

I can't really tell what are valid combinations from this. It reads that I could list every string here and that would be valid. It is basically 'riscv' plus any other combinations of strings.

Quoted 2 lines

I think that's actually the correct interpretation: if it's a RISC-V CPU then it must have "riscv" listed in compatible, but it can also be anything else.

But is '"sifive,rocket0", "sifive,e51", "sifive,e5", "riscv"' valid? What about '"sifive,rocket0", "sifive,e5", "riscv"'?

If they are, is there really any value in specifying all of them or different variations? I'd suggest keeping things simple because writing a json-schema gets messy when there's arbitrary combinations of compatible values.

Quoted 3 lines

There's some concrete examples here (a "sifive,e51" is a type of "riscv"), but I don't think it's realistic to count on us being able to enumerate all RISC-V implementations here.

I think you'll find that "riscv" will become pointless as it is not specific enough to mean anything. It would be like having "arm" as a compatible on Arm based systems.

OTOH, you only really need to enumerate what you can't discover. For example, how are optional features (SIMD inst a common example) discovered? On Arm, we generally just have the CPU model in the compatible, but it's generally not even used because that, cpu revision, instruction set features, etc. are all discoverable.

Rob

#11 lore raw

Re: [PATCH 5/7] riscv: dts: add initial support for the SiFive FU540-C000 SoC

In reply to Paul Walmsley
Quoted 26 lines · Paul Walmsley

Add initial support for the SiFive FU540-C000 SoC. This is a 28nm SoC based around the SiFive U54-MC core complex and a TileLink interconnect.

This file is expected to grow considerably as more device drivers are added to the kernel.

---
 arch/riscv/boot/dts/sifive/fu540-c000.dtsi | 182 +++++++++++++++++++++
 1 file changed, 182 insertions(+)
 create mode 100644 arch/riscv/boot/dts/sifive/fu540-c000.dtsi
arch/riscv/boot/dts/sifive/fu540-c000.dtsi new file +0 -0
new file mode 100644
index 000000000000..0ef314cf17b6

arch/riscv/boot/dts/sifive/fu540-c000.dtsi line 29

Quoted 8 lines
arch/riscv/boot/dts/sifive/fu540-c000.dtsi new file +7 -0
 
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		timebase-frequency = <1000000>;
+		cpu0: cpu@0 {
+			clock-frequency = <0>;
+			compatible = "sifive,e51", "sifive,rocket0";

Looks like you forgot the currently required "riscv" compatible here and below.

But perhaps it's the binding and arch code that should be revised instead (e.g. as per your discussion with Rob elsewhere in this thread).

Johan

#16 lore raw

Re: [PATCH 7/7] riscv: dts: add initial board data for the SiFive HiFive Unleashed

In reply to Rob Herring
Quoted 6 lines · Rob Herring
Quoted 5 lines · Paul Walmsley

Add initial board data for the SiFive HiFive Unleashed A00.

Currently the data populated in this DT file describes the board DRAM configuration and the external clock sources that supply the PRCI.

...

Quoted 10 lines

arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts line 2

Quoted 8 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +2 -0
new file mode 100644
index 000000000000..0c6afabe69e3
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-License-Identifier: GPL-2.0-or-later

This should be a single line with: (Apache-2.0 OR GPL-2.0+)

Done.

Quoted 5 lines

arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts line 15

Quoted 3 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +3 -0
+	model = "SiFive HiFive Unleashed A00 (FU540-C000)"
+	compatible = "sifive,hifive-unleashed-a00-fu540",
+		"sifive,hifive-unleashed-fu540";

SoC compatible should be here too.

Done.

Quoted 8 lines
Quoted 8 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +8 -0
+	soc {
+		hfclk: hfclk {
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <33333333>;
+			clock-output-names = "hfclk";
+		};
+		rtcclk: rtcclk {
Quoted 8 lines

arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts line 37

Quoted 5 lines
arch/riscv/boot/dts/sifive/hifive-unleashed-a00-fu540.dts new file +5 -0
+			#clock-cells = <0>;
+			compatible = "fixed-clock";
+			clock-frequency = <1000000>;
+			clock-output-names = "rtcclk";
+		};

Are these the clock inputs to the SoC or dummy clocks until you write a proper clock driver? If the former, they should be at the top level.

Done.

Thanks for your comments; Will send an updated patch set.

- Paul