Compare commits

...

27 Commits
of ... vbi6-ci

Author SHA1 Message Date
Simon Glass
4c278ea699 bloblist: Allow using a different bloblist address
Where the bloblist is located in internal memory and TF-A's BL31 blob
removes access to this memory, the best option seems to be to relocate
the bloblist just before running TF-A.

We can do the relocation in board-specific code, but need an option to
pick up the correct address within U-Boot proper.

Series-changes: 2
- Move the actual relocation code to a previous board-specific patch

Series-to: u-boot
Series-links: 3:443538 2:443538 1:442878
Series-version: 6
Cover-letter:
VBE serial part H: Implement VBE on Rockchip RK3399
This series completes the work to enable VBE on a suitable board. Most
of it is rockchip-specific patches to support the VPL phase, i.e. the
one which decides which boot patch to take (A, B or recovery).

A good chunk of this series is adding an image for VBE, by creating a
new Binman image. Future work in Binman may make this more automated /
easier, but for now it is written out in full. The work is undertaken
piecemeal so it is easier to review the steps.

VBE allows similar boards to share firmware images, with perhaps just
TPL (around 75K) being different for each board. Using a common image
for VPL, SPL and U-Boot saves a lot of space in the image and makes
builds easier. Of course, each board still needs a separate devicetree.

Here is the layout of the image:

Name                          Image-pos  Size      Entry-type          Offset    Uncomp-size
----------------------------------------------------------------------------------------------
image                                 0   1b960cf  section                    0
  alternates-fdt                   8000     31000  alternates-fdt          8000
    mkimage                        8000     31000  mkimage                    0
      u-boot-tpl                   8048     12a11  u-boot-tpl                48
  vpl                            208000     16200  fit                   208000
    image-vpl                    209400      a5a3  section                 1400
      section                    209400      a5a3  section                    0
        u-boot-vpl-nodtb                    10348  u-boot-vpl-nodtb           0
        u-boot-vpl-bss-pad                     20  u-boot-vpl-bss-pad     10348
    @fdt-SEQ                          0         0  section                    0
  vbe-a                          800000    39b200  section               800000
    spl-a                        800000    100000  fit                        0
      spl                        801400     10c97  section                 1400
        section                  801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-a                     900000    29b200  fit                   100000
      spl                        902400     10c97  section                 2400
        section                  902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                     913200     e4250  section                13200
        u-boot-nodtb             913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-b                         1000000    39b200  section              1000000
    spl-b                       1000000    100000  fit                        0
      spl                       1001400     10c97  section                 1400
        section                 1001400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-b                    1100000    29b200  fit                   100000
      spl                       1102400     10c97  section                 2400
        section                 1102400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1113200     e4250  section                13200
        u-boot-nodtb            1113200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  vbe-recovery                  1800000    39b200  section              1800000
    spl-recovery                1800000    100000  fit                        0
      spl                       1801400     10c97  section                 1400
        section                 1801400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      @fdt-SEQ                        0         0  section                    0
    u-boot-recovery             1900000    29b200  fit                   100000
      spl                       1902400     10c97  section                 2400
        section                 1902400     10c97  section                    0
          u-boot-spl-nodtb                  1a908  u-boot-spl-nodtb           0
          u-boot-spl-bss-pad                  1b0  u-boot-spl-bss-pad     1a908
      u-boot                    1913200     e4250  section                13200
        u-boot-nodtb            1913200     e4250  u-boot-nodtb               0
      @atf-SEQ                        0         0  section                    0
        atf-bl31                      0         0  atf-bl31                   0
      @tee-SEQ                        0         0  section                    0
        tee-os                        0         0  tee-os                     0
      @fdt-SEQ                        0         0  section                    0
  fdtmap                        1b9b200      2ecf  fdtmap               1b9b200

This series still includes the bloblist reverts, at the end, just so
that the board doesn't have on boot, but I have a series locally which
should improve things, so I will send that when complete.

This is (mostly) the final VBE series, but there are a few loose ends to
tidy up:

- cache is disabled in SPL, which slows the boot a little
- pinctrl init needs to be tidied up to avoid warnings
- bloblist logic as above
- bloblist-relocation is partly in board-specific code, partly generic

Other things may become apparently after more usage / testing.
END
Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:24:23 -06:00
Simon Glass
11b5c50909 rockchip: Relocate bloblist at the end of the SPL phase
Where the bloblist is located in internal memory and TF-A's BL31 blob
removes access to this memory, the best option seems to be to relocate
the bloblist just before running TF-A.

Do this at the end of SPL.

Series-changes: 2
- Move this logic into board-specific code

Series-changes: 3
- Add the BLOBLIST_RELOC condition as well

Series-changes: 5
- Use 'SDRAM' instead of 'IRAM' in comment
- Drop mention of rk3399 since 64-boards always have TF-A after SPL
- Drop condition on VPL

Signed-off-by: Simon Glass <sjg@chromium.org>
Suggested-by: Raymond Mao <raymond.mao@linaro.org>
2025-06-09 16:24:23 -06:00
Simon Glass
4620af1c49 rockchip: Update binman image for new skip-at-start setup
Now that the skip-at-start feature is properly used in Binman, drop the
various workarounds in the image.

Series-changes: 2
- Split out the fixes for skip-at-start into a new patch

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:24:23 -06:00
Simon Glass
f893dfc3a9 vbe: Add a bootmeth driver for abrec
Add a VBE-ABrec bootmeth so that the VBE state can be accessed.

Series-changes: 2
- Add new patch with a bootmeth driver for abrec

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:24:23 -06:00
Simon Glass
768b87d25b rockchip: Set the skip-at-start property correctly
The rockchip image is written to the media at block 64, which is a 32K
offset, so set the skip-at-start property to 0x8000

Update CONFIG_SPL_PAD_TO to point to the offset in the image, since
Binman is dealing with the 'missing' 32K now.

Series-changes: 2
- Move this patch to the end of the series
- Drop 0x8000 offset for SPI

Series-changes: 5
- Add to VPL file also

Series-changes: 6
- Update CONFIG_SPL_PAD_TO for puma-rk3399 and ringneck-px30

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:24:18 -06:00
Simon Glass
7ffcf24660 gitlab: Add an VBE board to the sjg lab
Add a rockchip rk3399 board which runs Verified Boot for Embedded.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:06 -06:00
Simon Glass
395b2c31fd rockchip: Add documentation for VBE
Now that VBE is running at a basic level on rk3399, add mention of it in
the documentation.
2025-06-09 16:21:06 -06:00
Simon Glass
e8a0dc398f rockchip: Add a generic-ddr3 rk3399 board
This build-target is used to build an image which can run on multiple
rk3399 boards, using VBE to boot.

