aboutsummaryrefslogtreecommitdiffstats
path: root/roms/u-boot/board/theobroma-systems
diff options
context:
space:
mode:
authorAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
committerAngelos Mouzakitis <a.mouzakitis@virtualopensystems.com>2023-10-10 14:33:42 +0000
commitaf1a266670d040d2f4083ff309d732d648afba2a (patch)
tree2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/u-boot/board/theobroma-systems
parente02cda008591317b1625707ff8e115a4841aa889 (diff)
Add submodule dependency filesHEADmaster
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/u-boot/board/theobroma-systems')
-rw-r--r--roms/u-boot/board/theobroma-systems/lion_rk3368/Kconfig21
-rw-r--r--roms/u-boot/board/theobroma-systems/lion_rk3368/MAINTAINERS10
-rw-r--r--roms/u-boot/board/theobroma-systems/lion_rk3368/Makefile5
-rw-r--r--roms/u-boot/board/theobroma-systems/lion_rk3368/README78
-rw-r--r--roms/u-boot/board/theobroma-systems/lion_rk3368/lion_rk3368.c4
-rw-r--r--roms/u-boot/board/theobroma-systems/puma_rk3399/Kconfig36
-rw-r--r--roms/u-boot/board/theobroma-systems/puma_rk3399/MAINTAINERS10
-rw-r--r--roms/u-boot/board/theobroma-systems/puma_rk3399/Makefile7
-rw-r--r--roms/u-boot/board/theobroma-systems/puma_rk3399/README107
-rw-r--r--roms/u-boot/board/theobroma-systems/puma_rk3399/puma-rk3399.c154
10 files changed, 432 insertions, 0 deletions
diff --git a/roms/u-boot/board/theobroma-systems/lion_rk3368/Kconfig b/roms/u-boot/board/theobroma-systems/lion_rk3368/Kconfig
new file mode 100644
index 000000000..fddbf826d
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/lion_rk3368/Kconfig
@@ -0,0 +1,21 @@
+if TARGET_LION_RK3368
+
+config SYS_BOARD
+ default "lion_rk3368"
+
+config SYS_VENDOR
+ default "theobroma-systems"
+
+config SYS_CONFIG_NAME
+ default "lion_rk3368"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+
+config ENV_SIZE
+ default 0x2000
+
+config ENV_OFFSET
+ default 0x3c000 if ENV_IS_IN_SPI_FLASH
+
+endif
diff --git a/roms/u-boot/board/theobroma-systems/lion_rk3368/MAINTAINERS b/roms/u-boot/board/theobroma-systems/lion_rk3368/MAINTAINERS
new file mode 100644
index 000000000..857f784d2
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/lion_rk3368/MAINTAINERS
@@ -0,0 +1,10 @@
+LION-RK3368 (RK3368-uQ7 system-on-module)
+M: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
+M: Klaus Goger <klaus.goger@theobroma-systems.com>
+S: Maintained
+F: board/theobroma-systems/lion_rk3368
+F: include/configs/lion_rk3368.h
+F: arch/arm/dts/rk3368-lion.dts
+F: configs/lion-rk3368_defconfig
+W: https://www.theobroma-systems.com/rk3368-uq7/tech-specs
+T: git git://git.theobroma-systems.com/lion-u-boot.git
diff --git a/roms/u-boot/board/theobroma-systems/lion_rk3368/Makefile b/roms/u-boot/board/theobroma-systems/lion_rk3368/Makefile
new file mode 100644
index 000000000..fc8df2714
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/lion_rk3368/Makefile
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
+
+obj-y += lion_rk3368.o
diff --git a/roms/u-boot/board/theobroma-systems/lion_rk3368/README b/roms/u-boot/board/theobroma-systems/lion_rk3368/README
new file mode 100644
index 000000000..7488b1832
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/lion_rk3368/README
@@ -0,0 +1,78 @@
+Here is the step-by-step to boot to U-Boot on RK3368-uQ7
+
+Get the Source and build ATF
+============================
+
+ > git clone git://git.theobroma-systems.com/arm-trusted-firmware.git
+ > cd arm-trusted-firmware
+ > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3368 bl31
+ > cp build/rk3368/release/bl31.bin ../u-boot/bl31-rk3368.bin
+
+Configure U-Boot
+================
+
+ > cd ../u-boot
+ > make lion-rk3368_defconfig
+
+Build the TPL/SPL stage
+=======================
+
+ > make CROSS_COMPILE=aarch64-unknown-elf-
+
+Build the full U-Boot and a FIT image including the ATF
+=======================================================
+
+ > make CROSS_COMPILE=aarch64-unknown-elf- u-boot.itb
+
+Flash the image
+===============
+
+Copy the SPL to offset 32k and the FIT image containing the payloads
+(U-Boot proper, ATF, devicetree) to offset 256k card.
+
+SD-Card
+-------
+
+ > dd if=idbloader.img of=/dev/sdb seek=64
+ > dd if=u-boot.itb of=/dev/sdb seek=512
+
+eMMC
+----
+
+rkdeveloptool allows to flash the on-board eMMC via the USB OTG interface with
+help of the Rockchip loader binary.
+
+ > git clone https://github.com/rockchip-linux/rkdeveloptool
+ > cd rkdeveloptool
+ > autoreconf -i && && ./configure && make
+ > git clone https://github.com/rockchip-linux/rkbin.git
+ > ./rkdeveloptool db rkbin/rk33/rk3368_loader_v2.00.256.bin
+ > ./rkdeveloptool wl 64 ../spl.img
+ > ./rkdeveloptool wl 512 ../u-boot.itb
+
+
+If everything went according to plan, you should see the following
+output on UART0:
+
+<debug_uart> U-Boot TPL board init
+Trying to boot from BOOTROM
+Returning to boot ROM...
+Trying to boot from MMC1
+NOTICE: BL31: v1.3(release):v1.2-1320-gbf43a443
+NOTICE: BL31: Built : 18:04:47, Jul 5 2017
+
+
+U-Boot 2017.07-00158-g2395e99858 (Jul 18 2017 - 21:03:31 +0200)
+
+Model: Theobroma Systems RK3368-uQ7 SoM
+DRAM: 2 GiB
+MMC: dwmmc@ff0c0000: 1, dwmmc@ff0f0000: 0
+Using default environment
+
+In: serial@ff180000
+Out: serial@ff180000
+Err: serial@ff180000
+Net:
+Warning: ethernet@ff290000 (eth0) using random MAC address - d2:69:35:7e:d0:1e
+eth0: ethernet@ff290000
+Hit any key to stop autoboot: 2
diff --git a/roms/u-boot/board/theobroma-systems/lion_rk3368/lion_rk3368.c b/roms/u-boot/board/theobroma-systems/lion_rk3368/lion_rk3368.c
new file mode 100644
index 000000000..1b0d50463
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/lion_rk3368/lion_rk3368.c
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
+ */
diff --git a/roms/u-boot/board/theobroma-systems/puma_rk3399/Kconfig b/roms/u-boot/board/theobroma-systems/puma_rk3399/Kconfig
new file mode 100644
index 000000000..21946d984
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/puma_rk3399/Kconfig
@@ -0,0 +1,36 @@
+if TARGET_PUMA_RK3399
+
+config SYS_BOARD
+ default "puma_rk3399"
+
+config SYS_VENDOR
+ default "theobroma-systems"
+
+config SYS_CONFIG_NAME
+ default "puma_rk3399"
+
+config BOARD_SPECIFIC_OPTIONS # dummy
+ def_bool y
+
+config ENV_SIZE
+ default 0x4000
+
+config ENV_OFFSET
+ default 0x3fc000 if ENV_IS_IN_SPI_FLASH
+
+choice
+ prompt "Theobroma Systems RK3399-Q7 DDR Option"
+ default TARGET_PUMA_RK3399_RAM_DDR3_1333
+
+config TARGET_PUMA_RK3399_RAM_DDR3_1333
+ bool "DDR3-1333MHz"
+
+config TARGET_PUMA_RK3399_RAM_DDR3_1600
+ bool "DDR3-1600MHz"
+
+config TARGET_PUMA_RK3399_RAM_DDR3_1866
+ bool "DDR3-1866MHz"
+
+endchoice
+
+endif
diff --git a/roms/u-boot/board/theobroma-systems/puma_rk3399/MAINTAINERS b/roms/u-boot/board/theobroma-systems/puma_rk3399/MAINTAINERS
new file mode 100644
index 000000000..ccec09c38
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/puma_rk3399/MAINTAINERS
@@ -0,0 +1,10 @@
+PUMA-RK3399
+M: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
+M: Klaus Goger <klaus.goger@theobroma-systems.com>
+S: Maintained
+F: board/theobroma-systems/puma_rk3399
+F: include/configs/puma_rk3399.h
+F: arch/arm/dts/rk3399-puma.dts
+F: configs/puma-rk3399_defconfig
+W: https://www.theobroma-systems.com/rk3399-q7/tech-specs
+T: git git://git.theobroma-systems.com/puma-u-boot.git
diff --git a/roms/u-boot/board/theobroma-systems/puma_rk3399/Makefile b/roms/u-boot/board/theobroma-systems/puma_rk3399/Makefile
new file mode 100644
index 000000000..d962b56f1
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/puma_rk3399/Makefile
@@ -0,0 +1,7 @@
+#
+# (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += puma-rk3399.o
diff --git a/roms/u-boot/board/theobroma-systems/puma_rk3399/README b/roms/u-boot/board/theobroma-systems/puma_rk3399/README
new file mode 100644
index 000000000..9b31b0b37
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/puma_rk3399/README
@@ -0,0 +1,107 @@
+Introduction
+============
+
+The RK3399-Q7 (Puma) is a system-on-module featuring the Rockchip
+RK3399 in a Qseven-compatible form-factor.
+
+RK3399-Q7 features:
+ * CPU: ARMv8 64bit Big-Little architecture,
+ * Big: dual-core Cortex-A72
+ * Little: quad-core Cortex-A53
+ * IRAM: 200KB
+ * DRAM: 4GB-128MB dual-channel
+ * eMMC: onboard eMMC
+ * SD/MMC
+ * GbE (onboard Micrel KSZ9031) Gigabit ethernet PHY
+ * USB:
+ * USB3.0 dual role port
+ * 2x USB3.0 host, 1x USB2.0 host via onboard USB3.0 hub
+ * Display: HDMI/eDP/MIPI
+ * Camera: 2x CSI (one on the edge connector, one on the Q7 specified CSI ZIF)
+ * NOR Flash: onboard SPI NOR
+ * Companion Controller: onboard additional Cortex-M0 microcontroller
+ * RTC
+ * fan controller
+ * CAN
+
+Here is the step-by-step to boot to U-Boot on rk3399.
+
+Get the Source and build ATF/Cortex-M0 binaries
+===============================================
+
+ > git clone git://git.theobroma-systems.com/arm-trusted-firmware.git
+ > git clone git://git.theobroma-systems.com/rk3399-cortex-m0.git
+
+Compile the ATF
+===============
+
+ > cd arm-trusted-firmware
+ > make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 bl31
+ > cp build/rk3399/release/bl31.bin ../u-boot/bl31-rk3399.bin
+
+Compile the M0 firmware
+=======================
+
+ > cd ../rk3399-cortex-m0
+ > make CROSS_COMPILE=arm-cortex_m0-eabi-
+ > cp rk3399m0.bin ../u-boot
+
+Compile the U-Boot
+==================
+
+ > cd ../u-boot
+ > make CROSS_COMPILE=aarch64-linux-gnu- puma-rk3399_defconfig all
+
+Package the image
+=================
+
+Creating a SPL image for SD-Card/eMMC
+ > tools/mkimage -n rk3399 -T rksd -d spl/u-boot-spl.bin spl_mmc.img
+Creating a SPL image for SPI-NOR
+ > tools/mkimage -n rk3399 -T rkspi -d spl/u-boot-spl.bin spl_nor.img
+Create the FIT image containing U-Boot proper, ATF, M0 Firmware, devicetree
+ > make CROSS_COMPILE=aarch64-linux-gnu-
+
+Flash the image
+===============
+
+Copy the SPL to offset 32k for SD/eMMC, offset 0 for NOR-Flash and the FIT
+image to offset 256k card.
+
+SD-Card
+-------
+
+ > dd if=spl_mmc.img of=/dev/sdb seek=64
+ > dd if=u-boot.itb of=/dev/sdb seek=512
+
+eMMC
+----
+
+rkdeveloptool allows to flash the on-board eMMC via the USB OTG interface with
+help of the Rockchip loader binary.
+
+ > git clone https://github.com/rockchip-linux/rkdeveloptool
+ > cd rkdeveloptool
+ > autoreconf -i && ./configure && make
+ > git clone https://github.com/rockchip-linux/rkbin.git
+ > ./rkdeveloptool db rkbin/rk33/rk3399_loader_v1.08.106.bin
+ > ./rkdeveloptool wl 64 ../spl_mmc.img
+ > ./rkdeveloptool wl 512 ../u-boot.itb
+
+NOR-Flash
+---------
+
+Writing the SPI NOR Flash requires a running U-Boot. For the sake of simplicity
+we assume you have a SD-Card with a partition containing the required files
+ready.
+
+ > load mmc 1:1 ${kernel_addr_r} spl_nor.img
+ > sf probe
+ > sf erase 0 +$filesize
+ > sf write $kernel_addr_r 0 ${filesize}
+ > load mmc 1:1 ${kernel_addr_r} u-boot.itb
+ > sf erase 0x40000 +$filesize
+ > sf write $kernel_addr_r 0x40000 ${filesize}
+
+
+Reboot the system and you should see a U-Boot console on UART0 (115200n8).
diff --git a/roms/u-boot/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/roms/u-boot/board/theobroma-systems/puma_rk3399/puma-rk3399.c
new file mode 100644
index 000000000..deeba3084
--- /dev/null
+++ b/roms/u-boot/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -0,0 +1,154 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2017 Theobroma Systems Design und Consulting GmbH
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <log.h>
+#include <misc.h>
+#include <spl.h>
+#include <syscon.h>
+#include <u-boot/crc.h>
+#include <usb.h>
+#include <dm/pinctrl.h>
+#include <dm/uclass-internal.h>
+#include <asm/io.h>
+#include <asm/setup.h>
+#include <asm/arch-rockchip/clock.h>
+#include <asm/arch-rockchip/hardware.h>
+#include <asm/arch-rockchip/grf_rk3399.h>
+#include <asm/arch-rockchip/periph.h>
+#include <asm/arch-rockchip/misc.h>
+#include <power/regulator.h>
+#include <u-boot/sha256.h>
+
+static void setup_iodomain(void)
+{
+ const u32 GRF_IO_VSEL_GPIO4CD_SHIFT = 3;
+ struct rk3399_grf_regs *grf =
+ syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
+
+ /*
+ * Set bit 3 in GRF_IO_VSEL so PCIE_RST# works (pin GPIO4_C6).
+ * Linux assumes that PCIE_RST# works out of the box as it probes
+ * PCIe before loading the iodomain driver.
+ */
+ rk_setreg(&grf->io_vsel, 1 << GRF_IO_VSEL_GPIO4CD_SHIFT);
+}
+
+/*
+ * Swap mmc0 and mmc1 in boot_targets if booted from SD-Card.
+ *
+ * If bootsource is uSD-card we can assume that we want to use the
+ * SD-Card instead of the eMMC as first boot_target for distroboot.
+ * We only want to swap the defaults and not any custom environment a
+ * user has set. We exit early if a changed boot_targets environment
+ * is detected.
+ */
+static int setup_boottargets(void)
+{
+ const char *boot_device =
+ ofnode_read_chosen_string("u-boot,spl-boot-device");
+ char *env_default, *env;
+
+ if (!boot_device) {
+ debug("%s: /chosen/u-boot,spl-boot-device not set\n",
+ __func__);
+ return -1;
+ }
+ debug("%s: booted from %s\n", __func__, boot_device);
+
+ env_default = env_get_default("boot_targets");
+ env = env_get("boot_targets");
+ if (!env) {
+ debug("%s: boot_targets does not exist\n", __func__);
+ return -1;
+ }
+ debug("%s: boot_targets current: %s - default: %s\n",
+ __func__, env, env_default);
+
+ if (strcmp(env_default, env) != 0) {
+ debug("%s: boot_targets not default, don't change it\n",
+ __func__);
+ return 0;
+ }
+
+ /*
+ * Only run, if booting from mmc1 (i.e. /mmc@fe320000) and
+ * only consider cases where the default boot-order first
+ * tries to boot from mmc0 (eMMC) and then from mmc1
+ * (i.e. external SD).
+ *
+ * In other words: the SD card will be moved to earlier in the
+ * order, if U-Boot was also loaded from the SD-card.
+ */
+ if (!strcmp(boot_device, "/mmc@fe320000")) {
+ char *mmc0, *mmc1;
+
+ debug("%s: booted from SD-Card\n", __func__);
+ mmc0 = strstr(env, "mmc0");
+ mmc1 = strstr(env, "mmc1");
+
+ if (!mmc0 || !mmc1) {
+ debug("%s: only one mmc boot_target found\n", __func__);
+ return -1;
+ }
+
+ /*
+ * If mmc0 comes first in the boot order, we need to change
+ * the strings to make mmc1 first.
+ */
+ if (mmc0 < mmc1) {
+ mmc0[3] = '1';
+ mmc1[3] = '0';
+ debug("%s: set boot_targets to: %s\n", __func__, env);
+ env_set("boot_targets", env);
+ }
+ }
+
+ return 0;
+}
+
+int misc_init_r(void)
+{
+ const u32 cpuid_offset = 0x7;
+ const u32 cpuid_length = 0x10;
+ u8 cpuid[cpuid_length];
+ int ret;
+
+ ret = rockchip_cpuid_from_efuse(cpuid_offset, cpuid_length, cpuid);
+ if (ret)
+ return ret;
+
+ ret = rockchip_cpuid_set(cpuid, cpuid_length);
+ if (ret)
+ return ret;
+
+ ret = rockchip_setup_macaddr();
+ if (ret)
+ return ret;
+
+ setup_iodomain();
+ setup_boottargets();
+
+ return 0;
+}
+
+#ifdef CONFIG_SERIAL_TAG
+void get_board_serial(struct tag_serialnr *serialnr)
+{
+ char *serial_string;
+ u64 serial = 0;
+
+ serial_string = env_get("serial#");
+
+ if (serial_string)
+ serial = simple_strtoull(serial_string, NULL, 16);
+
+ serialnr->high = (u32)(serial >> 32);
+ serialnr->low = (u32)(serial & 0xffffffff);
+}
+#endif