menu "Loader and Board Information"
	
choice 
	bool "UART Selection"
	default RTL865X_UART_AUTO
config RTL865X_UART_AUTO
	bool "AUTO_DETECT"
config RTL865X_UART_UART0
	bool "FORCE_UART0"
config RTL865X_UART_UART1
	bool "FORCE_UART1"
endchoice

config RTL865X_NOR_CFI
	bool "Support NOR Flash CFI Auto-Detection"
	default n

choice 
	bool "Supported Kernel Decompression Method"
	default RTL865X_GZIP_DECOMPRESSION
config RTL865X_GZIP_DECOMPRESSION
	bool "GZIP"
config RTL865X_LZMA_DECOMPRESSION
	bool "LZMA"
config RTL865X_ALL_DECOMPRESSION
	bool "ALL"
config RTL865X_NONE_DECOMPRESSION
	bool "NONE"
endchoice

choice 
	bool "Load Address of Linux Kernel"
	default RTL865X_LOADER_00_00_10
config RTL865X_LOADER_00_00_01
	bool "AT_0x81000000"
#	select RTL865X_RUNTIME_ADDRESS
config RTL865X_LOADER_00_00_10
	bool "AT_0x80080000"
#	select RTL865X_RUNTIME_ADDRESS
config RTL865X_LOADER_00_00_11
	bool "AT_0x80000400"
#	select RTL865X_RUNTIME_ADDRESS
endchoice


config RTL865X_RUNTIME_ADDRESS
	hex
	default 0x81000000 if RTL865X_LOADER_00_00_01
	default 0x80080000 if RTL865X_LOADER_00_00_10
	default 0x80000400 if RTL865X_LOADER_00_00_11

choice 
	bool "Flash Size"
	default RTL865X_FLASH_4MB
config RTL865X_FLASH_1MB
	bool "1MB"
config RTL865X_FLASH_2MB
	bool "2MB"
config RTL865X_FLASH_4MB
	bool "4MB"
config RTL865X_FLASH_8MB
	bool "8MB"
	select _SUPPORT_LARGE_FLASH_
config RTL865X_FLASH_16MB
	bool "16MB"
	select _SUPPORT_LARGE_FLASH_
endchoice
	
if CONFIG_RTL865X_FLASH_16MB || CONFIG_RTL865X_FLASH_8MB
config _SUPPORT_LARGE_FLASH_
	bool
	default y
endif

config RTL865X_CUSTOM_FLASH_MAP
	bool
	default y


comment "Select Flash Type For RTL865xB"
	depends on RTL865XB

comment "Select Flash Type For RTL865xC"
	depends on RTL865XC

choice 
	bool "Flash Type"
	default RTL865X_FLASH_BOTTOM if RTL865XB
	default RTL865X_FLASH_TOP if RTL865XC
config  RTL865X_FLASH_TOP
	bool "TOP"
config RTL865X_FLASH_BOTTOM
	bool "Bottom"
endchoice

#config CHANGED
#	bool	
#	default y if RTL865X_FLASH_1MB = y  && RTL865X_CUSTOM_PREVIOUS_MB != "1MB" 
#	default y if RTL865X_FLASH_2MB = y  && RTL865X_CUSTOM_PREVIOUS_MB != "2MB" 
#	default y if RTL865X_FLASH_4MB = y  && RTL865X_CUSTOM_PREVIOUS_MB != "4MB" 
#	default y if RTL865X_FLASH_8MB = y  && RTL865X_CUSTOM_PREVIOUS_MB != "8MB" 
#	default y if RTL865X_FLASH_16MB = y && RTL865X_CUSTOM_PREVIOUS_MB != "16MB" 
	

#config RTL865X_CUSTOM_PREVIOUS_MB
#	string 
#	default "1MB" if RTL865X_FLASH_1MB
#	default "2MB" if RTL865X_FLASH_2MB
#	default "4MB" if RTL865X_FLASH_4MB
#	default "8MB" if RTL865X_FLASH_8MB
#	default "16MB" if RTL865X_FLASH_16MB

if RTL865X_FLASH_BOTTOM
config RTL865X_CUSTOM_LOADER_SEG1_ADDRESS
	hex "Flash Loader Segment 1 Address"
	default 0x00000000 
config RTL865X_CUSTOM_LOADER_SEG1_SIZE
	hex "Flash Loader Segment 1 Size"
	default 0x00004000 