To use it, the TPL binary for a particular board must be placed into the
first part of the image. The rest of the image (i.e. VPL, SPL and
U-Boot) are largely generic and can work on any supported board.

With VBE, memory-init happens in SPL so that this code is updatable in
the field. Due to size constraints, the type of memory on the board is
defined at build-time. So it is not possible to use the same VBE image
on boards with different SDRAM (DDR3 vs LPDDR4 for example). This may
become possible with newer boards with more SRAM.

Series-changes: 2
- Rename to rk3399-generic-ddr3
- Update devicetree to match firefly-rk3399
- Use the firefly devicetree as the default for this board

Series-changes: 4
- Drop SPL_PAD_TO value since the default is fine
- Drop ROCKCHIP_IODOMAIN since it is the default
- Add SPL_LIBCOMMON_SUPPORT and SPL_LIBGENERIC_SUPPORT

Series-changes: 5
- Add value for CONFIG_SPL_STACK_R_ADDR

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:06 -06:00
Simon Glass
bdfcebbee0 rockchip: Allow SPL to set up SDRAM
The current logic assumes that if TPL exists then it must be setting up
the SDRAM. This is not true with VBE, so allow this to be controlled by
whether CONFIG_TPL_RAM is enabled, or not.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:06 -06:00
Simon Glass
99ef6887dc rockchip: rk3399: Adjust TPL stack to allow for bloblist
Reduce the TPL value a little to allow for a 256-byte bloblist to be
safely located above the stack in all phases.

Note that for most boards, SDRAM init happens in TPL so the SPL stack
ends up in DRAM, at address CONFIG_SPL_STACK_R_ADDR.

Series-changes: 2
- Reword commit to mention comments from Jonas

Series-changes: 5
- Reword first paragraph to mention bloblist instead of other stacks

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:06 -06:00
Simon Glass
8331f26691 rockchip: Add symbols for spl_reloc
Add various symbols so that this feature works as intended. This allows
xPL to copy the relocating-jump code up to the top of memory, then use
it to decompress and start the next phase.

Series-changes: 5
- Drop duplicate __image_copy_start and __image_copy_end
- Drop unwanted comment in script

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:06 -06:00
Simon Glass
df2e7be349 rockchip: Provide a VPL phase on rk3399
Add support for this new phase, related to VBE, which runs after TPL.

It determines the state of the machine, then selects which SPL image
to use. SDRAM init is then done in SPL (rather than TPL as normal for
Rockchip), so that VBE can update the SDRAM-intit code in the field.

Series-changes: 2
- Rewrite help for VPL_ROCKCHIP_COMMON_BOARD
- Skip spl-boot-order.c for VPL (rather than modifying it)

Series-changes: 4
- Add a value for SPL_STACK_R_ADDR

Series-changes: 5
- Expand commit message to mention VBE
- Move  SUPPORT_VPL next to other SUPPORT_xxx options
- Put TPL_DM_MMC in alpha order
- Move VPL_ROCKCHIP_COMMON_BOARD up a bit
- Move VPL_LDSCRIPT up a bit
- Drop config SPL_STACK_R_ADDR
- Use if() instead of ? in spl_boot_device()
- Drop mention of SPL_RAW_IMAGE_SUPPORT since it is already the default
- Drop mention of SPL_SEPARATE_BSS since VPL doesn't need it

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:06 -06:00
Simon Glass
24815c2659 rockchip: Update rk3399 bootph-tags for VPL
When VPL is in use, memory init happens in SPL, so there is no need to
include the DMC device before that. Adjust the tags to save space.

Series-changes: 2
- Only enable MMC when VPM is in use.

Series-changes: 3
- Unindent bootph tags

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:06 -06:00
Simon Glass
3232b0a2e1 rockchip: Add TPL alternatives
With VBE, the TPL image must be built separately for each board we need
to support. It is the only part of the VBE image which is
board-specific.

This helps to save space and reduce the size of TPL, so that it can fit
within the internal 192K IRAM of the RK3399 SoC.

As with other phases, the TPL devicetree is run through fdtgrep to
remove unwanted nodes and properties and reduce its size.

Update the fdtmap so it is at the end of the image, since templates are
added after existing nodes.

Series-changes: 2
- Mention RK3399 with respect to the memory limit
- Move VPL things into a separate file

Series-changes: 4
- Put the fdtmap at the end of the image
- Update the comment at the end of the '#ifndef CONFIG_VPL' block

Series-changes: 5
- Drop removal of stray #ifdef
- Mention VBE in the first paragraph of the commit message
- Wrap the entire simple-bin node and add the properties to vpl

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
0998ee0ecb rockchip: Add a VPL image
The VPL image is immutable and has a single VPL binary plus a devicetree
for each board we need to support.

The devicetree is run through fdtgrep to remove unwanted nodes and
properties and reduce its size.

Series-changes: 2
- Move VPL things into a separate file

Series-changes: 4
- Use FIT_ARCH instead of ARCH
- Use fit_template instead of common_part

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
9d8e588745 rockchip: Add a template for SPL
The SPL phase has a single SPL binary plus a devicetree for each board
we need to support.

The devicetree is run through fdtgrep to remove unwanted nodes and
properties and reduce its size.

While it would be nicer to just have a single FIT holding both the SPL
and U-Boot images, there may not be enough SRAM to support that. So we
end up providing this special image just for SPL.

Series-changes: 3
- Move template to the vpl file

Series-changes: 4
- Use FIT_ARCH instead of ARCH

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
35a27de948 rockchip: Add SPL into the main FIT
VBE may want to load the SPL image from the same FIT as contains U-Boot,
if there is enough memory, so add it.

Series-changes: 2
- Move VPL things into a separate file

Series-changes: 4
- Use FIT_ARCH instead of ARCH

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
2cbdfe444e rockchip: Provide a bootstd configuration
Add bootstd information for VBE. Put it in a separate file to avoid
cluttering the main one.

Series-changes: 2
- Move VPL things into a separate file

Series-changes: 3
- Add a comment about the offsets

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
7bcf47d022 rockchip: dts: Specify the phase in the image
Add 'u-boot' as the phase for the images intended for use with U-Boot
proper.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
7087014989 rockchip: dts: Add an fdtmap
Add an fdtmap so it is possible to look at the image with 'binman ls'.

Series-changes: 3
- Add blank lines before the node

Series-changes: 5
- Drop stray #endif

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
2025-06-09 16:21:05 -06:00
Simon Glass
719e8aa2be rockchip: Allow RAM init to happen in SPL on rk3399
TPL runs before VPL. The earliest updatable phase with VBE is SPL. We
want to be able to update the RAM-init code in the field.

