Skip to contentSkip to conversation

board: rockchip: add FriendlyElec NanoPC-T6 rk3588 board

PATCH Superseded John Clark 3 participants 6 messages Oct 7, 2023 – Nov 1, 2023

Subsystems (3)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

John Clark

author
#0 lore raw

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

NanoPC-T6 is a Rockchip RK3588 based SBC by FriendlyElec.

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, supports 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 input 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/rk3588.c    |   1 +
 configs/nanopc-t6-rk3588_defconfig        | 113 +++
 5 files changed, 1067 insertions(+)
 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 configs/nanopc-t6-rk3588_defconfig
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/rk3588.c +1 -0
index b1f535fad5..e08ebfa39b 100644
@@ -40,6 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
 const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
 	[BROM_BOOTSOURCE_EMMC] = "/mmc@fe2e0000",
 	[BROM_BOOTSOURCE_SPINOR] = "/spi@fe2b0000/flash@0",
+	[BROM_BOOTSOURCE_SPINAND] = "/spi@fe2b0000/flash@0",
 	[BROM_BOOTSOURCE_SD] = "/mmc@fe2c0000",
 	[BROM_BOOTSOURCE_SPINOR_RK3588] = "/spi@fe2b0000/flash@0",
 };
configs/nanopc-t6-rk3588_defconfig new file +113 -0

113 lines not on this page · raw message

Signature · 1 line
2.40.1
#1 lore raw

Hi John,

Quick feedback below, will look at schematics and runtime test later.

Quoted 43 lines · John Clark

NanoPC-T6 is a Rockchip RK3588 based SBC by FriendlyElec.

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, supports 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 input 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")

---

Quoted 9 lines
 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/rk3588.c    |   1 +
 configs/nanopc-t6-rk3588_defconfig        | 113 +++
 5 files changed, 1067 insertions(+)
 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 configs/nanopc-t6-rk3588_defconfig

This is missing addition of the board to the list in board documentation and an entry in the evb_rk3588 MAINTAINERS file.

[...]

Quoted 71 lines
arch/arm/dts/rk3588-nanopc-t6.dts new file +65 -0
new file mode 100644
index 0000000000..965bf5263d
@@ -0,0 +1,916 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2021 Rockchip Electronics Co., Ltd.
+ * Copyright (c) 2023 Thomas McKahan
+ *
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/pinctrl/rockchip.h>
+#include <dt-bindings/usb/pd.h>
+#include "rk3588.dtsi"
+
+/ {
+	model = "FriendlyElec NanoPC-T6";
+	compatible = "friendlyarm,nanopc-t6", "rockchip,rk3588";
+
+	aliases {
+		mmc0 = &sdhci;
+		mmc1 = &sdmmc;
+		serial2 = &uart2;
+	};
+
+	chosen {
+		stdout-path = "serial2:1500000n8";
+	};
+
+	sound {
+		compatible = "simple-audio-card";
+		pinctrl-names = "default";
+		pinctrl-0 = <&hp_det>;
+
+		simple-audio-card,name = "realtek,rt5616-codec";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,mclk-fs = <256>;
+
+		simple-audio-card,hp-det-gpio = <&gpio1 RK_PC4 GPIO_ACTIVE_LOW>;
+		simple-audio-card,hp-pin-name = "Headphones";
+
+		simple-audio-card,widgets =
+			"Headphone", "Headphones",
+			"Microphone", "Microphone Jack";
+		simple-audio-card,routing =
+			"Headphones", "HPOL",
+			"Headphones", "HPOR",
+			"MIC1", "Microphone Jack",
+			"Microphone Jack", "micbias1";
+
+		simple-audio-card,cpu {
+			sound-dai = <&i2s0_8ch>;
+		};
+		simple-audio-card,codec {
+			sound-dai = <&rt5616>;
+		};
+	};
+
+	leds {
+		compatible = "gpio-leds";
+
+		sys_led: led-0 {
+			gpios = <&gpio2 RK_PB7 GPIO_ACTIVE_HIGH>;
+			label = "system-led";
+			pinctrl-names = "default";
+			pinctrl-0 = <&sys_led_pin>;

arch/arm/dts/rk3588-nanopc-t6.dts line 75

Quoted 10 lines
arch/arm/dts/rk3588-nanopc-t6.dts new file +10 -0
+			linux,default-trigger = "heartbeat";
+		};
+
+		usr_led: led-1 {
+			gpios = <&gpio2 RK_PC0 GPIO_ACTIVE_HIGH>;
+			label = "user-led";
+			pinctrl-names = "default";
+			pinctrl-0 = <&usr_led_pin>;
+		};
+	};

sound and leds node is out of order compared to mmind/for-next tree. Rest of the device tree seem to be a 1:1 copy.

https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git/tree/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6.dts?h=for-next

[...]

arch/arm/mach-rockchip/rk3588/rk3588.c DECLARE_GLOBAL_DATA_PTR; · line 43

Quoted 9 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +1 -0
index b1f535fad5..e08ebfa39b 100644
@@ -40,6 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
 const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
 	[BROM_BOOTSOURCE_EMMC] = "/mmc@fe2e0000",
 	[BROM_BOOTSOURCE_SPINOR] = "/spi@fe2b0000/flash@0",
+	[BROM_BOOTSOURCE_SPINAND] = "/spi@fe2b0000/flash@0",

Hum, maybe we need to look at using the atags to determine boot device. We now have 3 different bootsource values representing same dt node.

Quoted 37 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +0 -0
 	[BROM_BOOTSOURCE_SD] = "/mmc@fe2c0000",
 	[BROM_BOOTSOURCE_SPINOR_RK3588] = "/spi@fe2b0000/flash@0",
 };
