Skip to contentSkip to conversation

Add support for QNAP's ts-433 4bay NAS

PATCH Applied Uwe Kleine-König 2 participants 8 messages Mar 1, 2025 – Mar 17, 2025

Subsystems (5)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Add support for QNAP's ts-433 4bay NAS

Hello,

this is the result of my quick effort to make barebox run on QNAP's ts-433 4bay NAS. The first 3 patches are IMHO fine to go in. The last one adds the new machine. As writting in the commit log the NAS boots with the resulting image, but neither network nor eMMC work.

I also tried adding

	writel(RK_SETBITS(0x50), 0xfdc20140)

in lowlevel.c, but that didn't make a difference. I'm open for other ideas about what bit is missing.

Best regards
Uwe

Uwe Kleine-König (4):
Documentation: rockchip: Update versions of DDR init blobs
arm64: rockchip: Refresh rockchip_v8_defconfig
arm64: rockchip: Enable rk-usb-loader in rockchip_v8_defconfig
WIP: arm64: rockchip: Add support for QNAP's ts-433 4bay NAS

 Documentation/boards/rockchip.rst      |  7 ++++---
 arch/arm/boards/Makefile               |  1 +
 arch/arm/boards/qnap-tsx33/.gitignore  |  1 +
 arch/arm/boards/qnap-tsx33/Makefile    |  2 ++
 arch/arm/boards/qnap-tsx33/lowlevel.c  | 27 ++++++++++++++++++++++++++
 arch/arm/configs/rockchip_v8_defconfig |  6 ++----
 arch/arm/dts/Makefile                  |  1 +
 arch/arm/dts/rk3568-qnap-ts433.dts     | 27 ++++++++++++++++++++++++++
 arch/arm/mach-rockchip/Kconfig         |  7 +++++++
 images/Makefile.rockchip               |  1 +
 10 files changed, 73 insertions(+), 7 deletions(-)
 create mode 100644 arch/arm/boards/qnap-tsx33/.gitignore
 create mode 100644 arch/arm/boards/qnap-tsx33/Makefile
 create mode 100644 arch/arm/boards/qnap-tsx33/lowlevel.c
 create mode 100644 arch/arm/dts/rk3568-qnap-ts433.dts

base-commit: 2afd1a809f1a41f1dd42b95c2bc0ae74853b475b

Signature · 1 line
2.47.1
#1 lore raw

PATCH 1/4 Documentation: rockchip: Update versions of DDR init blobs

Update file names as they are currently available
https://github.com/rockchip-linux/rkbin as of today.

---
 Documentation/boards/rockchip.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/boards/rockchip.rst +3 -3
index b94c7a78e115..b2b04abb03cd 100644
@@ -75,9 +75,9 @@ The build process needs three binary files which have to be copied from the
 
 .. code-block:: sh
 
-  cp $RKBIN/bin/rk35/rk3568_bl31_v1.34.elf firmware/rk3568-bl31.bin
-  cp $RKBIN/bin/rk35/rk3568_bl32_v2.08.bin firmware/rk3568-bl32.bin
-  cp $RKBIN/bin/rk35/rk3568_ddr_1560MHz_v1.13.bin arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
+  cp $RKBIN/bin/rk35/rk3568_bl31_v1.44.elf firmware/rk3568-bl31.bin
+  cp $RKBIN/bin/rk35/rk3568_bl32_v2.15.bin firmware/rk3568-bl32.bin
+  cp $RKBIN/bin/rk35/rk3568_ddr_1560MHz_v1.23.bin arch/arm/boards/rockchip-rk3568-evb/sdram-init.bin
 
 With these barebox can be compiled as:
 
Signature · 1 line
2.47.1
#2 lore raw

PATCH 2/4 arm64: rockchip: Refresh rockchip_v8_defconfig

In reply to Uwe Kleine-König

This is just the result of

make rockchip_v8_defconfig
make savedefconfig
cp defconfig arch/arm/configs/rockchip_v8_defconfig

---
 arch/arm/configs/rockchip_v8_defconfig | 4 ----
 1 file changed, 4 deletions(-)
