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