configs/nanopc-t6-rk3588_defconfig new file +28 -0
new file mode 100644
index 0000000000..a1d20b0770
@@ -0,0 +1,113 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_SYS_HAS_NONCACHED_MEMORY=y
+CONFIG_COUNTER_FREQUENCY=24000000
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_TEXT_BASE=0x00a00000
+CONFIG_SPL_LIBCOMMON_SUPPORT=y
+CONFIG_SPL_LIBGENERIC_SUPPORT=y
+CONFIG_NR_DRAM_BANKS=2
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0xc00000
+CONFIG_SF_DEFAULT_SPEED=24000000
+CONFIG_SF_DEFAULT_MODE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="rk3588-nanopc-t6"
+CONFIG_ROCKCHIP_RK3588=y
+CONFIG_SPL_ROCKCHIP_COMMON_BOARD=y
+CONFIG_ROCKCHIP_SPI_IMAGE=y
+CONFIG_SPL_SERIAL=y
+CONFIG_SPL_STACK_R_ADDR=0x600000
+CONFIG_TARGET_EVB_RK3588=y
+CONFIG_SPL_STACK=0x400000
+CONFIG_DEBUG_UART_BASE=0xFEB50000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI=y
+CONFIG_SYS_LOAD_ADDR=0xc00800
+CONFIG_PCI=y
+CONFIG_DEBUG_UART=y

configs/nanopc-t6-rk3588_defconfig line 38

Quoted 10 lines
configs/nanopc-t6-rk3588_defconfig new file +10 -0
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_FIT_SIGNATURE=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_LEGACY_IMAGE_FORMAT=y
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3588-nanopc-t6.dtb"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_PCI_INIT_R=y

This should not be needed and may slow down boot from e.g. eMMC when there is no PCIe devices attached. Standard boot should init pci after it has tested faster boot targets.

configs/nanopc-t6-rk3588_defconfig line 48

Quoted 10 lines
configs/nanopc-t6-rk3588_defconfig new file +10 -0
+CONFIG_SPL_MAX_SIZE=0x40000
+CONFIG_SPL_PAD_TO=0x7f8000
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x4000000
+CONFIG_SPL_BSS_MAX_SIZE=0x4000
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000

We use 0x60000 for other rk35xx boards, odroid-m1 use 0x100000 because board vendor have existing partitions defined in the device tree.

Quoted 30 lines
configs/nanopc-t6-rk3588_defconfig new file +30 -0
+CONFIG_SPL_ATF=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_REGULATOR=y
+# CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_SPL_OF_CONTROL=y
+CONFIG_OF_LIVE=y
+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_SPL_DM_SEQ_ALIAS=y
+CONFIG_SPL_REGMAP=y
+CONFIG_SPL_SYSCON=y
+CONFIG_SPL_CLK=y
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_MISC=y
+CONFIG_SUPPORT_EMMC_RPMB=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_SDMA=y
+CONFIG_MMC_SDHCI_ROCKCHIP=y
+CONFIG_SF_DEFAULT_BUS=5
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_SPI_FLASH_WINBOND=y