arch/arm/configs/rockchip_v8_defconfig +0 -4
index 83799ac492e7..941625394ccf 100644
@@ -7,8 +7,6 @@ CONFIG_MACH_PROTONIC_MECSBC=y
 CONFIG_MACH_RADXA_ROCK3=y
 CONFIG_MACH_RADXA_ROCK5=y
 CONFIG_MACH_RADXA_CM3=y
-CONFIG_BOARD_GENERIC_DT=y
-CONFIG_64BIT=y
 CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
 CONFIG_ARM_PSCI_CLIENT=y
 CONFIG_MMU=y
@@ -91,7 +89,6 @@ CONFIG_CMD_TIME=y
 CONFIG_NET=y
 CONFIG_NET_NFS=y
 CONFIG_NET_NETCONSOLE=y
-CONFIG_OFDEVICE=y
 CONFIG_OF_BAREBOX_DRIVERS=y
 CONFIG_AIODEV=y
 CONFIG_ROCKCHIP_SARADC=y
@@ -156,7 +153,6 @@ CONFIG_FS_TFTP=y
 CONFIG_FS_NFS=y
 CONFIG_FS_FAT=y
 CONFIG_FS_FAT_WRITE=y
-CONFIG_FS_FAT_LFN=y
 CONFIG_FS_BPKFS=y
 CONFIG_FS_UIMAGEFS=y
 CONFIG_LZO_DECOMPRESS=y
Signature · 1 line
2.47.1
#3 lore raw

PATCH 3/4 arm64: rockchip: Enable rk-usb-loader in rockchip_v8_defconfig

In reply to Uwe Kleine-König

rk-usb-loader is the tool advertised in the rockchip documentation to bootstrap a machine. So enable it in the defconfig.

---
 arch/arm/configs/rockchip_v8_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/rockchip_v8_defconfig +1 -0
index 941625394ccf..f1f418872385 100644
@@ -157,3 +157,4 @@ CONFIG_FS_BPKFS=y
 CONFIG_FS_UIMAGEFS=y
 CONFIG_LZO_DECOMPRESS=y
 # CONFIG_MISSING_FIRMWARE_ERROR is not set
+CONFIG_RK_USB_LOADER=y
Signature · 1 line
2.47.1
#4 lore raw

PATCH 4/4 WIP: arm64: rockchip: Add support for QNAP's ts-433 4bay NAS

In reply to Uwe Kleine-König

The resulting image boots to a prompt using usb booting. But neither network nor eMMC work :-\

---
 Documentation/boards/rockchip.rst      |  1 +
 arch/arm/boards/Makefile               |  1 +
 arch/arm/boards/qnap-tsx33/.gitignore  |  1 +
 arch/arm/boards/qnap-tsx33/Makefile    |  2 ++
 arch/arm/boards/qnap-tsx33/lowlevel.c  | 27 ++++++++++++++++++++++++++
 arch/arm/configs/rockchip_v8_defconfig |  1 +
 arch/arm/dts/Makefile                  |  1 +
 arch/arm/dts/rk3568-qnap-ts433.dts     | 27 ++++++++++++++++++++++++++
 arch/arm/mach-rockchip/Kconfig         |  7 +++++++
 images/Makefile.rockchip               |  1 +
 10 files changed, 69 insertions(+)
 create mode 100644 arch/arm/boards/qnap-tsx33/.gitignore
 create mode 100644 arch/arm/boards/qnap-tsx33/Makefile
 create mode 100644 arch/arm/boards/qnap-tsx33/lowlevel.c
 create mode 100644 arch/arm/dts/rk3568-qnap-ts433.dts
Documentation/boards/rockchip.rst +1 -0
index b2b04abb03cd..a9499e3560dd 100644
@@ -61,6 +61,7 @@ Supported Boards
 - Pine64 Quartz64 Model A
 - Radxa ROCK3 Model A
 - Radxa CM3 (RK3566) IO Board
+- QNAP TS-433 NAS
 - Protonic MECSBC
 
 The steps described in the following target the RK3568 and the RK3568 EVB but
