if ARCH_MVEBU

config HAVE_MVEBU_EFUSE
	bool

config ARMADA_32BIT
	bool
	select BOARD_EARLY_INIT_F
	select CPU_V7A
	select SPL_DM if SPL
	select SPL_DM_SEQ_ALIAS if SPL
	select SPL_OF_CONTROL if SPL
	select SPL_SKIP_LOWLEVEL_INIT if SPL
	select SPL_SIMPLE_BUS if SPL
	select SUPPORT_SPL
	select SYS_L2_PL310 if !SYS_L2CACHE_OFF
	select TRANSLATION_OFFSET
	select TOOLS_KWBIMAGE if SPL
	select SPL_SYS_NO_VECTOR_TABLE if SPL
	select ARCH_VERY_EARLY_INIT
	select ARMADA_32BIT_SYSCON_RESET if DM_RESET && PCI_MVEBU
	select ARMADA_32BIT_SYSCON_SYSRESET if SYSRESET

# ARMv7 SoCs...
config ARMADA_375
	bool
	select ARMADA_32BIT

config ARMADA_38X
	bool
	select ARMADA_32BIT
	select HAVE_MVEBU_EFUSE

config ARMADA_38X_HS_IMPEDANCE_THRESH
	hex  "Armada 38x USB 2.0 High-Speed Impedance Threshold (0x0 - 0x7)"
	depends on ARMADA_38X
	default 0x6
	range 0x0 0x7

config ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING
	bool
	depends on ARMADA_38X

config ARMADA_XP
	bool
	select ARMADA_32BIT

# ARMv8 SoCs...
config ARMADA_3700
	bool
	select ARM64
	select HAVE_MVEBU_EFUSE

# Armada 7K and 8K are very similar - use only one Kconfig symbol for both
config ARMADA_8K
	bool
	select ARM64

config ALLEYCAT_5
	bool
	select ARM64

# Armada PLL frequency (used for NAND clock generation)
config SYS_MVEBU_PLL_CLOCK
	int
	default "2000000000" if ARMADA_XP || ARMADA_3700 || ARMADA_8K || ARMADA_MSYS
	default "1000000000" if ARMADA_38X || ARMADA_375

# Armada XP/38x SoC types...
config MV78230
	bool
	select ARMADA_XP

config MV78260
	bool
	select ARMADA_XP
	imply SATA

config MV78460
	bool
	select ARMADA_XP

config ARMADA_MSYS
	bool
	select ARMADA_32BIT

config 98DX4251
	bool
	select ARMADA_MSYS

config 98DX3336
	bool
	select ARMADA_MSYS

config 98DX3236
	bool
	select ARMADA_MSYS

config 88F6820
	bool
	select ARMADA_38X

config CUSTOMER_BOARD_SUPPORT
	bool

config DDR4
	bool "Support Marvell DDR4 Training driver"

choice
	prompt "Armada XP/375/38x/3700/7K/8K/Alleycat-5 board select"
	optional

config TARGET_CLEARFOG
	bool "Support ClearFog"
	select 88F6820
	select BOARD_LATE_INIT
	select OF_BOARD_SETUP

config TARGET_HELIOS4
	bool "Support Helios4"
	select 88F6820

config TARGET_MVEBU_ARMADA_37XX
	bool "Support Armada 37xx platforms"
	select ARMADA_3700
	imply SCSI

config TARGET_DB_88F6720
	bool "Support DB-88F6720 Armada 375"
	select ARMADA_375

config TARGET_DB_88F6820_GP
	bool "Support DB-88F6820-GP"
	select 88F6820

config TARGET_DB_88F6820_AMC
	bool "Support DB-88F6820-AMC"
	select 88F6820

config TARGET_TURRIS_OMNIA
	bool "Support Turris Omnia"
	select 88F6820
	select BOARD_LATE_INIT
	select DM_I2C
	select I2C_MUX
	select I2C_MUX_PCA954x
	select SPL_DRIVERS_MISC
	select SPL_I2C_MUX
	select SPL_SYS_MALLOC_SIMPLE
	select SYS_I2C_MVTWSI
	select ATSHA204A
	select I2C_EEPROM
	select ARMADA_38X_SUPPORT_OLD_DDR3_TRAINING

config TARGET_TURRIS_MOX
	bool "Support CZ.NIC's Turris Mox / RIPE Atlas Probe"
	select ARMADA_3700
	select BOARD_TYPES
	select ENV_IS_IN_MMC
	select ENV_IS_IN_SPI_FLASH
	select MULTI_DTB_FIT

config TARGET_MVEBU_ARMADA_8K
	bool "Support Armada 7k/8k platforms"
	select ARMADA_8K
	select BOARD_LATE_INIT
	imply SCSI