configs/nanopc-t6-rk3588_defconfig line 88

Quoted 10 lines
configs/nanopc-t6-rk3588_defconfig new file +10 -0
+CONFIG_SPI_FLASH_XTX=y
+CONFIG_PHYLIB=y
+CONFIG_RTL8169=y
+CONFIG_NVME_PCI=y
+CONFIG_PCIE_DW_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
+CONFIG_PHY_ROCKCHIP_USBDP=y
+CONFIG_SPL_PINCTRL=y
+CONFIG_REGULATOR_PWM=y

This could be dropped, there is no use of pwm-regulator in the DT.

configs/nanopc-t6-rk3588_defconfig line 99

Quoted 11 lines
configs/nanopc-t6-rk3588_defconfig new file +11 -0
+CONFIG_PWM_ROCKCHIP=y
+CONFIG_SPL_RAM=y
+CONFIG_BAUDRATE=1500000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_SYS_NS16550_MEM32=y
+CONFIG_ROCKCHIP_SFC=y
+CONFIG_SYSRESET=y
+CONFIG_USB=y
+CONFIG_DM_USB_GADGET=y
+CONFIG_USB_XHCI_HCD=y
+# CONFIG_USB_XHCI_DWC3_OF_SIMPLE is not set

You can drop this line, only the pre-mainline usb3 nodes in -u-boot.dtsi use a rk3399 compatible that would load this driver. I will also send two series that make this driver obsolete on rockchip platform.

- First series will sync compatible of usb3 nodes with collabora rk3588 tree, removing the use of the rk3399 compatible.
- Second series will switch rk3399 boards to use dwc3-generic and drop the use of dwc3-of-simple driver.

configs/nanopc-t6-rk3588_defconfig line 106

Quoted 7 lines
configs/nanopc-t6-rk3588_defconfig new file +7 -0
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_GENERIC=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_OHCI_GENERIC=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y

This is not really needed, usb nodes are not included in the spl dtb.

Regards,
Jonas

Quoted 7 lines
configs/nanopc-t6-rk3588_defconfig new file +7 -0
+CONFIG_USB_HOST_ETHER=y
+CONFIG_USB_ETHER_ASIX=y
+CONFIG_USB_ETHER_ASIX88179=y
+CONFIG_USB_ETHER_MCS7830=y
+CONFIG_USB_ETHER_RTL8152=y
+CONFIG_USB_ETHER_SMSC95XX=y
+CONFIG_ERRNO_STR=y
#2 lore raw
In reply to John Clark
Quoted 4 lines · John Clark

NanoPC-T6 is a Rockchip RK3588 based SBC by FriendlyElec.

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

So the board is using SPI NOR flash.

[...]

arch/arm/mach-rockchip/rk3588/rk3588.c DECLARE_GLOBAL_DATA_PTR; · line 43

Quoted 9 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +1 -0
index b1f535fad5..e08ebfa39b 100644
@@ -40,6 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
  const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
  	[BROM_BOOTSOURCE_EMMC] = "/mmc@fe2e0000",
  	[BROM_BOOTSOURCE_SPINOR] = "/spi@fe2b0000/flash@0",
+	[BROM_BOOTSOURCE_SPINAND] = "/spi@fe2b0000/flash@0",

Why need a SPI NAND?

If this is really needed, will be a separate patch to support a new boot source from bootrom.

Thanks,
- Kever

author
#3 lore raw

In commit fd6e425, Jonas finds the rock-5b device has a value of 6 at CFG_IRAM_BASE + 0x10 (0xff000010) when booted from spi and creates the BROM_BOOTSOURCE_SPINOR_RK3588 enum value.
https://github.com/u-boot/u-boot/commit/fd6e425be243dce518a02710482514faccf3c211

When I boot the nanopv-t6 from spi, I am seeing a value of 4 at 0xff000010.

We both should be expecting a value of 3:

BROM_BOOTSOURCE_SPINOR = 3,        =>  0x0000 0011   pre-RK3588 variants
BROM_BOOTSOURCE_SPINAND = 4,       =>  0x0000 0100   NanoPC-T6
BROM_BOOTSOURCE_SPINOR_RK3588 = 6, =>  0x0000 0110   Rock-5b