arch/arm/boards/Makefile +1 -0
index c6104d043297..747676056a45 100644
@@ -94,6 +94,7 @@ obj-$(CONFIG_MACH_PROTONIC_STM32MP1)		+= protonic-stm32mp1/
 obj-$(CONFIG_MACH_PROTONIC_STM32MP13)		+= protonic-stm32mp13/
 obj-$(CONFIG_MACH_QIL_A9260)			+= qil-a926x/
 obj-$(CONFIG_MACH_QIL_A9G20)			+= qil-a926x/
+obj-$(CONFIG_MACH_QNAP_TSX33)			+= qnap-tsx33/
 obj-$(CONFIG_MACH_RADXA_ROCK)			+= radxa-rock/
 obj-$(CONFIG_MACH_PHYTEC_SOM_RK3288)		+= phytec-som-rk3288/
 obj-$(CONFIG_MACH_REALQ7)			+= datamodul-edm-qmx6/
arch/arm/boards/qnap-tsx33/.gitignore new file +1 -0
new file mode 100644
index 000000000000..f458f794b54c
@@ -0,0 +1 @@
+sdram-init.bin
arch/arm/boards/qnap-tsx33/Makefile new file +2 -0
new file mode 100644
index 000000000000..9961af02a3ea
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+lwl-y += lowlevel.o
arch/arm/boards/qnap-tsx33/lowlevel.c new file +27 -0
new file mode 100644
index 000000000000..f852e8d00a2b
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: GPL-2.0-only
+#include <common.h>
+#include <linux/sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/rockchip/hardware.h>
+#include <mach/rockchip/atf.h>
+#include <debug_ll.h>
+#include <mach/rockchip/rockchip.h>
+
+extern char __dtb_rk3568_qnap_ts433_start[];
+
+ENTRY_FUNCTION(start_rk3568_qnap_ts433, r0, r1, r2)
+{
+	/*
+	 * Image execution starts at 0x0, but this is used for ATF and
+	 * OP-TEE later, so move away from here.
+	 */
+	if (current_el() == 3)
+		relocate_to_adr_full(RK3568_BAREBOX_LOAD_ADDRESS);
+	else
+		relocate_to_current_adr();
+
+	setup_c();
+
+	rk3568_barebox_entry(__dtb_rk3568_qnap_ts433_start);
+}
arch/arm/configs/rockchip_v8_defconfig +1 -0
index f1f418872385..86f31affa901 100644
@@ -4,6 +4,7 @@ CONFIG_MACH_RK3568_BPI_R2PRO=y
 CONFIG_MACH_PINE64_PINETAB2=y
 CONFIG_MACH_PINE64_QUARTZ64=y
 CONFIG_MACH_PROTONIC_MECSBC=y
+CONFIG_MACH_QNAP_TSX33=y
 CONFIG_MACH_RADXA_ROCK3=y
 CONFIG_MACH_RADXA_ROCK5=y
 CONFIG_MACH_RADXA_CM3=y
arch/arm/dts/Makefile +1 -0
index d2de01927824..b4875cc00c91 100644
@@ -117,6 +117,7 @@ lwl-$(CONFIG_MACH_PROTONIC_STM32MP1) += \
 	stm32mp151-mecio1.dtb.o \
 	stm32mp151-mect1s.dtb.o
 lwl-$(CONFIG_MACH_PROTONIC_STM32MP13) += stm32mp133c-prihmb.dtb.o
+lwl-$(CONFIG_MACH_QNAP_TSX33) += rk3568-qnap-ts433.dtb.o
 lwl-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o
 lwl-$(CONFIG_MACH_RADXA_ROCK3) += rk3568-rock-3a.dtb.o
 lwl-$(CONFIG_MACH_RADXA_ROCK5) += rk3588-rock-5b.dtb.o
