Skip to contentSkip to conversation

arm: mvebu: add .dts file for Synology DS213j

PATCH New Arnaud Ebalard 4 participants 6 messages Oct 25, 2014 – Oct 26, 2014

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

PATCH 1/1 arm: mvebu: add .dts file for Synology DS213j

Synology DS213j is a 2-bay NAS powered by a Marvell Armada 370 (88F6710 @1.2Ghz). It is very similar on many aspects to previous 2-bay Synology models based on Marvell kirkwood SoC. Here is a short summary of the device:

- 512MB RAM
- boot on SPI flash (64Mbit Micron N25Q064)
- 1 GbE interface (Armada MAC connected to a Marvell 88E1512 PHY via SGMII)
- 2 rear USB 2.0 ports (directly handled by the Armada 370)
- 2 internal SATA ports handled by the Armada 370: 2 GPIO for presence, 2 for powering them
- two front amber LED (disk1, disk2) controlled by the SoC
- Seiko S-35390A I2C RTC chip
- UART0 providing serial console
- UART1 used for poweroff
- Fan handled via 4 GPIO (3 for speed, 1 for alarm)

---

This v0 is just to gather initial comments. Some random notes and questions (Andrew, Ben, Simon):

- Simon: why does fan_alarm_irq_handler in gpio-fan.c returns IRQ_NONE?

- When I bought the NAS, it had an old Marvell bootloader. After install of latest DSM version, the u-boot was a new one w/ I had to change the 'ranges' in the .dts to the ones below to have the kernel boot. I guess new DS213j hardware will be shipped with new u-boot version at some point and this will be fine; Otherwise, users will either have to upgrade their DSM or manually s/1f/d0/ in .dts.

- Andrew,Ben: SPI flash partitions are correct, I can read all those, 'file' recognize them and the content looks kosher. Nonetheless, I did a diff before and after a 'saveenv' under u-boot and u-boot environment is saved by u-boot itself in the middle of the kernel (0x40000 after the start of mtd1). This make kernel CRC incorrect and prevent u-boot to boot the kernel. If you have any idea on this, I am interested.

- Andrew, Ben: I did a single file for the .dts but I intend to create a .dtsi; I have started a .dts for the DS414 (2-core Armada XP) and they share various nodes.

 arch/arm/boot/dts/Makefile                       |   3 +-
 arch/arm/boot/dts/armada-370-synology-ds213j.dts | 312 +++++++++++++++++++++++
 2 files changed, 314 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/armada-370-synology-ds213j.dts
arch/arm/boot/dts/Makefile +2 -1
index 38c89cafa1ab..95387b59ebb2 100644
@@ -495,7 +495,8 @@ dtb-$(CONFIG_MACH_ARMADA_370) += \
 	armada-370-mirabox.dtb \
 	armada-370-netgear-rn102.dtb \
 	armada-370-netgear-rn104.dtb \
-	armada-370-rd.dtb
+	armada-370-rd.dtb \
+	armada-370-synology-ds213j.dtb
 dtb-$(CONFIG_MACH_ARMADA_375) += \
 	armada-375-db.dtb
 dtb-$(CONFIG_MACH_ARMADA_38X) += \
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +312 -0

312 lines not on this page · raw message

Signature · 1 line
2.1.1
#1 lore raw

PATCH 1/1 arm: mvebu: add .dts file for Synology DS213j

Hi Arnaud

Nice to see another device supported.

Quoted 6 lines

- When I bought the NAS, it had an old Marvell bootloader. After install of latest DSM version, the u-boot was a new one w/ I had to change the 'ranges' in the .dts to the ones below to have the kernel boot. I guess new DS213j hardware will be shipped with new u-boot version at some point and this will be fine; Otherwise, users will either have to upgrade their DSM or manually s/1f/d0/ in .dts.

Marvell have made a real mess here. Since there seems to be two different base addresses in use, i suggest you put a fat comment on the top of the .dts file about this issue. Give users a clue what to try if the kernel does not do anything at all.

Quoted 7 lines

