Skip to contentSkip to conversation

board: rockchip: add FriendlyElec NanoPC-T6 rk3588 board

PATCH Superseded John Clark 1 participant 2 messages Oct 8, 2023

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

John Clark

author
#0 lore raw

v2 cover board: rockchip: add FriendlyElec NanoPC-T6 rk3588 board

Jonas, thank you for your detailed review. The explanations for each of config change recommendations were especially helpful.

As for the CFG_IRAM_BASE / BROM_LAST_BOOTSOURCE issue, I have made a step forward, but expect I will be getting feedback as to a better approach.

Note: This patchset is based on Kever's most recent pull request "u-boot-rockchip-20231007" which, as of this writing, has yet to be merged upstream.

Finally, I would appreciate any insight as to FriendlyElec vs FriendlyARM naming. Currently, I have documented this as the "FriendlyARM NanoPC-T6" but it would seem that it could also be called the "FriendlyElec NanoPC-T6" and be equally correct. It is worth noting that u-boot currently contains support for the "FriendlyARM NanoPi2" board/friendlyarm/nanopi2 and thus my use of FriendlyARM.

Changes in v2:
- resync dt from:
https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git/plain/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dts?h=for-next
- config changes:

    -CONFIG_PCI_INIT_R=y
    -CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000
    +CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
    -CONFIG_REGULATOR_PWM=y
    -# CONFIG_USB_XHCI_DWC3_OF_SIMPLE is not set
    -CONFIG_SPL_USB_DWC3_GENERIC=y

- added board files:
create mode 100644 board/friendlyarm/nanopct6-rk3588/Kconfig create mode 100644 board/friendlyarm/nanopct6-rk3588/MAINTAINERS create mode 100644 board/friendlyarm/nanopct6-rk3588/Makefile create mode 100644 board/friendlyarm/nanopct6-rk3588/nanopct6-rk3588.c create mode 100644 include/configs/nanopct6-rk3588.h
- improved BROM_LAST_BOOTSOURCE handling for SPI NOR:

    if (CONFIG_IS_ENABLED(TARGET_NANOPCT6_RK3588) && bootdevice_brom_id == 4)
        bootdevice_ofpath = boot_devices[BROM_BOOTSOURCE_SPINOR];
    else
        bootdevice_ofpath = boot_devices[bootdevice_brom_id];
Signature · 1 line
2.42.0
author
#1 lore raw

PATCH v2 1/1 board: rockchip: add FriendlyElec NanoPC-T6 rk3588 board

The NanoPC-T6 is a Rockchip RK3588 based SBC by FriendlyARM.

There are four variants depending on the DRAM size: 4G/32GB eMMC, 8G/64GB eMMC, 16G/16MB SPI NOR, and 16G/256GB eMMC/16MB SPI NOR

Specifications:
CPU: Rockchip RK3588, 4x Cortex-A76 (up to 2.4GHz)
+ 4x Cortex-A55 (up to 1.8GHz)
GPU: Mali-G610 MP4
VPU: 8K@60fps H.265 and VP9 decoder, 8K@30fps H.264 decoder,
4K@60fps AV1 decoder, 8K@30fps H.264 and H.265 encoder
NPU: 6TOPs, supports INT4/INT8/INT16/FP16
RAM: 64-bit 4GB/8GB/16GB LPDDR4X at 2133MHz
eMMC: 0GB/32GB/64GB/256GB HS400
MicroSD Slot: MicroSD SDR104
PCIe 3.0: M.2 M-Key x1, PCIe 3.0 x4 for NVMe SSDs up to 2,500 MB/s
Ethernet: PCIe 2.5G 2x Ethernet (RTL8125BG)
PCIe 2.1: M.2 E-Key x1, PCIe 2.1 x1 and USB2.0 Host,
supports M.2 WiFi and Bluetooth
4G Module: MiniPCIe x1, MicroSIM Card Slot x1
Audio Out: 3.5mm jack for stereo headphone output
Audio In: 2.0mm PH-2A connector for analog microphone input Video Input: standard HDMI input port, up to 4Kp60
2x 4-lane MIPI-CSI, compatible with MIPI V1.2
Video Output: 2x standard HDMI output ports compatible with HDMI2.1,
HDMI2.0, and HDMI1.4
2x 4-lane MIPI-DSI, compatible with MIPI DPHY 2.0 or CPHY 1.1
USB-A: USB 3.0, Type A
USB-C: Full function USB Type‑C port, DP display up to 4Kp60, USB 3.0 40-pin 2.54mm header connector: up to 2x SPIs, 6x UARTs, 1x I2Cs,
8x PWMs, 2x I2Ss, 28x GPIOs
Debug UART: 3 Pin 2.54mm header, 3V level, 1500000bps Onboard IR receiver: 38KHz carrier frequency
RTC Battery: 2 Pin 1.27/1.25mm RTC battery connector for low power
RTC IC HYM8563TS
5V Fan connector
Working Temperature: 0C to 70C
Power: 5.5*2.1mm DC Jack, 12VDC input
Dimensions: 110x80x1.6mm (without case) / 86x114.5x30mm (with case)

Kernel commits:
893c17716d0c ("arm64: dts: rockchip: Add NanoPC T6") a721e28dfad2 ("arm64: dts: rockchip: Add NanoPC T6 PCIe Ethernet support") ac76b786cc37 ("arm64: dts: rockchip: Add NanoPC T6 PCIe e-key support")

---
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/rk3588-nanopc-t6-u-boot.dtsi     |  36 +
 arch/arm/dts/rk3588-nanopc-t6.dts             | 916 ++++++++++++++++++
 arch/arm/mach-rockchip/rk3588/Kconfig         |  46 +
 arch/arm/mach-rockchip/spl.c                  |   8 +-
 board/friendlyarm/nanopct6-rk3588/Kconfig     |  15 +
 board/friendlyarm/nanopct6-rk3588/MAINTAINERS |   9 +
 board/friendlyarm/nanopct6-rk3588/Makefile    |   6 +
 .../nanopct6-rk3588/nanopct6-rk3588.c         |  39 +
 configs/nanopc-t6-rk3588_defconfig            | 109 +++
 doc/board/rockchip/rockchip.rst               |   1 +
 include/configs/nanopct6-rk3588.h             |  15 +
 12 files changed, 1199 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/rk3588-nanopc-t6-u-boot.dtsi
 create mode 100644 arch/arm/dts/rk3588-nanopc-t6.dts
 create mode 100644 board/friendlyarm/nanopct6-rk3588/Kconfig
 create mode 100644 board/friendlyarm/nanopct6-rk3588/MAINTAINERS
 create mode 100644 board/friendlyarm/nanopct6-rk3588/Makefile
 create mode 100644 board/friendlyarm/nanopct6-rk3588/nanopct6-rk3588.c
 create mode 100644 configs/nanopc-t6-rk3588_defconfig
 create mode 100644 include/configs/nanopct6-rk3588.h
arch/arm/dts/Makefile +1 -0
index bde2176ec7..6a4335cf9c 100644
@@ -189,6 +189,7 @@ dtb-$(CONFIG_ROCKCHIP_RK3588) += \
 	rk3588-edgeble-neu6a-io.dtb \
 	rk3588-edgeble-neu6b-io.dtb \
 	rk3588-evb1-v10.dtb \
+	rk3588-nanopc-t6.dtb \
 	rk3588s-rock-5a.dtb \
 	rk3588-rock-5b.dtb
 
arch/arm/dts/rk3588-nanopc-t6-u-boot.dtsi new file +36 -0
new file mode 100644
index 0000000000..87831c9d43
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2023 John Clark <[email protected]>
+ *
+ */
+
+#include "rk3588-u-boot.dtsi"
+
+/ {
+	chosen {
+		u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
+	};
+};
+
+&fspim1_pins {
+	bootph-all;
+};
+
+&sfc {
+	bootph-pre-ram;
+	u-boot,spl-sfc-no-dma;
+	pinctrl-names = "default";
+	pinctrl-0 = <&fspim1_pins>;
+	#address-cells = <1>;
+	#size-cells = <0>;
+	status = "okay";
+
+	flash@0 {
+		bootph-pre-ram;
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <24000000>;
+		spi-rx-bus-width = <4>;
+		spi-tx-bus-width = <1>;
+	};
+};
arch/arm/dts/rk3588-nanopc-t6.dts new file +916 -0

916 lines not on this page · raw message

arch/arm/mach-rockchip/rk3588/Kconfig +46 -0

58 lines not on this page · raw message

arch/arm/mach-rockchip/spl.c +6 -2
index 87280e2ba7..ac45aa97db 100644
@@ -35,8 +35,12 @@ const char *board_spl_was_booted_from(void)
 	u32  bootdevice_brom_id = readl(BROM_BOOTSOURCE_ID_ADDR);
 	const char *bootdevice_ofpath = NULL;
 
