Skip to contentSkip to conversation

ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

PATCH New Willy Tarreau 3 participants 8 messages Feb 11, 2017 – Feb 12, 2017

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

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

This commit adds the device tree description for the Synology DS116 NAS.

It is a one-bay NAS powered by a Marvell Armada 385 at 1.866 GHz. The device features the following items :
- 1 GB DDR3 RAM
- a 8MB SPI flash
- 2 USB3 ports, power-controlled via a GPIO for each
- 1 gigabit ethernet interface connected over SGMII to a 88e1514 phy
- a single SATA port, power-controlled via a GPIO
- a battery-powered RTC
- one UART connected to the serial console (2mm connector on board)
- the Tx line of the second UART connected to a PIC microcontroller dealing with beep, reset, power-off and LED blinking (115200 Bps)
- some of the front-panel LEDs are connected to GPIOs, one is directly connected to the SATA link to report disk activity.
- a GPIO-controlled fan (3 bits for 7 speeds and OFF)

With this DTS, my NAS is 100% functional starting with kernel 4.9.

---
 arch/arm/boot/dts/Makefile                      |   1 +
 arch/arm/boot/dts/armada-385-synology-ds116.dts | 315 ++++++++++++++++++++++++
 2 files changed, 316 insertions(+)
 create mode 100644 arch/arm/boot/dts/armada-385-synology-ds116.dts
arch/arm/boot/dts/Makefile +1 -0
index 01d178a..2bc2b33 100644
@@ -949,6 +949,7 @@ dtb-$(CONFIG_MACH_ARMADA_38X) += \
 	armada-385-db-ap.dtb \
 	armada-385-linksys-caiman.dtb \
 	armada-385-linksys-cobra.dtb \
+	armada-385-synology-ds116.dtb \
 	armada-385-turris-omnia.dtb \
 	armada-388-clearfog.dtb \
 	armada-388-db.dtb \
arch/arm/boot/dts/armada-385-synology-ds116.dts new file +315 -0

315 lines not on this page · raw message

Signature · 1 line
2.8.0.rc2.1.gbe9624a
#1 lore raw

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

arch/arm/boot/dts/armada-385-synology-ds116.dts line 85

Quoted 10 lines
arch/arm/boot/dts/armada-385-synology-ds116.dts new file +10 -0
+			serial at 12000 {
+				pinctrl-names = "default";
+				pinctrl-0 = <&uart0_pins>;
+				status = "okay";
+			};
+
+			serial at 12100 {
+				/* A PIC16F1829 is connected to uart1 at 115200 bps,
+				 * and takes single-character orders :
+				 *   "1" : power off

Hi Willy

The qnap-poweroff.c driver will support this. You need a new compatible string, since 115200 is not the speed the current synology devices use.

Quoted 11 lines
arch/arm/boot/dts/armada-385-synology-ds116.dts new file +11 -0
+				 *   "2" : short beep
+				 *   "3" : long beep
+				 *   "4" : turn the power LED ON
+				 *   "5" : flash the power LED
+				 *   "6" : turn the power LED OFF
+				 *   "7" : turn the status LED OFF
+				 *   "8" : turn the status LED ON
+				 *   "9" : flash the status LED
+				 *   "A" : flash the motherboard LED (D8)
+				 *   "B" : turn the motherboard LED OFF
+				 *   "C" : hard reset

arch/arm/boot/dts/armada-385-synology-ds116.dts

Quoted 10 lines
arch/arm/boot/dts/armada-385-synology-ds116.dts new file +9 -0
+				 */
+				pinctrl-names = "default";
+				pinctrl-0 = <&uart1_pins>;
+				status = "okay";
+			};
 
