Skip to contentSkip to conversation

openrisc: Add DTS and defconfig for DE0-Nano

PATCH In review Geert Uytterhoeven 7 participants 21 messages Nov 9, 2013 – Nov 20, 2013

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

PATCH 1/1 openrisc: Add DTS and defconfig for DE0-Nano

Add a DTS and defconfig for the Terasic DE0-Nano Development and Education Board running ORPSoC. This board contains an Altera Cyclone IV FPGA with support chips and I/O.

The DTS was derived from published versions by Kevin Mehall and Marek Czerski.

Cc Kevin Mehall <[email protected]>
Cc Marek Czerski <[email protected]>

---
Notable changes:
- Change flash0 to spansion,s25sl064p, due to kernel message

    m25p80 spi32766.0: found s25sl064p, expected m25p10

- Use reg-shift instead of regstep for i2c0, due to kernel message ocores-i2c a0000000.ocores: regstep property deprecated, use reg-shift

 arch/openrisc/boot/dts/de0_nano.dts      |  158 ++++++++++++++++++++++++++++++
 arch/openrisc/configs/de0_nano_defconfig |   86 ++++++++++++++++
 2 files changed, 244 insertions(+)
 create mode 100644 arch/openrisc/boot/dts/de0_nano.dts
 create mode 100644 arch/openrisc/configs/de0_nano_defconfig
arch/openrisc/boot/dts/de0_nano.dts new file +158 -0
new file mode 100644
index 000000000000..42f91b5184d9
@@ -0,0 +1,158 @@
+/dts-v1/;
+/ {
+	compatible = "opencores,de0_nano";
+	#address-cells = <1>;
+	#size-cells = <1>;
+	interrupt-parent = <&pic>;
+
+	chosen {
+		bootargs = "console=uart,mmio,0x90000000,115200";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x02000000>;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		cpu@0 {
+			compatible = "opencores,or1200-rtlsvn481";
+			reg = <0>;
+			clock-frequency = <50000000>;
+		};
+	};
+
+	/*
+	 * OR1K PIC is built into CPU and accessed via special purpose
+	 * registers.  It is not addressable and, hence, has no 'reg'
+	 * property.
+	 */
+	pic: pic {
+		compatible = "opencores,or1k-pic";
+		#interrupt-cells = <1>;
+		interrupt-controller;
+	};
+
+	serial0: serial@90000000 {
+		compatible = "opencores,uart16550-rtlsvn105", "ns16550a";
+		reg = <0x90000000 0x100>;
+		interrupts = <2>;
+		clock-frequency = <50000000>;
+	};
+
+	i2c0: ocores@a0000000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "opencores,i2c-ocores";
+		reg = <0xa0000000 0x8>;
+		interrupts = <10>;
+		clock-frequency = <50000000>;
+
+		reg-shift = <0>;	/* 8 bit registers */
+		reg-io-width = <1>;	/* 8 bit read/write */
+
+		adxl34x@1d {
+			compatible = "adxl34x";
+			reg = <0x1d>;
+			interrupts = <26>;
+		};
+		eeprom@50 {
+			compatible = "at24,24c02";
+			reg = <0x50>;
+			pagesize = <8>;
+		};
+	};
+
+	spi0: spi0@b0000000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "opencores,spi-simple";
+		reg = <0xb0000000 0x5>;
+
+		flash0: mtd@0 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "spansion,s25sl064p";
+			reg = <0>;
+			spi-max-frequency = <40000000>;
+			m25p,fast-read;
+
+			partition@0 {
+				label = "FPGA image";
+				reg = <0x00000000 0x000b0000>;
+				read-only;
+			};
+			partition@b0000 {
+				label = "bootloader";
+				reg = <0x000b0000 0x00050000>;
+				read-only;
+			};
+			partition@100000 {
+				label = "free space";
+				reg = <0x00100000 0x00700000>;
+			};
+		};
+	};
+
+	spi1: spi1@b1000000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "opencores,spi-simple";
+		reg = <0xb1000000 0x5>;
+
+		adc@0 {
+			compatible = "adcxx,adcxx8s";
+			reg = <0>;
+			spi-max-frequency = <1000000>;
+		};
+	};
+
+	gpio0: gpio@91000000 {
+		compatible = "opencores,jbtrivial";
+		reg = <0x91000000 0x2>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		xlnx,data-offset = <0>;
+		xlnx,tri-offset = <1>;
+		xlnx,gpio-width = <8>;
+	};
+
+	gpio-leds {
+		compatible = "gpio-leds";
+		heartbeat {
+			label = "Heartbeat";
+			gpios = <&gpio0 0 0x0>;
+			linux,default-trigger = "heartbeat";
+		};
+		led1 {
+			label = "led1";
+			gpios = <&gpio0 1 0>;
+		};
+		led2 {
+			label = "led2";
+			gpios = <&gpio0 2 0>;
+		};
+		led3 {
+			label = "led3";
+			gpios = <&gpio0 3 0>;
+		};
+		led4 {
+			label = "led4";
+			gpios = <&gpio0 4 0>;
+		};
+		led5 {
+			label = "led5";
+			gpios = <&gpio0 5 0>;
+		};
+		led6 {
+			label = "led6";
+			gpios = <&gpio0 6 0>;
+		};
+		led7 {
+			label = "led7";
+			gpios = <&gpio0 7 0>;
+		};
+	};
+};
arch/openrisc/configs/de0_nano_defconfig new file +86 -0