So when VPL is being used, init the RAM later, in SPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
f2a033a3d1 vbe: Show the margin when using SPL_RELOC
Collect information about the memory-margin in each phase which uses
this feature. Update the 'vbe state' command to show it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
166eebc45f spl: Allow VBE to handle xPL size
When VBE is in use, the size of each phase is obtained by reading it
from a FIT. Avoid using binman symbols unless necessary, i.e. in TPL.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 16:21:05 -06:00
Simon Glass
4fd0989c9d spl: Adjust xPL symbols
Update for the new xPL naming, which was missed in a previous patch
which purported to do this.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-06-09 16:21:05 -06:00
Simon Glass
efbca75965 Merge branch 'contr' into 'master'
Add a contrib directory

See merge request u-boot/u-boot!102
2025-06-09 17:18:20 +00:00
Simon Glass
16e59e0f94 Add a contrib directory
Add a place where people can add contributions, along with
documentation. These may be useful to other developers of U-Boot but are
not maintained / supported by the core developers.

Signed-off-by: Simon Glass <sjg@chromium.org>
2025-06-09 06:36:15 -06:00
Simon Glass
f01720ad95 Merge branch 'ci' into 'master'
fdt: Use events for pre-relocation devicetree manipulation

See merge request u-boot/u-boot!101
2025-06-08 11:44:23 +00:00
30 changed files with 819 additions and 20 deletions

View File

@@ -818,3 +818,9 @@ tk1:
variables:
ROLE: tk1
<<: *lab_dfn
# Firefly-RK3399 board running the rk3399-generic build
vbe:
variables:
ROLE: vbe
<<: *lab_dfn

View File

@@ -46,7 +46,12 @@
0x0 0xffa88800 0x0 0x1800
0x0 0xffa8a000 0x0 0x2000
0x0 0xffa8c000 0x0 0x1000>;
#ifdef CONFIG_VPL
bootph-pre-ram;
bootph-some-ram;
#else
bootph-all;
#endif
status = "okay";
};
@@ -93,6 +98,10 @@
};
&sdmmc {
#ifdef CONFIG_VPL
bootph-pre-sram;
bootph-verify;
#endif
bootph-pre-ram;
bootph-some-ram;

View File

@@ -64,6 +64,7 @@
compression = FIT_UBOOT_COMP;
load = <CONFIG_TEXT_BASE>;
entry = <CONFIG_TEXT_BASE>;
phase = "u-boot";
u-boot-nodtb {
compress = FIT_UBOOT_COMP;
};
@@ -82,6 +83,7 @@
arch = FIT_ARCH;
os = "arm-trusted-firmware";
compression = "none";
phase = "u-boot";
fit,load;
fit,entry;
fit,data;
@@ -101,6 +103,7 @@
arch = FIT_ARCH;
os = "tee";
compression = "none";
phase = "u-boot";
fit,load;
fit,entry;
fit,data;
@@ -123,6 +126,7 @@
compression = "none";
load = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
entry = <(CFG_SYS_SDRAM_BASE + 0x8400000)>;
phase = "u-boot";
tee-os {
};
@@ -163,9 +167,11 @@
};
#endif /* HAS_FIT */
#ifndef CONFIG_VPL
simple-bin {
filename = "u-boot-rockchip.bin";
pad-byte = <0xff>;
skip-at-start = <0x8000>;
mkimage {
filename = "idbloader.img";
@@ -192,7 +198,11 @@
#endif
offset = <CONFIG_SPL_PAD_TO>;
};
fdtmap {
};
};
#endif /* !VPL */
#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
simple-bin-spi {
@@ -224,7 +234,14 @@
/* Sync with u-boot,spl-payload-offset if present */
offset = <CONFIG_SYS_SPI_U_BOOT_OFFS>;
};
fdtmap {
};
};
#endif /* CONFIG_ROCKCHIP_SPI_IMAGE */
};
#endif /* CONFIG_SPL */
#ifdef CONFIG_VPL
#include "rockchip-vpl-u-boot.dtsi"
#endif

View File

@@ -0,0 +1,224 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2019 Jagan Teki <jagan@amarulasolutions.com>
*/
/ {
bootstd {
bootph-verify;
compatible = "u-boot,boot-std";
/*
* This is used for the VBE OS-request tests. A FAT filesystem
* created in a partition with the VBE information appearing
* before the partition starts.
*
* Offsets are aligned to the media block-size, typically 0x200
*
* The start of the VBE area is set at 8MB, adjusted for the
* skip-at-start offset. Before that is a block containing the
* version information and before that is the state. These could
* be stored in a different storage device if available, but so
* far VBE only supports MMC.
*
* The total area size is 8MB which should be enough for a FIT
* containing U-Boot and a number of devicetrees.
*/
firmware0 {
bootph-verify;
compatible = "fwupd,vbe-abrec";
storage = "mmc0";
area-start = <0x7f8000>;
area-size = <0x800000>;
state-offset = <(0x7f8000 - 0x400)>;
state-size = <0x40>;
version-offset = <(0x7f8000 - 0x200)>;
version-size = <0x100>;
};
};
};
&binman {
template-1 {
images {
spl {
description = "U-Boot SPL";
type = "firmware";
os = "u-boot";
arch = FIT_ARCH;
compression = "lz4";
load = <CONFIG_SPL_TEXT_BASE>;
entry = <CONFIG_SPL_TEXT_BASE>;
phase = "spl";
section {
compress = "lz4";
u-boot-spl-nodtb {
};
u-boot-spl-bss-pad {
};
};
};
};
configurations {
@config-SEQ {
fit,firmware = "atf-1", "u-boot", "spl";
};
};
};
spl_template: template-2 {
type = "fit";
description = "FIT image for U-Boot SPL";
#address-cells = <1>;
fit,fdt-list = "of-list";
fit,align = <512>;
fit,external-offset = <0>;
images {
spl {
description = "U-Boot SPL";
type = "firmware";
os = "u-boot";
arch = FIT_ARCH;
compression = "lz4";
load = <CONFIG_SPL_TEXT_BASE>;
entry = <CONFIG_SPL_TEXT_BASE>;
section {
compress = "lz4";
u-boot-spl-nodtb {
};
u-boot-spl-bss-pad {
};
};
};
@fdt-SEQ {
description = "fdt-NAME";
compression = "none";
type = "flat_dt";
fit,fdt-phase = "spl";
};
};
configurations {
default = "@config-DEFAULT-SEQ";
@config-SEQ {
description = "NAME.dtb";
fdt = "fdt-SEQ";
fit,firmware = "spl";
fit,loadables;
fit,compatible;
};
};
};
simple-bin {
filename = "u-boot-rockchip.bin";
pad-byte = <0xff>;
skip-at-start = <0x8000>;
alternates-fdt {
fdt-list-dir = "dts/upstream/src/arm64/rockchip";
filename-pattern = "alt-NAME.bin";
fdt-phase = "tpl";
mkimage {
filename = "idbloader.img";
args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
multiple-data-files;
u-boot-tpl {
symbols-base = <0>;
};
};
};
vpl {
type = "fit";
offset = <(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR * 0x200)>;
description = "FIT image for U-Boot TPL";
#address-cells = <1>;
fit,fdt-list = "of-list";
fit,align = <512>;
fit,external-offset = <0>;
images {
image-vpl {
description = "U-Boot VPL";
type = "firmware";
os = "u-boot";
arch = FIT_ARCH;
compression = "lz4";
load = <CONFIG_VPL_TEXT_BASE>;
entry = <CONFIG_VPL_TEXT_BASE>;
section {
compress = "lz4";
u-boot-vpl-nodtb {
symbols-base = <0>;
};
u-boot-vpl-bss-pad {
};
};
};
@fdt-SEQ {
description = "fdt-NAME";
compression = "none";
type = "flat_dt";
fit,fdt-phase = "vpl";
};
};
configurations {
default = "@config-DEFAULT-SEQ";
@config-SEQ {
description = "NAME.dtb";
fdt = "fdt-SEQ";
fit,firmware = "image-vpl";
fit,loadables;
fit,compatible;
};
};
};
# ifdef CONFIG_BOOTMETH_VBE_ABREC
vbe-a {
type = "section";
offset = <CONFIG_SPL_PAD_TO>;
spl-a {
insert-template = <&spl_template>;
size = <0x100000>;
};
u-boot-a {
insert-template = <&fit_template>;
};
};
vbe-b {
type = "section";
offset = <0x1000000>;
spl-b {
insert-template = <&spl_template>;
size = <0x100000>;
};
u-boot-b {
insert-template = <&fit_template>;
};
};
vbe-recovery {
type = "section";
offset = <0x1800000>;
spl-recovery {
insert-template = <&spl_template>;
size = <0x100000>;
};
u-boot-recovery {
insert-template = <&fit_template>;
};
};
# else /* CONFIG_BOOTMETH_VBE_SIMPLE */
vbe {
type = "fit";
offset = <CONFIG_SPL_PAD_TO>;
insert-template = <&fit_template>;
};
# endif /* VBE method */
fdtmap {
};
};
};

