# SPDX-License-Identifier: GPL-2.0-only

menu "Rockchip Features"
	depends on ARCH_ROCKCHIP

config RK_TIMER
	hex
	default 1

config ARCH_ROCKCHIP_V7
	bool
	select CPU_V7
	select ARM_SMP_TWD
	select ARCH_HAS_L2X0

config ARCH_RK3188
	bool
	select ARCH_ROCKCHIP_V7

config ARCH_RK3288
	bool
	select ARCH_ROCKCHIP_V7
	select CLOCKSOURCE_ROCKCHIP

config ARCH_ROCKCHIP_V8
	bool
	select CPU_V8
	select ARM_ATF

config ARCH_RK3568
	bool
	select ARCH_ROCKCHIP_V8

config ARCH_RK3576
	bool
	select ARCH_ROCKCHIP_V8

config ARCH_RK3588
	bool
	select ARCH_ROCKCHIP_V8

comment "select Rockchip boards:"

if 32BIT

config MACH_RADXA_ROCK
	select ARCH_RK3188
	select I2C
	select MFD_ACT8846
	bool "Radxa rock board"

config MACH_PHYTEC_SOM_RK3288
	select ARCH_RK3288
	select I2C
	bool "RK3288 phyCORE SOM"
	help
	  Say Y here if you are using a RK3288 based Phytecs SOM

endif

if 64BIT

config MACH_RK3568_EVB
	select ARCH_RK3568
	bool "RK3568 EVB"
	help
	  Say Y here if you are using a RK3568 EVB

config MACH_RK3568_BPI_R2PRO
	select ARCH_RK3568
	bool "RK3568 BPI R2PRO"
	help
	  Say Y here if you are using a RK3568 Bananpi R2 Pro

config MACH_PINE64_PINETAB2
	select ARCH_RK3568
	bool "Pine64 PineTab 2"
	help
	  Say Y here if you are using a Pine64 PineTab 2

	  This will build Barebox for two revisions of PineTab 2:

	  - v0.1: distributed to several OS developers for early OS bring
	          up. Not many of them are available and was superseded
	          by rev 2.0.

	  - v2.0: distributed to consumers. Use this if you intend to ship
	          Barebox to the general public.

config MACH_PINE64_QUARTZ64
	select ARCH_RK3568
	bool "Pine64 Quartz64"
	help
	  Say Y here if you are using a Pine64 Quartz64

config MACH_PROTONIC_MECSBC
	select ARCH_RK3568
	bool "Protonic MECSBC"
	help
	  Say Y here if you are using a Protonic MECSBC

config MACH_PROTONIC_PRTPUK
	select ARCH_RK3576
	bool "Protonic PRTPUK"
	help
	  Say Y here if you are using a Protonic PRTPUK

config MACH_RADXA_ROCK3
	select ARCH_RK3568
	bool "Radxa ROCK3"
	help
	  Say Y here if you are using a Radxa ROCK3

config MACH_RADXA_ROCK5
	select ARCH_RK3588
	bool "Radxa ROCK5"
	help
	  Say Y here if you are using a Radxa ROCK5

config MACH_RADXA_CM3
	select ARCH_RK3568
	bool "Radxa CM3"
	help
	  Say Y here if you are using a Radxa CM3

config MACH_WOLFVISION_PF5
	select ARCH_RK3568
	select BOARD_WOLFVISION
	bool "WolfVision PF5 mainboard"
	help
	  Say Y here if you are using a WolfVision PF5 mainboard

config MACH_XUNLONG_ORANGEPI_5_PLUS
       select ARCH_RK3588
       bool "Xunlong Orange Pi 5 Plus"
       help
         Say Y here if you are using a Xunlong Orange Pi 5 Plus

endif

comment "select board features:"

config ARCH_ROCKCHIP_ATF
	bool "Build rockchip ATF binaries into barebox"
	depends on ARCH_ROCKCHIP_V8
	default y
	help
	  When deselected, barebox proper will run in EL3. This can be
	  useful for debugging early startup, but for all other cases,
	  say y here.

config ARCH_ROCKCHIP_ATF_PASS_FDT
	bool "Pass device tree to TF-A"
	depends on ARCH_ROCKCHIP_ATF
	help
	  Enable this option if you are using an upstream OP-TEE that uses the
	  device tree to initialize dynamic shared memory, which is passed
	  through the upstream TF-A.

	  Disable the option if you are using a downstream TF-A since it
	  doesn't always cope with device trees. Supposedly this happens if the
	  device tree is too large, for example if CONFIG_OF_OVERLAY_LIVE is
	  enabled.

config ARCH_ROCKCHIP_ATF_FDT_SIZE
	hex
	default 0x0
	default 0x60000 if ARCH_ROCKCHIP_ATF_PASS_FDT
	prompt "Reserved size for the FDT blob passed to the TF-A"
	help
	  Set this size to CFG_DTB_MAX_SIZE in the OP-TEE configuration. OP-TEE
	  may modify the passed device tree and increase it's size. This
	  ensures that barebox reserves enough memory for the modifications.

config ARCH_ROCKCHIP_OPTEE
	bool "Build rockchip OP-TEE binary into barebox"
	depends on ARCH_ROCKCHIP_ATF
	select PBL_OPTEE
	help
	  With this option enabled the OP-TEE binary is compiled
	  into barebox and started along with the BL31 trusted firmware.

config ARCH_ROCKCHIP_IMAGE_SIGNED
	bool "Create Rockchip signed images"
	help
	  Sign the created Rockchip images to allow the ROM code of devices
	  that have secure boot enabled to boot the barebox images.

	  The ROM code of the Rockchip SoCs accepts signed images on unlocked
	  boards, too. Thus, if this option is enabled, all barebox images are
	  signed.

if ARCH_ROCKCHIP_IMAGE_SIGNED

config ARCH_ROCKCHIP_IMAGE_SIGN_KEY_ENV
	bool "Specify signing key in environment"
	help
	  If this option is enabled, the path to the bootloader signing key
	  is taken from an environment variable. This allows for better
	  integration in build systems.

	  The environment variable has the same name as the corresponding
	  Kconfig variable, which is CONFIG_ARCH_ROCKCHIP_IMAGE_SIGN_KEY.

if !ARCH_ROCKCHIP_IMAGE_SIGN_KEY_ENV

config ARCH_ROCKCHIP_IMAGE_SIGN_KEY
	string "RSA private key for signing the images"
	default "rk-development.key.pem"
        help
	  The private key that is used for signing the Rockchip images. The
	  string may contain the path to a PEM file or a PKCS#11 URI.

	  The key must be an RSA private key with 2048 or 4096 bits. It may be
	  generated by the Rockchip rk_sign_tool or by OpenSSL.

endif

endif

endmenu
