xref: /rk3399_rockchip-uboot/include/configs/ethernut5.h (revision ef0f2f57524ec85fb9058a23298f2c4995e0d950)
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 
156dbeb893STim Schendekehl #define CONFIG_SYS_GENERIC_BOARD
166dbeb893STim 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_ATMEL
6414c32614STim Schendekehl #define CONFIG_ATMEL_DATAFLASH_SPI
6514c32614STim Schendekehl #define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0	0xC0000000
6614c32614STim Schendekehl #define DATAFLASH_TCSS			(0x1a << 16)
6714c32614STim Schendekehl #define DATAFLASH_TCHS			(0x1 << 24)
6814c32614STim Schendekehl 
6914c32614STim Schendekehl #define CONFIG_ENV_IS_IN_SPI_FLASH
7014c32614STim Schendekehl #define CONFIG_ENV_OFFSET		0x3DE000
7114c32614STim Schendekehl #define CONFIG_ENV_SECT_SIZE		(132 << 10)
7214c32614STim Schendekehl #define CONFIG_ENV_SIZE			CONFIG_ENV_SECT_SIZE
7314c32614STim Schendekehl #define CONFIG_ENV_ADDR			(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
7414c32614STim Schendekehl 					+ CONFIG_ENV_OFFSET)
7514c32614STim Schendekehl #define CONFIG_SYS_MONITOR_BASE		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
7614c32614STim Schendekehl 					+ 0x042000)
7714c32614STim Schendekehl 
7814c32614STim Schendekehl /* SPI */
7914c32614STim Schendekehl #define CONFIG_ATMEL_SPI
8014c32614STim Schendekehl #define AT91_SPI_CLK			15000000
8114c32614STim Schendekehl 
8214c32614STim Schendekehl /* Serial port */
8314c32614STim Schendekehl #define CONFIG_ATMEL_USART
8414c32614STim Schendekehl #define CONFIG_USART3			/* USART 3 is DBGU */
8514c32614STim Schendekehl #define CONFIG_BAUDRATE			115200
8614c32614STim Schendekehl #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
8714c32614STim Schendekehl #define	CONFIG_USART_ID			ATMEL_ID_SYS
8814c32614STim Schendekehl 
8914c32614STim Schendekehl /* Misc. hardware drivers */
9014c32614STim Schendekehl #define CONFIG_AT91_GPIO
9114c32614STim Schendekehl 
9214c32614STim Schendekehl /* Command line configuration */
9314c32614STim Schendekehl #define CONFIG_CMD_JFFS2
9414c32614STim Schendekehl #define CONFIG_CMD_MII
9514c32614STim Schendekehl #define CONFIG_CMD_MTDPARTS
9614c32614STim Schendekehl #define CONFIG_CMD_NAND
9714c32614STim Schendekehl #define CONFIG_CMD_SPI
9814c32614STim Schendekehl 
99*ef0f2f57SJoe Hershberger #ifndef MINIMAL_LOADER
10014c32614STim Schendekehl #define CONFIG_CMD_ASKENV
10114c32614STim Schendekehl #define CONFIG_CMD_BSP
10214c32614STim Schendekehl #define CONFIG_CMD_CACHE
10314c32614STim Schendekehl #define CONFIG_CMD_CDP
10414c32614STim Schendekehl #define CONFIG_CMD_DATE
10514c32614STim Schendekehl #define CONFIG_CMD_DHCP
10614c32614STim Schendekehl #define CONFIG_CMD_DNS
10714c32614STim Schendekehl #define CONFIG_CMD_EXT2
10814c32614STim Schendekehl #define CONFIG_CMD_FAT
10914c32614STim Schendekehl #define CONFIG_CMD_I2C
11014c32614STim Schendekehl #define CONFIG_CMD_MMC
11114c32614STim Schendekehl #define CONFIG_CMD_PING
11214c32614STim Schendekehl #define CONFIG_CMD_RARP
11314c32614STim Schendekehl #define CONFIG_CMD_REISER
11414c32614STim Schendekehl #define CONFIG_CMD_SAVES
11514c32614STim Schendekehl #define CONFIG_CMD_SF
11614c32614STim Schendekehl #define CONFIG_CMD_SNTP
11714c32614STim Schendekehl #define CONFIG_CMD_UBI
11814c32614STim Schendekehl #define CONFIG_CMD_UBIFS
11914c32614STim Schendekehl #define CONFIG_CMD_UNZIP
12014c32614STim Schendekehl #define CONFIG_CMD_USB
12114c32614STim Schendekehl #endif
12214c32614STim Schendekehl 
12314c32614STim Schendekehl /* NAND flash */
12414c32614STim Schendekehl #ifdef CONFIG_CMD_NAND
12514c32614STim Schendekehl #define CONFIG_SYS_MAX_NAND_DEVICE	1
12614c32614STim Schendekehl #define CONFIG_SYS_NAND_BASE		0x40000000
12714c32614STim Schendekehl #define CONFIG_SYS_NAND_DBW_8
12814c32614STim Schendekehl #define CONFIG_NAND_ATMEL
12914c32614STim Schendekehl /* our ALE is AD21 */
13014c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
13114c32614STim Schendekehl /* our CLE is AD22 */
13214c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
133ac45bb16SAndreas Bießmann #define CONFIG_SYS_NAND_ENABLE_PIN	GPIO_PIN_PC(14)
13414c32614STim Schendekehl #endif
13514c32614STim Schendekehl 
13614c32614STim Schendekehl /* JFFS2 */
13714c32614STim Schendekehl #ifdef CONFIG_CMD_JFFS2
13814c32614STim Schendekehl #define CONFIG_JFFS2_CMDLINE
13914c32614STim Schendekehl #define CONFIG_JFFS2_NAND
14014c32614STim Schendekehl #endif
14114c32614STim Schendekehl 
14214c32614STim Schendekehl /* Ethernet */
14314c32614STim Schendekehl #define CONFIG_NET_RETRY_COUNT		20
14414c32614STim Schendekehl #define CONFIG_MACB
14514c32614STim Schendekehl #define CONFIG_RMII
14614c32614STim Schendekehl #define CONFIG_PHY_ID			0
14714c32614STim Schendekehl #define CONFIG_MACB_SEARCH_PHY
14814c32614STim Schendekehl 
14914c32614STim Schendekehl /* MMC */
15014c32614STim Schendekehl #ifdef CONFIG_CMD_MMC
15114c32614STim Schendekehl #define CONFIG_MMC
15214c32614STim Schendekehl #define CONFIG_GENERIC_MMC
15314c32614STim Schendekehl #define CONFIG_GENERIC_ATMEL_MCI
15414c32614STim Schendekehl #define CONFIG_SYS_MMC_CD_PIN		AT91_PIO_PORTC, 8
15514c32614STim Schendekehl #endif
15614c32614STim Schendekehl 
15714c32614STim Schendekehl /* USB */
15814c32614STim Schendekehl #ifdef CONFIG_CMD_USB
15914c32614STim Schendekehl #define CONFIG_USB_ATMEL
160dcd2f1a0SBo Shen #define CONFIG_USB_ATMEL_CLK_SEL_PLLB
16114c32614STim Schendekehl #define CONFIG_USB_OHCI_NEW
16214c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_CPU_INIT
16314c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_REGS_BASE	0x00500000
16414c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_SLOT_NAME	"host"
16514c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
16614c32614STim Schendekehl #define CONFIG_USB_STORAGE
16714c32614STim Schendekehl #endif
16814c32614STim Schendekehl 
16914c32614STim Schendekehl /* RTC */
17014c32614STim Schendekehl #if defined(CONFIG_CMD_DATE) || defined(CONFIG_CMD_SNTP)
17114c32614STim Schendekehl #define CONFIG_RTC_PCF8563
17214c32614STim Schendekehl #define CONFIG_SYS_I2C_RTC_ADDR		0x51
17314c32614STim Schendekehl #endif
17414c32614STim Schendekehl 
17514c32614STim Schendekehl /* I2C */
17614c32614STim Schendekehl #define CONFIG_SYS_MAX_I2C_BUS	1
17714c32614STim Schendekehl 
178ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C
179ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT			/* I2C bit-banged */
180ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SPEED	100000
181ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SLAVE	0
182ea818dbbSHeiko Schocher 
18314c32614STim Schendekehl #define I2C_SOFT_DECLARATIONS
18414c32614STim Schendekehl 
18514c32614STim Schendekehl #define GPIO_I2C_SCL		AT91_PIO_PORTA, 24
18614c32614STim Schendekehl #define GPIO_I2C_SDA		AT91_PIO_PORTA, 23
18714c32614STim Schendekehl 
18814c32614STim Schendekehl #define I2C_INIT { \
18914c32614STim Schendekehl 	at91_set_pio_periph(AT91_PIO_PORTA, 23, 0); \
19014c32614STim Schendekehl 	at91_set_pio_multi_drive(AT91_PIO_PORTA, 23, 1); \
19114c32614STim Schendekehl 	at91_set_pio_periph(AT91_PIO_PORTA, 24, 0); \
19214c32614STim Schendekehl 	at91_set_pio_output(AT91_PIO_PORTA, 24, 0); \
19314c32614STim Schendekehl 	at91_set_pio_multi_drive(AT91_PIO_PORTA, 24, 1); \
19414c32614STim Schendekehl }
19514c32614STim Schendekehl 
19614c32614STim Schendekehl #define I2C_ACTIVE	at91_set_pio_output(AT91_PIO_PORTA, 23, 0)
19714c32614STim Schendekehl #define I2C_TRISTATE	at91_set_pio_input(AT91_PIO_PORTA, 23, 0)
19814c32614STim Schendekehl #define I2C_SCL(bit)	at91_set_pio_value(AT91_PIO_PORTA, 24, bit)
19914c32614STim Schendekehl #define I2C_SDA(bit)	at91_set_pio_value(AT91_PIO_PORTA, 23, bit)
20014c32614STim Schendekehl #define I2C_DELAY	udelay(100)
20114c32614STim Schendekehl #define I2C_READ	at91_get_pio_value(AT91_PIO_PORTA, 23)
20214c32614STim Schendekehl 
20314c32614STim Schendekehl /* DHCP/BOOTP options */
20414c32614STim Schendekehl #ifdef CONFIG_CMD_DHCP
20514c32614STim Schendekehl #define CONFIG_BOOTP_BOOTFILESIZE
20614c32614STim Schendekehl #define CONFIG_BOOTP_BOOTPATH
20714c32614STim Schendekehl #define CONFIG_BOOTP_GATEWAY
20814c32614STim Schendekehl #define CONFIG_BOOTP_HOSTNAME
20914c32614STim Schendekehl #define CONFIG_SYS_AUTOLOAD	"n"
21014c32614STim Schendekehl #endif
21114c32614STim Schendekehl 
21214c32614STim Schendekehl /* File systems */
21314c32614STim Schendekehl #define CONFIG_MTD_DEVICE
21414c32614STim Schendekehl #define CONFIG_MTD_PARTITIONS
21514c32614STim Schendekehl #if defined(CONFIG_CMD_MTDPARTS) || defined(CONFIG_CMD_NAND)
21614c32614STim Schendekehl #define MTDIDS_DEFAULT		"nand0=atmel_nand"
21714c32614STim Schendekehl #define MTDPARTS_DEFAULT	"mtdparts=atmel_nand:-(root)"
21814c32614STim Schendekehl #endif
21914c32614STim Schendekehl #if defined(CONFIG_CMD_REISER) || defined(CONFIG_CMD_EXT2) || \
22014c32614STim Schendekehl 	defined(CONFIG_CMD_USB) || defined(CONFIG_MMC)
22114c32614STim Schendekehl #define CONFIG_DOS_PARTITION
22214c32614STim Schendekehl #endif
22314c32614STim Schendekehl #define CONFIG_LZO
22414c32614STim Schendekehl #define CONFIG_RBTREE
22514c32614STim Schendekehl 
22614c32614STim Schendekehl /* Boot command */
22714c32614STim Schendekehl #define CONFIG_BOOTDELAY	3
22814c32614STim Schendekehl #define CONFIG_CMDLINE_TAG
22914c32614STim Schendekehl #define CONFIG_SETUP_MEMORY_TAGS
23014c32614STim Schendekehl #define CONFIG_INITRD_TAG
23114c32614STim Schendekehl #define CONFIG_BOOTCOMMAND	"cp.b 0xC00C6000 ${loadaddr} 0x294000; bootm"
23214c32614STim Schendekehl #if defined(CONFIG_CMD_NAND)
23314c32614STim Schendekehl #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
23414c32614STim Schendekehl 				"root=/dev/mtdblock0 " \
23514c32614STim Schendekehl 				MTDPARTS_DEFAULT \
23614c32614STim Schendekehl 				" rw rootfstype=jffs2"
23714c32614STim Schendekehl #endif
23814c32614STim Schendekehl 
23914c32614STim Schendekehl /* Misc. u-boot settings */
24014c32614STim Schendekehl #define CONFIG_SYS_PROMPT		"U-Boot> "
24114c32614STim Schendekehl #define CONFIG_SYS_HUSH_PARSER
24214c32614STim Schendekehl #define CONFIG_SYS_CBSIZE		256
24314c32614STim Schendekehl #define CONFIG_SYS_MAXARGS		16
24414c32614STim Schendekehl #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + 16 \
24514c32614STim Schendekehl 					+ sizeof(CONFIG_SYS_PROMPT))
24614c32614STim Schendekehl #define CONFIG_SYS_LONGHELP
24714c32614STim Schendekehl #define CONFIG_CMDLINE_EDITING
24814c32614STim Schendekehl 
24914c32614STim Schendekehl #endif
250