View File

@@ -30,6 +30,7 @@ enum {
BOOT_DEVICE_XIP,
BOOT_DEVICE_BOOTROM,
BOOT_DEVICE_SMH,
BOOT_DEVICE_VBE,
BOOT_DEVICE_NONE
};
#endif

View File

@@ -255,17 +255,18 @@ config ROCKCHIP_RK3399
select ARM64
select SUPPORT_SPL
select SUPPORT_TPL
select SUPPORT_VPL
select SPL
select SPL_ATF
select SPL_BOARD_INIT if SPL
select SPL_LOAD_FIT
select SPL_CLK if SPL
select SPL_CLK if SPL && !VPL
select SPL_PINCTRL if SPL
select SPL_RAM if SPL
select SPL_REGMAP if SPL
select SPL_SYSCON if SPL
select TPL_HAVE_INIT_STACK if TPL
select SPL_SEPARATE_BSS
select VPL_HAVE_INIT_STACK if VPL
select CLK
select FIT
select PINCTRL
@@ -301,10 +302,11 @@ config ROCKCHIP_RK3399
imply SYS_BOOTCOUNT_SINGLEWORD if BOOTCOUNT_LIMIT
imply TPL_CLK
imply TPL_DM
imply TPL_DM_MMC if VPL
imply TPL_LIBCOMMON_SUPPORT
imply TPL_LIBGENERIC_SUPPORT
imply TPL_OF_CONTROL
imply TPL_RAM
imply TPL_RAM if !VPL
imply TPL_REGMAP
imply TPL_ROCKCHIP_COMMON_BOARD
imply TPL_SERIAL
@@ -569,7 +571,7 @@ config SPL_ROCKCHIP_BACK_TO_BROM
config TPL_ROCKCHIP_BACK_TO_BROM
bool "TPL returns to bootrom"
default y
default y if !VPL
select ROCKCHIP_BROM_HELPER if !ROCKCHIP_RK3066
select TPL_BOOTROM_SUPPORT
depends on TPL
@@ -602,6 +604,16 @@ config TPL_ROCKCHIP_COMMON_BOARD
common board is a basic TPL board init which can be shared for most
of SoCs to avoid copy-paste for different SoCs.
config VPL_ROCKCHIP_COMMON_BOARD
bool "Rockchip VPL common board file"
depends on VPL
default y
help
Enable the VPL phase for rockchip, which selects which SPL/U-Boot
will be used on each boot. With this flow, used by Verified Boot for
Embedded (VBE), TPL is loaded by the boot ROM. Then TPL loads VPL,
VPL loads SPL and SPL loads U-Boot.
config ROCKCHIP_EXTERNAL_TPL
bool "Use external TPL binary"
help
@@ -700,6 +712,9 @@ config TPL_ROCKCHIP_EARLYRETURN_TO_BROM
config SPL_MMC
default y if !SPL_ROCKCHIP_BACK_TO_BROM
config TPL_MMC
default y if !TPL_ROCKCHIP_BACK_TO_BROM
config ROCKCHIP_SPI_IMAGE
bool "Build a SPI image for rockchip"
help

View File

@@ -8,11 +8,16 @@
# inaccessible/protected memory (and the bootrom-helper assumes that
# the stack-pointer is valid before switching to the U-Boot stack).
obj-spl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl-boot-order.o spl_common.o
obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl.o spl_common.o
ifndef CONFIG_VPL
obj-spl-$(CONFIG_SPL_ROCKCHIP_COMMON_BOARD) += spl-boot-order.o
endif
obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
obj-tpl-$(CONFIG_TPL_ROCKCHIP_COMMON_BOARD) += tpl.o spl_common.o
obj-tpl-$(CONFIG_ROCKCHIP_PX30) += px30-board-tpl.o
obj-vpl-$(CONFIG_VPL_ROCKCHIP_COMMON_BOARD) += vpl.o
obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
ifeq ($(CONFIG_XPL_BUILD)$(CONFIG_TPL_BUILD),)
@@ -49,9 +54,11 @@ obj-$(CONFIG_ROCKCHIP_RK3588) += rk3588/
obj-$(CONFIG_ROCKCHIP_RV1108) += rv1108/
obj-$(CONFIG_ROCKCHIP_RV1126) += rv1126/
# Clear out SPL objects, in case this is a TPL build
# Clear out SPL objects, in case this is a TPL or VPL build
obj-spl-$(CONFIG_TPL_BUILD) =
obj-spl-$(CONFIG_VPL_BUILD) =
# Now add SPL/TPL objects back into the main build
obj-$(CONFIG_XPL_BUILD) += $(obj-spl-y)
obj-$(CONFIG_TPL_BUILD) += $(obj-tpl-y)
obj-$(CONFIG_VPL_BUILD) += $(obj-vpl-y)