86 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 6 lines · Geert Uytterhoeven

Add a DTS and defconfig for the Terasic DE0-Nano Development and Education Board running ORPSoC. This board contains an Altera Cyclone IV FPGA with support chips and I/O.

The DTS was derived from published versions by Kevin Mehall and Marek Czerski.

To give credit where credit is due, this was created by:
Gong Tao <[email protected]>

Quoted 8 lines
Cc Kevin Mehall <[email protected]>
Cc Marek Czerski <[email protected]>

---
Notable changes:
- Change flash0 to spansion,s25sl064p, due to kernel message

    m25p80 spi32766.0: found s25sl064p, expected m25p10

This is due to Altera changing the EPCS chip on newer revisions of that board, older versions are "relabeled" m25p10 and newer once s25sl064p.
The change is fine though, you have to pick one.

Stefan

#2 lore raw
Quoted 10 lines · Stefan Kristiansson
Quoted 6 lines · Geert Uytterhoeven

Add a DTS and defconfig for the Terasic DE0-Nano Development and Education Board running ORPSoC. This board contains an Altera Cyclone IV FPGA with support chips and I/O.

The DTS was derived from published versions by Kevin Mehall and Marek Czerski.

To give credit where credit is due, this was created by:
Gong Tao <[email protected]>

Sorry, I didn't know that. Jonas: please add.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#7 lore raw
In reply to Geert Uytterhoeven

Hi Geert,

I'll pull this into my OpenRISC tree now as-is, but there's a couple of things that need sorting out before this can be upstreamed... see below.

Thanks,
Jonas

Quoted 29 lines · Geert Uytterhoeven

Add a DTS and defconfig for the Terasic DE0-Nano Development and Education Board running ORPSoC. This board contains an Altera Cyclone IV FPGA with support chips and I/O.

The DTS was derived from published versions by Kevin Mehall and Marek Czerski.

Cc Kevin Mehall <[email protected]>
Cc Marek Czerski <[email protected]>

---
Notable changes:
- Change flash0 to spansion,s25sl064p, due to kernel message

     m25p80 spi32766.0: found s25sl064p, expected m25p10

- Use reg-shift instead of regstep for i2c0, due to kernel message ocores-i2c a0000000.ocores: regstep property deprecated, use reg-shift

  arch/openrisc/boot/dts/de0_nano.dts      |  158 ++++++++++++++++++++++++++++++
  arch/openrisc/configs/de0_nano_defconfig |   86 ++++++++++++++++
  2 files changed, 244 insertions(+)

create mode 100644 arch/openrisc/boot/dts/de0_nano.dts create mode 100644 arch/openrisc/configs/de0_nano_defconfig

arch/openrisc/boot/dts/de0_nano.dts new file +0 -0
new file mode 100644
index 000000000000..42f91b5184d9

arch/openrisc/boot/dts/de0_nano.dts line 3

Quoted 3 lines
arch/openrisc/boot/dts/de0_nano.dts new file +3 -0
@@ -0,0 +1,158 @@
+/dts-v1/;
+/ {
+	compatible = "opencores,de0_nano";

This should probably be "altera,de0_nano". We also need to put a version number of some kind on this thing. How are the de0_nano boards versioned?

Quoted 35 lines
arch/openrisc/boot/dts/de0_nano.dts new file +35 -0
+	#address-cells = <1>;
+	#size-cells = <1>;
+	interrupt-parent = <&pic>;
+
+	chosen {
+		bootargs = "console=uart,mmio,0x90000000,115200";
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x00000000 0x02000000>;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		cpu@0 {
+			compatible = "opencores,or1200-rtlsvn481";
+			reg = <0>;
+			clock-frequency = <50000000>;
+		};
+	};
+
+	/*
+	 * OR1K PIC is built into CPU and accessed via special purpose
+	 * registers.  It is not addressable and, hence, has no 'reg'
+	 * property.
+	 */
+	pic: pic {
+		compatible = "opencores,or1k-pic";
+		#interrupt-cells = <1>;
+		interrupt-controller;
+	};
+
+	serial0: serial@90000000 {

arch/openrisc/boot/dts/de0_nano.dts line 48

Quoted 10 lines
arch/openrisc/boot/dts/de0_nano.dts new file +10 -0
+		compatible = "opencores,uart16550-rtlsvn105", "ns16550a";
+		reg = <0x90000000 0x100>;
+		interrupts = <2>;
+		clock-frequency = <50000000>;
+	};
+
+	i2c0: ocores@a0000000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "opencores,i2c-ocores";

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

Quoted 13 lines
arch/openrisc/boot/dts/de0_nano.dts new file +13 -0
+		reg = <0xa0000000 0x8>;
+		interrupts = <10>;
+		clock-frequency = <50000000>;
+
+		reg-shift = <0>;	/* 8 bit registers */
+		reg-io-width = <1>;	/* 8 bit read/write */
+
+		adxl34x@1d {
+			compatible = "adxl34x";
+			reg = <0x1d>;
+			interrupts = <26>;
+		};
+		eeprom@50 {

arch/openrisc/boot/dts/de0_nano.dts line 71

Quoted 10 lines
arch/openrisc/boot/dts/de0_nano.dts new file +10 -0
+			compatible = "at24,24c02";
+			reg = <0x50>;
+			pagesize = <8>;
+		};
+	};
+
+	spi0: spi0@b0000000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "opencores,spi-simple";

