Files
BPI-CM9-Linux/build/patch/u-boot/v2025.10/board_rk322x-box/rk322x-box-add-device-tree-makefile.patch

241 lines
6.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Thu, 25 Apr 2024 21:24:15 +0200
Subject: Makefile and basic configuration for rk322x-box
---
arch/arm/dts/Makefile | 3 +-
arch/arm/mach-rockchip/rk322x/Kconfig | 5 +
board/rockchip/rk322x-box/Kconfig | 15 ++
board/rockchip/rk322x-box/MAINTAINERS | 6 +
board/rockchip/rk322x-box/Makefile | 7 +
board/rockchip/rk322x-box/README | 72 ++++++++++
board/rockchip/rk322x-box/rk322x-box.c | 21 +++
include/configs/rk322x-box.h | 29 ++++
8 files changed, 157 insertions(+), 1 deletion(-)
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 111111111111..222222222222 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -73,7 +73,8 @@ dtb-$(CONFIG_ROCKCHIP_RK3188) += \
rk3188-radxarock.dtb
dtb-$(CONFIG_ROCKCHIP_RK322X) += \
- rk3229-evb.dtb
+ rk3229-evb.dtb \
+ rk322x-box.dtb
dtb-$(CONFIG_ROCKCHIP_RK3288) += \
rk3288-evb.dtb \
diff --git a/arch/arm/mach-rockchip/rk322x/Kconfig b/arch/arm/mach-rockchip/rk322x/Kconfig
index 111111111111..222222222222 100644
--- a/arch/arm/mach-rockchip/rk322x/Kconfig
+++ b/arch/arm/mach-rockchip/rk322x/Kconfig
@@ -11,6 +11,10 @@ config ROCKCHIP_BOOT_MODE_REG
config ROCKCHIP_STIMER_BASE
default 0x110d0020
+config TARGET_RK322X_BOX
+ bool "RK322X-BOX"
+ select BOARD_LATE_INIT
+
config SYS_SOC
default "rk322x"
@@ -33,5 +37,6 @@ config TPL_TEXT_BASE
default 0x10081000
source "board/rockchip/evb_rk3229/Kconfig"
+source "board/rockchip/rk322x-box/Kconfig"
endif
diff --git a/board/rockchip/rk322x-box/Kconfig b/board/rockchip/rk322x-box/Kconfig
new file mode 100644
index 000000000000..111111111111
--- /dev/null
+++ b/board/rockchip/rk322x-box/Kconfig
@@ -0,0 +1,15 @@
+if TARGET_RK322X_BOX
+
+config SYS_BOARD
+ default "rk322x-box"
+
+config SYS_VENDOR
+ default "rockchip"
+
+config SYS_CONFIG_NAME
+ default "rk322x-box"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+
+endif
diff --git a/board/rockchip/rk322x-box/MAINTAINERS b/board/rockchip/rk322x-box/MAINTAINERS
new file mode 100644
index 000000000000..111111111111
--- /dev/null
+++ b/board/rockchip/rk322x-box/MAINTAINERS
@@ -0,0 +1,6 @@
+XT-MX4VR-V10
+M: Paolo Sabatino <paolo.sabatino@gmail.com>
+S: Out of tree
+F: board/rockchip/rk322x-box
+F: include/configs/rk322x-box.h
+F: configs/rk322x-box_defconfig
diff --git a/board/rockchip/rk322x-box/Makefile b/board/rockchip/rk322x-box/Makefile
new file mode 100644
index 000000000000..111111111111
--- /dev/null
+++ b/board/rockchip/rk322x-box/Makefile
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2015 Google, Inc
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += rk322x-box.o
diff --git a/board/rockchip/rk322x-box/README b/board/rockchip/rk322x-box/README
new file mode 100644
index 000000000000..111111111111
--- /dev/null
+++ b/board/rockchip/rk322x-box/README
@@ -0,0 +1,72 @@
+Get the Source and prebuild binary
+==================================
+
+ > mkdir ~/rk322x-box
+ > cd ~/rk322x-box
+ > git clone git://git.denx.de/u-boot.git
+ > git clone https://github.com/OP-TEE/optee_os.git
+ > git clone https://github.com/rockchip-linux/rkbin.git
+ > git clone https://github.com/rockchip-linux/rkdeveloptool.git
+
+Compile the OP-TEE
+===============
+
+ > cd optee_os
+ > make clean
+ > make CROSS_COMPILE_ta_arm32=arm-none-eabi- PLATFORM=rockchip-rk322x
+ Get tee.bin in this step, copy it to U-Boot root dir:
+ > cp out/arm-plat-rockchip/core/tee-pager.bin ../u-boot/tee.bin
+
+Compile the U-Boot
+==================
+
+ > cd ../u-boot
+ > export CROSS_COMPILE=arm-linux-gnueabihf-
+ > export ARCH=arm
+ > make rk322x-box_defconfig
+ > make
+ > make u-boot.itb
+
+ Get tpl/u-boot-tpl.bin, spl/u-boot-spl.bin and u-boot.itb in this step.
+
+Compile the rkdeveloptool
+=======================
+ Follow instructions in latest README
+ > cd ../rkflashtool
+ > autoreconf -i
+ > ./configure
+ > make
+ > sudo make install
+
+ Get rkdeveloptool in you Host in this step.
+
+Both origin binaries and Tool are ready now, choose either option 1 or
+option 2 to deploy U-Boot.
+
+Package the image
+=================
+
+ > cd ../u-boot
+ > tools/mkimage -n rk322x -T rksd -d tpl/u-boot-spl.bin idbloader.img
+ > cat spl/u-boot-spl.bin >> idbloader.img
+
+ Get idbloader.img in this step.
+
+Flash the image to eMMC
+=======================
+Power on(or reset with RESET KEY) with MASKROM KEY preesed, and then:
+ > cd ..
+ > rkdeveloptool db rkbin/rk32/rk322x_loader_v1.04.232.bin
+ > rkdeveloptool wl 64 u-boot/idbloader.img
+ > rkdeveloptool wl 0x4000 u-boot/u-boot.itb
+ > rkdeveloptool rd
+
+Flash the image to SD card
+==========================
+ > dd if=u-boot/idbloader.img of=/dev/sdb seek=64
+ > dd if=u-boot/u-boot.itb of=/dev/sdb seek=16384
+
+You should be able to get U-Boot log message with OP-TEE boot info.
+
+For more detail, please reference to:
+http://opensource.rock-chips.com/wiki_Boot_option
diff --git a/board/rockchip/rk322x-box/rk322x-box.c b/board/rockchip/rk322x-box/rk322x-box.c
new file mode 100644
index 000000000000..111111111111
--- /dev/null
+++ b/board/rockchip/rk322x-box/rk322x-box.c
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2017 Rockchip Electronics Co., Ltd
+ */
+
+#include <dm.h>
+#include <asm/io.h>
+#include <asm/arch-rockchip/uart.h>
+#include <led.h>
+
+int board_early_init_r(void) {
+
+ /* LED setup */
+ //if (IS_ENABLED(CONFIG_LED))
+ //led_default_state();
+
+ return 0;
+
+}
+
diff --git a/include/configs/rk322x-box.h b/include/configs/rk322x-box.h
new file mode 100644
index 000000000000..111111111111
--- /dev/null
+++ b/include/configs/rk322x-box.h
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * (C) Copyright 2017 Rockchip Electronics Co., Ltd
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#include <configs/rk322x_common.h>
+
+#define ROCKCHIP_DEVICE_SETTINGS \
+ "stdin=serial,usbkbd\0" \
+ "stdout=serial,vidconsole\0" \
+ "stderr=serial,vidconsole\0" \
+ "fdt_high=0xffffffff\0" \
+ "initrd_high=0xffffffff\0"
+
+#undef BOOT_TARGETS
+#undef CFG_EXTRA_ENV_SETTINGS
+
+#define BOOT_TARGETS "mmc0 usb mmc1 pxe dhcp"
+
+#define CFG_EXTRA_ENV_SETTINGS \
+ "fdtfile=" CONFIG_DEFAULT_FDT_FILE "\0" \
+ ENV_MEM_LAYOUT_SETTINGS \
+ ROCKCHIP_DEVICE_SETTINGS \
+ "boot_targets=" BOOT_TARGETS "\0"
+
+#endif
--
Armbian