-	if (bootdevice_brom_id < ARRAY_SIZE(boot_devices))
-		bootdevice_ofpath = boot_devices[bootdevice_brom_id];
+	if (bootdevice_brom_id < ARRAY_SIZE(boot_devices)) {
+		if (CONFIG_IS_ENABLED(TARGET_NANOPCT6_RK3588) && bootdevice_brom_id == 4)
+			bootdevice_ofpath = boot_devices[BROM_BOOTSOURCE_SPINOR];
+		else
+			bootdevice_ofpath = boot_devices[bootdevice_brom_id];
+	}
 
 	if (bootdevice_ofpath)
 		debug("%s: brom_bootdevice_id %x maps to '%s'\n",
board/friendlyarm/nanopct6-rk3588/Kconfig new file +15 -0
new file mode 100644
index 0000000000..0fd9ff32cb
@@ -0,0 +1,15 @@
+if TARGET_NANOPCT6_RK3588
+
+config SYS_BOARD
+	default "nanopct6-rk3588"
+
+config SYS_VENDOR
+	default "friendlyarm"
+
+config SYS_CONFIG_NAME
+	default "nanopct6-rk3588"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+	def_bool y
+
+endif
board/friendlyarm/nanopct6-rk3588/MAINTAINERS new file +9 -0
new file mode 100644
index 0000000000..cb3a7fe973
@@ -0,0 +1,9 @@
+NANOPCT6-RK3588
+M:	John Clark <[email protected]>
+R:	Jonas Karlman <[email protected]>
+S:	Maintained
+F:	board/friendlyarm/nanopct6-rk3588
+F:	include/configs/nanopct6-rk3588.h
+F:	configs/nanopc-t6-rk3588_defconfig
+F:	arch/arm/dts/rk3588-nanopc-t6.dts
+F:	arch/arm/dts/rk3588-nanopc-t6-u-boot.dtsi
board/friendlyarm/nanopct6-rk3588/Makefile new file +6 -0
new file mode 100644
index 0000000000..eff1cde22d
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier:     GPL-2.0+
+#
+# Copyright (c) 2023 Rockchip Electronics Co,. Ltd.
+#
+
+obj-y += nanopct6-rk3588.o
board/friendlyarm/nanopct6-rk3588/nanopct6-rk3588.c new file +39 -0
new file mode 100644
index 0000000000..26155c8943
@@ -0,0 +1,39 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2023 Rockchip Electronics Co,. Ltd.
+ */
+
+#include <fdtdec.h>
+#include <fdt_support.h>
+
+#ifdef CONFIG_OF_BOARD_SETUP
+int nanopct6_add_reserved_memory_fdt_nodes(void *new_blob)
+{
+	struct fdt_memory gap1 = {
+		.start = 0x3fc000000,
+		.end = 0x3fc4fffff,
+	};
+	struct fdt_memory gap2 = {
+		.start = 0x3fff00000,
+		.end = 0x3ffffffff,
+	};
+	unsigned long flags = FDTDEC_RESERVED_MEMORY_NO_MAP;
+	unsigned int ret;
+
+	/*
+	 * Inject the reserved-memory nodes into the DTS
+	 */
+	ret = fdtdec_add_reserved_memory(new_blob, "gap1", &gap1,  NULL, 0,
+					 NULL, flags);
+	if (ret)
+		return ret;
+
+	return fdtdec_add_reserved_memory(new_blob, "gap2", &gap2,  NULL, 0,
+					  NULL, flags);
+}
+
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	return nanopct6_add_reserved_memory_fdt_nodes(blob);
+}
+#endif
configs/nanopc-t6-rk3588_defconfig new file +109 -0

109 lines not on this page · raw message

doc/board/rockchip/rockchip.rst +1 -0
index de9fe8e642..739e8467e3 100644
@@ -112,6 +112,7 @@ List of mainline supported Rockchip boards:
      - Rockchip EVB (evb-rk3588)
      - Edgeble Neural Compute Module 6A SoM - Neu6a (neu6a-io-rk3588)
      - Edgeble Neural Compute Module 6B SoM - Neu6b (neu6b-io-rk3588)
+     - FriendlyARM NanoPC-T6 (nanopct6-rk3588)
      - Radxa ROCK 5A (rock5a-rk3588s)
      - Radxa ROCK 5B (rock5b-rk3588)
 
include/configs/nanopct6-rk3588.h new file +15 -0
new file mode 100644
index 0000000000..1ece6f9383
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (c) 2023 Rockchip Electronics Co., Ltd.
+ */
+
+#ifndef __NANOPCT6_RK3588_H
+#define __NANOPCT6_RK3588_H
+
+#define ROCKCHIP_DEVICE_SETTINGS \
+		"stdout=serial,vidconsole\0" \
+		"stderr=serial,vidconsole\0"
+
+#include <configs/rk3588_common.h>
+
+#endif /* __NANOPCT6_RK3588_H */
Signature · 1 line
2.42.0