xref: /rk3399_rockchip-uboot/include/configs/ethernut5.h (revision 6dbeb893c4a7668d0098318d6668ccf59bfbfdea)
114c32614STim Schendekehl /*
214c32614STim Schendekehl  * (C) Copyright 2011
314c32614STim Schendekehl  * egnite GmbH <info@egnite.de>
414c32614STim Schendekehl  *
514c32614STim Schendekehl  * Configuation settings for Ethernut 5 with AT91SAM9XE.
614c32614STim Schendekehl  *
71a459660SWolfgang Denk  * SPDX-License-Identifier:	GPL-2.0+
814c32614STim Schendekehl  */
914c32614STim Schendekehl 
1014c32614STim Schendekehl #ifndef __CONFIG_H
1114c32614STim Schendekehl #define __CONFIG_H
1214c32614STim Schendekehl 
1314c32614STim Schendekehl #include <asm/hardware.h>
1414c32614STim Schendekehl 
15*6dbeb893STim Schendekehl #define CONFIG_SYS_GENERIC_BOARD
16*6dbeb893STim Schendekehl 
1714c32614STim Schendekehl /* The first stage boot loader expects u-boot running at this address. */
1814c32614STim Schendekehl #define CONFIG_SYS_TEXT_BASE	0x27000000	/* 16MB available */
1914c32614STim Schendekehl 
2014c32614STim Schendekehl /* The first stage boot loader takes care of low level initialization. */
2114c32614STim Schendekehl #define CONFIG_SKIP_LOWLEVEL_INIT
2214c32614STim Schendekehl 
2314c32614STim Schendekehl /* Set our official architecture number. */
2414c32614STim Schendekehl #define MACH_TYPE_ETHERNUT5 1971
2514c32614STim Schendekehl #define CONFIG_MACH_TYPE MACH_TYPE_ETHERNUT5
2614c32614STim Schendekehl 
2714c32614STim Schendekehl /* CPU information */
2814c32614STim Schendekehl #define CONFIG_DISPLAY_CPUINFO		/* Display at console. */
2914c32614STim Schendekehl #define CONFIG_ARCH_CPU_INIT
3014c32614STim Schendekehl 
3114c32614STim Schendekehl /* ARM asynchronous clock */
3214c32614STim Schendekehl #define CONFIG_SYS_AT91_SLOW_CLOCK	32768	/* slow clock xtal */
3314c32614STim Schendekehl #define CONFIG_SYS_AT91_MAIN_CLOCK	18432000 /* 18.432 MHz crystal */
3414c32614STim Schendekehl 
3514c32614STim Schendekehl /* 32kB internal SRAM */
3614c32614STim Schendekehl #define CONFIG_SRAM_BASE	0x00300000 /*AT91SAM9XE_SRAM_BASE */
3714c32614STim Schendekehl #define CONFIG_SRAM_SIZE	(32 << 10)
383d6ba91eSRob Herring #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SRAM_BASE + CONFIG_SRAM_SIZE - \
393d6ba91eSRob Herring 				GENERATED_GBL_DATA_SIZE)
4014c32614STim Schendekehl 
4114c32614STim Schendekehl /* 128MB SDRAM in 1 bank */
4214c32614STim Schendekehl #define CONFIG_NR_DRAM_BANKS		1
4314c32614STim Schendekehl #define CONFIG_SYS_SDRAM_BASE		0x20000000
4414c32614STim Schendekehl #define CONFIG_SYS_SDRAM_SIZE		(128 << 20)
4514c32614STim Schendekehl #define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_SDRAM_BASE
4614c32614STim Schendekehl #define CONFIG_LOADADDR			CONFIG_SYS_LOAD_ADDR
4714c32614STim Schendekehl #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
4814c32614STim Schendekehl #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
4914c32614STim Schendekehl #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_TEXT_BASE \
5014c32614STim Schendekehl 					- CONFIG_SYS_MALLOC_LEN)
5114c32614STim Schendekehl 
5214c32614STim Schendekehl /* 512kB on-chip NOR flash */
5314c32614STim Schendekehl # define CONFIG_SYS_MAX_FLASH_BANKS	1
5414c32614STim Schendekehl # define CONFIG_SYS_FLASH_BASE		0x00200000 /* AT91SAM9XE_FLASH_BASE */
5514c32614STim Schendekehl # define CONFIG_AT91_EFLASH
5614c32614STim Schendekehl # define CONFIG_SYS_MAX_FLASH_SECT	32
5714c32614STim Schendekehl # define CONFIG_SYS_FLASH_PROTECTION	/* First stage loader in sector 0 */
5814c32614STim Schendekehl # define CONFIG_EFLASH_PROTSECTORS	1
5914c32614STim Schendekehl 
6014c32614STim Schendekehl /* 512kB DataFlash at NPCS0 */
6114c32614STim Schendekehl #define CONFIG_SYS_MAX_DATAFLASH_BANKS	1
6214c32614STim Schendekehl #define CONFIG_HAS_DATAFLASH
6314c32614STim Schendekehl #define CONFIG_SPI_FLASH
6414c32614STim Schendekehl #define CONFIG_SPI_FLASH_ATMEL
6514c32614STim Schendekehl #define CONFIG_ATMEL_DATAFLASH_SPI
6614c32614STim Schendekehl #define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0	0xC0000000
6714c32614STim Schendekehl #define DATAFLASH_TCSS			(0x1a << 16)
6814c32614STim Schendekehl #define DATAFLASH_TCHS			(0x1 << 24)
6914c32614STim Schendekehl 
7014c32614STim Schendekehl #define CONFIG_ENV_IS_IN_SPI_FLASH
7114c32614STim Schendekehl #define CONFIG_ENV_OFFSET		0x3DE000
7214c32614STim Schendekehl #define CONFIG_ENV_SECT_SIZE		(132 << 10)
7314c32614STim Schendekehl #define CONFIG_ENV_SIZE			CONFIG_ENV_SECT_SIZE
7414c32614STim Schendekehl #define CONFIG_ENV_ADDR			(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
7514c32614STim Schendekehl 					+ CONFIG_ENV_OFFSET)
7614c32614STim Schendekehl #define CONFIG_SYS_MONITOR_BASE		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
7714c32614STim Schendekehl 					+ 0x042000)
7814c32614STim Schendekehl 
7914c32614STim Schendekehl /* SPI */
8014c32614STim Schendekehl #define CONFIG_ATMEL_SPI
8114c32614STim Schendekehl #define CONFIG_SYS_SPI_WRITE_TOUT	(5 * CONFIG_SYS_HZ)
8214c32614STim Schendekehl #define AT91_SPI_CLK			15000000
8314c32614STim Schendekehl 
8414c32614STim Schendekehl /* Serial port */
8514c32614STim Schendekehl #define CONFIG_ATMEL_USART
8614c32614STim Schendekehl #define CONFIG_USART3			/* USART 3 is DBGU */
8714c32614STim Schendekehl #define CONFIG_BAUDRATE			115200
8814c32614STim Schendekehl #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
8914c32614STim Schendekehl #define	CONFIG_USART_ID			ATMEL_ID_SYS
9014c32614STim Schendekehl 
9114c32614STim Schendekehl /* Misc. hardware drivers */
9214c32614STim Schendekehl #define CONFIG_AT91_GPIO
9314c32614STim Schendekehl 
9414c32614STim Schendekehl /* Command line configuration */
9514c32614STim Schendekehl #include <config_cmd_default.h>
9614c32614STim Schendekehl #undef CONFIG_CMD_BDI
9714c32614STim Schendekehl #undef CONFIG_CMD_FPGA
9814c32614STim Schendekehl #undef CONFIG_CMD_LOADS
9914c32614STim Schendekehl 
10014c32614STim Schendekehl #define CONFIG_CMD_JFFS2
10114c32614STim Schendekehl #define CONFIG_CMD_MII
10214c32614STim Schendekehl #define CONFIG_CMD_MTDPARTS
10314c32614STim Schendekehl #define CONFIG_CMD_NAND
10414c32614STim Schendekehl #define CONFIG_CMD_SPI
10514c32614STim Schendekehl 
10614c32614STim Schendekehl #ifdef MINIMAL_LOADER
10714c32614STim Schendekehl #undef CONFIG_CMD_CONSOLE
10814c32614STim Schendekehl #undef CONFIG_CMD_EDITENV
10914c32614STim Schendekehl #undef CONFIG_CMD_IMI
11014c32614STim Schendekehl #undef CONFIG_CMD_ITEST
11114c32614STim Schendekehl #undef CONFIG_CMD_IMLS
11214c32614STim Schendekehl #undef CONFIG_CMD_LOADB
11314c32614STim Schendekehl #undef CONFIG_CMD_LOADS
11414c32614STim Schendekehl #undef CONFIG_CMD_NFS
11514c32614STim Schendekehl #undef CONFIG_CMD_SETGETDCR
11614c32614STim Schendekehl #undef CONFIG_CMD_XIMG
11714c32614STim Schendekehl #else
11814c32614STim Schendekehl #define CONFIG_CMD_ASKENV
11914c32614STim Schendekehl #define CONFIG_CMD_BSP
12014c32614STim Schendekehl #define CONFIG_CMD_CACHE
12114c32614STim Schendekehl #define CONFIG_CMD_CDP
12214c32614STim Schendekehl #define CONFIG_CMD_DATE
12314c32614STim Schendekehl #define CONFIG_CMD_DHCP
12414c32614STim Schendekehl #define CONFIG_CMD_DNS
12514c32614STim Schendekehl #define CONFIG_CMD_EXT2
12614c32614STim Schendekehl #define CONFIG_CMD_FAT
12714c32614STim Schendekehl #define CONFIG_CMD_I2C
12814c32614STim Schendekehl #define CONFIG_CMD_MMC
12914c32614STim Schendekehl #define CONFIG_CMD_PING
13014c32614STim Schendekehl #define CONFIG_CMD_RARP
13114c32614STim Schendekehl #define CONFIG_CMD_REISER
13214c32614STim Schendekehl #define CONFIG_CMD_SAVES
13314c32614STim Schendekehl #define CONFIG_CMD_SETEXPR
13414c32614STim Schendekehl #define CONFIG_CMD_SF
13514c32614STim Schendekehl #define CONFIG_CMD_SNTP
13614c32614STim Schendekehl #define CONFIG_CMD_UBI
13714c32614STim Schendekehl #define CONFIG_CMD_UBIFS
13814c32614STim Schendekehl #define CONFIG_CMD_UNZIP
13914c32614STim Schendekehl #define CONFIG_CMD_USB
14014c32614STim Schendekehl #endif
14114c32614STim Schendekehl 
14214c32614STim Schendekehl /* NAND flash */
14314c32614STim Schendekehl #ifdef CONFIG_CMD_NAND
14414c32614STim Schendekehl #define CONFIG_SYS_MAX_NAND_DEVICE	1
14514c32614STim Schendekehl #define CONFIG_SYS_NAND_BASE		0x40000000
14614c32614STim Schendekehl #define CONFIG_SYS_NAND_DBW_8
14714c32614STim Schendekehl #define CONFIG_NAND_ATMEL
14814c32614STim Schendekehl /* our ALE is AD21 */
14914c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
15014c32614STim Schendekehl /* our CLE is AD22 */
15114c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
152ac45bb16SAndreas Bießmann #define CONFIG_SYS_NAND_ENABLE_PIN	GPIO_PIN_PC(14)
15314c32614STim Schendekehl #endif
15414c32614STim Schendekehl 
15514c32614STim Schendekehl /* JFFS2 */
15614c32614STim Schendekehl #ifdef CONFIG_CMD_JFFS2
15714c32614STim Schendekehl #define CONFIG_MTD_NAND_ECC_JFFS2
15814c32614STim Schendekehl #define CONFIG_JFFS2_CMDLINE
15914c32614STim Schendekehl #define CONFIG_JFFS2_NAND
16014c32614STim Schendekehl #endif
16114c32614STim Schendekehl 
16214c32614STim Schendekehl /* Ethernet */
16314c32614STim Schendekehl #define CONFIG_NET_RETRY_COUNT		20
16414c32614STim Schendekehl #define CONFIG_MACB
16514c32614STim Schendekehl #define CONFIG_RMII
16614c32614STim Schendekehl #define CONFIG_PHY_ID			0
16714c32614STim Schendekehl #define CONFIG_MACB_SEARCH_PHY
16814c32614STim Schendekehl 
16914c32614STim Schendekehl /* MMC */
17014c32614STim Schendekehl #ifdef CONFIG_CMD_MMC
17114c32614STim Schendekehl #define CONFIG_MMC
17214c32614STim Schendekehl #define CONFIG_GENERIC_MMC
17314c32614STim Schendekehl #define CONFIG_GENERIC_ATMEL_MCI
17414c32614STim Schendekehl #define CONFIG_SYS_MMC_CD_PIN		AT91_PIO_PORTC, 8
17514c32614STim Schendekehl #endif
17614c32614STim Schendekehl 
17714c32614STim Schendekehl /* USB */
17814c32614STim Schendekehl #ifdef CONFIG_CMD_USB
17914c32614STim Schendekehl #define CONFIG_USB_ATMEL
180dcd2f1a0SBo Shen #define CONFIG_USB_ATMEL_CLK_SEL_PLLB
18114c32614STim Schendekehl #define CONFIG_USB_OHCI_NEW
18214c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_CPU_INIT
18314c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_REGS_BASE	0x00500000
18414c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_SLOT_NAME	"host"
18514c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
18614c32614STim Schendekehl #define CONFIG_USB_STORAGE
18714c32614STim Schendekehl #endif
18814c32614STim Schendekehl 
18914c32614STim Schendekehl /* RTC */
19014c32614STim Schendekehl #if defined(CONFIG_CMD_DATE) || defined(CONFIG_CMD_SNTP)
19114c32614STim Schendekehl #define CONFIG_RTC_PCF8563
19214c32614STim Schendekehl #define CONFIG_SYS_I2C_RTC_ADDR		0x51
19314c32614STim Schendekehl #endif
19414c32614STim Schendekehl 
19514c32614STim Schendekehl /* I2C */
19614c32614STim Schendekehl #define CONFIG_SYS_MAX_I2C_BUS	1
19714c32614STim Schendekehl 
198ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C
199ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT			/* I2C bit-banged */
200ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SPEED	100000
201ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SLAVE	0
202ea818dbbSHeiko Schocher 
20314c32614STim Schendekehl #define I2C_SOFT_DECLARATIONS
20414c32614STim Schendekehl 
20514c32614STim Schendekehl #define GPIO_I2C_SCL		AT91_PIO_PORTA, 24
20614c32614STim Schendekehl #define GPIO_I2C_SDA		AT91_PIO_PORTA, 23
20714c32614STim Schendekehl 
20814c32614STim Schendekehl #define I2C_INIT { \
20914c32614STim Schendekehl 	at91_set_pio_periph(AT91_PIO_PORTA, 23, 0); \
21014c32614STim Schendekehl 	at91_set_pio_multi_drive(AT91_PIO_PORTA, 23, 1); \
21114c32614STim Schendekehl 	at91_set_pio_periph(AT91_PIO_PORTA, 24, 0); \
21214c32614STim Schendekehl 	at91_set_pio_output(AT91_PIO_PORTA, 24, 0); \
21314c32614STim Schendekehl 	at91_set_pio_multi_drive(AT91_PIO_PORTA, 24, 1); \
21414c32614STim Schendekehl }
21514c32614STim Schendekehl 
21614c32614STim Schendekehl #define I2C_ACTIVE	at91_set_pio_output(AT91_PIO_PORTA, 23, 0)
21714c32614STim Schendekehl #define I2C_TRISTATE	at91_set_pio_input(AT91_PIO_PORTA, 23, 0)
21814c32614STim Schendekehl #define I2C_SCL(bit)	at91_set_pio_value(AT91_PIO_PORTA, 24, bit)
21914c32614STim Schendekehl #define I2C_SDA(bit)	at91_set_pio_value(AT91_PIO_PORTA, 23, bit)
22014c32614STim Schendekehl #define I2C_DELAY	udelay(100)
22114c32614STim Schendekehl #define I2C_READ	at91_get_pio_value(AT91_PIO_PORTA, 23)
22214c32614STim Schendekehl 
22314c32614STim Schendekehl /* DHCP/BOOTP options */
22414c32614STim Schendekehl #ifdef CONFIG_CMD_DHCP
22514c32614STim Schendekehl #define CONFIG_BOOTP_BOOTFILESIZE
22614c32614STim Schendekehl #define CONFIG_BOOTP_BOOTPATH
22714c32614STim Schendekehl #define CONFIG_BOOTP_GATEWAY
22814c32614STim Schendekehl #define CONFIG_BOOTP_HOSTNAME
22914c32614STim Schendekehl #define CONFIG_SYS_AUTOLOAD	"n"
23014c32614STim Schendekehl #endif
23114c32614STim Schendekehl 
23214c32614STim Schendekehl /* File systems */
23314c32614STim Schendekehl #define CONFIG_MTD_DEVICE
23414c32614STim Schendekehl #define CONFIG_MTD_PARTITIONS
23514c32614STim Schendekehl #if defined(CONFIG_CMD_MTDPARTS) || defined(CONFIG_CMD_NAND)
23614c32614STim Schendekehl #define MTDIDS_DEFAULT		"nand0=atmel_nand"
23714c32614STim Schendekehl #define MTDPARTS_DEFAULT	"mtdparts=atmel_nand:-(root)"
23814c32614STim Schendekehl #endif
23914c32614STim Schendekehl #if defined(CONFIG_CMD_REISER) || defined(CONFIG_CMD_EXT2) || \
24014c32614STim Schendekehl 	defined(CONFIG_CMD_USB) || defined(CONFIG_MMC)
24114c32614STim Schendekehl #define CONFIG_DOS_PARTITION
24214c32614STim Schendekehl #endif
24314c32614STim Schendekehl #define CONFIG_LZO
24414c32614STim Schendekehl #define CONFIG_RBTREE
24514c32614STim Schendekehl 
24614c32614STim Schendekehl /* Boot command */
24714c32614STim Schendekehl #define CONFIG_BOOTDELAY	3
24814c32614STim Schendekehl #define CONFIG_CMDLINE_TAG
24914c32614STim Schendekehl #define CONFIG_SETUP_MEMORY_TAGS
25014c32614STim Schendekehl #define CONFIG_INITRD_TAG
25114c32614STim Schendekehl #define CONFIG_BOOTCOMMAND	"cp.b 0xC00C6000 ${loadaddr} 0x294000; bootm"
25214c32614STim Schendekehl #if defined(CONFIG_CMD_NAND)
25314c32614STim Schendekehl #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
25414c32614STim Schendekehl 				"root=/dev/mtdblock0 " \
25514c32614STim Schendekehl 				MTDPARTS_DEFAULT \
25614c32614STim Schendekehl 				" rw rootfstype=jffs2"
25714c32614STim Schendekehl #endif
25814c32614STim Schendekehl 
25914c32614STim Schendekehl /* Misc. u-boot settings */
26014c32614STim Schendekehl #define CONFIG_SYS_PROMPT		"U-Boot> "
26114c32614STim Schendekehl #define CONFIG_SYS_HUSH_PARSER
26214c32614STim Schendekehl #define CONFIG_SYS_CBSIZE		256
26314c32614STim Schendekehl #define CONFIG_SYS_MAXARGS		16
26414c32614STim Schendekehl #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + 16 \
26514c32614STim Schendekehl 					+ sizeof(CONFIG_SYS_PROMPT))
26614c32614STim Schendekehl #define CONFIG_SYS_LONGHELP
26714c32614STim Schendekehl #define CONFIG_CMDLINE_EDITING
26814c32614STim Schendekehl 
26914c32614STim Schendekehl #endif
270