#
# For a description of the syntax of this configuration file,
# see Linux Documentation
#
#

config IFX_UBOOT_OPTIMIZED
      bool
      default y

config CONFIG_REMOVE_GZIP
      bool
    default y

config CONFIG_IFX_MIPS
      bool
      default y

config CROSS_COMPILE_UCLIBC
      bool
      default y

config LANTIQ_UART
	  bool
	  default y
          depends on !LANTIQ_UBOOT_vbg400

menu "Build Options"

choice
    prompt 'Boot From'

config BOOT_FROM_NOR
    bool "NOR Flash"
    select ENV_IS_IN_FLASH
    depends on !DRIVER_HN1 && !DRIVER_AR10 
    depends on !DRIVER_GRX500

config BOOT_FROM_SPI
    bool "SPI Flash"
    select ENV_IS_IN_SPI_FLASH
    select SPI_FLASH
    help
    Boots from SPI flash.

config BOOT_FROM_NAND
    bool "NAND Flash"
    select NAND_FLASH
    select NAND_U_BOOT
	help
    Boots from NAND flash.


config BOOT_FROM_ETHERNET
    bool "ETHERNET"
	select ENV_IS_NOWHERE
    help
    Boots from ethernet port.
    depends on !DRIVER_HN1
	
config BOOT_FROM_UART
    bool "UART"
    select ENV_IS_IN_FLASH
    help
    Boots from asc port.
	depends on !DRIVER_HN1

config BOOT_WITH_NO_FLASH
    bool "NO FLASH"
    select ENV_IS_NOWHERE
    depends on !DRIVER_HN1

endchoice

config ENV_IS_NOWHERE
    bool 
	default n

config ENV_IS_IN_FLASH
    bool

config ENV_IS_IN_SPI_FLASH
    bool

config ENV_IS_IN_NAND
    bool
	default y
	depends on BOOT_FROM_NAND && !ENV_IS_NOWHERE

config ENV_IS_NOWHERE
    bool

config NAND_U_BOOT
    bool

config SPI_WITH_NAND
	bool

config RAM_TEXT_BASE
    hex  
	default "0xA0400000"

config BOOTSTRAP_TEXT_BASE
    hex 
    default "0x80200000" if ( LANTIQ_UBOOT_grx500 )
    default "0x80100000" if ( BOOT_FROM_NAND )
    default "0xB0000000" if ( BOOT_FROM_NOR )
    default "0xa0100000" if ( BOOT_FROM_SPI && !LANTIQ_UBOOT_vbg400 )
    default "0xA0800000" if ( LANTIQ_UBOOT_vbg400 )

config NAND_PRELOAD_TEXT_BASE
	hex
	default "0xbe1a0000" if LANTIQ_UBOOT_ar9
	default "0xbe220000" if LANTIQ_UBOOT_vr9
	default "0xbf280000" if LANTIQ_UBOOT_hn1
	default "0xbe1a0000" if LANTIQ_UBOOT_ar10
        default "0xa0010000" if LANTIQ_UBOOT_grx500

config NAND_SPL_TEXT_BASE
    hex  
	default "0xBE1a0400"  if LANTIQ_UBOOT_ar9
        default "0xBE220400"  if ( LANTIQ_UBOOT_vr9 && NAND_PRELOAD )
	default "0xbe220000"  if ( LANTIQ_UBOOT_vr9 && !NAND_PRELOAD )
        default "0xBF280400"  if LANTIQ_UBOOT_hn1
	default "0xBE1A0000"  if LANTIQ_UBOOT_ar10 
	default "0xa0001000"  if LANTIQ_UBOOT_grx500
        depends on BOOT_FROM_NAND

config SFDDR_TEXT_BASE
	hex 
	default "0xbe1a0000" if LANTIQ_UBOOT_ar9
	default "0xbe220500" if LANTIQ_UBOOT_vr9
	default "0xbf280500" if LANTIQ_UBOOT_hn1
	default "0xa0001000" if LANTIQ_UBOOT_grx500
    depends on BOOT_FROM_SPI

choice
     prompt "OS COMPRESSION TYPE"
     default OS_LZMA

config OS_GZIP
     bool "GZIP"

config OS_LZMA
     bool "LZMA"

config OS_LZO
     bool "LZO"

config OS_BZIP2
     bool "BZIP2"

endchoice
						   

config LTQ_SECURE_BOOT
	bool "SECURE BOOT"
	default n
	depends on DRIVER_VR9 || DRIVER_AR10 || DRIVER_GRX500 
        depends on !BOOT_FROM_NOR

config AES_KEY
        string "stage1 aes key"
	default "0000000000000000000000000000000000000000000000000000000000000000"
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10 

config STAGE2_AES_KEY
        string "stage2 aes key"
        default "0000000000000000000000000000000000000000000000000000000000000000"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config STAGE2_AES_IV
	string
	default "00000000000000000000000000000000"
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config STAGE2_AES_IV
	string
	default "00000000000000000000000000000000"
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10 

config ENCRYPT_STAGE3
        bool "encypt stage3 image"
	default n
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config STAGE3_AES_KEY
        string "stage3 aes key"
        default "0000000000000000000000000000000000000000000000000000000000000000"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config DSA_KEY_AUTO
	bool "generate a new DSA key"
	default y
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config DSA_PRIVKEY
        string "dsa private key"
	default "privkey.pem"
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config DSA_PUBKEY
        string "dsa public key"
        default "pubkey.pem"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config STAGE2_LOADADDR
        hex "stage2 load address"
	default "0x80400000"
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config STAGE2_SIZE
        hex "stage2 size"
	default "0x19000"
	depends on LTQ_SECURE_BOOT
        depends on DRIVER_VR9 || DRIVER_AR10