+		gpio-leds {
+			compatible = "gpio-leds";
+
+			/* The greed part is on gpio0.20 which is also used by

green?

Andrew

#2 lore raw

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

Hi Andrew,

Quoted 13 lines · Andrew Lunn

arch/arm/boot/dts/armada-385-synology-ds116.dts line 85

Quoted 10 lines
arch/arm/boot/dts/armada-385-synology-ds116.dts new file +10 -0
+			serial at 12000 {
+				pinctrl-names = "default";
+				pinctrl-0 = <&uart0_pins>;
+				status = "okay";
+			};
+
+			serial at 12100 {
+				/* A PIC16F1829 is connected to uart1 at 115200 bps,
+				 * and takes single-character orders :
+				 *   "1" : power off

Hi Willy

Quoted 3 lines

The qnap-poweroff.c driver will support this. You need a new compatible string, since 115200 is not the speed the current synology devices use.

But won't that squat the I/O address and prevent me from using all the other codes via the regular serial port ? They are particularly convenient in fact since they are the only way to access the LEDs, beeper and even to trigger a reset (even if this last one is less used in software form).

Quoted 17 lines
Quoted 16 lines
arch/arm/boot/dts/armada-385-synology-ds116.dts new file +16 -0
+				 *   "2" : short beep
+				 *   "3" : long beep
+				 *   "4" : turn the power LED ON
+				 *   "5" : flash the power LED
+				 *   "6" : turn the power LED OFF
+				 *   "7" : turn the status LED OFF
+				 *   "8" : turn the status LED ON
+				 *   "9" : flash the status LED
+				 *   "A" : flash the motherboard LED (D8)
+				 *   "B" : turn the motherboard LED OFF
+				 *   "C" : hard reset
+				 */
+				pinctrl-names = "default";
+				pinctrl-0 = <&uart1_pins>;
+				status = "okay";
+			};
Quoted 6 lines

arch/arm/boot/dts/armada-385-synology-ds116.dts line 173

Quoted 4 lines
arch/arm/boot/dts/armada-385-synology-ds116.dts new file +4 -0
+		gpio-leds {
+			compatible = "gpio-leds";
+
+			/* The greed part is on gpio0.20 which is also used by

green?

Oops, sorry, thanks for catching.

Willy

#3 lore raw

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

Quoted 2 lines

But won't that squat the I/O address and prevent me from using all the other codes via the regular serial port ?

Nope. That driver hijacks the serial port during shutdown to actually turn the power off. The rest of the time, it does not touch the serial port. Userspace, or the rest of the kernel is free to use it.

Andrew

#4 lore raw

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

Quoted 6 lines · Andrew Lunn
Quoted 2 lines

But won't that squat the I/O address and prevent me from using all the other codes via the regular serial port ?

Nope. That driver hijacks the serial port during shutdown to actually turn the power off. The rest of the time, it does not touch the serial port. Userspace, or the rest of the kernel is free to use it.

OK so I should declare both the serial and the power-off device at the same address ? Excuse-me for the dumb question but I'm not much used to doing uncommon things in DTS files :-/

Willy

#5 lore raw

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

Quoted 11 lines · Willy Tarreau
Quoted 6 lines · Andrew Lunn
Quoted 2 lines

But won't that squat the I/O address and prevent me from using all the other codes via the regular serial port ?

Nope. That driver hijacks the serial port during shutdown to actually turn the power off. The rest of the time, it does not touch the serial port. Userspace, or the rest of the kernel is free to use it.

OK so I should declare both the serial and the power-off device at the same address ? Excuse-me for the dumb question but I'm not much used to doing uncommon things in DTS files :-/

Hi Willy

What you have in v2 and v3 looks good. It could be considered a bit of a hack, two nodes for the same hardware block. But they are used at different times, normal runtime, and late in the shutdown. So it works out O.K.

Andrew

#6 lore raw

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

Quoted 13 lines · Andrew Lunn
Quoted 11 lines · Willy Tarreau
Quoted 6 lines · Andrew Lunn
Quoted 2 lines

But won't that squat the I/O address and prevent me from using all the other codes via the regular serial port ?

Nope. That driver hijacks the serial port during shutdown to actually turn the power off. The rest of the time, it does not touch the serial port. Userspace, or the rest of the kernel is free to use it.

OK so I should declare both the serial and the power-off device at the same address ? Excuse-me for the dumb question but I'm not much used to doing uncommon things in DTS files :-/

Quoted 6 lines

Hi Willy

What you have in v2 and v3 looks good. It could be considered a bit of a hack, two nodes for the same hardware block. But they are used at different times, normal runtime, and late in the shutdown. So it works out O.K.

OK thanks for confirming :-)

Willy

#7 lore raw

PATCH 1/1 ARM: dts: armada-385-synology-ds116: add support for Synology DS116 NAS

In reply to Andrew Lunn

Hello,

Quoted 4 lines · Andrew Lunn

What you have in v2 and v3 looks good. It could be considered a bit of a hack, two nodes for the same hardware block. But they are used at different times, normal runtime, and late in the shutdown. So it works out O.K.

I don't really mind personally, but IMO this is clearly a hack. It completely violates the rule that the DT should represent the HW, and the fact that the DT should be operating system agnostic.

But anyway, there are so many things in the DT that violates those rules that probably this hack is fine.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com