From: Fabio Estevam via U-Boot <u-boot@lists.u-boot-project.org>
To: u-boot@0leil.net
Cc: djw@t-chip.com.cn, sjg@chromium.org, kever.yang@rock-chips.com,
u-boot@lists.u-boot-project.org, trini@konsulko.com,
Fabio Estevam <festevam@nabladev.com>
Subject: [PATCH v2 3/5] rockchip: rk3399: Add ROC-PC-PLUS board detection
Date: Tue, 21 Jul 2026 22:36:40 -0300 [thread overview]
Message-ID: <20260722013642.1011666-3-festevam@gmail.com> (raw)
In-Reply-To: <20260722013642.1011666-1-festevam@gmail.com>
From: Fabio Estevam <festevam@nabladev.com>
The ROC-RK3399-PC has an MP8859 regulator on I2C7 at address 0x66,
while the ROC-RK3399-PC-PLUS does not. Probe for the regulator in SPL
and use the result to select the matching devicetree from the U-Boot
FIT. Fall back to the original board if the I2C bus cannot be probed.
Build both devicetrees from the existing roc-pc-rk3399_defconfig and
enable the XMC SPI NOR driver used by the Plus variant. Set fdtfile
from the selected U-Boot devicetree so the matching Linux devicetree
is used as well.
Signed-off-by: Fabio Estevam <festevam@nabladev.com>
---
Changes since v1:
- Added run-time board time detection.
arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi | 3 ++
arch/arm/dts/rk3399-roc-pc-u-boot.dtsi | 8 +++++
board/firefly/roc-pc-rk3399/roc-pc-rk3399.c | 37 +++++++++++++++++++++
configs/roc-pc-rk3399_defconfig | 3 ++
doc/board/rockchip/rockchip.rst | 2 +-
5 files changed, 52 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi
diff --git a/arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi b/arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi
new file mode 100644
index 000000000000..c80529a62b97
--- /dev/null
+++ b/arch/arm/dts/rk3399-roc-pc-plus-u-boot.dtsi
@@ -0,0 +1,3 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include "rk3399-roc-pc-u-boot.dtsi"
diff --git a/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi b/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
index a85e9549c83e..e7e4a2c89072 100644
--- a/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
+++ b/arch/arm/dts/rk3399-roc-pc-u-boot.dtsi
@@ -12,6 +12,14 @@
};
};
+&i2c7 {
+ bootph-pre-ram;
+};
+
+&i2c7_xfer {
+ bootph-pre-ram;
+};
+
&gpio4 {
bootph-pre-ram;
};
diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
index 6937a27176f9..60a3ba43cdbd 100644
--- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
+++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
@@ -5,14 +5,24 @@
#include <dm.h>
#include <env.h>
+#include <fdtdec.h>
+#include <i2c.h>
+#include <image.h>
#include <log.h>
#include <spl_gpio.h>
+#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/arch-rockchip/cru.h>
#include <asm/arch-rockchip/gpio.h>
#include <asm/arch-rockchip/grf_rk3399.h>
+#define ROC_PC_MP8859_BUS "i2c@ff160000"
+#define ROC_PC_MP8859_ADDR 0x66
+#define ROC_PC_PLUS_FDTFILE "rockchip/rk3399-roc-pc-plus.dtb"
+
+DECLARE_GLOBAL_DATA_PTR;
+
#ifdef CONFIG_XPL_BUILD
#define PMUGRF_BASE 0xff320000
@@ -54,4 +64,31 @@ void led_setup(void)
spl_gpio_output(gpio0, GPIO(BANK_B, 5), 1);
}
+static bool is_roc_pc_plus(void)
+{
+ struct udevice *bus, *dev;
+
+ if (uclass_get_device_by_name(UCLASS_I2C, ROC_PC_MP8859_BUS, &bus))
+ return false;
+
+ return dm_i2c_probe(bus, ROC_PC_MP8859_ADDR, 0, &dev);
+}
+
+int board_fit_config_name_match(const char *name)
+{
+ if (is_roc_pc_plus())
+ return strcmp(name, ROC_PC_PLUS_FDTFILE);
+
+ return strcmp(name, CONFIG_DEFAULT_FDT_FILE);
+}
+
#endif
+
+int rk_board_late_init(void)
+{
+ if (!fdt_node_check_compatible(gd->fdt_blob, 0,
+ "firefly,roc-rk3399-pc-plus"))
+ env_set("fdtfile", ROC_PC_PLUS_FDTFILE);
+
+ return 0;
+}
diff --git a/configs/roc-pc-rk3399_defconfig b/configs/roc-pc-rk3399_defconfig
index 1df5cb03adbb..6ef447e0e715 100644
--- a/configs/roc-pc-rk3399_defconfig
+++ b/configs/roc-pc-rk3399_defconfig
@@ -3,12 +3,14 @@ CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_SPL_GPIO=y
+CONFIG_SPL_I2C=y
CONFIG_NR_DRAM_BANKS=1
CONFIG_SF_DEFAULT_SPEED=30000000
CONFIG_ENV_SIZE=0x8000
CONFIG_ENV_OFFSET=0x3F8000
CONFIG_ENV_SECT_SIZE=0x1000
CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-roc-pc"
+CONFIG_OF_LIST="rockchip/rk3399-roc-pc rockchip/rk3399-roc-pc-plus"
CONFIG_DM_RESET=y
CONFIG_ROCKCHIP_RK3399=y
CONFIG_ROCKCHIP_SPI_IMAGE=y
@@ -48,6 +50,7 @@ CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_SDMA=y
CONFIG_MMC_SDHCI_ROCKCHIP=y
CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_XMC=y
CONFIG_SPI_FLASH_WINBOND=y
CONFIG_DM_ETH_PHY=y
CONFIG_ETH_DESIGNWARE=y
diff --git a/doc/board/rockchip/rockchip.rst b/doc/board/rockchip/rockchip.rst
index 9351a5b8eae7..b565aea311e9 100644
--- a/doc/board/rockchip/rockchip.rst
+++ b/doc/board/rockchip/rockchip.rst
@@ -81,7 +81,7 @@ List of mainline supported Rockchip boards:
- 96boards RK3399 Ficus (ficus-rk3399)
- 96boards Rock960 (rock960-rk3399)
- Firefly-RK3399 (firefly_rk3399)
- - Firefly ROC-RK3399-PC
+ - Firefly ROC-RK3399-PC/ROC-RK3399-PC-PLUS (roc-pc-rk3399)
- FriendlyElec NanoPC-T4 (nanopc-t4-rk3399)
- FriendlyElec NanoPi M4 (nanopi-m4-rk3399)
- FriendlyElec NanoPi M4B (nanopi-m4b-rk3399)
--
2.43.0
next prev parent reply other threads:[~2026-07-22 1:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-22 1:36 [PATCH v2 1/5] mtd: spi-nor-ids: Add XMC XM25QH128C Fabio Estevam via U-Boot
2026-07-22 1:36 ` [PATCH v2 2/5] rockchip: rk3399: Remove ROC-PC regulator overrides Fabio Estevam via U-Boot
2026-07-22 13:53 ` Quentin Schulz via U-Boot
2026-07-22 1:36 ` Fabio Estevam via U-Boot [this message]
2026-07-22 14:07 ` [PATCH v2 3/5] rockchip: rk3399: Add ROC-PC-PLUS board detection Quentin Schulz via U-Boot
2026-07-22 1:36 ` [PATCH v2 4/5] rockchip: rk3399: Enable UMS on ROC-PC-PLUS Fabio Estevam via U-Boot
2026-07-22 15:01 ` Quentin Schulz via U-Boot
2026-07-22 1:36 ` [PATCH v2 5/5] rockchip: roc-pc-rk3399: Enable redundant environment Fabio Estevam via U-Boot
2026-07-22 14:12 ` Quentin Schulz via U-Boot
2026-07-22 10:52 ` [PATCH v2 1/5] mtd: spi-nor-ids: Add XMC XM25QH128C Quentin Schulz via U-Boot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260722013642.1011666-3-festevam@gmail.com \
--to=u-boot@lists.u-boot-project.org \
--cc=djw@t-chip.com.cn \
--cc=festevam@gmail.com \
--cc=festevam@nabladev.com \
--cc=kever.yang@rock-chips.com \
--cc=sjg@chromium.org \
--cc=trini@konsulko.com \
--cc=u-boot@0leil.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox