if ARCH_SUNXI


config IDENT_STRING
	default " Allwinner Technology"


config AXP_PMIC_BUS
	bool "Sunxi AXP PMIC bus access helpers"
	help
	  Select this PMIC bus access helpers for Sunxi platform PRCM or other
	  AXP family PMIC devices.
config SUN6I_PRCM
          bool
          help
            Support for the PRCM (Power/Reset/Clock Management) unit available
	    in A31 SoC.
config SUN8I_RSB
	bool "Allwinner sunXi Reduced Serial Bus Driver"
	help
	  Say y here to enable support for Allwinner's Reduced Serial Bus
	  (RSB) support. This controller is responsible for communicating
	  with various RSB based devices, such as AXP223, AXP8XX PMICs,
	  and AC100/AC200 ICs.
config SUNXI_GIC_V3
          bool
          help
            Support for the GIC controller for 600
config SUNXI_NCAT
          bool
          help
            Support for the sunxi ncat version 1 memory layout.

config SUNXI_NCAT_V2
          bool
          help
            Support for the sunxi ncat version 2 memory layout.

config SUNXI_VERSION1
          bool
          help
            Support for the sunxi version 1 memory layout.

config SUNXI_SECURE
          bool
          help
            Support for the sunxi security

config SUNXI_SECURE_BOOT
	bool "Sunxi secure boot support"
	select SUNXI_IMAGE_VERIFIER
	help
	  Enable secure boot, uboot will verify image in a secure boot.

config SUNXI_PART_VERIFY
	bool "Sunxi partition verify support"
		depends on SUNXI_SECURE_BOOT
	help
	  Enable this, uboot will verify rootfs when boot

config SUNXI_DM_VERITY
	bool "Sunxi dm verity support"
		depends on SUNXI_SECURE_BOOT
	help
	  Enable this, uboot will support rootfs dm-verity

config SUNXI_MEM_MAPPING_CHECK
          bool
          default n
          help
            Support for the sunxi memory mapping check

config SUNXI_COMPARE_IMAGE_AND_FLASH
	bool "compare image and flash size"
	help
	 Support comparison of image and flash before burning,
	 if image is larger than flash, will exit burning.
	default n

config SUNXI_INITRD_ROUTINE
	bool "Sunxi ramdisk init routine"
	default y
	help
		use sunxi ramdisk init routine ,witch copy ramdisk to addr defined
		in boot.img head, instead of original one, whitch will copy ramdisk
		to dynamically malloced addr.

config SUNXI_A64_TIMER_ERRATUM
	bool

# Note only one of these may be selected at a time! But hidden choices are
# not supported by Kconfig
config SUNXI_GEN_SUN4I
	bool
	---help---
	Select this for sunxi SoCs which have resets and clocks set up
	as the original A10 (mach-sun4i).

config SUNXI_GEN_SUN6I
	bool
	---help---
	Select this for sunxi SoCs which have sun6i like periphery, like
	separate ahb reset control registers, custom pmic bus, new style
	watchdog, etc.


config SUNXI_WDT_V2
	bool "sunxi watchdog v2"
	help
		version2 watch dog, work as a independent peripheral
		no longer included in a timer

config SUNXI_SECURE_CRYPTO
    bool "sunxi secure crypto"
    default n
    help
    Select this for sunxi SoCs which the ce can use the secure key to crypt.


choice
	prompt "Sunxi SoC Variant"
	optional


config MACH_SUN50I
	bool "sun50i (Allwinner A64)"
	select ARM64
	select DM_I2C
	select SUNXI_DE2
	select SUNXI_GEN_SUN6I
	select SUNXI_HIGH_SRAM
	select SUPPORT_SPL
	select SUNXI_DRAM_DW
	select SUNXI_DRAM_DW_32BIT
	select FIT
	select SPL_LOAD_FIT

config MACH_SUN50IW3
	bool "sun50i(Allwinner sun50iw3)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN50IW5
	bool "sun50i(Allwinner sun50iw5)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN50IW5
	bool "sun50i(Allwinner sun50iw5)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN50IW9
	bool "sun50i(Allwinner sun50iw9)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN50IW10
	bool "sun50i(Allwinner sun50iw10)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN55IW3
	bool "sun55i(Allwinner sun55iw3)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUNXI_SECURE
	select SUNXI_GIC_V3

config MACH_SUN50IW11
	bool "sun50i(Allwinner sun50iw11)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN50IW12
	bool "sun50i(Allwinner sun50iw12)"
	select SUNXI_ARM64
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE
	select SUNXI_WDT_V2