config MANUBOOT
        bool "Manufacturing Boot ( Root Of Trust Transfer )"
        default n
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500

config SIGNTOOL
        string "signtool path"
        default "signtool"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500

config PROD_UNIQUE_KEY
        string "product unique key(path)"
        default "CRkey.bin"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500

config PRIVATE_KEY
        string "private key(path)"
        default "privatekey.der"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500

config CERTIFICATION_SUPPORT
        bool "Certification Support"
        default y
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500

config CERTIFICATION
        string "certification(path)"
        default "cert.bin"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500
        depends on CERTIFICATION_SUPPORT

config MANUBOOT_CREDENTIAL_SUPPORT
        bool "Manufacturing Boot Credential Support"
        default n
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500
        depends on MANUBOOT

config MANUBOOT_CREDENTIAL
        string "Manufacturing Boot Credential(path)"
        default "cred.bin"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500
        depends on MANUBOOT
        depends on MANUBOOT_CREDENTIAL_SUPPORT

config MANUBOOT_OTP_SUPPORT
        bool "Manufacturing Boot OTP Programming Support"
        default n
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500
        depends on MANUBOOT
        select CMD_ROT

config MANUBOOT_OTP
        string "Manufacturing Boot OTP binary(path)"
        default "otp.bin"
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500
        depends on MANUBOOT
        depends on MANUBOOT_OTP_SUPPORT

config LTQ_EIP123_IAP_ACCESS
        bool "EIP-123 InterAptiv Access (for Secure EJTAG)"
        default n
        depends on LTQ_SECURE_BOOT
        depends on DRIVER_GRX500

config USE_DEFAULT_PREBOOT
    bool "use default preboot command" 
    default y

config PREBOOT
    string "pre-boot command"
    default "echo;echo run \"flash_flash\" to bring up the kernel;echo;"
	depends on !USE_DEFAULT_PREBOOT

config AUTOBOOT_KEYED
    bool "AUTOBOOT KEYED"
	default n

config AUTOBOOT_DELAY_STR
    string "AUTOBOOT PASSWORD"
    default ""
    depends on AUTOBOOT_KEYED

config SILENT_CONSOLE
    bool "Silent console support"
	default n

config SUPPRESS_KERNEL_OUTPUT
    bool "suppress kernel output"
	default n
	depends on SILENT_CONSOLE

config VENDOR_NAME
    string 
	default "LANTIQ"
	depends on LTQ_IMAGE_EXTRA_CHECKS

config SW_VERSION
    string 
	default "4.2.0"
	depends on LTQ_IMAGE_EXTRA_CHECKS

config DEBUG
    bool "VERBOSE"
	default n

endmenu

menu "Board Settings"

config IFX_MEMORY_SIZE
        int "RAM Size(M)"
        default 32

config BAUDRATE
  int "ASC BAUDRATE"
  default 115200

config NOR_FLASH
        bool "NOR FLASH SUPPORT"
        default y
        select CMD_FLASH
        depends on !DRIVER_AR10 && !DRIVER_HN1

config SYS_NO_FLASH
       bool
	   default y
	   depends on !NOR_FLASH

config FLASH_CFI_DRIVER
       bool
	   default y
	   depends on NOR_FLASH

config SYS_FLASH_CFI
       bool
	   default y
	   depends on NOR_FLASH

config FLASH_CFI_MTD
	   bool "MTD SUPPORT"
	   default n
	   depends on NOR_FLASH

choice
     prompt "NOR Flash Size(M)"
     depends on BOOT_FROM_NOR
     default NOR_FLASH_8M

config NOR_FLASH_8M
     bool "8M"

config NOR_FLASH_4M
     bool "4M"

config NOR_FLASH_2M
     bool "2M"

config NOR_FLASH_AUTO
     bool "auto detect"

endchoice


config SPI_FLASH
      bool "SPI FLASH SUPPORT"
        select LANTIQ_SPI
      select CMD_SF

choice
     prompt "SPI Flash Size(M)"
	 depends on BOOT_FROM_SPI
	 default SPI_FLASH_4M

config SPI_FLASH_16M
     bool "16M"

config SPI_FLASH_8M
     bool "8M"

config SPI_FLASH_4M
     bool "4M"

config SPI_FLASH_2M
     bool "2M"

config SPI_FLASH_1M
     bool "1M"

endchoice
							  

config SPI_FLASH_ATMEL
        bool "ATMEL SFLASH SUPPORT"
    depends on SPI_FLASH

config SPI_FLASH_STMICRO
        bool  "STMICRO SFLASH SUPPORT"
    depends on SPI_FLASH

config SPI_FLASH_SST
        bool "SST SFLASH SUPPORT"
        depends on SPI_FLASH

config SPI_FLASH_SPANSION
        bool "SPANSION SFLASH SUPPORT"
    depends on SPI_FLASH

config SPI_FLASH_MXIC
        bool "MXIC SFLASH SUPPORT"
    depends on SPI_FLASH

config SPI_FLASH_WINBOND
   bool "WINBOND SFLASH SUPPORT"
   depends on SPI_FLASH

