瀏覽代碼

sunxi: binman: Add support for including SCP firmware

Allwinner sun50i SoCs contain an OpenRISC 1000 CPU that functions as a
System Control Processor, or SCP. ARM Trusted Firmware (ATF)
communicates with the SCP over SCPI to implement the PSCI system
suspend, shutdown and reset functionality. Currently, SCP firmware is
optional; the system will boot and run without it, but system suspend
will be unavailable.

Since all communication with the SCP is mediated by ATF, the only thing
U-Boot needs to do is load the firmware into SRAM. The SCP firmware
occupies the last 16KiB of SRAM A2, immediately following ATF.

Reviewed-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Samuel Holland 3 年之前
父節點
當前提交
e72a6be4fc
共有 3 個文件被更改,包括 60 次插入8 次删除
  1. 16 1
      arch/arm/dts/sunxi-u-boot.dtsi
  2. 40 7
      board/sunxi/README.sunxi64
  3. 4 0
      tools/binman/missing-blob-help

+ 16 - 1
arch/arm/dts/sunxi-u-boot.dtsi

@@ -2,8 +2,10 @@
 
 
 #ifdef CONFIG_MACH_SUN50I_H6
 #ifdef CONFIG_MACH_SUN50I_H6
 #define BL31_ADDR 0x104000
 #define BL31_ADDR 0x104000
+#define  SCP_ADDR 0x114000
 #else
 #else
 #define BL31_ADDR  0x44000
 #define BL31_ADDR  0x44000
+#define  SCP_ADDR  0x50000
 #endif
 #endif
 
 
 / {
 / {
@@ -59,6 +61,19 @@
 					};
 					};
 				};
 				};
 
 
+				scp {
+					description = "SCP firmware";
+					type = "firmware";
+					arch = "or1k";
+					compression = "none";
+					load = <SCP_ADDR>;
+
+					scp {
+						filename = "scp.bin";
+						missing-msg = "scp-sunxi";
+					};
+				};
+
 				@fdt-SEQ {
 				@fdt-SEQ {
 					description = "NAME";
 					description = "NAME";
 					type = "flat_dt";
 					type = "flat_dt";
@@ -72,7 +87,7 @@
 				@config-SEQ {
 				@config-SEQ {
 					description = "NAME";
 					description = "NAME";
 					firmware = "atf";
 					firmware = "atf";
-					loadables = "uboot";
+					loadables = "scp", "uboot";
 					fdt = "fdt-SEQ";
 					fdt = "fdt-SEQ";
 				};
 				};
 			};
 			};

+ 40 - 7
board/sunxi/README.sunxi64

@@ -14,8 +14,12 @@ Quick Start / Overview
 - Build the ARM Trusted Firmware binary (see "ARM Trusted Firmware (ATF)" below)
 - Build the ARM Trusted Firmware binary (see "ARM Trusted Firmware (ATF)" below)
   $ cd /src/arm-trusted-firmware
   $ cd /src/arm-trusted-firmware
   $ make PLAT=sun50i_a64 DEBUG=1 bl31
   $ make PLAT=sun50i_a64 DEBUG=1 bl31
+- Build the SCP firmware binary (see "SCP firmware (Crust)" below)
+  $ cd /src/crust
+  $ make pine64_plus_defconfig && make -j5 scp
 - Build U-Boot (see "SPL/U-Boot" below)
 - Build U-Boot (see "SPL/U-Boot" below)
   $ export BL31=/path/to/bl31.bin
   $ export BL31=/path/to/bl31.bin
+  $ export SCP=/src/crust/build/scp/scp.bin
   $ make pine64_plus_defconfig && make -j5
   $ make pine64_plus_defconfig && make -j5
 - Transfer to an uSD card (see "microSD card" below)
 - Transfer to an uSD card (see "microSD card" below)
   $ dd if=u-boot-sunxi-with-spl.bin of=/dev/sdx bs=8k seek=1
   $ dd if=u-boot-sunxi-with-spl.bin of=/dev/sdx bs=8k seek=1
@@ -24,13 +28,17 @@ Quick Start / Overview
 Building the firmware
 Building the firmware
 =====================
 =====================
 
 
-The Allwinner A64/H5 firmware consists of three parts: U-Boot's SPL, an
-ARM Trusted Firmware (ATF) build and the U-Boot proper.
-The SPL will load both ATF and U-Boot proper along with the right device
-tree blob (.dtb) and will pass execution to ATF (in EL3), which in turn will
-drop into the U-Boot proper (in EL2).
-As the ATF binary will become part of the U-Boot image file, you will need
-to build it first.
+The Allwinner A64/H5/H6 firmware consists of several parts: U-Boot's SPL,
+ARM Trusted Firmware (ATF), optional System Control Processor (SCP) firmware
+(e.g. Crust), and the U-Boot proper.
+
+The SPL will load all of the other firmware binaries into RAM, along with the
+right device tree blob (.dtb), and will pass execution to ATF (in EL3). If SCP
+firmware was loaded, ATF will power on the SCP and wait for it to boot.
+ATF will then drop into U-Boot proper (in EL2).
+
+As the ATF binary and SCP firmware will become part of the U-Boot image file,
+you will need to build them first.
 
 
  ARM Trusted Firmware (ATF)
  ARM Trusted Firmware (ATF)
 ----------------------------
 ----------------------------
@@ -53,6 +61,31 @@ As sometimes the ATF build process is a bit picky about the toolchain used,
 or if you can't be bothered with building ATF, there are known working
 or if you can't be bothered with building ATF, there are known working
 binaries in the firmware repository[3], purely for convenience reasons.
 binaries in the firmware repository[3], purely for convenience reasons.
 
 
+ SCP firmware (Crust)
+----------------------
+SCP firmware is responsible for implementing system suspend/resume, and (on
+boards without a PMIC) soft poweroff/on. ATF contains fallback code for CPU
+power control, so SCP firmware is optional if you don't need either of these
+features. It runs on the AR100, with is an or1k CPU, not ARM, so it needs a
+different cross toolchain.
+
+There is one SCP firmware implementation currently available, Crust:
+$ git clone https://github.com/crust-firmware/crust
+$ cd crust
+$ export CROSS_COMPILE=or1k-linux-musl-
+$ make pine64_plus_defconfig
+$ make scp
+
+The same configuration generally works on any board with the same SoC (A64, H5,
+or H6), so if there is no config for your board, use one for a similar board.
+
+Like for ATF, U-Boot finds the SCP firmware binary via an environment variable:
+$ export SCP=/src/crust/build/scp/scp.bin
+
+If you do not want to use SCP firmware, you can silence the warning from binman
+by pointing it to an empty file:
+$ export SCP=/dev/null
+
  SPL/U-Boot
  SPL/U-Boot
 ------------
 ------------
 Both U-Boot proper and the SPL are using the 64-bit mode. As the boot ROM
 Both U-Boot proper and the SPL are using the 64-bit mode. As the boot ROM

+ 4 - 0
tools/binman/missing-blob-help

@@ -13,3 +13,7 @@ Firmware and build with BL31=/path/to/bl31.bin
 atf-bl31-sunxi:
 atf-bl31-sunxi:
 Please read the section on ARM Trusted Firmware (ATF) in
 Please read the section on ARM Trusted Firmware (ATF) in
 board/sunxi/README.sunxi64
 board/sunxi/README.sunxi64
+
+scp-sunxi:
+SCP firmware is required for system suspend, but is otherwise optional.
+Please read the section on SCP firmware in board/sunxi/README.sunxi64