Since this is the only use of CFG_IRAM_BASE, I have to wonder if 0xff000000 is correct for the RK3588?

I have included the relevant code below for convenience:

/**
* Boot-device identifiers as used by the BROM
*/
enum {
BROM_BOOTSOURCE_NAND = 1,
BROM_BOOTSOURCE_EMMC = 2,
BROM_BOOTSOURCE_SPINOR = 3,
BROM_BOOTSOURCE_SPINAND = 4,
BROM_BOOTSOURCE_SD = 5,
BROM_BOOTSOURCE_SPINOR_RK3588 = 6,
BROM_BOOTSOURCE_USB = 10,
BROM_LAST_BOOTSOURCE = BROM_BOOTSOURCE_USB
};

extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1];

/**
* Locations of the boot-device identifier in SRAM */
#define BROM_BOOTSOURCE_ID_ADDR (CFG_IRAM_BASE + 0x10)

https://github.com/u-boot/u-boot/blob/master/arch/arm/include/asm/arch-rockchip/bootrom.h

./include/configs/rk3128_common.h:#define CFG_IRAM_BASE 0x10080000 ./include/configs/px30_common.h:#define CFG_IRAM_BASE 0xff0e0000 ./include/configs/rk3188_common.h:#define CFG_IRAM_BASE 0x10080000 ./include/configs/rk3568_common.h:#define CFG_IRAM_BASE 0xfdcc0000 ./include/configs/rk3399_common.h:#define CFG_IRAM_BASE 0xff8c0000 ./include/configs/rk3066_common.h:#define CFG_IRAM_BASE 0x10080000 ./include/configs/rk3308_common.h:#define CFG_IRAM_BASE 0xfff80000 ./include/configs/rk3368_common.h:#define CFG_IRAM_BASE 0xff8c0000 ./include/configs/rk3288_common.h:#define CFG_IRAM_BASE 0xff700000 ./include/configs/rk3328_common.h:#define CFG_IRAM_BASE 0xff090000 ./include/configs/rv1108_common.h:#define CFG_IRAM_BASE 0x10080000 ./include/configs/rk3588_common.h:#define CFG_IRAM_BASE 0xff000000 ./include/configs/rk322x_common.h:#define CFG_IRAM_BASE 0x10080000 ./include/configs/rv1126_common.h:#define CFG_IRAM_BASE 0xff700000

Quoted 34 lines · Kever Yang
Quoted 3 lines · John Clark

NanoPC-T6 is a Rockchip RK3588 based SBC by FriendlyElec.

There are four variants depending on the DRAM size: 4G/32GB eMMC,

8G/64GB eMMC,

Quoted 1 line

16G/16MB SPI NOR, and 16G/256GB eMMC/16MB SPI NOR

So the board is using SPI NOR flash.

[...]

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/mach-rockchip/rk3588/rk3588.c

arch/arm/mach-rockchip/rk3588/rk3588.c DECLARE_GLOBAL_DATA_PTR; · line 43

Quoted 8 lines

index b1f535fad5..e08ebfa39b 100644

arch/arm/mach-rockchip/rk3588/rk3588.c +1 -0
@@ -40,6 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
  const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
      [BROM_BOOTSOURCE_EMMC] = "/mmc@fe2e0000",
      [BROM_BOOTSOURCE_SPINOR] = "/spi@fe2b0000/flash@0",
+     [BROM_BOOTSOURCE_SPINAND] = "/spi@fe2b0000/flash@0",

Why need a SPI NAND?

If this is really needed, will be a separate patch to support a new boot source from bootrom.

Thanks,
- Kever

#4 lore raw
In reply to Kever Yang

Hi Kever,

Quoted 24 lines · Kever Yang
Quoted 4 lines · John Clark

NanoPC-T6 is a Rockchip RK3588 based SBC by FriendlyElec.

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

So the board is using SPI NOR flash.

[...]

arch/arm/mach-rockchip/rk3588/rk3588.c DECLARE_GLOBAL_DATA_PTR; · line 43

Quoted 9 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +1 -0
index b1f535fad5..e08ebfa39b 100644
@@ -40,6 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
  const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
  	[BROM_BOOTSOURCE_EMMC] = "/mmc@fe2e0000",
  	[BROM_BOOTSOURCE_SPINOR] = "/spi@fe2b0000/flash@0",