config LANTIQ_SPI
        bool

config  SF_DEFAULT_SPEED
        int "SPI FLASH BAUDRATE(Hz)"
    default "1000000"
        depends on SPI_FLASH

config SF_DEFAULT_MODE
        int "SFLASH SPI MODE"
    default "0"
    depends on LANTIQ_SPI

config SPI_EEPROM
        bool "SPI EEPROM SUPPORT"
    select CMD_EEPROM
    select LANTIQ_SPI
    select SPI_EEPROM_ATMEL


config SPI_EEPROM_ATMEL
        bool "ATMEL 250X0 SUPPORT"
        depends on SPI_EEPROM


config  EEPROM_DEFAULT_SPEED
        int "EEPROM BAUDRATE(Hz)"
    default "1000000"
    depends on SPI_EEPROM

config  EEPROM_DEFAULT_MODE
        int "EEPROM SPI MODE"
        default "0"
        depends on SPI_EEPROM


config NAND_FLASH
      bool "NAND FLASH_SUPPORT"
      select CMD_NAND
      select SPI_WITH_NAND if BOOT_FROM_SPI

choice
      prompt "NAND TYPE"
      default NAND_LANTIQ
      depends on NAND_FLASH

config NAND_LANTIQ
       bool "EBU NAND"

config SPINAND_LANTIQ
       bool "SPI NAND"
       depends on LANTIQ_SPI
endchoice

config GIGA_DEVICE_SPINAND
       bool "GIGADEVICE SPI NAND"
       depends on SPINAND_LANTIQ

choice 
      prompt "ECC MODE"
	  depends on NAND_FLASH
	  default NAND_ECC_SOFT

config NAND_ECC_SOFT
       bool "SOFTWARE HAMMING"

config NAND_ECC_BCH
       bool "SOFTWARE BCH"
       select BCH

config NAND_ECC_HW_REED_SOLOMON
       bool "HARDWARE REED SOLOMON"

config NAND_BENAND
	   bool "BENAND Flash Boot"
	   select BENAND

endchoice


choice 
	prompt "BCH ECC Strength configuration"
        depends on NAND_ECC_BCH
        depends on DRIVER_GRX500

config BCH_4BITS
	bool "Support for 4-bits/512bytes BCH"

config BCH_8BITS
	bool "Support for 8-bits/512bytes BCH"

endchoice

config BCH_CONT_T
	int
	depends on NAND_ECC_BCH
        depends on DRIVER_GRX500
        default "7" if ( BCH_4BITS )
	default "13" if ( BCH_8BITS )

config SPL_OOBSIZE
	int "NAND Flash OOB Size"
        depends on NAND_ECC_BCH
        depends on DRIVER_GRX500
	default "64" if ( NAND_PAGE_SIZE = 0x800) 
	default "448" if ( NAND_PAGE_SIZE = 0x2000)




choice 
     prompt "ECC LOCATION"
     depends on NAND_ECC_HW_REED_SOLOMON
     default NAND_HW_ECC_SPARE_AREA

config NAND_HW_ECC_SPARE_AREA
      bool "ECC IN OOB AREA"

config NAND_HW_ECC_EMBEDDED
      bool "ECC EMBEDDED IN DATA AREA"
	  
endchoice

choice
     prompt "ECC LENGTH"
     depends on NAND_ECC_HW_REED_SOLOMON
	 default NAND_ECC_HW_4BYTES

config NAND_ECC_HW_4BYTES
     bool "4 bytes"

config NAND_ECC_HW_3BYTES
     bool "3 bytes"

endchoice


config MLC_NAND_HEADER_NUMBER
      int "MLC NAND HEADER NUMBER"
	  default 1
	  depends on BOOT_FROM_NAND && NAND_ECC_HW_REED_SOLOMON

config NAND_ECC_HW
	  bool
	  depends on NAND_ECC_HW_HAMMING || NAND_ECC_HW_REED_SOLOMON
	  default y

config NAND_BBT_SCAN
        bool "BAD NAND BLOCK SCAN"
        depends on NAND_FLASH

config NAND_LANTIQ
       bool
       depends on NAND_FLASH

if LANTIQ_UBOOT_ar10 
config NAND_CS0
       bool "NAND FLASH ON CS0"
	   default n
	   depends on NAND_FLASH 
endif 

choice
     prompt "NAND Flash Size(M)"
	 depends on BOOT_FROM_NAND
	 default NAND_FLASH_4M

config NAND_FLASH_8192M
	 bool "8192M" 

config NAND_FLASH_4096M
	 bool "4096M" 

config NAND_FLASH_2048M
     bool "2048M"

config NAND_FLASH_1024M
     bool "1024M"

config NAND_FLASH_512M
     bool "512M"

config NAND_FLASH_256M
     bool "256M"

config NAND_FLASH_128M
     bool "128M"

config NAND_FLASH_64M
     bool "64M"

config NAND_FLASH_32M
     bool "32M"

config NAND_FLASH_8M
     bool "8M"

config NAND_FLASH_4M
     bool "4M"

config NAND_FLASH_2M
     bool "2M"

endchoice