- Andrew,Ben: SPI flash partitions are correct, I can read all those, 'file' recognize them and the content looks kosher. Nonetheless, I did a diff before and after a 'saveenv' under u-boot and u-boot environment is saved by u-boot itself in the middle of the kernel (0x40000 after the start of mtd1). This make kernel CRC incorrect and prevent u-boot to boot the kernel. If you have any idea on this, I am interested.

This sounds like the default install of u-boot does not make use of any environment variables which are not the default value. Hence the uboot environment store being in the middle of the kernel is not an issue. Maybe you can ask for the u-boot sources, or see if they are on the synology download site, and check this? Again, a fat warning in the .dts file may be a good idea. What does seem odd is the Reboot, FIS, etc, mtd partition names. Is there redboot installed at all?

Quoted 3 lines

- Andrew, Ben: I did a single file for the .dts but I intend to create a .dtsi; I have started a .dts for the DS414 (2-core Armada XP) and they share various nodes.

O.K, good.

Quoted 25 lines
 arch/arm/boot/dts/Makefile                       |   3 +-
 arch/arm/boot/dts/armada-370-synology-ds213j.dts | 312 +++++++++++++++++++++++
 2 files changed, 314 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/armada-370-synology-ds213j.dts
arch/arm/boot/dts/Makefile +2 -1
index 38c89cafa1ab..95387b59ebb2 100644
@@ -495,7 +495,8 @@ dtb-$(CONFIG_MACH_ARMADA_370) += \
 	armada-370-mirabox.dtb \
 	armada-370-netgear-rn102.dtb \
 	armada-370-netgear-rn104.dtb \
-	armada-370-rd.dtb
+	armada-370-rd.dtb \
+	armada-370-synology-ds213j.dtb
 dtb-$(CONFIG_MACH_ARMADA_375) += \
 	armada-375-db.dtb
 dtb-$(CONFIG_MACH_ARMADA_38X) += \
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +0 -0
new file mode 100644
index 000000000000..a99ccd0df20d

arch/arm/boot/dts/armada-370-synology-ds213j.dts line 10

Quoted 10 lines
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +10 -0
@@ -0,0 +1,312 @@
+/*
+ * Device Tree file for Synology DS213j
+ *
+ * Copyright (C) 2014, Arnaud EBALARD <[email protected]>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */

There has been some discussion on using MIT or BSD for .dts files. Your choice thought.

arch/arm/boot/dts/armada-370-synology-ds213j.dts line 101