config RTL865X_CUSTOM_BDINFO_ADDRESS  
	hex "Flash BDINFO Address"
	default 0x00004000 
config RTL865X_CUSTOM_BDINFO_SIZE 
	hex "Flash BDINFO Size"
	default 0x00002000

config RTL865X_CUSTOM_CCFG_ADDRESS
	hex "Flash CCFG Address"
	default 0x00006000
config RTL865X_CUSTOM_CCFG_SIZE 
	hex "Flash CCFG Size"
	default 0x0000A000

config RTL865X_CUSTOM_LOADER_SEG2_ADDRESS    
	hex "Flash Loader Segment 2 Address"
	default 0x00010000
config RTL865X_CUSTOM_LOADER_SEG2_SIZE
        hex "Flash Loader Segment 2 Size"
        default 0x00010000

config RTL865X_CUSTOM_RUNTIME_ADDRESS
	hex "Flash RUNTIME Address"
	default 0x00020000
config RTL865X_CUSTOM_RUNTIME_SIZE 
	hex "Flash RUNTIME Size"
	default 0x000D0000 if RTL865X_FLASH_1MB
	default 0x001D0000 if RTL865X_FLASH_2MB
	default 0x003D0000 if RTL865X_FLASH_4MB
	default 0x007D0000 if RTL865X_FLASH_8MB
	default 0x00FD0000 if RTL865X_FLASH_16MB

config RTL865X_CUSTOM_LOADER_SEG3_ADDRESS
	hex "Flash Loader Segment 3 Address"
        default 0x000F0000 if RTL865X_FLASH_1MB
        default 0x001F0000 if RTL865X_FLASH_2MB
        default 0x003F0000 if RTL865X_FLASH_4MB
        default 0x007F0000 if RTL865X_FLASH_8MB
        default 0x00FF0000 if RTL865X_FLASH_16MB
config RTL865X_CUSTOM_LOADER_SEG3_SIZE 
	hex "Flash Loader Segment 3 Size"
        default 0x00010000 

endif # End of if RTL865X_FLASH_BOTTOM


if RTL865X_FLASH_TOP
config RTL865X_CUSTOM_LOADER_SEG1_ADDRESS
	hex "Flash Loader Segment 1 Address"
	default 0x00000000 
config RTL865X_CUSTOM_LOADER_SEG1_SIZE
	hex "Flash Loader Segment 1 Size"
	default 0x00004000 

config RTL865X_CUSTOM_LOADER_SEG2_ADDRESS    
	hex "Flash Loader Segment 2 Address"
	default 0x00010000
config RTL865X_CUSTOM_LOADER_SEG2_SIZE
        hex "Flash Loader Segment 2 Size"
        default 0x00010000

config RTL865X_CUSTOM_RUNTIME_ADDRESS
        hex "Flash RUNTIME Address"
        default 0x00020000
config RTL865X_CUSTOM_RUNTIME_SIZE
        hex "Flash RUNTIME Size"
        default 0x000D0000 if RTL865X_FLASH_1MB
        default 0x001D0000 if RTL865X_FLASH_2MB
        default 0x003D0000 if RTL865X_FLASH_4MB
        default 0x007D0000 if RTL865X_FLASH_8MB
        default 0x00FD0000 if RTL865X_FLASH_16MB

config RTL865X_CUSTOM_CCFG_ADDRESS
        hex "Flash CCFG Address"
        default 0x000F0000 if RTL865X_FLASH_1MB
        default 0x001F0000 if RTL865X_FLASH_2MB
        default 0x003F0000 if RTL865X_FLASH_4MB
        default 0x007F0000 if RTL865X_FLASH_8MB
        default 0x00FF0000 if RTL865X_FLASH_16MB
config RTL865X_CUSTOM_CCFG_SIZE 
        hex "Flash CCFG Size"
        default 0x0000A000

config RTL865X_CUSTOM_BDINFO_ADDRESS  
	hex "Flash BDINFO Address"
        default 0x000FA0000 if RTL865X_FLASH_1MB
        default 0x001FA0000 if RTL865X_FLASH_2MB
        default 0x003FA000 if RTL865X_FLASH_4MB
        default 0x007FA000 if RTL865X_FLASH_8MB
        default 0x00FFA000 if RTL865X_FLASH_16MB	 
config RTL865X_CUSTOM_BDINFO_SIZE 
	hex "Flash BDINFO Size"
        default 0x00002000