config NAND_FLASH_SIZE
    int 
	default "2" if ( NAND_FLASH_2M )
	default "4" if ( NAND_FLASH_4M )
	default "8" if ( NAND_FLASH_8M )
	default "32" if ( NAND_FLASH_32M )
	default "64" if ( NAND_FLASH_64M )
	default "128" if ( NAND_FLASH_128M )
	default "256" if ( NAND_FLASH_256M )
	default "512" if ( NAND_FLASH_512M )
	default "1024" if ( NAND_FLASH_1024M )
	default "2048" if ( NAND_FLASH_2048M )
	default "4096" if ( NAND_FLASH_4096M )
	default "8192" if ( NAND_FLASH_8192M )
	
config NAND_PAGE_SIZE
     hex "NAND flash page size(bytes in hex)"
     default "0x200"
     depends on BOOT_FROM_NAND

config NAND_BLOCK_SIZE
	 hex "NAND flash erase block size(bytes in hex)"
	 default "0x40000"
	 depends on BOOT_FROM_NAND

config NAND_SPL_BLOCK_SIZE
     hex "NAND SPL IMAGE SIZE(bytes in hex)"
	 default "0x4000"
	 depends on BOOT_FROM_NAND && (!NAND_ECC_HW_REED_SOLOMON || DRIVER_GRX500)

config NAND_PRELOAD
     bool "nand mini loader"
	 default n
	 depends on BOOT_FROM_NAND && !NAND_ECC_HW_REED_SOLOMON

config NAND_SPL_BBT
	 bool "nand spl bbt support"
	 default n
	 depends on BOOT_FROM_NAND && !NAND_ECC_HW_REED_SOLOMON

config FIRMWARE_IN_ROOTFS
     bool "firmware in rootfs"
     default n

config OVERLAY
	 bool "overlay fs support"
	 default n
	 depends on DRIVER_VR9 || DRIVER_AR9 || DRIVER_DANUBE

config LTQ_I2C
	bool "I2C access support"
	default n
	depends on DRIVER_GRX500
	select CMD_I2C 

if LANTIQ_UBOOT_ar9
   source board/ar9/Kconfig
endif

if LANTIQ_UBOOT_danube
   source board/danube/Kconfig
endif

if LANTIQ_UBOOT_amazon_se
   source board/amazon_se/Kconfig
endif

if LANTIQ_UBOOT_vr9
   source board/vr9/Kconfig
endif

if LANTIQ_UBOOT_hn1
   source board/hn1/Kconfig
endif

if LANTIQ_UBOOT_ar10 
   source board/ar10/Kconfig
endif

if LANTIQ_UBOOT_vbg400
   source board/vbg400/Kconfig
endif

if LANTIQ_UBOOT_grx500
   source board/grx500/Kconfig
endif

endmenu


menu "Network Settings"
config IP_ADDRESS
    string "IP address"
    default "192.168.1.1"

config SERVER_IP_ADDRESS
    string "Server IP address"
    default "192.168.1.2"

config ETHERNET_ADDRESS
    string "Ethernet Address"
    default "00:E0:92:00:01:40"

config ETHERNET_DEVICE
    string "Ethernet Interface"
    default "eth0"
endmenu

menu "Environment Settings"

config ENV_SIZE
	hex "env size"
	default "0x4000"
	#depends on BOOT_FROM_NAND

config ENV_REDUND
    bool "redundant env"
	default no

config ENV_OVERWRITE
	bool "enable env overwrite"
	default y

config BUILD_ENV_BLOCK
    bool "build env block image"
	default n

config TFTP_LOAD_ADDRESS
    string "tftp load address"
    default "0x80800000"
    
config MEM
    string "mem"
    default "31M"

config PHYM
    string "phym"
    default "32M"

config WLANM
    string "wlanm"
	default "30M"
	depends on DRIVER_AR10

config BOOTDELAY
    int "BOOTDELAY(seconds)"
	default 5

config ROOT_PATH
    string "rootpath"
    default "/mnt/full_fs"


config CONSOLE
    string "console"
	default "ttyS0" if ( LANTIQ_UBOOT_vbg400 )
	default "ttyS1" if ( !LANTIQ_UBOOT_vbg400 )

config TFTPPATH
    string "tftppath"
	default ""

config ROOTFSMTD
    string "rootfsmtd" 
	default "/dev/mtdblock1" if ( FIRMWARE_IN_ROOTFS && !BOOT_FROM_NAND )
	default "/dev/mtdblock2" if ( !FIRMWARE_IN_ROOTFS && !BOOT_FROM_NAND && !LANTIQ_UBOOT_hn1)
	default "/dev/mtdblock3" if ( !FIRMWARE_IN_ROOTFS && !BOOT_FROM_NAND && LANTIQ_UBOOT_hn1)
	default "/dev/mtdblock2" if ( FIRMWARE_IN_ROOTFS && BOOT_FROM_NAND )
	default "/dev/mtdblock3" if ( !FIRMWARE_IN_ROOTFS && BOOT_FROM_NAND )

config NFSARGS
    string "nfsargs"
    default "setenv bootargs root=/dev/nfs rw nfsroot=$(serverip):$(rootpath)"

config RAMARGS
    string "ramargs"
    default "setenv bootargs root=/dev/ram rw"

config FLASHARGS
    string "flashargs"
    default "setenv bootargs root=$(rootfsmtd) ro rootfstype=squashfs init=/etc/preinit"

config ADDIP
    string "addip"
    default "setenv bootargs $(bootargs) ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname):$(netdev):on"