config TARGET_NBX10G
	bool "Support Freebox Nodebox 10G"
	select ARMADA_8K
	select BOARD_LATE_INIT
	help
	  Enable support for the Freebox Nodebox 10G board based on the
	  Marvell Armada 8040 SoC with dual CP110 companion chips.

config TARGET_MVEBU_ALLEYCAT5
	bool "Support AlleyCat 5 platforms"
	select ALLEYCAT_5

config TARGET_OCTEONTX2_CN913x
	bool "Support CN913x platforms"
	select ARMADA_8K
	imply BOARD_EARLY_INIT_R
	select BOARD_LATE_INIT
	imply SCSI

config TARGET_DB_MV784MP_GP
	bool "Support db-mv784mp-gp"
	select BOARD_ECC_SUPPORT
	select MV78460

config TARGET_DS116
	bool "Support Synology DS116"
	select 88F6820

config TARGET_DS414
	bool "Support Synology DS414"
	select MV78230

config TARGET_MAXBCM
	bool "Support maxbcm"
	select BOARD_ECC_SUPPORT
	select MV78460

config TARGET_N2350
	bool "Support Thecus N2350"
	select 88F6820
	select DDR4

config TARGET_THEADORABLE
	bool "Support theadorable Armada XP"
	select BOARD_LATE_INIT if USB
	select MV78260
	imply SATA

config TARGET_CONTROLCENTERDC
	bool "Support CONTROLCENTERDC"
	select 88F6820
	select CUSTOMER_BOARD_SUPPORT

config TARGET_X530
	bool "Support Allied Telesis x530"
	select 88F6820

config TARGET_X250
	bool "Support Allied Telesis x250"
	select ARMADA_8K
	imply SCSI
	imply BOOTSTD_DEFAULTS

config TARGET_X240
	bool "Support Allied Telesis x240"
	select ALLEYCAT_5
	imply BOOTSTD_DEFAULTS

config TARGET_X220
	bool "Support Allied Telesis x220"
	select 98DX3336

config TARGET_X960
	bool "Support Allied Telesis x960"
	select ARMADA_8K
	imply BOOTSTD_DEFAULTS

config TARGET_DB_XC3_24G4XG
	bool "Support DB-XC3-24G4XG"
	select 98DX3336

config TARGET_CRS3XX_98DX3236
	bool "Support CRS3XX-98DX3236"
	select 98DX3236

endchoice

choice
	prompt "DDR bus width"
	default DDR_64BIT
	depends on ARMADA_XP

config DDR_64BIT
	bool "64bit bus width"

config DDR_32BIT
	bool "32bit bus width"

endchoice

config DDR_LOG_LEVEL
	int "DDR training code log level"
	depends on ARMADA_XP
	default 0
	range 0 3
	help
	  Amount of information provided on error while running the DDR
	  training code.  At level 0, provides an error code in a case of
	  failure, RL, WL errors and other algorithm failure.  At level 1,
	  provides the D-Unit setup (SPD/Static configuration).  At level 2,
	  provides the windows margin as a results of DQS centeralization.
	  At level 3, provides the windows margin of each DQ as a results of
	  DQS centeralization.

config DDR_IMMUTABLE_DEBUG_SETTINGS
	bool "Immutable DDR debug level (always DEBUG_LEVEL_ERROR)"
	depends on ARMADA_38X
	help
	  Makes the DDR training code debug level settings immutable.
	  The debug level setting from board topology definition is ignored.
	  The debug level is always set to DEBUG_LEVEL_ERROR and register
	  dumps are disabled.
	  This can save around 10 KiB of space in SPL binary.

config DDR_RESET_ON_TRAINING_FAILURE
	bool "Reset the board on DDR training failure instead of hanging"
	depends on ARMADA_38X || ARMADA_XP
	help
	  If DDR training fails in SPL, reset the board instead of hanging.
	  Some boards are known to fail DDR training occasionally and an
	  immediate reset may be preferable to waiting until the board is
	  reset by watchdog (if there even is one).

	  Note that if booting via UART and the DDR training fails, the
	  device will still hang - it doesn't make sense to reset the board
	  in such a case.

config BOARD_ECC_SUPPORT
	bool