Version number.

Quoted 21 lines
arch/openrisc/boot/dts/de0_nano.dts new file +21 -0
+		reg = <0xb0000000 0x5>;
+
+		flash0: mtd@0 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "spansion,s25sl064p";
+			reg = <0>;
+			spi-max-frequency = <40000000>;
+			m25p,fast-read;
+
+			partition@0 {
+				label = "FPGA image";
+				reg = <0x00000000 0x000b0000>;
+				read-only;
+			};
+			partition@b0000 {
+				label = "bootloader";
+				reg = <0x000b0000 0x00050000>;
+				read-only;
+			};
+			partition@100000 {

arch/openrisc/boot/dts/de0_nano.dts line 102

Quoted 10 lines
arch/openrisc/boot/dts/de0_nano.dts new file +10 -0
+				label = "free space";
+				reg = <0x00100000 0x00700000>;
+			};
+		};
+	};
+
+	spi1: spi1@b1000000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "opencores,spi-simple";

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

arch/openrisc/boot/dts/de0_nano.dts line 113

Quoted 11 lines
arch/openrisc/boot/dts/de0_nano.dts new file +11 -0
+		reg = <0xb1000000 0x5>;
+
+		adc@0 {
+			compatible = "adcxx,adcxx8s";
+			reg = <0>;
+			spi-max-frequency = <1000000>;
+		};
+	};
+
+	gpio0: gpio@91000000 {
+		compatible = "opencores,jbtrivial";

There's no project called 'jbtrivial' at OpenCores. Should this be "linux,jbtrivial" to indicate that this refers to a Linux driver?

arch/openrisc/boot/dts/de0_nano.dts line 119

Quoted 6 lines
arch/openrisc/boot/dts/de0_nano.dts new file +6 -0
+		reg = <0x91000000 0x2>;
+		#gpio-cells = <2>;
+		gpio-controller;
+		xlnx,data-offset = <0>;
+		xlnx,tri-offset = <1>;
+		xlnx,gpio-width = <8>;

Yuck... I wrote this driver with a similar driver for a Xilinx part as a starting point. Apparently I left the Xilenx (xlnx) tags in there for the device properties. We can't really have it like this, though.

Like I mentioned earlier, I'd like to see this thing disappear altogether and be replaced with gpio-generic.

/Jonas

maintainer
#3 lore raw
In reply to Stefan Kristiansson
Quoted 9 lines · Stefan Kristiansson
Quoted 3 lines · Geert Uytterhoeven

Notable changes:
- Change flash0 to spansion,s25sl064p, due to kernel message

     m25p80 spi32766.0: found s25sl064p, expected m25p10

This is due to Altera changing the EPCS chip on newer revisions of that board, older versions are "relabeled" m25p10 and newer once s25sl064p.
The change is fine though, you have to pick one.

Actually, you want two DTS's: one for each version of the board with a 'compatible' property to help select the right one. What do the revision numbers for these boards look like?

/Jonas

#4 lore raw
Quoted 15 lines · Jonas Bonn
Quoted 8 lines · Stefan Kristiansson
Quoted 4 lines · Geert Uytterhoeven

Notable changes:
- Change flash0 to spansion,s25sl064p, due to kernel message

     m25p80 spi32766.0: found s25sl064p, expected m25p10
Quoted 4 lines

This is due to Altera changing the EPCS chip on newer revisions of that board, older versions are "relabeled" m25p10 and newer once s25sl064p.
The change is fine though, you have to pick one.

Quoted 3 lines

Actually, you want two DTS's: one for each version of the board with a 'compatible' property to help select the right one. What do the revision numbers for these boards look like?

The bottom of my board has the following text:

P012060013
94V-0
HL9-VO
1227 F

Plus a barcode sticker which I assume is the S/N.

Best,

Andrew

--
Principal, AB Open Ltd
http://abopen.com

#5 lore raw
Quoted 3 lines · Andrew Back

P012060013
94V-0
HL9-VO

Same here.

Quoted 1 line

1227 F

Mine says "1321 F"

Do you have the 8 MiB Spansion FL064PIF?

Quoted 1 line

Plus a barcode sticker which I assume is the S/N.

Idem ditto. And the last 4 digits don't match the sticker on the box. Hmm...

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#6 lore raw
Quoted 5 lines · Geert Uytterhoeven
Quoted 3 lines · Andrew Back

P012060013
94V-0
HL9-VO

Quoted 7 lines

Same here.

Quoted 1 line

1227 F

Mine says "1321 F"

Do you have the 8 MiB Spansion FL064PIF?

Yes. Although it looks as though someone has drawn over the first "F" with black pen, so it sort of reads "L064PIF".

Best,

Andrew

Signature · 3 lines
Andrew Back
Principal, AB Open Ltd
http://abopen.com
#8 lore raw
In reply to Jonas Bonn

Hi Jonas,

Quoted 7 lines · Jonas Bonn

arch/openrisc/boot/dts/de0_nano.dts line 3

Quoted 5 lines

+++ b/arch/openrisc/boot/dts/de0_nano.dts

arch/openrisc/boot/dts/de0_nano.dts new file +3 -0
@@ -0,0 +1,158 @@
+/dts-v1/;
+/ {
+       compatible = "opencores,de0_nano";

This should probably be "altera,de0_nano". We also need to put a version

"terasic,de0_nano"? The board says "Designed and manufactured by Terasic". Hmm, the sticker on the box says "Altera DE0-Nano".

Quoted 1 line

number of some kind on this thing. How are the de0_nano boards versioned?

That's a good question...

See also Andrew back's email and my response.

The supplied schematics filename is de0-nano-c4-rev-c\(release_cd_rom\).pdf, and the drawings mention "Rev C".
The block diagram on page 2 still says "EPCS16 (16 Mb), but on page 8 it mentions "EPCS64", which is what's on my board.

Quoted 9 lines

arch/openrisc/boot/dts/de0_nano.dts line 48

Quoted 4 lines
arch/openrisc/boot/dts/de0_nano.dts new file +4 -0
+       i2c0: ocores@a0000000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "opencores,i2c-ocores";

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

That's gonna need some information diving, as Stefan's orpsoc git repositories only contains references to orpsocv2 git-svn-ids, not the svn ids of the original
component repositories.

Quoted 15 lines

arch/openrisc/boot/dts/de0_nano.dts line 113

Quoted 2 lines
arch/openrisc/boot/dts/de0_nano.dts new file +2 -0
+       gpio0: gpio@91000000 {
+               compatible = "opencores,jbtrivial";

There's no project called 'jbtrivial' at OpenCores. Should this be "linux,jbtrivial" to indicate that this refers to a Linux driver?

arch/openrisc/boot/dts/de0_nano.dts line 119

Quoted 6 lines
arch/openrisc/boot/dts/de0_nano.dts new file +6 -0
+               reg = <0x91000000 0x2>;
+               #gpio-cells = <2>;
+               gpio-controller;
+               xlnx,data-offset = <0>;
+               xlnx,tri-offset = <1>;
+               xlnx,gpio-width = <8>;
Quoted 6 lines

Yuck... I wrote this driver with a similar driver for a Xilinx part as a starting point. Apparently I left the Xilenx (xlnx) tags in there for the device properties. We can't really have it like this, though.

Like I mentioned earlier, I'd like to see this thing disappear altogether and be replaced with gpio-generic.

That needs device-tree support and published bindings first. IIRC, you had some preliminary code?

Thanks for review!

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#9 lore raw
Quoted 4 lines · Geert Uytterhoeven

The supplied schematics filename is de0-nano-c4-rev-c\(release_cd_rom\).pdf, and the drawings mention "Rev C".
The block diagram on page 2 still says "EPCS16 (16 Mb), but on page 8 it mentions "EPCS64", which is what's on my board.

I found the Rev B schematics on the web. It lacks the EPCS drawing on page 8.

According to
http://forums.parallax.com/showthread.php/132578-Getting-started-with-FPGAs/page7
there are also versions with a 64 Mbit Altera EPCS64.

So my guess is:
Rev A: EPCS16
Rev B: Altera EPCS64
Rev C: Spansian EPCS64

Unless Andrew and I have Rev Fs, as there's no "C" on our boards.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#10 lore raw
In reply to Geert Uytterhoeven
Quoted 4 lines · Geert Uytterhoeven
Quoted 1 line

This should probably be "altera,de0_nano". We also need to put a version

"terasic,de0_nano"? The board says "Designed and manufactured by Terasic". Hmm, the sticker on the box says "Altera DE0-Nano".

Good question...

Quoted 9 lines
Quoted 4 lines

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

That's gonna need some information diving, as Stefan's orpsoc git repositories only contains references to orpsocv2 git-svn-ids, not the svn ids of the original
component repositories.

Stefan? Where's the "official" home of these cores nowadays? Have they been modified since they were copied from OpenCores into orpsocv2?

Quoted 5 lines
Quoted 2 lines

Like I mentioned earlier, I'd like to see this thing disappear altogether and be replaced with gpio-generic.

That needs device-tree support and published bindings first. IIRC, you had some preliminary code?

I thought I did, but I was mistaken. I don't have anything for gpio-generic.

/Jonas

#11 lore raw

2013/11/15 Jonas Bonn <[email protected]>

Quoted 13 lines · Geert Uytterhoeven
Quoted 7 lines

This should probably be "altera,de0_nano". We also need to put a version

Quoted 1 line

"terasic,de0_nano"? The board says "Designed and manufactured by Terasic". Hmm, the sticker on the box says "Altera DE0-Nano".

Good question...

terasic makes more sense than Altera. Altera just provides one of the components on the board

Quoted 14 lines
Quoted 7 lines
Quoted 6 lines

Version number needed. OpenCores wanted "projectname-rtlsvn###" where
###
is the SVN commit number of the RTL directory in the project's source repository.

Quoted 6 lines

That's gonna need some information diving, as Stefan's orpsoc git repositories
only contains references to orpsocv2 git-svn-ids, not the svn ids of the original
component repositories.

Quoted 4 lines

Stefan? Where's the "official" home of these cores nowadays? Have they been modified since they were copied from OpenCores into orpsocv2?

Most cores are fetched directly from OpenCores SVN. Out of these, some are patched on the fly by ORPSoC before they are being built. Most of the new cores are only available on github

More generally, can Linux use out-of-tree DTS files in an easy way? It's handy to have them in the kernel, but the best fit might actually be to put them in the corresponding orpsocv3 system directory. That would also make it easier to have separate device trees for differently configured FPGAs (they are reprogrammable after all).

//Olof

#12 lore raw
Quoted 5 lines · Olof Kindgren

More generally, can Linux use out-of-tree DTS files in an easy way? It's handy to have them in the kernel, but the best fit might actually be to put them in the corresponding orpsocv3 system directory. That would also make it easier to have separate device trees for differently configured FPGAs (they are reprogrammable after all).

If I'm not mistaken, this is ORPSoC v2?

Yes, it would be nice to have the DTS in ORPSoc itself.

Still, we would need overlays for the devices that are not defined in ORPSoC, e.g. on-board (and off-board) devices on i2c and spi.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

maintainer
#13 lore raw
In reply to Olof Kindgren
Quoted 11 lines · Olof Kindgren

2013/11/15 Jonas Bonn <[email protected]>

Quoted 9 lines · Geert Uytterhoeven
Quoted 7 lines

This should probably be "altera,de0_nano". We also need to put a version

Quoted 1 line

"terasic,de0_nano"? The board says "Designed and manufactured by Terasic". Hmm, the sticker on the box says "Altera DE0-Nano".

Quoted 6 lines
Quoted 4 lines

Good question...

terasic makes more sense than Altera. Altera just provides one of the components on the board

OK, terasic is probably better then.

Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 8 lines

Version number needed. OpenCores wanted "projectname-rtlsvn###" where
###
is the SVN commit number of the RTL directory in the project's source repository.

That's gonna need some information diving, as Stefan's orpsoc git repositories
only contains references to orpsocv2 git-svn-ids, not the svn ids of the original
component repositories.

Quoted 7 lines
Quoted 4 lines

Stefan? Where's the "official" home of these cores nowadays? Have they been modified since they were copied from OpenCores into orpsocv2?

Most cores are fetched directly from OpenCores SVN. Out of these, some are patched on the fly by ORPSoC before they are being built. Most of the new cores are only available on github

The version number is important in order to ensure _driver_ compatibility. As long as the patches don't make changes that requires changes to the Linux driver then it's OK to just put the SVN version number on them. If incompatible changes are being made, then we really need to find a "home" for these cores so that we can manage their version numbers in some way.

Quoted 6 lines

More generally, can Linux use out-of-tree DTS files in an easy way? It's handy to have them in the kernel, but the best fit might actually be to put them in the corresponding orpsocv3 system directory. That would also make it easier to have separate device trees for differently configured FPGAs (they are reprogrammable after all).

Yes, the DTS files don't really belong in the kernel tree at all. They belong "near the hardware". For these FPGA projects it definitely makes sense to keep (or automatically generate) the DTS files in the RTL build system, i.e. orpsoc.

We generally build the DTB into the kernel image itself, but that's not really necessary. You just need to get the DTB into memory and pass the kernel a pointer to it. If you can find some way to build the DTB into the FPGA image (block RAM?) then you've got a self-describing HW image:
have the OpenRISC core initialize itself with r3 containing the
address of the DTB and jump to the kernel entry point (reset vector) and everything should just work. If you put device tree logic into newlib as well then you can use this HW description for (other) bare metal apps, as well.

The device tree compiler is in the Linux kernel tree... but it's usable outside of the Linux build system, as well. You'll find the binary in script/dtc/dtc in the kernel tree... run it with --help to get an idea of how it's used. It really isn't supposed to have anything to do with Linux at all; it's a generic tool for a generic HW description.

/Jonas

Quoted 4 lines

//Olof

#15 lore raw
In reply to Jonas Bonn

On Fri, Nov 15, 2013 at 09:50:18AM +0000, Jonas Bonn wrote:
[...]

Quoted 5 lines

arch/openrisc/boot/dts/de0_nano.dts line 113

Quoted 2 lines
arch/openrisc/boot/dts/de0_nano.dts new file +2 -0
+	gpio0: gpio@91000000 {
+		compatible = "opencores,jbtrivial";

There's no project called 'jbtrivial' at OpenCores. Should this be "linux,jbtrivial" to indicate that this refers to a Linux driver?

I would prefer not. Having driver names in bindings is an antipattern; drivers should be free to change independently of the hardware or bindings, and we should be able to create new drivers that handle existing bindings.

Either a new compatible string should be allcoated, or one of the generic bindings should be used. While we do have drivers for the generic cases, the *-generic bindings are treated as a specification that hardware can meet, and are not intended to change. They are also there fore independent of Linux.

Thanks,
Mark.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw
In reply to Jonas Bonn

[...]

Quoted 21 lines
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Quoted 5 lines

Version number needed. OpenCores wanted "projectname-rtlsvn###" where
###
is the SVN commit number of the RTL directory in the project's source repository.

That's gonna need some information diving, as Stefan's orpsoc git repositories
only contains references to orpsocv2 git-svn-ids, not the svn ids of the original
component repositories.

Quoted 7 lines
Quoted 4 lines

Stefan? Where's the "official" home of these cores nowadays? Have they been modified since they were copied from OpenCores into orpsocv2?

Most cores are fetched directly from OpenCores SVN. Out of these, some are patched on the fly by ORPSoC before they are being built. Most of the new cores are only available on github

Quoted 6 lines

The version number is important in order to ensure _driver_ compatibility. As long as the patches don't make changes that requires changes to the Linux driver then it's OK to just put the SVN version number on them. If incompatible changes are being made, then we really need to find a "home" for these cores so that we can manage their version numbers in some way.

On this front, I note the CPU node has:

  compatible = "opencores,or1200-rtlsvn481";

Should this not be something like:

  compatible = "opencores,or1200-rtlsvn481", "opencores,or1200";

That way falling back to an always known compatible string is easier.

Quoted 23 lines
Quoted 7 lines

More generally, can Linux use out-of-tree DTS files in an easy way? It's handy to have them in the kernel, but the best fit might actually be to put them in the corresponding orpsocv3 system directory. That would also make it easier to have separate device trees for differently configured FPGAs (they are reprogrammable after all).

Yes, the DTS files don't really belong in the kernel tree at all. They belong "near the hardware". For these FPGA projects it definitely makes sense to keep (or automatically generate) the DTS files in the RTL build system, i.e. orpsoc.

We generally build the DTB into the kernel image itself, but that's not really necessary. You just need to get the DTB into memory and pass the kernel a pointer to it. If you can find some way to build the DTB into the FPGA image (block RAM?) then you've got a self-describing HW image:
have the OpenRISC core initialize itself with r3 containing the
address of the DTB and jump to the kernel entry point (reset vector) and everything should just work. If you put device tree logic into newlib as well then you can use this HW description for (other) bare metal apps, as well.

Quoted 5 lines

The device tree compiler is in the Linux kernel tree... but it's usable outside of the Linux build system, as well. You'll find the binary in script/dtc/dtc in the kernel tree... run it with --help to get an idea of how it's used. It really isn't supposed to have anything to do with Linux at all; it's a generic tool for a generic HW description.

It's worth noting the dtc is managed outside of the kernel [1] and periodically new features are pulled in. It's available on it's own, and several distributions package it.

As long as the bindings you are using are not in flux, then it's entirely possible to use an out-of-tree dts.

Thanks,
Mark.

[1] http://git.jdl.com/gitweb/?p=dtc.git;a=summary
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#16 lore raw
In reply to Jonas Bonn
Quoted 10 lines · Jonas Bonn

arch/openrisc/boot/dts/de0_nano.dts line 48

Quoted 5 lines
arch/openrisc/boot/dts/de0_nano.dts new file +5 -0
+
+	i2c0: ocores@a0000000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "opencores,i2c-ocores";

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

That will also require a change to the driver.

Using svn commit ids as version info seems a bit too fine grained to me, but if that's what's agreed on, then it should be the commit id from the projects official repository at opencores.org I think.

Stefan

#17 lore raw

2013/11/16 Stefan Kristiansson <[email protected]>

Quoted 19 lines · Jonas Bonn
Quoted 10 lines

arch/openrisc/boot/dts/de0_nano.dts line 48

Quoted 5 lines
arch/openrisc/boot/dts/de0_nano.dts new file +5 -0
+
+    i2c0: ocores@a0000000 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "opencores,i2c-ocores";

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

That will also require a change to the driver.

Using svn commit ids as version info seems a bit too fine grained to me, but if that's what's agreed on, then it should be the commit id from the projects official repository at opencores.org I think.

Quoted 5 lines

Stefan
_______________________________________________
Linux mailing list
[email protected]
http://lists.openrisc.net/listinfo/linux

I agree. I don't like doing versioning with revision numbers. It's too closely tied to the currently used VCS. The problem is that no one has bothered to do proper releases of the cores for the last ten years or so.

But since we are talking about a relatively small amount of cores here, I think it could be worth to take a quick glance to see if the latest SVN version is compatible with the latest tagged release. I would suspect that is the case for the majority of the cores and the we can just use the latest tag as version. For the other cores we could
1. Use latest tag + 1 (a bit ugly if the maintainer wants to do a proper release
2. Take over maintainership/fork and just release what's in the trunk (taking over maintenance is preferrable here to avoid more repo confusion)
3. Use SVN revisions

option 2 would be my preferred choice here, given that we get someone to do the actual work. I could probably help out with a few of the cores

Jonas, you said that opencores wanted projectname-svnversion. Do you know where that comes from? My proposal here would conflict with that

//Olof

maintainer
#18 lore raw

Hi Olof,

I think this discussion is veering away from what's relevant for the linux-kernel and devicetree lists and did consider dropping them at this point... but let's leave them in the discussion a bit longer in case there's some sage guidance to be found there on the topic of doing sane versioning of open source hardware.

Quoted 12 lines · Olof Kindgren

2013/11/16 Stefan Kristiansson <[email protected]>

Quoted 11 lines · Jonas Bonn
Quoted 9 lines

arch/openrisc/boot/dts/de0_nano.dts line 48

Quoted 5 lines
arch/openrisc/boot/dts/de0_nano.dts new file +5 -0
+
+    i2c0: ocores@a0000000 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "opencores,i2c-ocores";

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

That will also require a change to the driver.

The drivers in question aren't upstream so it's not a big deal. Making a change to get sane revisioning would be worth it anyway.

Quoted 4 lines
Quoted 4 lines

Using svn commit ids as version info seems a bit too fine grained to me, but if that's what's agreed on, then it should be the commit id from the projects official repository at opencores.org I think.

The DTS version tells the driver what feature set it can expect to find in the HW core and thus how to go about driving it. Normally, the core won't change features much, but if you add something new you'd want the driver to see a new 'compatible' tag so that it knows which features it can/should enable. New features will always entail driver changes; and a driver can always be compatible with both the old and new HW versions by just enabling the feature set appropriate to the HW in question.

Quoted 24 lines
Quoted 6 lines

Stefan
_______________________________________________
Linux mailing list
[email protected]
http://lists.openrisc.net/listinfo/linux

I agree. I don't like doing versioning with revision numbers. It's too closely tied to the currently used VCS. The problem is that no one has bothered to do proper releases of the cores for the last ten years or so.

But since we are talking about a relatively small amount of cores here, I think it could be worth to take a quick glance to see if the latest SVN version is compatible with the latest tagged release. I would suspect that is the case for the majority of the cores and the we can just use the latest tag as version. For the other cores we could
1. Use latest tag + 1 (a bit ugly if the maintainer wants to do a proper release
2. Take over maintainership/fork and just release what's in the trunk (taking over maintenance is preferrable here to avoid more repo confusion)
3. Use SVN revisions

Quoted 3 lines

option 2 would be my preferred choice here, given that we get someone to do the actual work. I could probably help out with a few of the cores

My suggestion:
i) Move the primary source of these cores to git (doesn't matter where... github is fine) ii) Use a shortened git commit ID (6 chars) as the version number

Why?

i) The commit ID is independent of the repository; whether the repo is opencores, github, or olof's computer, the commit ID is constant
ii) Tag names are arbitrary labels; they don't contain any more information than the commit ID
iii) The commit ID, being a hash of the source and repository history itself, contains information that makes it effectively impossible for someone to attach the same label to an incompatible core iv) I think everyone actively working on these cores today are doing so via git already... via orpsocv2/3, presumably

NB: you might do named releases of a core, from versions 1.2 to 2.5, but if the underlying feature set remains the same and the same driver applies then the DTS 'compatible' tag would remain constant across all these releases. This means that the HW feature set is decoupled from the arbitrary version numbers that people like to use when doing releases.

Quoted 2 lines

Jonas, you said that opencores wanted projectname-svnversion. Do you know where that comes from? My proposal here would conflict with that

It came out of a private conversion I had with Marcus Erlandsson (who spoke for OpenCores at the time). The OpenRISC project hadn't really moved on to git back then (as it has today) so it was the best we could come up with.

/Jonas

#19 lore raw
Quoted 10 lines · Jonas Bonn

2013/11/16 Stefan Kristiansson <[email protected]>

Quoted 9 lines
Quoted 9 lines · Jonas Bonn
Quoted 7 lines

+

Quoted 5 lines
arch/openrisc/boot/dts/de0_nano.dts new file +4 -0
+    i2c0: ocores@a0000000 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            compatible = "opencores,i2c-ocores";
Quoted 10 lines
Quoted 7 lines
Quoted 6 lines
Quoted 5 lines

Version number needed. OpenCores wanted "projectname-rtlsvn###" where ### is the SVN commit number of the RTL directory in the project's source repository.

That will also require a change to the driver.

The drivers in question aren't upstream so it's not a big deal. Making a

change to get sane revisioning would be worth it anyway.

Actually, the i2c driver *is* upstream. The remark was mostly meant as a reminder of that.

Stefan

#20 lore raw
In reply to Geert Uytterhoeven
Quoted 29 lines · Geert Uytterhoeven

Add a DTS and defconfig for the Terasic DE0-Nano Development and Education Board running ORPSoC. This board contains an Altera Cyclone IV FPGA with support chips and I/O.

The DTS was derived from published versions by Kevin Mehall and Marek Czerski.

Cc Kevin Mehall <contact-U/[email protected]>
Cc Marek Czerski <[email protected]>

---
Notable changes:
- Change flash0 to spansion,s25sl064p, due to kernel message

    m25p80 spi32766.0: found s25sl064p, expected m25p10

- Use reg-shift instead of regstep for i2c0, due to kernel message ocores-i2c a0000000.ocores: regstep property deprecated, use reg-shift

 arch/openrisc/boot/dts/de0_nano.dts      |  158 ++++++++++++++++++++++++++++++
 arch/openrisc/configs/de0_nano_defconfig |   86 ++++++++++++++++
 2 files changed, 244 insertions(+)
 create mode 100644 arch/openrisc/boot/dts/de0_nano.dts
 create mode 100644 arch/openrisc/configs/de0_nano_defconfig
arch/openrisc/boot/dts/de0_nano.dts new file +0 -0
new file mode 100644
index 000000000000..42f91b5184d9

arch/openrisc/boot/dts/de0_nano.dts line 3

Quoted 3 lines
arch/openrisc/boot/dts/de0_nano.dts new file +3 -0
@@ -0,0 +1,158 @@
+/dts-v1/;
+/ {
+       compatible = "opencores,de0_nano";

This string needs to be documented.

Quoted 25 lines
arch/openrisc/boot/dts/de0_nano.dts new file +25 -0
+       #address-cells = <1>;
+       #size-cells = <1>;
+       interrupt-parent = <&pic>;
+
+       chosen {
+               bootargs = "console=uart,mmio,0x90000000,115200";
+       };
+
+       memory@0 {
+               device_type = "memory";
+               reg = <0x00000000 0x02000000>;
+       };
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               cpu@0 {
+                       compatible = "opencores,or1200-rtlsvn481";
+                       reg = <0>;
+                       clock-frequency = <50000000>;
+               };
+       };
+
+       /*
+        * OR1K PIC is built into CPU and accessed via special purpose

arch/openrisc/boot/dts/de0_nano.dts line 38

Quoted 10 lines
arch/openrisc/boot/dts/de0_nano.dts new file +10 -0
+        * registers.  It is not addressable and, hence, has no 'reg'
+        * property.
+        */
+       pic: pic {
+               compatible = "opencores,or1k-pic";
+               #interrupt-cells = <1>;
+               interrupt-controller;
+       };
+
+       serial0: serial@90000000 {

These memory mapped devices should be under a bus node of some sort. Typically a "simple-bus" node.

arch/openrisc/boot/dts/de0_nano.dts line 39

Quoted 1 line
arch/openrisc/boot/dts/de0_nano.dts new file +1 -0
+               compatible = "opencores,uart16550-rtlsvn105", "ns16550a";

This needs to be documented. Same comment applies to all compatible strings.

Quoted 22 lines
arch/openrisc/boot/dts/de0_nano.dts new file +22 -0
+               reg = <0x90000000 0x100>;
+               interrupts = <2>;
+               clock-frequency = <50000000>;
+       };
+
+       i2c0: ocores@a0000000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "opencores,i2c-ocores";
+               reg = <0xa0000000 0x8>;
+               interrupts = <10>;
+               clock-frequency = <50000000>;
+
+               reg-shift = <0>;        /* 8 bit registers */
+               reg-io-width = <1>;     /* 8 bit read/write */
+
+               adxl34x@1d {
+                       compatible = "adxl34x";
+                       reg = <0x1d>;
+                       interrupts = <26>;
+               };
+               eeprom@50 {

arch/openrisc/boot/dts/de0_nano.dts line 71

Quoted 10 lines
arch/openrisc/boot/dts/de0_nano.dts new file +10 -0
+                       compatible = "at24,24c02";
+                       reg = <0x50>;
+                       pagesize = <8>;
+               };
+       };
+
+       spi0: spi0@b0000000 {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               compatible = "opencores,spi-simple";

Is this different than "opencores,tiny-spi-rtlsvn2"? Is "simple" something I can correlate to a specific version of h/w?

Rob
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html