config ADDMISC
    string "addmisc"
	default "setenv bootargs $(bootargs) console=$(console),$(baudrate) ethaddr=$(ethaddr) phym=$(phym) mem=$(mem) panic=1 mtdparts=$(mtdparts)" 

config BOOTFILE
    string "bootfile"
    default "uImage"

config BOOT_CORE
	string "bootcore"
	default "bootcore"

config U_BOOT
    string "u-boot"
    default "u-boot.ltq"

config ROOTFS
    string "rootfs"
    default "rootfs.img"

config FIRMWARE
    string "firmware"
    default "firmware.img"

config FULLIMAGE
    string "fullimage"
	default "fullimage.img"

config TOTALIMAGE
    string "totalimage"
	default "totalimage.img"

config MTDIDS
    string "mtdids"
	default "nand0=ifx_nand"
	depends on CMD_MTDPARTS 


config USE_DEFAULT_MTDPARTS
    bool "use default MTDPARTS"
	default y


if LANTIQ_UBOOT_danube
config MTDPARTS
    string
	default "ifx_nor0:64k(uboot),256k(firmware),7744k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M  && !FIRMWARE_IN_ROOTFS && !OVERLAY )
  default "ifx_nor0:64k(uboot),256k(firmware),7424k(rootfs),320k(overlay),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M  && !FIRMWARE_IN_ROOTFS && OVERLAY )
  default "ifx_nor0:64k(uboot),8000k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M && FIRMWARE_IN_ROOTFS && !OVERLAY)
  default "ifx_nor0:64k(uboot),7680k(rootfs),320k(overlay),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M && FIRMWARE_IN_ROOTFS && OVERLAY )
	default "ifx_nor0:64k(uboot),-(rootfs)" if ( BOOT_FROM_UART )
	default "" if ( NOR_FLASH_AUTO )
	depends on USE_DEFAULT_MTDPARTS
endif