config SYS_BOARD
	default "clearfog" if TARGET_CLEARFOG
	default "helios4" if TARGET_HELIOS4
	default "mvebu_armada-37xx" if TARGET_MVEBU_ARMADA_37XX
	default "db-88f6720" if TARGET_DB_88F6720
	default "db-88f6820-gp" if TARGET_DB_88F6820_GP
	default "db-88f6820-amc" if TARGET_DB_88F6820_AMC
	default "turris_omnia" if TARGET_TURRIS_OMNIA
	default "turris_mox" if TARGET_TURRIS_MOX
	default "mvebu_armada-8k" if TARGET_MVEBU_ARMADA_8K
	default "octeontx2_cn913x" if TARGET_OCTEONTX2_CN913x
	default "db-mv784mp-gp" if TARGET_DB_MV784MP_GP
	default "ds116" if TARGET_DS116
	default "ds414" if TARGET_DS414
	default "maxbcm" if TARGET_MAXBCM
	default "n2350" if TARGET_N2350
	default "theadorable" if TARGET_THEADORABLE
	default "a38x" if TARGET_CONTROLCENTERDC
	default "x530" if TARGET_X530
	default "x250" if TARGET_X250
	default "x240" if TARGET_X240
	default "x220" if TARGET_X220
	default "x960" if TARGET_X960
	default "db-xc3-24g4xg" if TARGET_DB_XC3_24G4XG
	default "crs3xx-98dx3236" if TARGET_CRS3XX_98DX3236
	default "mvebu_alleycat-5" if TARGET_MVEBU_ALLEYCAT5

config SYS_CONFIG_NAME
	default "clearfog" if TARGET_CLEARFOG
	default "helios4" if TARGET_HELIOS4
	default "mvebu_armada-37xx" if TARGET_MVEBU_ARMADA_37XX
	default "db-88f6720" if TARGET_DB_88F6720
	default "db-88f6820-gp" if TARGET_DB_88F6820_GP
	default "db-88f6820-amc" if TARGET_DB_88F6820_AMC
	default "mvebu_armada-8k" if TARGET_MVEBU_ARMADA_8K
	default "mvebu_armada-8k" if TARGET_OCTEONTX2_CN913x
	default "db-mv784mp-gp" if TARGET_DB_MV784MP_GP
	default "ds116" if TARGET_DS116
	default "ds414" if TARGET_DS414
	default "maxbcm" if TARGET_MAXBCM
	default "n2350" if TARGET_N2350
	default "theadorable" if TARGET_THEADORABLE
	default "turris_omnia" if TARGET_TURRIS_OMNIA
	default "turris_mox" if TARGET_TURRIS_MOX
	default "controlcenterdc" if TARGET_CONTROLCENTERDC
	default "x530" if TARGET_X530
	default "x250" if TARGET_X250
	default "x240" if TARGET_X240
	default "x220" if TARGET_X220
	default "x960" if TARGET_X960
	default "db-xc3-24g4xg" if TARGET_DB_XC3_24G4XG
	default "crs3xx-98dx3236" if TARGET_CRS3XX_98DX3236
	default "mvebu_alleycat-5" if TARGET_MVEBU_ALLEYCAT5

config SYS_VENDOR
	default "Marvell" if TARGET_DB_MV784MP_GP
	default "Marvell" if TARGET_MVEBU_ARMADA_37XX
	default "Marvell" if TARGET_DB_88F6720
	default "Marvell" if TARGET_DB_88F6820_GP
	default "Marvell" if TARGET_DB_88F6820_AMC
	default "Marvell" if TARGET_MVEBU_ARMADA_8K
	default "Marvell" if TARGET_OCTEONTX2_CN913x
	default "Marvell" if TARGET_DB_XC3_24G4XG
	default "Marvell" if TARGET_MVEBU_DB_88F7040
	default "solidrun" if TARGET_CLEARFOG
	default "kobol" if TARGET_HELIOS4
	default "Synology" if TARGET_DS116
	default "Synology" if TARGET_DS414
	default "thecus" if TARGET_N2350
	default "CZ.NIC" if TARGET_TURRIS_OMNIA
	default "CZ.NIC" if TARGET_TURRIS_MOX
	default "gdsys" if TARGET_CONTROLCENTERDC
	default "alliedtelesis" if TARGET_X530
	default "alliedtelesis" if TARGET_X250
	default "alliedtelesis" if TARGET_X240
	default "alliedtelesis" if TARGET_X220
	default "alliedtelesis" if TARGET_X960
	default "mikrotik" if TARGET_CRS3XX_98DX3236
	default "Marvell" if TARGET_MVEBU_ALLEYCAT5

config SYS_SOC
	default "mvebu"

choice
	prompt "Boot method"
	depends on SPL

config MVEBU_SPL_BOOT_DEVICE_SPI
	bool "NOR flash (SPI or parallel)"
	imply ENV_IS_IN_SPI_FLASH
	imply SPL_DM_SPI
	imply SPL_SPI_FLASH_SUPPORT
	imply SPL_SPI_LOAD
	imply SPL_SPI
	select SPL_BOOTROM_SUPPORT

config MVEBU_SPL_BOOT_DEVICE_NAND
	bool "NAND flash (SPI or parallel)"
	select MTD_RAW_NAND
	select SPL_BOOTROM_SUPPORT