config MACH_SUN8IW7

	bool "sun8i(Allwinner sun8iw7)"
	select CPU_V7A
	select SUNXI_VERSION1
	select SUNXI_SECURE

config MACH_SUN8IW11

	bool "sun8i(Allwinner sun8iw11)"
	select CPU_V7A
	select SUNXI_VERSION1

config MACH_SUN8IW15
	bool "sun8i(Allwinner sun8iw15)"
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN8IW16
	bool "sun8iw16(Allwinner sun8w16)"
	select CPU_V7A
	select SUNXI_NCAT

config MACH_SUN8IW18
	bool "sun8i(Allwinner sun8iw18)"
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN4I
	bool "sun4i (Allwinner A10)"
	select CPU_V7A
	select ARM_CORTEX_CPU_IS_UP
	select DRAM_SUN4I
	select SUNXI_GEN_SUN4I
	select SUPPORT_SPL

config MACH_SUN5I
	bool "sun5i (Allwinner A13)"
	select CPU_V7A
	select ARM_CORTEX_CPU_IS_UP
	select DRAM_SUN4I
	select SUNXI_GEN_SUN4I
	select SUPPORT_SPL
	imply CONS_INDEX_2 if !DM_SERIAL

config MACH_SUN6I
	bool "sun6i (Allwinner A31)"
	select CPU_V7A
	select CPU_V7_HAS_NONSEC
	select CPU_V7_HAS_VIRT
	select ARCH_SUPPORT_PSCI
	select DRAM_SUN6I
	select SUN6I_P2WI
	select SUN6I_PRCM
	select SUNXI_GEN_SUN6I
	select SUPPORT_SPL
	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT

config MACH_SUN7I
	bool "sun7i (Allwinner A20)"
	select CPU_V7A
	select CPU_V7_HAS_NONSEC
	select CPU_V7_HAS_VIRT
	select ARCH_SUPPORT_PSCI
	select DRAM_SUN4I
	select SUNXI_GEN_SUN4I
	select SUPPORT_SPL
	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT

config MACH_SUN8I_A23
	bool "sun8i (Allwinner A23)"
	select CPU_V7A
	select CPU_V7_HAS_NONSEC
	select CPU_V7_HAS_VIRT
	select ARCH_SUPPORT_PSCI
	select DRAM_SUN8I_A23
	select SUNXI_GEN_SUN6I
	select SUPPORT_SPL
	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
	imply CONS_INDEX_5 if !DM_SERIAL

config MACH_SUN8I_A33
	bool "sun8i (Allwinner A33)"
	select CPU_V7A
	select CPU_V7_HAS_NONSEC
	select CPU_V7_HAS_VIRT
	select ARCH_SUPPORT_PSCI
	select DRAM_SUN8I_A33
	select SUNXI_GEN_SUN6I
	select SUPPORT_SPL
	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT
	imply CONS_INDEX_5 if !DM_SERIAL

config MACH_SUN8I_A83T
	bool "sun8i (Allwinner A83T)"
	select CPU_V7A
	select DRAM_SUN8I_A83T
	select SUNXI_GEN_SUN6I
	select MMC_SUNXI_HAS_NEW_MODE
	select SUPPORT_SPL

config MACH_SUN8I_H3
	bool "sun8i (Allwinner H3)"
	select CPU_V7A
	select CPU_V7_HAS_NONSEC
	select CPU_V7_HAS_VIRT
	select ARCH_SUPPORT_PSCI
	select MACH_SUNXI_H3_H5
	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT

config MACH_SUN8I_R40
	bool "sun8i (Allwinner R40)"
	select CPU_V7A
	select CPU_V7_HAS_NONSEC
	select CPU_V7_HAS_VIRT
	select ARCH_SUPPORT_PSCI
	select SUNXI_GEN_SUN6I
	select SUPPORT_SPL
	select SUNXI_DRAM_DW
	select SUNXI_DRAM_DW_32BIT

config MACH_SUN8I_V3S
	bool "sun8i (Allwinner V3s)"
	select CPU_V7A
	select CPU_V7_HAS_NONSEC
	select CPU_V7_HAS_VIRT
	select ARCH_SUPPORT_PSCI
	select SUNXI_GEN_SUN6I
	select SUNXI_DRAM_DW
	select SUNXI_DRAM_DW_16BIT
	select SUPPORT_SPL
	select ARMV7_BOOT_SEC_DEFAULT if OLD_SUNXI_KERNEL_COMPAT