+	[BROM_BOOTSOURCE_SPINAND] = "/spi@fe2b0000/flash@0",

Why need a SPI NAND?

Quoted 2 lines

If this is really needed, will be a separate patch to support a new boot source from bootrom.

I have done spi boot testing on a few rk3588 boards with SPI NOR flash, and there seem to be a correlation between the bootsource/bootdevice id written to reg by the bootrom and the fspi iomux used by the board.

Following bootsource/bootdevice value can be read from reg,

- FSPI (M0): 3
- FSPI (M1): 4
- FSPI (M2): 6

based on testing on the following boards:

- Radxa ROCK 5 Model A - fspim0_pins - rk3588s
- Xunlong Orange Pi 5 - fspim0_pins - rk3588s
brom_bootdevice_id: 3

- FriendlyElec NanoPC-T6 - fspim1_pins - rk3588
- Xunlong Orange Pi 5 Plus - fspim1_pins - rk3588
brom_bootdevice_id: 4

- Radxa ROCK 5 Model B - fspim2_pins - rk3588
brom_bootdevice_id: 6

Can these observations be correct? And if so, maybe we should use following constants for RK3588?

BROM_BOOTSOURCE_FSPI_M0 = 3
BROM_BOOTSOURCE_FSPI_M1 = 4
BROM_BOOTSOURCE_FSPI_M2 = 6

Any insights into what values bootrom will write to reg would be very helpful.

Regards,
Jonas

Quoted 5 lines

Thanks,
- Kever

#5 lore raw

Add Slawomir Stepien;

Hi Jonas,  John, Slawomir:

Quoted 49 lines · Jonas Karlman

Hi Kever,

Quoted 21 lines · Kever Yang
Quoted 4 lines · John Clark

NanoPC-T6 is a Rockchip RK3588 based SBC by FriendlyElec.

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

So the board is using SPI NOR flash.

[...]

arch/arm/mach-rockchip/rk3588/rk3588.c DECLARE_GLOBAL_DATA_PTR; · line 43

Quoted 9 lines
arch/arm/mach-rockchip/rk3588/rk3588.c +1 -0
index b1f535fad5..e08ebfa39b 100644
@@ -40,6 +40,7 @@ DECLARE_GLOBAL_DATA_PTR;
   const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
   	[BROM_BOOTSOURCE_EMMC] = "/mmc@fe2e0000",
   	[BROM_BOOTSOURCE_SPINOR] = "/spi@fe2b0000/flash@0",
+	[BROM_BOOTSOURCE_SPINAND] = "/spi@fe2b0000/flash@0",

Why need a SPI NAND?

Quoted 2 lines

If this is really needed, will be a separate patch to support a new boot source from bootrom.

I have done spi boot testing on a few rk3588 boards with SPI NOR flash, and there seem to be a correlation between the bootsource/bootdevice id written to reg by the bootrom and the fspi iomux used by the board.

Following bootsource/bootdevice value can be read from reg,

- FSPI (M0): 3
- FSPI (M1): 4
- FSPI (M2): 6

based on testing on the following boards:

- Radxa ROCK 5 Model A - fspim0_pins - rk3588s
- Xunlong Orange Pi 5 - fspim0_pins - rk3588s
brom_bootdevice_id: 3

- FriendlyElec NanoPC-T6 - fspim1_pins - rk3588
- Xunlong Orange Pi 5 Plus - fspim1_pins - rk3588
brom_bootdevice_id: 4

- Radxa ROCK 5 Model B - fspim2_pins - rk3588
brom_bootdevice_id: 6

Quoted 6 lines

Can these observations be correct? And if so, maybe we should use following constants for RK3588?

BROM_BOOTSOURCE_FSPI_M0 = 3
BROM_BOOTSOURCE_FSPI_M1 = 4
BROM_BOOTSOURCE_FSPI_M2 = 6

Very good finding, I have check internally with bootrom owner, the definition is exactly same as

these three option for SPI M0 to M2.

Quoted 3 lines

Any insights into what values bootrom will write to reg would be very helpful.

After add FSPI M0-M2, the spi NAND/NOR source has complete support, there is no separate definition

for SPI NAND and SPI NOR for now until RK3588, all three ports can support both SPI NAND and spi NOR.

Thanks,

- Kever

Quoted 8 lines

Regards,
Jonas

Quoted 4 lines

Thanks,
- Kever