config MVEBU_SPL_BOOT_DEVICE_MMC
	bool "eMMC or SD card"
	imply ENV_IS_IN_MMC
	# GPIO needed for eMMC/SD card presence detection
	imply SPL_DM_GPIO
	imply SPL_DM_MMC
	imply SPL_GPIO
	imply SPL_LIBDISK_SUPPORT
	imply SPL_MMC
	select SUPPORT_EMMC_BOOT if SPL_MMC
	select SPL_BOOTROM_SUPPORT

config MVEBU_SPL_BOOT_DEVICE_SATA
	bool "SATA"
	imply SPL_SATA
	imply SPL_LIBDISK_SUPPORT
	select SPL_BOOTROM_SUPPORT

config MVEBU_SPL_BOOT_DEVICE_PEX
	bool "PCI Express"
	select SPL_BOOTROM_SUPPORT

config MVEBU_SPL_BOOT_DEVICE_UART
	bool "UART"
	select SPL_BOOTROM_SUPPORT

endchoice

config MVEBU_SPL_NAND_BADBLK_LOCATION
	hex "NAND Bad block indicator location"
	depends on MVEBU_SPL_BOOT_DEVICE_NAND
	range 0x0 0x1
	help
	  Value 0x0 = SLC flash = BBI at page 0 or page 1
	  Value 0x1 = MLC flash = BBI at last page in the block

config MVEBU_SPL_SATA_BLKSZ
	int "SATA block size"
	depends on MVEBU_SPL_BOOT_DEVICE_SATA
	range 512 32768
	default 512
	help
	  Block size of the SATA disk in bytes.
	  Typically 512 bytes for majority of disks
	  and 4096 bytes for 4K Native disks.

config MVEBU_EFUSE
	bool "Enable eFuse support"
	depends on HAVE_MVEBU_EFUSE
	help
	  Enable support for reading and writing eFuses on mvebu SoCs.

config MVEBU_EFUSE_FAKE
	bool "Fake eFuse access (dry run)"
	depends on MVEBU_EFUSE
	help
	  This enables a "dry run" mode where eFuses are not really programmed.
	  Instead the eFuse accesses are emulated by writing to and reading
	  from a memory block.
	  This is can be used for testing prog scripts.

config MVEBU_EFUSE_VHV_GPIO
	string "VHV_Enable GPIO name for eFuse programming"
	depends on MVEBU_EFUSE && !ARMADA_3700
	help
	  The eFuse programming (burning) phase requires supplying 1.8V to the
	  device on the VHV power pin, while for normal operation the VHV power
	  rail must be left unconnected. See Marvell AN-389: ARMADA VHV Power
	  document (Doc. No. MV-S302545-00 Rev. C, August 2, 2016) for details.
	  .
	  This specify VHV_Enable GPIO name used in U-Boot for enabling VHV power.

config MVEBU_EFUSE_VHV_GPIO_ACTIVE_LOW
	bool "VHV_Enable GPIO is Active Low"
	depends on MVEBU_EFUSE_VHV_GPIO != ""

config SECURED_MODE_IMAGE
	bool "Build image for trusted boot"
	default false
	depends on 88F6820
	help
	  Build an image that employs the ARMADA SoC's trusted boot framework
	  for securely booting images.

config SECURED_MODE_CSK_INDEX
	int "Index of active CSK"
	default 0
	depends on SECURED_MODE_IMAGE

config SF_DEFAULT_SPEED
	int "Default speed for SPI flash in Hz"
	default 10000000
	depends on MVEBU_SPL_BOOT_DEVICE_SPI

config SF_DEFAULT_MODE
	hex "Default mode for SPI flash"
	default 0x0
	depends on MVEBU_SPL_BOOT_DEVICE_SPI

config ARMADA_32BIT_SYSCON
	bool
	depends on ARMADA_32BIT
	select REGMAP
	select SYSCON

config ARMADA_32BIT_SYSCON_RESET
	bool "Support Armada XP/375/38x/39x reset controller"
	depends on ARMADA_32BIT
	depends on DM_RESET
	select ARMADA_32BIT_SYSCON
	help
	  Build support for Armada XP/375/38x/39x reset controller. This is
	  needed for PCIe support.

config ARMADA_32BIT_SYSCON_SYSRESET
	bool "Support Armada XP/375/38x/39x sysreset via driver model"
	depends on ARMADA_32BIT
	depends on SYSRESET
	select ARMADA_32BIT_SYSCON
	help
	  Build support for Armada XP/375/38x/39x system reset via driver model.

source "board/solidrun/clearfog/Kconfig"
source "board/kobol/helios4/Kconfig"
source "board/freebox/nbx10g/Kconfig"

endif