config MACH_SUN9I
	bool "sun9i (Allwinner A80)"
	select CPU_V7A
	select DRAM_SUN9I
	select SUN6I_PRCM
	select SUNXI_HIGH_SRAM
	select SUNXI_GEN_SUN6I
	select SUN8I_RSB
	select SUNXI_NCAT
	select SUNXI_SECURE

config MACH_SUN50I
	bool "sun50i (Allwinner A64)"
	select ARM64
	select DM_I2C
	select PHY_SUN4I_USB
	select SUNXI_DE2
	select SUNXI_GEN_SUN6I
	select SUNXI_HIGH_SRAM
	select SUPPORT_SPL
	select SUNXI_DRAM_DW
	select SUNXI_DRAM_DW_32BIT
	select FIT
	select SPL_LOAD_FIT
	select SUNXI_A64_TIMER_ERRATUM

config MACH_SUN8IW19
	bool "sun8iw19(Allwinner sun8w19)"
	select CPU_V7A
	select SUNXI_NCAT

config MACH_SUN8IW20
	bool "sun8i(Allwinner sun8iw20)"
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT_V2
	select SUNXI_WDT_V2
	select SUNXI_SECURE

config MACH_SUN8IW21
	bool "sun8i(Allwinner sun8iw21)"
	select CPU_V7A
	select SUN8I_RSB
	select SUNXI_NCAT_V2
	select SUNXI_WDT_V2
	select SUNXI_SECURE
endchoice

# The sun8i SoCs share a lot, this helps to avoid a lot of "if A23 || A33"
config MACH_SUN8I
	bool
	select SUN8I_RSB
	select SUN6I_PRCM
	default y if MACH_SUN8I_V3S

config RESERVE_ALLWINNER_BOOT0_HEADER
	bool "reserve space for Allwinner boot0 header"
	select ENABLE_ARM_SOC_BOOT0_HOOK
	---help---
	Prepend a 1536 byte (empty) header to the U-Boot image file, to be
	filled with magic values post build. The Allwinner provided boot0
	blob relies on this information to load and execute U-Boot.
	Only needed on 64-bit Allwinner boards so far when using boot0.
config DRAM_PARA_ADDR
	hex
	---help---
	show the dram init para for sprite.
config SUNXI_FDT_ADDR
	hex "device tree address for kernel"
	default 44000000
	---help---
	set the address for start_kernel.

config SUNXI_VENDOR_BOOT_ADDR
	hex "vendor boot for kernel"
	default 49000000
	---help---
	set vendor boot the address for start_kernel.

config SUNXI_FDT_SAVE
	bool "SUNXI FDT SVAE"
	default n
	depends on CMD_FDT
	help
	  This is the SUNXI FDT SAVE

config SUNXI_DTB_RESERVE_SIZE
	hex "sunxi dtb reserve default size to 1M"
	default 0x100000
	depends on SUNXI_FDT_SAVE
	help
	  set sunxi dtb reserve default size

config SUNXI_TURNNING_FLASH
	bool "SUNXI TURNNING FLASH SVAE"
	default y
	help
	  This is the SUNXI TURNNING FLASH

config SUNXI_DEBUG
	bool "the gating for uboot debug"
	default false

config SUNXI_NOR_IMG
	bool "crate u-boot-nor.bin"
	default false

config SYS_CLK_FREQ
	default 1008000000 if MACH_SUN50IW3
	default 1008000000 if MACH_SUN50IW5
	default 1008000000 if MACH_SUN50IW9
	default 1008000000 if MACH_SUN50IW10
	default 1008000000 if MACH_SUN50IW11
	default 1008000000 if MACH_SUN8IW15
	default 1008000000 if MACH_SUN8IW16
	default 1008000000 if MACH_SUN8IW18
	default 1008000000 if MACH_SUN8IW19
	default 1008000000 if MACH_SUN55IW3
	default 1008000000

config SYS_CONFIG_NAME
	string  "system config header name"
	default "sun50iw3p1" if  MACH_SUN50IW3
	default "sun50iw5p1" if  MACH_SUN50IW5
	default "sun50iw9p1" if  MACH_SUN50IW9
	default "sun50iw10p1" if  MACH_SUN50IW10
	default "sun50iw11p1" if  MACH_SUN50IW11
	default "sun8iw15p1" if  MACH_SUN8IW15
	default "sun8iw16p1" if  MACH_SUN8IW16
	default "sun8iw18p1" if MACH_SUN8IW18
	default "sun8iw19p1" if MACH_SUN8IW19
	default "sun8iw7p1" if MACH_SUN8IW7
	default "sun8iw11p1" if MACH_SUN8IW11
	default "sun8iw20p1" if MACH_SUN8IW20
	default "sun8iw21p1" if MACH_SUN8IW21
	default "sun55iw3p1" if  MACH_SUN55IW3