if LANTIQ_UBOOT_amazon_se
config MTDPARTS
    string
    default "ifx_nor0:64k(uboot),3904k(rootfs),32k(sysconfig),4k(ubootconfig),4k(fwdiag),-(res)" if ( BOOT_FROM_NOR && NOR_FLASH_4M && FIRMWARE_IN_ROOTFS )  
    default "ifx_nor0:64k(uboot),192k(firmware),3796k(rootfs),32k(sysconfig),4k(ubootconfig),4k(fwdiag),-(res)" if ( BOOT_FROM_NOR && NOR_FLASH_4M && !FIRMWARE_IN_ROOTFS )
	default "ifx_nor0:64k(uboot),256k(firmware),7744k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M  && !FIRMWARE_IN_ROOTFS )
	default "ifx_nor0:64k(uboot),8000k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M && FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:64k(uboot),3904k(rootfs),32k(sysconfig),4k(ubootconfig),4k(fwdiag),-(res)" if ( BOOT_FROM_SPI && SPI_FLASH_4M && FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:64k(uboot),192k(firmware),3796k(rootfs),32k(sysconfig),4k(ubootconfig),4k(fwdiag),-(res)" if ( BOOT_FROM_SPI && SPI_FLASH_4M && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:64kk(uboot),192k(firmware),7744k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_SPI && SPI_FLASH_8M && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:64k(uboot),-(rootfs)" if ( BOOT_FROM_SPI && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:64k(uboot),-(rootfs)" if ( BOOT_FROM_NAND && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:64k(uboot),192k(firmware),-(rootfs)" if ( BOOT_FROM_NAND && !FIRMWARE_IN_ROOTFS )
	default "ifx_nor0:64k(uboot),-(rootfs)" if ( BOOT_FROM_UART )
	default "" if ( NOR_FLASH_AUTO )
	depends on USE_DEFAULT_MTDPARTS
endif

if LANTIQ_UBOOT_vbg400
config MTDPARTS
    string
	default "ifx_sflash:64k(uboot),3904k(rootfs),64k(sysconfig),8k(ubootconfig),8k(wlanconfig),-(res)" if ( BOOT_FROM_SPI && SPI_FLASH_4M && FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:64k(uboot),8000k(rootfs),64k(sysconfig),8k(ubootconfig),8k(wlanconfig),-(res)" if ( BOOT_FROM_SPI && SPI_FLASH_8M && FIRMWARE_IN_ROOTFS )
	depends on USE_DEFAULT_MTDPARTS
endif

if LANTIQ_UBOOT_ar9
config MTDPARTS
    string
	default "ifx_nor0:64k(uboot),192k(firmware),-(rootfs)" if ( BOOT_FROM_NOR && NOR_FLASH_4M && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:64k(uboot),3904k(rootfs),32k(sysconfig),4k(ubootconfig),-(res)" if ( BOOT_FROM_SPI && SPI_FLASH_4M && !FIRMWARE_IN_ROOTFS )
	default "ifx_nor0:64k(uboot),256k(firmware),7744k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M  && !FIRMWARE_IN_ROOTFS && !OVERLAY )
  default "ifx_nor0:64k(uboot),256k(firmware),7424k(rootfs),320k(overlay),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M  && !FIRMWARE_IN_ROOTFS && OVERLAY )
  default "ifx_nor0:64k(uboot),8000k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M && FIRMWARE_IN_ROOTFS && !OVERLAY )
  default "ifx_nor0:64k(uboot),7680k(rootfs),320k(overlay),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && NOR_FLASH_8M && FIRMWARE_IN_ROOTFS && OVERLAY )
  default "ifx_sflash:128k(uboot),192k(firmware),-(rootfs)" if ( BOOT_FROM_SPI && SPI_FLASH_1M && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:128k(uboot),192k(firmware),7744k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_SPI && SPI_FLASH_8M && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:128k(uboot),-(rootfs)" if ( BOOT_FROM_SPI && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:128k(uboot),2688k(kernel),28800k(rootfs),64k(sysconfig),16k(ubootconfig),16k(fwdiag),-(res)" if ( BOOT_FROM_NAND && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:128k(uboot),192k(firmware),-(rootfs)" if ( BOOT_FROM_NAND && !FIRMWARE_IN_ROOTFS )
	default "ifx_nor0:64k(uboot),-(rootfs)" if ( BOOT_FROM_UART )
	default "" if ( NOR_FLASH_AUTO )
	depends on USE_DEFAULT_MTDPARTS
endif



if LANTIQ_UBOOT_vr9
config MTDPARTS
    string 
	default "ifx_nor0:128k(uboot),7936k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && FIRMWARE_IN_ROOTFS && !OVERLAY )
	default "ifx_nor0:128k(uboot),7616k(rootfs),320k(overlay),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && FIRMWARE_IN_ROOTFS && OVERLAY )
	default "ifx_nor0:128k(uboot),512k(firmware),7424k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && !FIRMWARE_IN_ROOTFS && !OVERLAY )
	default "ifx_nor0:128k(uboot),512k(firmware),7104k(rootfs),320k(overlay),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_NOR && !FIRMWARE_IN_ROOTFS && OVERLAY )
	default "ifx_sflash:128k(uboot),512k(firmware),-(rootfs)" if ( SPI_FLASH_4M && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:128k(uboot),512k(firmware),7424k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( SPI_FLASH_8M && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:128k(uboot),7936k(rootfs),64k(sysconfig),64k(ubootconfig)" if ( BOOT_FROM_SPI && FIRMWARE_IN_ROOTFS )
  default "ifx_nand:256k(uboot),2560k(kernel),111872k(rootfs),256k(sysconfig),256k(ubootconfig),256k(fwdiag),-(res)" if ( BOOT_FROM_NAND && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:256k(uboot),512k(firmware),2m(kernel),111872k(rootfs),256k(sysconfig),256k(ubootconfig),256k(fwdiag),-(res)" if ( BOOT_FROM_NAND && !FIRMWARE_IN_ROOTFS )
	default "ifx_nor0:128k(uboot),-(rootfs)" if ( BOOT_FROM_UART )
	depends on USE_DEFAULT_MTDPARTS
endif


if LANTIQ_UBOOT_hn1
config MTDPARTS
    string 
	default "ifx_sflash:64k(uboot),64k(gphyfirmware),512k(firmware),-(rootfs)" if ( BOOT_FROM_SPI && !FIRMWARE_IN_ROOTFS )
	default "ifx_sflash:64k(uboot),64k(gphyfirmware),-(rootfs)" if ( BOOT_FROM_SPI && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:192k(uboot),64k(gphyfirmware),2560k(kernel),111872k(rootfs),256k(sysconfig),4k(ubootconfig),256k(fwdiag),-(res)" if ( BOOT_FROM_NAND && NAND_FLASH_128M && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:192k(uboot),64k(gphyfirmware),512k(firmware),2m(kernel),111872k(rootfs),256k(sysconfig),4k(ubootconfig),256k(fwdiag),-(res)" if ( BOOT_FROM_NAND && NAND_FLASH_128M && !FIRMWARE_IN_ROOTFS )	
	default "ifx_nand:192k(uboot),64k(gphyfirmware),2560k(kernel),505088k(rootfs),256k(sysconfig),4k(ubootconfig),256k(fwdiag),-(res)" if ( BOOT_FROM_NAND && NAND_FLASH_512M && FIRMWARE_IN_ROOTFS )
	default "ifx_nand:192k(uboot),64k(gphyfirmware),512k(firmware),2048k(kernel),505088k(rootfs),256k(sysconfig),4k(ubootconfig),256k(fwdiag),-(res)" if ( BOOT_FROM_NAND && NAND_FLASH_512M && !FIRMWARE_IN_ROOTFS )
	depends on USE_DEFAULT_MTDPARTS
endif


if LANTIQ_UBOOT_ar10 
config MTDPARTS
    string 
    default "ifx_nand:64k(uboot),-(rootfs)"
	depends on USE_DEFAULT_MTDPARTS
endif

if LANTIQ_UBOOT_grx500
config MTDPARTS
    string
    default "ifx_nand:64k(uboot),-(rootfs)"
    depends on USE_DEFAULT_MTDPARTS
endif


config MTDPARTS
    string "MTDPARTS"
	default "ifx_nor0:64k(uboot),-(rootfs)"
	depends on !USE_DEFAULT_MTDPARTS

if LANTIQ_UBOOT_vbg400
config UPDATE_TFTP_NFS
	string "update_tftp_nfs"
	default "setenv bootcmd run tftp_nfs;saveenv"

config TFTP_NFS
	string "tftp_nfs"
	default "tftpboot $(loadaddr) uimage.unc;run nfsargs addip addmisc;bootm $(loadaddr)"

config UPDATE_TFTP_FLASH
	string "update_tftp_flash"
	default "run update_rootfs;setenv bootcmd run tftp_flash;saveenv"

config TFTP_FLASH
	string "tftp_flash"
	default "tftpboot $(loadaddr) uimage.unc;run flashargs addip addmisc;bootm $(loadaddr)"
	
config UPDATE_FLASH_FLASH
	string "update_flash_flash"
	default "run update_fullimage;setenv bootcmd run flash_flash;saveenv"

config UPDATE_FLASH_NFS
	string "update_flash_nfs"
	default "set bootfile uImage.unc;run update_kernel;setenv bootcmd run flash_nfs;saveenv"

config FLASH_NFS
	string "flash_nfs"
	default "run nfsargs addip addmisc;bootm $(loadaddr)"
endif

config NET_RAM
    string "net_ram"
    default "tftp $(loadaddr) $(tftppath)$(bootfile); run ramargs addip addmisc; bootm"

config NET_FLASH
    string "net_flash"
    default "tftp $(loadaddr) $(tftppath)$(bootfile); run flashargs addip addmisc; bootm"

config FLASH_NFS
    string "flash_nfs"
    default "run nfsargs addip addmisc;bootm $(kernel_addr)"

config NET_NFS
    string "net_nfs"
    default "tftp $(loadaddr) $(tftppath)$(bootfile);run nfsargs addip addmisc;bootm"

config FLASH_FLASH
    string "flash_flash"
    default "run flashargs addip addmisc; bootm $(kernel_addr)"

config UPDATE_NANDBOOT
    string "update_nandboot"
	default "tftp $(loadaddr) $(tftppath)u-boot-nand.bin; nand erase clean 0 0x08000000; nand write $(loadaddr) 0 $(filesize)"
#	depends on BOOT_FROM_NAND

config UPDATE_UBOOT
    string "update_uboot"
    default "tftpboot $(loadaddr) $(tftppath)$(u-boot);erase b0000000 b001ffff;cp.b $(loadaddr) b0000000 $(filesize);reset"

config UPDATE_BOOTLOADER
    string "update_bootloader"
	default "update_uboot" if LANTIQ_UBOOT_ar9 
	default "update_uboot;update gphyfirmware" if LANTIQ_UBOOT_vr9 
	default "update_uboot;update gphyfirmware" if LANTIQ_UBOOT_ar10 
	default "update_uboot"

config UPDATE_KERNEL
    string "update_kernel"
    default "tftpboot $(loadaddr) $(tftppath)$(bootfile);upgrade $(loadaddr) $(filesize)"

config UPDATE_ROOTFS
    string "update_rootfs"
    default "tftpboot $(loadaddr) $(tftppath)$(rootfs); upgrade $(loadaddr) $(filesize)"

config UPDATE_FIRMWARE
    string "update_firmware"
    default "tftpboot $(loadaddr) $(tftppath)$(firmware);upgrade $(loadaddr) $(filesize)"
    depends on !FIRMWARE_IN_ROOTFS

config UPDATE_GPHYFIRMWARE
    string "update_gphyfirmware"
	default "tftpboot $(loadaddr) $(tftppath)gphy_firmware.img;nand write.partial $(loadaddr) 24000 10000" if ( !VR9_GPHY_FW_EMBEDDED )
	default "tftpboot $(loadaddr) $(tftppath)gphy_firmware.img; sf probe 3; sf erase 0x10000 0x10000; sf write $(loadaddr) 0x10000 $(filesize)" if ( LANTIQ_UBOOT_hn1 && !HN1_GPHY_FW_EMBEDDED && BOOT_FROM_SPI)
	default "tftpboot $(loadaddr) $(tftppath)gphy_firmware.img; nand write.partial $(loadaddr) 0x24000 10000" if ( LANTIQ_UBOOT_hn1 && !HN1_GPHY_FW_EMBEDDED && BOOT_FROM_NAND)
	depends on !VR9_GPHY_FW_EMBEDDED && !HN1_GPHY_FW_EMBEDDED && !AR10_GPHY_FW_EMBEDDED

config UPDATE_FULLIMAGE
    string "update_fullimage"
	default "tftpboot $(loadaddr) $(tftppath)$(fullimage);upgrade $(loadaddr) $(filesize)"

config UPDATE_TOTALIMAGE
    string "update_totalimage"
	default "tftpboot $(loadaddr) $(tftppath)$(totalimage);upgrade $(loadaddr) $(filesize)"

if LANTIQ_UBOOT_grx500
config UPDATE_BOOTCORE
    string "update_bootcore"
    default "tftpboot $(loadaddr) $(tftppath)$(bootcore);nand erase 200000 40000;nand write $(loadaddr) 200000 40000"

config RUN_BOOTCORE
	string "run_bootcore"
	default "nand read 0xA0400000 $(tftppath)$(bootcore);secboot load_os 0x8E000000 0xA0400000 0x200000"

endif

config UBI_INIT
  string "ubi_init"
	default "ubi part data;setenv kernelA_vol_id 0;setenv rootfsA_vol_id 1;setenv firmwareA_vol_id 2;setenv kernelB_vol_id 3;setenv rootfsB_vol_id 4;setenv firmwareB_vol_id 5;i setenv bootcoreA_vol_id 6; bootcoreB_vol_id 7; setenv setbank check_image$(update_chk);run $(setbank)"
	depends on CMD_UBI 

config DUAL_IMAGE
  bool "dual image support"
  default n
  #depends on BOOT_FROM_NAND
 
config UPDATE_CHK
  string "update_chk"
  default "0"
  depends on DUAL_IMAGE
 
config SWITCH_BANKA
  string "switchbankA"
  default "setenv active_bank A;setenv kernel_vol kernelA_vol;setenv rootfs_vol rootfsA_vol;setenv firmware_vol firmwareA_vol;setenv rootfsmtd /dev/mtdblock5"  
  depends on DUAL_IMAGE

config SWITCH_BANKB
  string "switchbankB"
  default "setenv active_bank B;setenv kernel_vol kernelB_vol;setenv rootfs_vol rootfsB_vol;setenv firmware_vol firmwareB_vol;setenv rootfsmtd /dev/mtdblock7"
  depends on DUAL_IMAGE

config CHECK_IMAGE0
  string "check_image0"
  default "run switchbankA"
  depends on DUAL_IMAGE
  
config CHECK_IMAGE1
  string "check_image1"
  default "run switchbankB;setenv update_chk 0;save"
  depends on DUAL_IMAGE
  
config CHECK_IMAGE2
  string "check_image2"
  default "run switchbankB"
  depends on DUAL_IMAGE
  
config CHECK_IMAGE3
  string "check_image3"
  default "run switchbankA;setenv update_chk 2;save"
  depends on DUAL_IMAGE
      
config BOOTCOMMAND
    string "bootcmd"
	default "run flash_flash"

config RESET_UBOOT_CONFIG
	string "reset_uboot_config"
	default "prot off $(f_ubootconfig_addr) $(f_ubootconfig_end); erase $(f_ubootconfig_addr) $(f_ubootconfig_end)" if ( BOOT_FROM_NOR )
	default "sf probe 3; sf write 80400000 $(f_ubootconfig_addr) $(f_ubootconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_ar9 ) 
	default "sf probe 0; sf write 80400000 $(f_ubootconfig_addr) $(f_ubootconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_amazon_se )
	default "sf probe 3; sf write 80400000 $(f_ubootconfig_addr) $(f_ubootconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_vr9 )
	default "sf probe 3; sf write 80400000 $(f_ubootconfig_addr) $(f_ubootconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_hn1 )
	default "sf probe 0; sf write A0400000 $(f_ubootconfig_addr) $(f_ubootconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_vbg400 )
        default "sf probe 0; sf write 80400000 $(f_ubootconfig_addr) $(f_ubootconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_ar10 )
	default "sf probe 1; sf write 80400000 $(f_ubootconfig_addr) $(f_ubootconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_grx500 )
        default "nand erase $(f_ubootconfig_addr) $(f_ubootconfig_range)" if ( BOOT_FROM_NAND && !ENV_REDUND)
	default "nand erase $(f_ubootconfig_addr) $(f_ubootconfig_range);nand erase $(f_red_ubootconfig_addr) $(f_ubootconfig_range);" if ( BOOT_FROM_NAND && ENV_REDUND)
        

config RESET_DDR_CONFIG
    string "reset_ddr_config"
	default "prot off $(f_ddrconfig_addr) $(f_ddrconfig_end); erase $(f_ddrconfig_addr) $(f_ddrconfig_end)" if ( BOOT_FROM_NOR )
    default "sf probe 3; sf write 80400000 $(f_ddrconfig_addr) $(f_ddrconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_ar9 )
    default "sf probe 0; sf write 80400000 $(f_ddrconfig_addr) $(f_ddrconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_amazon_se	)
    default "sf probe 3; sf write 80400000 $(f_ddrconfig_addr) $(f_ddrconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_vr9 )
    default "sf probe 3; sf read 0x80800000 0x0 0x10000; mw 0x8080ffe8 0xffffffff 0x6; sf erase 0x0 0x10000; sf write 0x80800000 0x0 0x10000"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_hn1 )
    default "sf probe 0; sf write 80400000 $(f_ddrconfig_addr) $(f_ddrconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_ar10 )
    default "sf probe 1; sf write 80400000 $(f_ddrconfig_addr) $(f_ddrconfig_size)"  if ( BOOT_FROM_SPI && LANTIQ_UBOOT_grx500 )
	default "nand write.partial 80400000 $(f_ddrconfig_addr) $(f_ddrconfig_size)" if ( BOOT_FROM_NAND )
					
config RESET_SYSCONFIG
    string 
	default "erase $(f_sysconfig_addr) 10000" if BOOT_FROM_NOR 
	default "sf probe 0;sf erase $(f_sysconfig_addr) 10000" if BOOT_FROM_SPI && ( LANTIQ_UBOOT_ar10 || LANTIQ_UBOOT_vbg400 || LANTIQ_UBOOT_amazon_se )
	default "sf probe 3;sf erase $(f_sysconfig_addr) 10000" if BOOT_FROM_SPI && ( LANTIQ_UBOOT_vr9 || LANTIQ_UBOOT_ar9 || LANTIQ_UBOOT_hn1 )
        default "sf probe 1;sf erase $(f_sysconfig_addr) 10000" if BOOT_FROM_SPI && LANTIQ_UBOOT_grx500
	default "run ubi_init;ubi remove sysconfig;ubi remove sysconfigA;ubi remove sysconfigB" if ( BOOT_FROM_NAND && CMD_UBI )

endmenu


source lib/Kconfig
source common/Kconfig