arch/arm/dts/rk3568-qnap-ts433.dts new file +27 -0
new file mode 100644
index 000000000000..05876656b4e2
@@ -0,0 +1,27 @@
+// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT)
+
+/dts-v1/;
+#include <arm64/rockchip/rk3568-qnap-ts433.dts>
+#include "rk356x.dtsi"
+
+/ {
+	chosen: chosen {
+		environment-emmc {
+			compatible = "barebox,environment";
+			device-path = &environment_emmc;
+		};
+	};
+};
+
+&sdmmc0 {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <2>;
+		#size-cells = <2>;
+
+		environment_emmc: partition@408000 {
+			label = "barebox-environment";
+			reg = <0x0 0x408000 0x0 0x8000>;
+		};
+	};
+};
arch/arm/mach-rockchip/Kconfig +7 -0
index bfbfa7367a3e..f8b0d5e4ec54 100644
@@ -106,6 +106,13 @@ config MACH_PROTONIC_MECSBC
 	help
 	  Say Y here if you are using a Protonic MECSBC
 
+config MACH_QNAP_TSX33
+	select ARCH_RK3568
+	bool "QNAP TS-433 NAS"
+	help
+	  Select this if you are using a QNAP TS-433 NAS.
+	  <https://www.qnap.com/en-us/product/ts-433>
+
 config MACH_RADXA_ROCK3
 	select ARCH_RK3568
 	bool "Radxa ROCK3"