View File

@@ -145,11 +145,20 @@ config TPL_LDSCRIPT
default "arch/arm/mach-rockchip/u-boot-tpl-v8.lds"
config TPL_STACK
default 0xff8effff
default 0xff8eff00
config TPL_TEXT_BASE
default 0xff8c2000
config VPL_LDSCRIPT
default "arch/arm/mach-rockchip/u-boot-vpl-v8.lds"
config VPL_STACK
default 0xff8eff00
config VPL_TEXT_BASE
default 0xff8c2000
if BOOTCOUNT_LIMIT
config BOOTCOUNT_BOOTLIMIT

View File

@@ -3,6 +3,7 @@
* (C) Copyright 2019 Rockchip Electronics Co., Ltd
*/
#include <bloblist.h>
#include <cpu_func.h>
#include <debug_uart.h>
#include <dm.h>
@@ -61,6 +62,9 @@ u32 spl_boot_device(void)
{
u32 boot_device = BOOT_DEVICE_MMC1;
if (IS_ENABLED(CONFIG_VPL))
return BOOT_DEVICE_VBE;
#if defined(CONFIG_TARGET_CHROMEBOOK_JERRY) || \
defined(CONFIG_TARGET_CHROMEBIT_MICKEY) || \
defined(CONFIG_TARGET_CHROMEBOOK_MINNIE) || \
@@ -130,6 +134,19 @@ void board_init_f(ulong dummy)
void spl_board_prepare_for_boot(void)
{
/*
* TF-A is executed after SPL and before U-Boot. It removes our access
* to the SRAM. So move the bloblist to RAM.
*/
if (xpl_phase() == PHASE_SPL && CONFIG_IS_ENABLED(BLOBLIST_RELOC)) {
ulong addr = CONFIG_IF_ENABLED_INT(BLOBLIST_RELOC,
BLOBLIST_RELOC_ADDR);
log_debug("Relocating bloblist %p to %lx\n", gd_bloblist(),
addr);
bloblist_reloc(map_sysmem(addr, 0), bloblist_get_total_size());
}
if (!IS_ENABLED(CONFIG_ARM64) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
return;

View File

@@ -60,10 +60,12 @@ void board_init_f(ulong dummy)
tpl_board_init();
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
if (ret) {
printf("DRAM init failed: %d\n", ret);
return;
if (CONFIG_IS_ENABLED(RAM)) {
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
if (ret) {
printf("DRAM init failed: %d\n", ret);
return;
}
}
}
@@ -84,5 +86,8 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
u32 spl_boot_device(void)
{
if (IS_ENABLED(CONFIG_VPL))
return BOOT_DEVICE_VBE;
return BOOT_DEVICE_BOOTROM;
}

View File

@@ -26,9 +26,18 @@ SECTIONS
.text : {
. = ALIGN(8);
CPUDIR/start.o (.text*)
/* put relocation code all together */
_rcode_start = .;
*(.text.rcode)
*(.text.rdata)
_rcode_end = .;
*(.text*)
}
_rcode_size = _rcode_end - _rcode_start;
.rodata : {
. = ALIGN(8);
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
@@ -55,6 +64,7 @@ SECTIONS
. = ALIGN(8);
__bss_end = .;
}
__bss_size = __bss_end - __bss_start;
/DISCARD/ : { *(.dynsym) }
/DISCARD/ : { *(.dynstr*) }

View File

@@ -0,0 +1,107 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2019
* Rockchip Electronics Co., Ltd
* Kever Yang<kever.yang@rock-chips.com>
*
* (C) Copyright 2013
* David Feng <fenghua@phytium.com.cn>
*
* (C) Copyright 2002
* Gary Jennejohn, DENX Software Engineering, <garyj@denx.de>
*
* (C) Copyright 2010
* Texas Instruments, <www.ti.com>
* Aneesh V <aneesh@ti.com>
*/
OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
OUTPUT_ARCH(aarch64)
ENTRY(_start)
SECTIONS
{
. = 0x00000000;
.text : {
. = ALIGN(8);
__image_copy_start = .;
CPUDIR/start.o (.text*)
/* put relocation code all together */
//. = . + 0xc0;
_rcode_start = .;
*(.text.rcode)
*(.text.rdata)
_rcode_end = .;
*(.text*)
}
.rodata : {
. = ALIGN(8);
*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
}
.data : {
. = ALIGN(8);
*(.data*)
}
__u_boot_list : {
. = ALIGN(8);
KEEP(*(SORT(__u_boot_list*)));
}
.image_copy_end : {
. = ALIGN(8);
*(.__image_copy_end)
}
.end : {
. = ALIGN(8);
*(.__end)
}
_image_binary_end = .;
_end = .;
__image_copy_end = .;
__bss_start = .;
.bss_start (NOLOAD) : {
. = ALIGN(8);
KEEP(*(.__bss_start));
}
.bss (NOLOAD) : {
*(.bss*)
. = ALIGN(8);
}
.bss_end (NOLOAD) : {
KEEP(*(.__bss_end));
}
__bss_end = .;
__bss_size = __bss_end - __bss_start;
/DISCARD/ : { *(.dynsym) }
/DISCARD/ : { *(.dynstr*) }
/DISCARD/ : { *(.dynamic*) }
/DISCARD/ : { *(.plt*) }
/DISCARD/ : { *(.interp*) }
/DISCARD/ : { *(.gnu*) }
}
#if defined(CONFIG_TPL_MAX_SIZE)
ASSERT(__image_copy_end - __image_copy_start < (CONFIG_TPL_MAX_SIZE), \
"TPL image too big");
#endif
#if defined(CONFIG_TPL_BSS_MAX_SIZE)
ASSERT(__bss_end - __bss_start < (CONFIG_TPL_BSS_MAX_SIZE), \
"TPL image BSS too big");
#endif
#if defined(CONFIG_TPL_MAX_FOOTPRINT)
ASSERT(__bss_end - _start < (CONFIG_TPL_MAX_FOOTPRINT), \
"TPL image plus BSS too big");
#endif

View File

@@ -0,0 +1,53 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* (C) Copyright 2019 Rockchip Electronics Co., Ltd
*/
#include <bootstage.h>
#include <debug_uart.h>
#include <dm.h>
#include <hang.h>
#include <init.h>
#include <log.h>
#include <ram.h>
#include <spl.h>
#include <version.h>
#include <asm/io.h>
#include <asm/arch-rockchip/bootrom.h>
#include <linux/bitops.h>
#if CONFIG_IS_ENABLED(BANNER_PRINT)
#include <timestamp.h>
#endif
void board_init_f(ulong dummy)
{
int ret;
#if defined(CONFIG_DEBUG_UART) && defined(CONFIG_VPL_SERIAL)
/*
* Debug UART can be used from here if required:
*
* debug_uart_init();
* printch('a');
* printhex8(0x1234);
* printascii("string");
*/
debug_uart_init();
#ifdef CONFIG_VPL_BANNER_PRINT
printascii("\nU-Boot VPL " PLAIN_VERSION " (" U_BOOT_DATE " - "
U_BOOT_TIME ")\n");
#endif
#endif
ret = spl_early_init();
if (ret) {
debug("spl_early_init() failed: %d\n", ret);
hang();
}
}
u32 spl_boot_device(void)
{
return BOOT_DEVICE_VBE;
}

View File

@@ -95,3 +95,9 @@ M: Jagan Teki <jagan@amarulasolutions.com>
S: Maintained
F: configs/rock-pi-n10-rk3399pro_defconfig
F: arch/arm/dts/rk3399pro-rock-pi-n10*
RK3399-GENERIC-DDR3
M: Simon Glass <sjg@chromium.org>
S: Maintained
F: configs/rk3399-generic-ddr3_defconfig
F: arch/arm/dts/rockchip-vpl-u-boot.dtsi

View File

@@ -8,6 +8,7 @@
#define LOG_CATEGORY LOGC_BOOT
#include <bootmeth.h>
#include <dm.h>
#include <memalign.h>
#include <mmc.h>
@@ -81,3 +82,101 @@ int abrec_read_state(struct udevice *dev, struct abrec_state *state)
return 0;
}
static int vbe_abrec_get_state_desc(struct udevice *dev, char *buf,
int maxsize)
{
struct abrec_state state;
int ret;
ret = abrec_read_state(dev, &state);
if (ret)
return log_msg_ret("read", ret);
if (maxsize < 30)
return -ENOSPC;
snprintf(buf, maxsize, "Version: %s\nVernum: %x/%x", state.fw_version,
state.fw_vernum >> FWVER_KEY_SHIFT,
state.fw_vernum & FWVER_FW_MASK);
return 0;
}
static int vbe_abrec_read_bootflow(struct udevice *dev, struct bootflow *bflow)
{
int ret;
if (CONFIG_IS_ENABLED(BOOTMETH_VBE_ABREC_FW)) {
if (vbe_phase() == VBE_PHASE_FIRMWARE) {
ret = abrec_read_bootflow_fw(dev, bflow);
if (ret)
return log_msg_ret("fw", ret);
return 0;
}
}
return -EINVAL;
}
static int vbe_abrec_read_file(struct udevice *dev, struct bootflow *bflow,
const char *file_path, ulong addr,
enum bootflow_img_t type, ulong *sizep)
{
int ret;
if (vbe_phase() == VBE_PHASE_OS) {
ret = bootmeth_common_read_file(dev, bflow, file_path, addr,
type, sizep);
if (ret)
return log_msg_ret("os", ret);
}
/* To be implemented */
return -EINVAL;
}
static struct bootmeth_ops bootmeth_vbe_abrec_ops = {
.get_state_desc = vbe_abrec_get_state_desc,
.read_bootflow = vbe_abrec_read_bootflow,
.read_file = vbe_abrec_read_file,
};
static int bootmeth_vbe_abrec_probe(struct udevice *dev)
{
struct abrec_priv *priv = dev_get_priv(dev);
int ret;
ret = abrec_read_priv(dev_ofnode(dev), priv);
if (ret)
return log_msg_ret("abp", ret);
return 0;
}
static int bootmeth_vbe_abrec_bind(struct udevice *dev)
{
struct bootmeth_uc_plat *plat = dev_get_uclass_plat(dev);
plat->desc = "VBE A/B/recovery";
plat->flags = BOOTMETHF_GLOBAL;
return 0;
}
#if CONFIG_IS_ENABLED(OF_REAL)
static const struct udevice_id generic_simple_vbe_abrec_ids[] = {
{ .compatible = "fwupd,vbe-abrec" },
{ }
};
#endif
U_BOOT_DRIVER(vbe_abrec) = {
.name = "vbe_abrec",
.id = UCLASS_BOOTMETH,
.of_match = of_match_ptr(generic_simple_vbe_abrec_ids),
.ops = &bootmeth_vbe_abrec_ops,
.bind = bootmeth_vbe_abrec_bind,
.probe = bootmeth_vbe_abrec_probe,
.flags = DM_FLAG_PRE_RELOC,
.priv_auto = sizeof(struct abrec_priv),
};

View File

@@ -92,9 +92,13 @@ static int do_vbe_state(struct cmd_tbl *cmdtp, int flag, int argc,
printf("Phases:");
for (i = PHASE_NONE; i < PHASE_COUNT; i++) {
if (handoff->phases & (1 << i))
printf(" %s", xpl_name(i));
if (handoff->phases & (1 << i)) {
int margin = handoff->reloc_margin[i];
printf(" %s", xpl_name(i));
if (margin)
printf(" (margin %x) ", margin);
}
}
if (!handoff->phases)
printf(" (none)");

View File

@@ -1141,6 +1141,26 @@ config SPL_BLOBLIST_PASSAGE
endchoice
config SPL_BLOBLIST_RELOC
bool "Relocate the bloblist before existing SPL"
depends on BLOBLIST_FIXED
help
Some platforms locate the bloblist in SRAM in SPL. In some cases,
the TF-A BL31 blob removes access to SRAM, e.g. with Rockchip RK3399.
Enable this option to make U-Boot copy the bloblist from SRAM to SDRAM
before leaving SPL.
config SPL_BLOBLIST_RELOC_ADDR
hex "Relocate the bloblist before existing SPL"
depends on SPL_BLOBLIST_RELOC
default BLOBLIST_ADDR
help
Sets the address to which the bloblist is relocated at the end of SPL.
U-Boot proper uses this address when it starts up. Note that U-Boot
always relocates the bloblist again as part of its own relocation
process.
endif # SPL_BLOBLIST
if TPL_BLOBLIST

View File

@@ -520,9 +520,22 @@ int bloblist_init(void)
expected = (fixed && !xpl_is_first_phase()) || passage_valid();
if (xpl_prev_phase() == PHASE_TPL && !IS_ENABLED(CONFIG_TPL_BLOBLIST))
expected = false;
if (fixed)
if (fixed) {
addr = IF_ENABLED_INT(CONFIG_BLOBLIST_FIXED,
CONFIG_BLOBLIST_ADDR);
if (xpl_phase() == PHASE_BOARD_F &&
IS_ENABLED(CONFIG_SPL_BLOBLIST_RELOC)) {
ulong addr = IF_ENABLED_INT(CONFIG_SPL_BLOBLIST_RELOC,
CONFIG_SPL_BLOBLIST_RELOC_ADDR);
log_debug("Using bloblist at %lx\n", addr);
bloblist_reloc(map_sysmem(addr, 0),
bloblist_get_total_size());
}
log_debug("bloblist addr=%lx\n", addr);
}
size = CONFIG_BLOBLIST_SIZE;
if (expected) {
if (passage_valid()) {

View File

@@ -97,7 +97,7 @@ config SPL_MAX_SIZE
config SPL_PAD_TO
hex "Offset to which the SPL should be padded before appending the SPL payload"
default 0x7f8000 if ARCH_ROCKCHIP
default 0x800000 if ARCH_ROCKCHIP
default 0x31000 if ARCH_MX6 && MX6_OCRAM_256KB
default 0x11000 if ARCH_MX7 || (ARCH_MX6 && !MX6_OCRAM_256KB)
default 0x10000 if ARCH_KEYSTONE
@@ -573,6 +573,7 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
default 0x200 if ARCH_SOCFPGA || ARCH_AT91
default 0x300 if ARCH_ZYNQ || ARCH_KEYSTONE || OMAP34XX || \
OMAP54XX || AM33XX || AM43XX || ARCH_K3
default 0x800 if ARCH_ROCKCHIP && VPL
default 0x4000 if ARCH_ROCKCHIP
default 0x822 if TARGET_SIFIVE_UNLEASHED || TARGET_SIFIVE_UNMATCHED
help

View File

@@ -205,6 +205,8 @@ ulong spl_get_image_size(void)
#ifdef CONFIG_VPL
if (xpl_next_phase() == PHASE_VPL)
return binman_sym(ulong, u_boot_vpl_any, size);
return 0; /* VBE handles this */
#endif
return xpl_next_phase() == PHASE_SPL ?
binman_sym(ulong, u_boot_spl_any, size) :

View File

@@ -4,11 +4,13 @@
* Written by Simon Glass <sjg@chromium.org>
*/
#include <bloblist.h>
#include <gzip.h>
#include <image.h>
#include <log.h>
#include <mapmem.h>
#include <spl.h>
#include <vbe.h>
#include <asm/global_data.h>
#include <asm/io.h>
#include <asm/sections.h>
@@ -58,8 +60,18 @@ static int setup_layout(struct spl_image_info *image, ulong *addrp)
buf_size = rcode_base - base;
uint need_size = image->size + image->fdt_size;
margin = buf_size - need_size;
if (CONFIG_IS_ENABLED(BLOBLIST)) {
struct vbe_handoff *handoff;
handoff = bloblist_find(BLOBLISTT_VBE,
sizeof(struct vbe_handoff));
if (handoff)
handoff->reloc_margin[xpl_phase()] = margin;
}
log_debug("spl_reloc %s->%s: margin%s%lx limit %lx fdt_size %lx base %lx avail %x image %x fdt %lx need %x\n",
spl_phase_name(spl_phase()), spl_phase_name(spl_phase() + 1),
xpl_name(xpl_phase()), xpl_name(xpl_phase() + 1),
margin >= 0 ? " " : " -", abs(margin), limit, fdt_size, base,
buf_size, image->size, image->fdt_size, need_size);
if (margin < 0) {

View File

@@ -23,7 +23,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-puma-haikou.dtb"
CONFIG_CONSOLE_MUX=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_SPL_MAX_SIZE=0x2e000
CONFIG_SPL_PAD_TO=0x38000
CONFIG_SPL_PAD_TO=0x40000
# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x200
CONFIG_SPL_I2C=y

View File

@@ -26,7 +26,7 @@ CONFIG_DEFAULT_FDT_FILE="rockchip/px30-ringneck-haikou.dtb"
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_MISC_INIT_R=y
CONFIG_SPL_MAX_SIZE=0x20000
CONFIG_SPL_PAD_TO=0x38000
CONFIG_SPL_PAD_TO=0x40000
CONFIG_SPL_BOARD_INIT=y
CONFIG_SPL_BOOTROM_SUPPORT=y
# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set

View File

@@ -0,0 +1,125 @@
CONFIG_ARM=y
CONFIG_SKIP_LOWLEVEL_INIT=y
CONFIG_SPL_SYS_DCACHE_OFF=y
CONFIG_COUNTER_FREQUENCY=24000000
CONFIG_ARCH_ROCKCHIP=y
CONFIG_TEXT_BASE=0x00200000
CONFIG_SPL_LIBCOMMON_SUPPORT=y
CONFIG_SPL_LIBGENERIC_SUPPORT=y
CONFIG_NR_DRAM_BANKS=1
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x3f00000
CONFIG_SF_DEFAULT_SPEED=20000000
CONFIG_ENV_OFFSET=0x3F8000
CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3399-firefly"
CONFIG_DM_RESET=y
CONFIG_ROCKCHIP_RK3399=y
CONFIG_SPL_STACK_R_ADDR=0x04000000
CONFIG_TARGET_EVB_RK3399=y
CONFIG_SPL_STACK=0xff8eff00
CONFIG_SPL_TEXT_BASE=0xff8c2000
CONFIG_SPL_BSS_MAX_SIZE=0x2000
CONFIG_SPL_STACK_R=y
CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x30000
CONFIG_SYS_LOAD_ADDR=0x800800
CONFIG_DEBUG_UART_BASE=0xFF1A0000
CONFIG_DEBUG_UART_CLOCK=24000000
CONFIG_PCI=y
CONFIG_DEBUG_UART=y
CONFIG_FIT_BEST_MATCH=y
CONFIG_VPL_LOAD_FIT_FULL=y
# CONFIG_VPL_FIT_PRINT is not set
# CONFIG_VPL_FIT_SIGNATURE is not set
# CONFIG_VPL_BOOTSTD is not set
# CONFIG_BOOTMETH_VBE_SIMPLE is not set
CONFIG_BOOTMETH_VBE_ABREC=y
CONFIG_BOOTSTAGE=y
CONFIG_BOOTSTAGE_REPORT=y
CONFIG_USE_PREBOOT=y
CONFIG_DEFAULT_FDT_FILE="rockchip/rk3399-generic.dtb"
CONFIG_LOG=y
CONFIG_DISPLAY_BOARDINFO_LATE=y
CONFIG_BLOBLIST=y
CONFIG_BLOBLIST_FIXED=y
CONFIG_BLOBLIST_ADDR=0xff8eff00
CONFIG_BLOBLIST_SIZE=0x100
CONFIG_SPL_MAX_SIZE=0x40000
# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
CONFIG_SPL_HAVE_INIT_STACK=y
# CONFIG_SPL_SEPARATE_BSS is not set
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1000
CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
CONFIG_TPL=y
CONFIG_TPL_RELOC_LOADER=y
CONFIG_VPL=y
CONFIG_VPL_RELOC_LOADER=y
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_GPT=y
CONFIG_CMD_MMC=y
CONFIG_CMD_PCI=y
CONFIG_CMD_USB=y
# CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_CACHE=y
CONFIG_CMD_TIME=y
CONFIG_CMD_BOOTSTAGE=y
CONFIG_SPL_OF_CONTROL=y
CONFIG_OF_LIST="rockchip/rk3399-nanopc-t4 rockchip/rk3399-nanopi-m4 rockchip/rk3399-nanopi-m4b rockchip/rk3399-nanopi-neo4 rockchip/rk3399-evb rockchip/rk3399-ficus rockchip/rk3399-firefly rockchip/rk3399-orangepi rockchip/rk3399-puma-haikou"
CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
CONFIG_ENV_IS_IN_MMC=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y
CONFIG_TPL_DM_SEQ_ALIAS=y
CONFIG_VPL_REGMAP=y
CONFIG_VPL_SYSCON=y
CONFIG_SPL_CLK=y
CONFIG_ROCKCHIP_GPIO=y
CONFIG_SYS_I2C_ROCKCHIP=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_PHY_REALTEK=y
CONFIG_DM_ETH_PHY=y
CONFIG_ETH_DESIGNWARE=y
CONFIG_GMAC_ROCKCHIP=y
CONFIG_NVME_PCI=y
CONFIG_PHY_ROCKCHIP_INNO_USB2=y
CONFIG_PHY_ROCKCHIP_TYPEC=y
# CONFIG_SPL_DM_PMIC is not set
CONFIG_PMIC_RK8XX=y
CONFIG_REGULATOR_PWM=y
CONFIG_REGULATOR_RK8XX=y
CONFIG_PWM_ROCKCHIP=y
CONFIG_BAUDRATE=1500000
CONFIG_DEBUG_UART_SHIFT=2
CONFIG_SYS_NS16550_MEM32=y
CONFIG_SYSRESET=y
# CONFIG_VPL_SYSRESET is not set
CONFIG_USB=y
# CONFIG_SPL_DM_USB is not set
CONFIG_USB_XHCI_HCD=y
CONFIG_USB_EHCI_HCD=y
CONFIG_USB_EHCI_GENERIC=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GENERIC=y
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_VIDEO=y
CONFIG_DISPLAY=y
CONFIG_VIDEO_ROCKCHIP=y
CONFIG_DISPLAY_ROCKCHIP_HDMI=y
CONFIG_VPL_USE_TINY_PRINTF=y
CONFIG_SPL_TINY_MEMSET=y
CONFIG_CMD_DHRYSTONE=y
# CONFIG_SPL_SHA1 is not set
# CONFIG_VPL_SHA1 is not set
# CONFIG_VPL_SHA256 is not set
CONFIG_TPL_CRC8=y
CONFIG_TPL_LZ4=y
CONFIG_VPL_LZ4=y
# CONFIG_VPL_LZMA is not set
CONFIG_ERRNO_STR=y

10
contrib/README.rst Normal file
View File

@@ -0,0 +1,10 @@
.. SPDX-License-Identifier: GPL-2.0-or-later
Contributions
=============
The `contrib` directory contains software / files which have been contributed
to the U-Boot project but are not maintained by the core developers.
Note to contributors: Each item must have at least an entry in this file. Be
sure to add the appropriate GPL-2.0-or-later SPDX tag to files.

View File

@@ -519,6 +519,19 @@ config-flash.ini:
[OUTPUT]
PATH=RK30xxLoader_uboot.bin
Verified Boot for Embedded (VBE)
--------------------------------
VBE is supported on rk3399 at present, with SDRAM being set up in SPL. The full
A/B/recovery flow is supported in U-Boot.
To build this, use the rk3399-generic board, setting CONFIG_OF_LIST to the list
of boards you want to support. All boards must use the same SDRAM type.
VBE uses internal SRAM (IRAM) for the TPL, VPL and early SPL phases. The stack
stop is near the top of this (0xff8eff00) with the 256-byte bloblist immediately
following.
TODO
----

1
doc/develop/contrib Symbolic link
View File

@@ -0,0 +1 @@
../../contrib/

View File

@@ -113,3 +113,11 @@ Historical documentation
:maxdepth: 2
historical/index
Contributions
-------------
.. toctree::
:maxdepth: 2
contrib/README

View File

@@ -194,6 +194,7 @@ struct io_setting {
static bool phase_sdram_init(void)
{
return xpl_phase() == PHASE_TPL ||
(IS_ENABLED(CONFIG_VPL) && xpl_phase() == PHASE_SPL) ||
(!IS_ENABLED(CONFIG_TPL) &&
!IS_ENABLED(CONFIG_ROCKCHIP_EXTERNAL_TPL) &&
!not_xpl());
@@ -3195,8 +3196,9 @@ U_BOOT_DRIVER(dmc_rk3399) = {
.of_to_plat = rk3399_dmc_of_to_plat,
.probe = rk3399_dmc_probe,
.priv_auto = sizeof(struct dram_info),
#if defined(CONFIG_TPL_BUILD) || \
(!defined(CONFIG_TPL) && defined(CONFIG_XPL_BUILD))
#if defined(CONFIG_VPL) && defined(CONFIG_SPL_BUILD) || \
!defined(CONFIG_VPL) && defined(CONFIG_TPL_BUILD) || \
!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)
.plat_auto = sizeof(struct rockchip_dmc_plat),
#endif
};

View File

@@ -11,6 +11,7 @@
#define __VBE_H
#include <linux/types.h>
#include <spl.h>
/**
* enum vbe_phase_t - current phase of VBE
@@ -47,12 +48,14 @@ enum vbe_pick_t {
* @size: Size of the area containing the FIT
* @phases: Indicates which phases used the VBE bootmeth (1 << PHASE_...)
* @pick: Indicates which firmware pick was used (enum vbe_pick_t)
* @reloc_margin: Indicates the number of bytes of margin coming into this phase
*/
struct vbe_handoff {
ulong offset;
ulong size;
u8 phases;
u8 pick;
int reloc_margin[PHASE_COUNT];
};
/**