xref: /rk3399_rockchip-uboot/include/configs/ethernut5.h (revision ea818dbbcd59300b56014ac2d67798a54994eb9b)
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  *
714c32614STim Schendekehl  * See file CREDITS for list of people who contributed to this
814c32614STim Schendekehl  * project.
914c32614STim Schendekehl  *
1014c32614STim Schendekehl  * This program is free software; you can redistribute it and/or
1114c32614STim Schendekehl  * modify it under the terms of the GNU General Public License as
1214c32614STim Schendekehl  * published by the Free Software Foundation; either version 2 of
1314c32614STim Schendekehl  * the License, or (at your option) any later version.
1414c32614STim Schendekehl  *
1514c32614STim Schendekehl  * This program is distributed in the hope that it will be useful,
1614c32614STim Schendekehl  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1714c32614STim Schendekehl  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1814c32614STim Schendekehl  * GNU General Public License for more details.
1914c32614STim Schendekehl  *
2014c32614STim Schendekehl  * You should have received a copy of the GNU General Public License
2114c32614STim Schendekehl  * along with this program; if not, write to the Free Software
2214c32614STim Schendekehl  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
2314c32614STim Schendekehl  * MA 02111-1307 USA
2414c32614STim Schendekehl  */
2514c32614STim Schendekehl 
2614c32614STim Schendekehl #ifndef __CONFIG_H
2714c32614STim Schendekehl #define __CONFIG_H
2814c32614STim Schendekehl 
2914c32614STim Schendekehl #include <asm/hardware.h>
3014c32614STim Schendekehl 
3114c32614STim Schendekehl /* The first stage boot loader expects u-boot running at this address. */
3214c32614STim Schendekehl #define CONFIG_SYS_TEXT_BASE	0x27000000	/* 16MB available */
3314c32614STim Schendekehl 
3414c32614STim Schendekehl /* The first stage boot loader takes care of low level initialization. */
3514c32614STim Schendekehl #define CONFIG_SKIP_LOWLEVEL_INIT
3614c32614STim Schendekehl 
3714c32614STim Schendekehl /* Set our official architecture number. */
3814c32614STim Schendekehl #define MACH_TYPE_ETHERNUT5 1971
3914c32614STim Schendekehl #define CONFIG_MACH_TYPE MACH_TYPE_ETHERNUT5
4014c32614STim Schendekehl 
4114c32614STim Schendekehl /* CPU information */
4214c32614STim Schendekehl #define CONFIG_ARM926EJS
4314c32614STim Schendekehl #define CONFIG_AT91FAMILY
4414c32614STim Schendekehl #define CONFIG_DISPLAY_CPUINFO		/* Display at console. */
4514c32614STim Schendekehl #define CONFIG_ARCH_CPU_INIT
4614c32614STim Schendekehl 
4714c32614STim Schendekehl /* ARM asynchronous clock */
4814c32614STim Schendekehl #define CONFIG_SYS_AT91_SLOW_CLOCK	32768	/* slow clock xtal */
4914c32614STim Schendekehl #define CONFIG_SYS_AT91_MAIN_CLOCK	18432000 /* 18.432 MHz crystal */
5014c32614STim Schendekehl #define CONFIG_SYS_HZ			1000
5114c32614STim Schendekehl 
5214c32614STim Schendekehl /* 32kB internal SRAM */
5314c32614STim Schendekehl #define CONFIG_SRAM_BASE	0x00300000 /*AT91SAM9XE_SRAM_BASE */
5414c32614STim Schendekehl #define CONFIG_SRAM_SIZE	(32 << 10)
553d6ba91eSRob Herring #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SRAM_BASE + CONFIG_SRAM_SIZE - \
563d6ba91eSRob Herring 				GENERATED_GBL_DATA_SIZE)
5714c32614STim Schendekehl 
5814c32614STim Schendekehl /* 128MB SDRAM in 1 bank */
5914c32614STim Schendekehl #define CONFIG_NR_DRAM_BANKS		1
6014c32614STim Schendekehl #define CONFIG_SYS_SDRAM_BASE		0x20000000
6114c32614STim Schendekehl #define CONFIG_SYS_SDRAM_SIZE		(128 << 20)
6214c32614STim Schendekehl #define CONFIG_SYS_LOAD_ADDR		CONFIG_SYS_SDRAM_BASE
6314c32614STim Schendekehl #define CONFIG_LOADADDR			CONFIG_SYS_LOAD_ADDR
6414c32614STim Schendekehl #define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
6514c32614STim Schendekehl #define CONFIG_SYS_MEMTEST_START	CONFIG_SYS_SDRAM_BASE
6614c32614STim Schendekehl #define CONFIG_SYS_MEMTEST_END		(CONFIG_SYS_TEXT_BASE \
6714c32614STim Schendekehl 					- CONFIG_SYS_MALLOC_LEN)
6814c32614STim Schendekehl 
6914c32614STim Schendekehl /* 512kB on-chip NOR flash */
7014c32614STim Schendekehl # define CONFIG_SYS_MAX_FLASH_BANKS	1
7114c32614STim Schendekehl # define CONFIG_SYS_FLASH_BASE		0x00200000 /* AT91SAM9XE_FLASH_BASE */
7214c32614STim Schendekehl # define CONFIG_AT91_EFLASH
7314c32614STim Schendekehl # define CONFIG_SYS_MAX_FLASH_SECT	32
7414c32614STim Schendekehl # define CONFIG_SYS_FLASH_PROTECTION	/* First stage loader in sector 0 */
7514c32614STim Schendekehl # define CONFIG_EFLASH_PROTSECTORS	1
7614c32614STim Schendekehl 
7714c32614STim Schendekehl /* 512kB DataFlash at NPCS0 */
7814c32614STim Schendekehl #define CONFIG_SYS_MAX_DATAFLASH_BANKS	1
7914c32614STim Schendekehl #define CONFIG_HAS_DATAFLASH
8014c32614STim Schendekehl #define CONFIG_SPI_FLASH
8114c32614STim Schendekehl #define CONFIG_SPI_FLASH_ATMEL
8214c32614STim Schendekehl #define CONFIG_ATMEL_DATAFLASH_SPI
8314c32614STim Schendekehl #define CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0	0xC0000000
8414c32614STim Schendekehl #define DATAFLASH_TCSS			(0x1a << 16)
8514c32614STim Schendekehl #define DATAFLASH_TCHS			(0x1 << 24)
8614c32614STim Schendekehl 
8714c32614STim Schendekehl #define CONFIG_ENV_IS_IN_SPI_FLASH
8814c32614STim Schendekehl #define CONFIG_ENV_OFFSET		0x3DE000
8914c32614STim Schendekehl #define CONFIG_ENV_SECT_SIZE		(132 << 10)
9014c32614STim Schendekehl #define CONFIG_ENV_SIZE			CONFIG_ENV_SECT_SIZE
9114c32614STim Schendekehl #define CONFIG_ENV_ADDR			(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
9214c32614STim Schendekehl 					+ CONFIG_ENV_OFFSET)
9314c32614STim Schendekehl #define CONFIG_SYS_MONITOR_BASE		(CONFIG_SYS_DATAFLASH_LOGIC_ADDR_CS0 \
9414c32614STim Schendekehl 					+ 0x042000)
9514c32614STim Schendekehl 
9614c32614STim Schendekehl /* SPI */
9714c32614STim Schendekehl #define CONFIG_ATMEL_SPI
9814c32614STim Schendekehl #define CONFIG_SYS_SPI_WRITE_TOUT	(5 * CONFIG_SYS_HZ)
9914c32614STim Schendekehl #define AT91_SPI_CLK			15000000
10014c32614STim Schendekehl 
10114c32614STim Schendekehl /* Serial port */
10214c32614STim Schendekehl #define CONFIG_ATMEL_USART
10314c32614STim Schendekehl #define CONFIG_USART3			/* USART 3 is DBGU */
10414c32614STim Schendekehl #define CONFIG_BAUDRATE			115200
10514c32614STim Schendekehl #define CONFIG_USART_BASE		ATMEL_BASE_DBGU
10614c32614STim Schendekehl #define	CONFIG_USART_ID			ATMEL_ID_SYS
10714c32614STim Schendekehl 
10814c32614STim Schendekehl /* Misc. hardware drivers */
10914c32614STim Schendekehl #define CONFIG_AT91_GPIO
11014c32614STim Schendekehl 
11114c32614STim Schendekehl /* Command line configuration */
11214c32614STim Schendekehl #include <config_cmd_default.h>
11314c32614STim Schendekehl #undef CONFIG_CMD_BDI
11414c32614STim Schendekehl #undef CONFIG_CMD_FPGA
11514c32614STim Schendekehl #undef CONFIG_CMD_LOADS
11614c32614STim Schendekehl 
11714c32614STim Schendekehl #define CONFIG_CMD_JFFS2
11814c32614STim Schendekehl #define CONFIG_CMD_MII
11914c32614STim Schendekehl #define CONFIG_CMD_MTDPARTS
12014c32614STim Schendekehl #define CONFIG_CMD_NAND
12114c32614STim Schendekehl #define CONFIG_CMD_SPI
12214c32614STim Schendekehl 
12314c32614STim Schendekehl #ifdef MINIMAL_LOADER
12414c32614STim Schendekehl #undef CONFIG_CMD_CONSOLE
12514c32614STim Schendekehl #undef CONFIG_CMD_EDITENV
12614c32614STim Schendekehl #undef CONFIG_CMD_IMI
12714c32614STim Schendekehl #undef CONFIG_CMD_ITEST
12814c32614STim Schendekehl #undef CONFIG_CMD_IMLS
12914c32614STim Schendekehl #undef CONFIG_CMD_LOADB
13014c32614STim Schendekehl #undef CONFIG_CMD_LOADS
13114c32614STim Schendekehl #undef CONFIG_CMD_NFS
13214c32614STim Schendekehl #undef CONFIG_CMD_SETGETDCR
13314c32614STim Schendekehl #undef CONFIG_CMD_XIMG
13414c32614STim Schendekehl #else
13514c32614STim Schendekehl #define CONFIG_CMD_ASKENV
13614c32614STim Schendekehl #define CONFIG_CMD_BSP
13714c32614STim Schendekehl #define CONFIG_CMD_CACHE
13814c32614STim Schendekehl #define CONFIG_CMD_CDP
13914c32614STim Schendekehl #define CONFIG_CMD_DATE
14014c32614STim Schendekehl #define CONFIG_CMD_DHCP
14114c32614STim Schendekehl #define CONFIG_CMD_DNS
14214c32614STim Schendekehl #define CONFIG_CMD_EXT2
14314c32614STim Schendekehl #define CONFIG_CMD_FAT
14414c32614STim Schendekehl #define CONFIG_CMD_I2C
14514c32614STim Schendekehl #define CONFIG_CMD_MMC
14614c32614STim Schendekehl #define CONFIG_CMD_PING
14714c32614STim Schendekehl #define CONFIG_CMD_RARP
14814c32614STim Schendekehl #define CONFIG_CMD_REISER
14914c32614STim Schendekehl #define CONFIG_CMD_SAVES
15014c32614STim Schendekehl #define CONFIG_CMD_SETEXPR
15114c32614STim Schendekehl #define CONFIG_CMD_SF
15214c32614STim Schendekehl #define CONFIG_CMD_SNTP
15314c32614STim Schendekehl #define CONFIG_CMD_UBI
15414c32614STim Schendekehl #define CONFIG_CMD_UBIFS
15514c32614STim Schendekehl #define CONFIG_CMD_UNZIP
15614c32614STim Schendekehl #define CONFIG_CMD_USB
15714c32614STim Schendekehl #endif
15814c32614STim Schendekehl 
15914c32614STim Schendekehl /* NAND flash */
16014c32614STim Schendekehl #ifdef CONFIG_CMD_NAND
16114c32614STim Schendekehl #define CONFIG_SYS_MAX_NAND_DEVICE	1
16214c32614STim Schendekehl #define CONFIG_SYS_NAND_BASE		0x40000000
16314c32614STim Schendekehl #define CONFIG_SYS_NAND_DBW_8
16414c32614STim Schendekehl #define CONFIG_NAND_ATMEL
16514c32614STim Schendekehl /* our ALE is AD21 */
16614c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_ALE	(1 << 21)
16714c32614STim Schendekehl /* our CLE is AD22 */
16814c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_CLE	(1 << 22)
16914c32614STim Schendekehl #define CONFIG_SYS_NAND_ENABLE_PIN	AT91_PIO_PORTC, 14
17014c32614STim Schendekehl #endif
17114c32614STim Schendekehl 
17214c32614STim Schendekehl /* JFFS2 */
17314c32614STim Schendekehl #ifdef CONFIG_CMD_JFFS2
17414c32614STim Schendekehl #define CONFIG_MTD_NAND_ECC_JFFS2
17514c32614STim Schendekehl #define CONFIG_JFFS2_CMDLINE
17614c32614STim Schendekehl #define CONFIG_JFFS2_NAND
17714c32614STim Schendekehl #endif
17814c32614STim Schendekehl 
17914c32614STim Schendekehl /* Ethernet */
18014c32614STim Schendekehl #define CONFIG_NET_RETRY_COUNT		20
18114c32614STim Schendekehl #define CONFIG_MACB
18214c32614STim Schendekehl #define CONFIG_RMII
18314c32614STim Schendekehl #define CONFIG_PHY_ID			0
18414c32614STim Schendekehl #define CONFIG_MACB_SEARCH_PHY
18514c32614STim Schendekehl 
18614c32614STim Schendekehl /* MMC */
18714c32614STim Schendekehl #ifdef CONFIG_CMD_MMC
18814c32614STim Schendekehl #define CONFIG_MMC
18914c32614STim Schendekehl #define CONFIG_GENERIC_MMC
19014c32614STim Schendekehl #define CONFIG_GENERIC_ATMEL_MCI
19114c32614STim Schendekehl #define CONFIG_SYS_MMC_CD_PIN		AT91_PIO_PORTC, 8
19214c32614STim Schendekehl #endif
19314c32614STim Schendekehl 
19414c32614STim Schendekehl /* USB */
19514c32614STim Schendekehl #ifdef CONFIG_CMD_USB
19614c32614STim Schendekehl #define CONFIG_USB_ATMEL
19714c32614STim Schendekehl #define CONFIG_USB_OHCI_NEW
19814c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_CPU_INIT
19914c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_REGS_BASE	0x00500000
20014c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_SLOT_NAME	"host"
20114c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
20214c32614STim Schendekehl #define CONFIG_USB_STORAGE
20314c32614STim Schendekehl #endif
20414c32614STim Schendekehl 
20514c32614STim Schendekehl /* RTC */
20614c32614STim Schendekehl #if defined(CONFIG_CMD_DATE) || defined(CONFIG_CMD_SNTP)
20714c32614STim Schendekehl #define CONFIG_RTC_PCF8563
20814c32614STim Schendekehl #define CONFIG_SYS_I2C_RTC_ADDR		0x51
20914c32614STim Schendekehl #endif
21014c32614STim Schendekehl 
21114c32614STim Schendekehl /* I2C */
21214c32614STim Schendekehl #define CONFIG_SYS_MAX_I2C_BUS	1
21314c32614STim Schendekehl 
214*ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C
215*ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT			/* I2C bit-banged */
216*ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SPEED	100000
217*ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SLAVE	0
218*ea818dbbSHeiko Schocher 
21914c32614STim Schendekehl #define I2C_SOFT_DECLARATIONS
22014c32614STim Schendekehl 
22114c32614STim Schendekehl #define GPIO_I2C_SCL		AT91_PIO_PORTA, 24
22214c32614STim Schendekehl #define GPIO_I2C_SDA		AT91_PIO_PORTA, 23
22314c32614STim Schendekehl 
22414c32614STim Schendekehl #define I2C_INIT { \
22514c32614STim Schendekehl 	at91_set_pio_periph(AT91_PIO_PORTA, 23, 0); \
22614c32614STim Schendekehl 	at91_set_pio_multi_drive(AT91_PIO_PORTA, 23, 1); \
22714c32614STim Schendekehl 	at91_set_pio_periph(AT91_PIO_PORTA, 24, 0); \
22814c32614STim Schendekehl 	at91_set_pio_output(AT91_PIO_PORTA, 24, 0); \
22914c32614STim Schendekehl 	at91_set_pio_multi_drive(AT91_PIO_PORTA, 24, 1); \
23014c32614STim Schendekehl }
23114c32614STim Schendekehl 
23214c32614STim Schendekehl #define I2C_ACTIVE	at91_set_pio_output(AT91_PIO_PORTA, 23, 0)
23314c32614STim Schendekehl #define I2C_TRISTATE	at91_set_pio_input(AT91_PIO_PORTA, 23, 0)
23414c32614STim Schendekehl #define I2C_SCL(bit)	at91_set_pio_value(AT91_PIO_PORTA, 24, bit)
23514c32614STim Schendekehl #define I2C_SDA(bit)	at91_set_pio_value(AT91_PIO_PORTA, 23, bit)
23614c32614STim Schendekehl #define I2C_DELAY	udelay(100)
23714c32614STim Schendekehl #define I2C_READ	at91_get_pio_value(AT91_PIO_PORTA, 23)
23814c32614STim Schendekehl 
23914c32614STim Schendekehl /* DHCP/BOOTP options */
24014c32614STim Schendekehl #ifdef CONFIG_CMD_DHCP
24114c32614STim Schendekehl #define CONFIG_BOOTP_BOOTFILESIZE
24214c32614STim Schendekehl #define CONFIG_BOOTP_BOOTPATH
24314c32614STim Schendekehl #define CONFIG_BOOTP_GATEWAY
24414c32614STim Schendekehl #define CONFIG_BOOTP_HOSTNAME
24514c32614STim Schendekehl #define CONFIG_SYS_AUTOLOAD	"n"
24614c32614STim Schendekehl #endif
24714c32614STim Schendekehl 
24814c32614STim Schendekehl /* File systems */
24914c32614STim Schendekehl #define CONFIG_MTD_DEVICE
25014c32614STim Schendekehl #define CONFIG_MTD_PARTITIONS
25114c32614STim Schendekehl #if defined(CONFIG_CMD_MTDPARTS) || defined(CONFIG_CMD_NAND)
25214c32614STim Schendekehl #define MTDIDS_DEFAULT		"nand0=atmel_nand"
25314c32614STim Schendekehl #define MTDPARTS_DEFAULT	"mtdparts=atmel_nand:-(root)"
25414c32614STim Schendekehl #endif
25514c32614STim Schendekehl #if defined(CONFIG_CMD_REISER) || defined(CONFIG_CMD_EXT2) || \
25614c32614STim Schendekehl 	defined(CONFIG_CMD_USB) || defined(CONFIG_MMC)
25714c32614STim Schendekehl #define CONFIG_DOS_PARTITION
25814c32614STim Schendekehl #endif
25914c32614STim Schendekehl #define CONFIG_LZO
26014c32614STim Schendekehl #define CONFIG_RBTREE
26114c32614STim Schendekehl 
26214c32614STim Schendekehl /* Boot command */
26314c32614STim Schendekehl #define CONFIG_BOOTDELAY	3
26414c32614STim Schendekehl #define CONFIG_CMDLINE_TAG
26514c32614STim Schendekehl #define CONFIG_SETUP_MEMORY_TAGS
26614c32614STim Schendekehl #define CONFIG_INITRD_TAG
26714c32614STim Schendekehl #define CONFIG_BOOTCOMMAND	"cp.b 0xC00C6000 ${loadaddr} 0x294000; bootm"
26814c32614STim Schendekehl #if defined(CONFIG_CMD_NAND)
26914c32614STim Schendekehl #define CONFIG_BOOTARGS		"console=ttyS0,115200 " \
27014c32614STim Schendekehl 				"root=/dev/mtdblock0 " \
27114c32614STim Schendekehl 				MTDPARTS_DEFAULT \
27214c32614STim Schendekehl 				" rw rootfstype=jffs2"
27314c32614STim Schendekehl #endif
27414c32614STim Schendekehl 
27514c32614STim Schendekehl /* Misc. u-boot settings */
27614c32614STim Schendekehl #define CONFIG_SYS_PROMPT		"U-Boot> "
27714c32614STim Schendekehl #define CONFIG_SYS_HUSH_PARSER
27814c32614STim Schendekehl #define CONFIG_SYS_CBSIZE		256
27914c32614STim Schendekehl #define CONFIG_SYS_MAXARGS		16
28014c32614STim Schendekehl #define CONFIG_SYS_PBSIZE		(CONFIG_SYS_CBSIZE + 16 \
28114c32614STim Schendekehl 					+ sizeof(CONFIG_SYS_PROMPT))
28214c32614STim Schendekehl #define CONFIG_SYS_LONGHELP
28314c32614STim Schendekehl #define CONFIG_CMDLINE_EDITING
28414c32614STim Schendekehl 
28514c32614STim Schendekehl #endif
286