config SUNXI_ARM64
	bool "set SUNXI ARM64"
	default y if MACH_SUN50IW3 || MACH_SUN50IW5 || MACH_SUN50IW9 || MACH_SUN50IW10 || MACH_SUN50IW11 || MACH_SUN55IW3
	---help---
	set SUNXI_ARM64 when SUN50I

config SYS_BOARD
	default "sunxi"

config SYS_SOC
	default "sunxi"

config OLD_SUNXI_KERNEL_COMPAT
	bool "Enable workarounds for booting old kernels"
	default n
	---help---
	Set this to enable various workarounds for old kernels, this results in
	sub-optimal settings for newer kernels, only enable if needed.

config MACPWR
	string "MAC power pin"
	default ""
	help
	  Set the pin used to power the MAC. This takes a string in the format
	  understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.

config I2C0_ENABLE
	bool "Enable I2C/TWI controller 0"
	default n
	select CMD_I2C
	---help---
	This allows enabling I2C/TWI controller 0 by muxing its pins, enabling
	its clock and setting up the bus. This is especially useful on devices
	with slaves connected to the bus or with pins exposed through e.g. an
	expansion port/header.

config I2C1_ENABLE
	bool "Enable I2C/TWI controller 1"
	default n
	select CMD_I2C
	---help---
	See I2C1_ENABLE help text.

config I2C2_ENABLE
	bool "Enable I2C/TWI controller 2"
	default n
	select CMD_I2C
	---help---
	See I2C2_ENABLE help text.

config I2C3_ENABLE
	bool "Enable I2C/TWI controller 3"
	default n
	select CMD_I2C
	---help---
	See I2C3_ENABLE help text.
config I2C4_ENABLE
	bool "Enable I2C/TWI controller 4"
	default n
	select CMD_I2C
	---help---
	See I2C4_ENABLE help text.
config I2C5_ENABLE
	bool "Enable I2C/TWI controller 5"
	default n
	select CMD_I2C
	---help---
	See I2C5_ENABLE help text.
config R_I2C0_ENABLE
	bool "Enable R_I2C/R_TWI controller 0"
	default n
	select CMD_I2C
	---help---
	See R_I2C0_ENABLE help text.
config R_I2C1_ENABLE
	bool "Enable R_I2C/R_TWI controller 1"
	default n
	select CMD_I2C
	---help---
	See R_I2C1_ENABLE help text.


config AXP_GPIO
	bool "Enable support for gpio-s on axp PMICs"
	default n
	---help---
	Say Y here to enable support for the gpio pins of the axp PMIC ICs.


config SATAPWR
	string "SATA power pin"
	default ""
	help
	  Set the pins used to power the SATA. This takes a string in the
	  format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of
	  port H.

config GMAC_TX_DELAY
	int "GMAC Transmit Clock Delay Chain"
	default 0
	---help---
	Set the GMAC Transmit Clock Delay Chain value.

config INITIAL_USB_SCAN_DELAY
	int "delay initial usb scan by x ms to allow builtin devices to init"
	default 0
	---help---
	Some boards have on board usb devices which need longer than the
	USB spec's 1 second to connect from board powerup. Set this config
	option to a non 0 value to add an extra delay before the first usb
	bus scan.

config USB0_VBUS_PIN
	string "Vbus enable pin for usb0 (otg)"
	default ""
	---help---
	Set the Vbus enable pin for usb0 (otg). This takes a string in the
	format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.

config USB1_VBUS_PIN
	string "Vbus enable pin for usb1 (ehci0)"
	default ""
	---help---
	Set the Vbus enable pin for usb1 (ehci0, usb0 is the otg). This takes
	a string in the format understood by sunxi_name_to_gpio, e.g.
	PH1 for pin 1 of port H.

config USB2_VBUS_PIN
	string "Vbus enable pin for usb2 (ehci1)"
	default ""
	---help---
	See USB1_VBUS_PIN help text.

config USB3_VBUS_PIN
	string "Vbus enable pin for usb3 (ehci2)"
	default ""
	---help---
	See USB1_VBUS_PIN help text.
endif