images/Makefile.rockchip +1 -0
index 761c6b814989..2e63e554edce 100644
@@ -35,6 +35,7 @@ $(call build_rockchip_image, CONFIG_MACH_PINE64_PINETAB2, start_pinetab2_v0, pin
 $(call build_rockchip_image, CONFIG_MACH_PINE64_PINETAB2, start_pinetab2_v2, pine64-pinetab2/sdram-init.bin, pinetab2-v2)
 $(call build_rockchip_image, CONFIG_MACH_PINE64_QUARTZ64, start_quartz64a, pine64-quartz64/sdram-init.bin, quartz64a)
 $(call build_rockchip_image, CONFIG_MACH_PROTONIC_MECSBC, start_mecsbc, protonic-mecsbc/sdram-init.bin, mecsbc)
+$(call build_rockchip_image, CONFIG_MACH_QNAP_TSX33, start_rk3568_qnap_ts433, qnap-tsx33/sdram-init.bin, qnap-ts433)
 $(call build_rockchip_image, CONFIG_MACH_RADXA_ROCK3, start_rock3a, radxa-rock3/sdram-init.bin, rock3a)
 $(call build_rockchip_image, CONFIG_MACH_RADXA_ROCK5, start_rock5b, radxa-rock5/sdram-init.bin, rock5b)
 $(call build_rockchip_image, CONFIG_MACH_RADXA_CM3, start_radxa_cm3_io, radxa-cm3/sdram-init.bin, radxa-cm3-io)
Signature · 1 line
2.47.1
Applied
#5 lore raw

Re: (subset) [PATCH 0/4] Add support for QNAP's ts-433 4bay NAS

In reply to Uwe Kleine-König
Quoted 8 lines · Uwe Kleine-König

this is the result of my quick effort to make barebox run on QNAP's ts-433 4bay NAS. The first 3 patches are IMHO fine to go in. The last one adds the new machine. As writting in the commit log the NAS boots with the resulting image, but neither network nor eMMC work.

I also tried adding

[...]

Applied, thanks!

[1/4] Documentation: rockchip: Update versions of DDR init blobs
https://git.pengutronix.de/cgit/barebox/commit/?id=4c0953db0f2d (link may not be stable)
[2/4] arm64: rockchip: Refresh rockchip_v8_defconfig
https://git.pengutronix.de/cgit/barebox/commit/?id=7a94e43d0862 (link may not be stable)
[3/4] arm64: rockchip: Enable rk-usb-loader in rockchip_v8_defconfig
https://git.pengutronix.de/cgit/barebox/commit/?id=12ba84b2a475 (link may not be stable)

Best regards,

Signature · 1 line
Sascha Hauer <[email protected]>
#6 lore raw
In reply to Uwe Kleine-König

Hi Uwe,

Quoted 7 lines · Uwe Kleine-König

Hello,

this is the result of my quick effort to make barebox run on QNAP's ts-433 4bay NAS. The first 3 patches are IMHO fine to go in. The last one adds the new machine. As writting in the commit log the NAS boots with the resulting image, but neither network nor eMMC work.

Quoted 6 lines

I also tried adding

	writel(RK_SETBITS(0x50), 0xfdc20140)

in lowlevel.c, but that didn't make a difference. I'm open for other ideas about what bit is missing.

dts/src/arm64/rockchip/rk3568-qnap-ts433.dts lacks the pinctrl nodes for the sdhci controller. It might be that it works when booting from eMMC, but not when booting from USB.

No idea for networking though.

Regards,
Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#7 lore raw

Hello Sascha,

thanks for picking up the first three patches

Quoted 8 lines · Sascha Hauer
Quoted 7 lines · Uwe Kleine-König

this is the result of my quick effort to make barebox run on QNAP's ts-433 4bay NAS. The first 3 patches are IMHO fine to go in. The last one adds the new machine. As writting in the commit log the NAS boots with the resulting image, but neither network nor eMMC work.

I also tried adding

Quoted 8 lines
Quoted 4 lines
	writel(RK_SETBITS(0x50), 0xfdc20140)

in lowlevel.c, but that didn't make a difference. I'm open for other ideas about what bit is missing.

dts/src/arm64/rockchip/rk3568-qnap-ts433.dts lacks the pinctrl nodes for the sdhci controller. It might be that it works when booting from eMMC, but not when booting from USB.

When I add pinctrl info like that:

dts/src/arm64/rockchip/rk3568-qnap-ts433.dts +2 -0
index e601d9271ba8..b65f2412023a 100644
@@ -567,6 +567,8 @@ &sdhci {
 	bus-width = <8>;
 	max-frequency = <200000000>;
 	non-removable;
+	pinctrl-names = "default";
+	pinctrl-0 = <&emmc_bus8 &emmc_clk &emmc_cmd &emmc_datastrobe>;
 	status = "okay";
 };
 

I get an error message when the driver probes (see below).

Enabling deep probe (which was an idea from #barebox) didn't change anything here.

Quoted 1 line

No idea for networking though.

With rtl8169 driver disabled the internal eth driver probes successfully (didn't work out the details, with both enabled I get
ERROR: register_device: already registered eth
ERROR: eqos-rockchip [email protected]: probe failed: Invalid argument
) the full boot log is:

barebox 2025.02.0-00004-g1ec0faa7cbbb-dirty #9 Mon Mar 17 17:29:30 CET 2025

Board: Qnap TS-433-4G NAS System 4-Bay
deep-probe: supported due to qnap,ts433
rockchip-dmc memory-controller.of: Detected memory size: 0x100000000
netconsole: registered as netconsole-1
arm-scmi firmware:scmi.of: SCMI Protocol v2.0 'rockchip:' Firmware version 0x0 psci psci.of: detected version 1.1
xHCI xHCI0: USB XHCI 1.10
ehci [email protected]: USB EHCI 1.00
ehci [email protected]: USB EHCI 1.00
rk808 rk8090: chip id: 0x8090
rk3568-dwcmshc-sdhci [email protected]: registered as mmc0
ERROR: rk3568-dwcmshc-sdhci [email protected]: SDHCI timeout while waiting for idle
WARNING: mmc0: Card's startup fails with -16
phy6: lane number 0, val 1
phy6: lane number 1, val 2
phy6: bifurcation enabled
mdio_bus: miibus0: probed
malloc space: 0xafd00000 -> 0xefcfffff (size 1 GiB)
environment load /dev/env0: No such file or directory
Maybe you have to create the partition.

Hit any to stop autoboot: 3
eth0: 1000Mbps full duplex link detected
barebox@QNAP TS-433:/ ifup eth0
WARNING: eth0: No MAC address set. Using random address 22:e8:c9:ad:3e:45 T T T T T T T T T T T T T T T T T T T T ifup: Connection timed out

I guess the next step is to try 2nd stage booting with U-Boot.

Best regards
Uwe