Quoted 1 line
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +1 -0
+				pmx_syno_id_bit0: pmx_syno_id_bit0 {

Should always be _ in the first part, and - in the second. There are other nodes which are wrong.

arch/arm/boot/dts/armada-370-synology-ds213j.dts line 169

Quoted 4 lines
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +4 -0
+				spi-flash at 0 {
+					#address-cells = <1>;
+					#size-cells = <1>;
+					compatible = "n25q064";

Should have a vendor prefix.

arch/arm/boot/dts/armada-370-synology-ds213j.dts line 222

Quoted 10 lines
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +10 -0
+			i2c at 11000 {
+				compatible = "marvell,mv64xxx-i2c";
+				clock-frequency = <400000>;
+				status = "okay";
+
+				s35390a: s35390a at 30 {
+					 compatible = "ssi,s35390a";
+					 reg = <0x30>;
+				};
+			};

If it uses an external RTC, it makes sense the disable the internal one.

arch/arm/boot/dts/armada-370-synology-ds213j.dts line 230

Quoted 8 lines
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +8 -0
+
+			serial at 12000 {
+				status = "okay";
+			};
+
+			serial at 12100 {
+				status = "okay";
+			};

It would be nice to put comments about what these two serial ports are used for. i.e. internal header, and to a PIC for power control.

Looks good otherwise.

Andrew

#2 lore raw

PATCH 1/1 arm: mvebu: add .dts file for Synology DS213j

Quoted 25 lines · Andrew Lunn

Hi Arnaud

Nice to see another device supported.

Quoted 6 lines

- When I bought the NAS, it had an old Marvell bootloader. After install of latest DSM version, the u-boot was a new one w/ I had to change the 'ranges' in the .dts to the ones below to have the kernel boot. I guess new DS213j hardware will be shipped with new u-boot version at some point and this will be fine; Otherwise, users will either have to upgrade their DSM or manually s/1f/d0/ in .dts.

Marvell have made a real mess here. Since there seems to be two different base addresses in use, i suggest you put a fat comment on the top of the .dts file about this issue. Give users a clue what to try if the kernel does not do anything at all.

Quoted 7 lines

- Andrew,Ben: SPI flash partitions are correct, I can read all those, 'file' recognize them and the content looks kosher. Nonetheless, I did a diff before and after a 'saveenv' under u-boot and u-boot environment is saved by u-boot itself in the middle of the kernel (0x40000 after the start of mtd1). This make kernel CRC incorrect and prevent u-boot to boot the kernel. If you have any idea on this, I am interested.

Quoted 6 lines

This sounds like the default install of u-boot does not make use of any environment variables which are not the default value. Hence the uboot environment store being in the middle of the kernel is not an issue. Maybe you can ask for the u-boot sources, or see if they are on the synology download site, and check this? Again, a fat warning in the .dts file may be a good idea.

On the Kirkwood-based Synology DiskStations, saving the environment is not possible, and the "RedBoot Config" partition is not used.

It sounds as if Synology configured the Marvell u-boot bootloader on the Marvell Armada series for a 1MiB bootloader partition size (instead of 768KiB), with the config partition following immediately after it, and never tested (or forgot to disable) saving environment variables.

Quoted 2 lines

What does seem odd is the Reboot, FIS, etc, mtd partition names. Is there redboot installed at all?

I think the RedBoot partition names are carried over from the older PPC-based Synology DiskStations. As far as I can tell, the FIS directory partition is never referenced by the Synology kernel or bootloader, though the information in it does match what is used by the kernel, and it appears it may be used by the Synology updater.

#3 lore raw

PATCH 1/1 arm: mvebu: add .dts file for Synology DS213j

Quoted 9 lines · Ben Peddell
Quoted 2 lines · Andrew Lunn

What does seem odd is the Reboot, FIS, etc, mtd partition names. Is there redboot installed at all?

I think the RedBoot partition names are carried over from the older PPC-based Synology DiskStations. As far as I can tell, the FIS directory partition is never referenced by the Synology kernel or bootloader, though the information in it does match what is used by the kernel, and it appears it may be used by the Synology updater.

I stand corrected here - on the Marvell Armada XP and Armada 370 DiskStations, the FIS directory (RedBoot parts) does appear to be used by the Synology kernel.

If I'm reading it right, unless otherwise configured, the RedBoot partition maps will take precedence over the device tree partition maps when CONFIG_MTD_REDBOOT_PARTS is enabled.

maintainer
#4 lore raw

PATCH 1/1 arm: mvebu: add .dts file for Synology DS213j

In reply to Andrew Lunn
Quoted 11 lines · On Sunday 26 October 2014 00:16:11 Andrew Lunn wrote:

Hi Arnaud

Nice to see another device supported.

Quoted 6 lines

- When I bought the NAS, it had an old Marvell bootloader. After install of latest DSM version, the u-boot was a new one w/ I had to change the 'ranges' in the .dts to the ones below to have the kernel boot. I guess new DS213j hardware will be shipped with new u-boot version at some point and this will be fine; Otherwise, users will either have to upgrade their DSM or manually s/1f/d0/ in .dts.

Quoted 5 lines

Marvell have made a real mess here. Since there seems to be two different base addresses in use, i suggest you put a fat comment on the top of the .dts file about this issue. Give users a clue what to try if the kernel does not do anything at all.

Maybe it's better to have multiple dtb files in this case. It should be trivial to have one .dts file that just overrides the one address.

Arnd

#5 lore raw

PATCH 1/1 arm: mvebu: add .dts file for Synology DS213j

In reply to Arnaud Ebalard

arch/arm/boot/dts/armada-370-synology-ds213j.dts line 25

Quoted 8 lines
arch/arm/boot/dts/armada-370-synology-ds213j.dts new file +8 -0
+/ {
+	model = "Synology DS213j";
+	compatible = "synology,ds213j", "marvell,armada370", "marvell,armada-370-xp";
+
+	chosen {
+		bootargs = "console=ttyS0,115200 earlyprintk";
+	};
+

Missed it on the first look through. To help barebox, it is good to have:

               stdout-path = &uart0;

       Andrew