config RTL865X_CUSTOM_LOADER_SEG3_ADDRESS
	hex "Flash Loader Segment 3 Address"
        default 0x000FC000 if RTL865X_FLASH_1MB
        default 0x001FC000 if RTL865X_FLASH_2MB
        default 0x003FC000 if RTL865X_FLASH_4MB
        default 0x007FC000 if RTL865X_FLASH_8MB
        default 0x00FFC000 if RTL865X_FLASH_16MB
config RTL865X_CUSTOM_LOADER_SEG3_SIZE 
	hex "Flash Loader Segment 3 Size"
        default 0x00004000 

endif # End of if RTL865X_FLASH_TOP

choice 
	bool "Bank1 Access Type"
	default BANK1_ROM_TYPE 

config BANK1_ROM_TYPE 
	bool "ROM_TYPE"
config BANK1_IO_TYPE
	bool "IO_TYPE"

endchoice

config MAX_FLASH_CHIPS
	hex 
	default 0x2 if BANK1_ROM_TYPE
	default 0x1 if BANK1_IO_TYPE

choice 
	bool "SDRAM Per Chip Size"
	default PER_SDRAM_32MB
config PER_SDRAM_2MB
	bool "2MB"
config PER_SDRAM_8MB
	bool "8MB"
config PER_SDRAM_16MB
	bool "16MB"
config PER_SDRAM_32MB
	bool "32MB"
config PER_SDRAM_64MB
        bool "64MB"
	select SDRAM_NUM_1
endchoice


choice 
	bool "SDRAM Number"
	default SDRAM_NUM_1
config SDRAM_NUM_1
	bool "one_chip"
config SDRAM_NUM_2
	bool "two_chip"
endchoice	

choice 
	bool "SDRAM Bus Width"
	default SDRAM_BUS_WIDTH_16BIT

config SDRAM_BUS_WIDTH_16BIT
	bool "16BIT"
#	default y
config SDRAM_BUS_WIDTH_32BIT
	bool "32BIT"
#        default y 
	depends on   PER_SDRAM_8MB != y || SDRAM_NUM_1 != y
endchoice
 
################################################################################
# Making CONFIG_RTL865X_MCR_FLASH with FLASH size and bus width
################################################################################	
config RTL865X_MCR_FLASH
	hex 
	default 0x80000000 if( RTL865X_FLASH_1MB = y && RTL865XB )
	default 0xC0000000 if( RTL865X_FLASH_2MB = y && RTL865XB )
	default 0xC0001000 if( RTL865X_FLASH_4MB = y && RTL865XB )
	default 0xC0002000 if( RTL865X_FLASH_8MB = y && RTL865XB )
	default 0xC0003000 if( RTL865X_FLASH_16MB = y && RTL865XB )
        default 0x40000000 if( RTL865X_FLASH_1MB = y && RTL865XC )
        default 0x60000000 if( RTL865X_FLASH_2MB = y && RTL865XC )
        default 0x80000000 if( RTL865X_FLASH_4MB = y && RTL865XC )
        default 0xA0000000 if( RTL865X_FLASH_8MB = y && RTL865XC )
        default 0xC0000000 if( RTL865X_FLASH_16MB = y && RTL865XC )
	
################################################################################
# Making CONFIG_RTL865X_MCR_SDRAM with SDRAM size and bus width
################################################################################
config RTL865X_MCR_SDRAM
	hex
	default 0x10000000
	
config RTL865X_SDRAM_TOTAL_32MB
	bool 
	default y

config RTL865X_DRAM_MAP_LOADER_ADDR 
	hex 
	default 0x81700000

config RTL865X_DRAM_MAP_DLOAD_BUF_ADDR
	hex 
	default 0x81800000

config RTL865X_LOADER_SUPPORT_TFTP
	bool "Support TFTP Download"
	default y

config RTL865X_LOADER_SUPPORT_TFTP_SERVER
        bool "Support TFTP SERVER Download"
	default y
config RTL865X_LOADER_SUPPORT_HTTP_SERVER
	bool "Support HTTP SERVER Download"
	default y
config RTL865X_LOADER_SUPPORT_GDB_STUB
	bool "Support DEBUG WITH GDB STUB"
	default y 
endmenu # End of Loader and Board Information

comment "-------------------------------"
	depends on RTL865X

#=================================== End of LDRconfig =========================#
