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 CONFIG_MACH_TYPE MACH_TYPE_ETHERNUT5 2314c32614STim Schendekehl 2414c32614STim Schendekehl /* CPU information */ 2514c32614STim Schendekehl #define CONFIG_ARCH_CPU_INIT 2614c32614STim Schendekehl 2714c32614STim Schendekehl /* ARM asynchronous clock */ 2814c32614STim Schendekehl #define CONFIG_SYS_AT91_SLOW_CLOCK 32768 /* slow clock xtal */ 2914c32614STim Schendekehl #define CONFIG_SYS_AT91_MAIN_CLOCK 18432000 /* 18.432 MHz crystal */ 3014c32614STim Schendekehl 3114c32614STim Schendekehl /* 32kB internal SRAM */ 3214c32614STim Schendekehl #define CONFIG_SRAM_BASE 0x00300000 /*AT91SAM9XE_SRAM_BASE */ 3314c32614STim Schendekehl #define CONFIG_SRAM_SIZE (32 << 10) 343d6ba91eSRob Herring #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SRAM_BASE + CONFIG_SRAM_SIZE - \ 353d6ba91eSRob Herring GENERATED_GBL_DATA_SIZE) 3614c32614STim Schendekehl 3714c32614STim Schendekehl /* 128MB SDRAM in 1 bank */ 3814c32614STim Schendekehl #define CONFIG_NR_DRAM_BANKS 1 3914c32614STim Schendekehl #define CONFIG_SYS_SDRAM_BASE 0x20000000 4014c32614STim Schendekehl #define CONFIG_SYS_SDRAM_SIZE (128 << 20) 4114c32614STim Schendekehl #define CONFIG_SYS_LOAD_ADDR CONFIG_SYS_SDRAM_BASE 4214c32614STim Schendekehl #define CONFIG_LOADADDR CONFIG_SYS_LOAD_ADDR 4314c32614STim Schendekehl #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (1 << 20)) 4414c32614STim Schendekehl #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE 4514c32614STim Schendekehl #define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_TEXT_BASE \ 4614c32614STim Schendekehl - CONFIG_SYS_MALLOC_LEN) 4714c32614STim Schendekehl 4814c32614STim Schendekehl /* 512kB on-chip NOR flash */ 4914c32614STim Schendekehl # define CONFIG_SYS_MAX_FLASH_BANKS 1 5014c32614STim Schendekehl # define CONFIG_SYS_FLASH_BASE 0x00200000 /* AT91SAM9XE_FLASH_BASE */ 5114c32614STim Schendekehl # define CONFIG_AT91_EFLASH 5214c32614STim Schendekehl # define CONFIG_SYS_MAX_FLASH_SECT 32 5314c32614STim Schendekehl # define CONFIG_SYS_FLASH_PROTECTION /* First stage loader in sector 0 */ 5414c32614STim Schendekehl # define CONFIG_EFLASH_PROTSECTORS 1 5514c32614STim Schendekehl 5614c32614STim Schendekehl 57*94db5120SWenyou.Yang@microchip.com /* bootstrap + u-boot + env + linux in dataflash on CS0 */ 5814c32614STim Schendekehl #define CONFIG_ENV_OFFSET 0x3DE000 59*94db5120SWenyou.Yang@microchip.com #define CONFIG_ENV_SIZE (132 << 10) 60*94db5120SWenyou.Yang@microchip.com #define CONFIG_ENV_SECT_SIZE CONFIG_ENV_SIZE 61*94db5120SWenyou.Yang@microchip.com #define CONFIG_ENV_SPI_MAX_HZ 15000000 6214c32614STim Schendekehl 63ef0f2f57SJoe Hershberger #ifndef MINIMAL_LOADER 6414c32614STim Schendekehl #endif 6514c32614STim Schendekehl 6614c32614STim Schendekehl /* NAND flash */ 6714c32614STim Schendekehl #ifdef CONFIG_CMD_NAND 6814c32614STim Schendekehl #define CONFIG_SYS_MAX_NAND_DEVICE 1 6914c32614STim Schendekehl #define CONFIG_SYS_NAND_BASE 0x40000000 7014c32614STim Schendekehl #define CONFIG_SYS_NAND_DBW_8 7114c32614STim Schendekehl /* our ALE is AD21 */ 7214c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_ALE (1 << 21) 7314c32614STim Schendekehl /* our CLE is AD22 */ 7414c32614STim Schendekehl #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) 75ac45bb16SAndreas Bießmann #define CONFIG_SYS_NAND_ENABLE_PIN GPIO_PIN_PC(14) 7614c32614STim Schendekehl #endif 7714c32614STim Schendekehl 7814c32614STim Schendekehl /* JFFS2 */ 7914c32614STim Schendekehl #ifdef CONFIG_CMD_JFFS2 8014c32614STim Schendekehl #define CONFIG_JFFS2_CMDLINE 8114c32614STim Schendekehl #define CONFIG_JFFS2_NAND 8214c32614STim Schendekehl #endif 8314c32614STim Schendekehl 8414c32614STim Schendekehl /* Ethernet */ 8514c32614STim Schendekehl #define CONFIG_NET_RETRY_COUNT 20 8614c32614STim Schendekehl #define CONFIG_MACB 8714c32614STim Schendekehl #define CONFIG_RMII 8814c32614STim Schendekehl #define CONFIG_PHY_ID 0 8914c32614STim Schendekehl #define CONFIG_MACB_SEARCH_PHY 9014c32614STim Schendekehl 9114c32614STim Schendekehl /* MMC */ 9214c32614STim Schendekehl #ifdef CONFIG_CMD_MMC 9314c32614STim Schendekehl #define CONFIG_GENERIC_ATMEL_MCI 9414c32614STim Schendekehl #define CONFIG_SYS_MMC_CD_PIN AT91_PIO_PORTC, 8 9514c32614STim Schendekehl #endif 9614c32614STim Schendekehl 9714c32614STim Schendekehl /* USB */ 9814c32614STim Schendekehl #ifdef CONFIG_CMD_USB 9914c32614STim Schendekehl #define CONFIG_USB_ATMEL 100dcd2f1a0SBo Shen #define CONFIG_USB_ATMEL_CLK_SEL_PLLB 10114c32614STim Schendekehl #define CONFIG_USB_OHCI_NEW 10214c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_CPU_INIT 10314c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_REGS_BASE 0x00500000 10414c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_SLOT_NAME "host" 10514c32614STim Schendekehl #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2 10614c32614STim Schendekehl #endif 10714c32614STim Schendekehl 10814c32614STim Schendekehl /* RTC */ 10914c32614STim Schendekehl #if defined(CONFIG_CMD_DATE) || defined(CONFIG_CMD_SNTP) 11014c32614STim Schendekehl #define CONFIG_RTC_PCF8563 11114c32614STim Schendekehl #define CONFIG_SYS_I2C_RTC_ADDR 0x51 11214c32614STim Schendekehl #endif 11314c32614STim Schendekehl 11414c32614STim Schendekehl /* I2C */ 11514c32614STim Schendekehl #define CONFIG_SYS_MAX_I2C_BUS 1 11614c32614STim Schendekehl 117ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C 118ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT /* I2C bit-banged */ 119ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SPEED 100000 120ea818dbbSHeiko Schocher #define CONFIG_SYS_I2C_SOFT_SLAVE 0 121ea818dbbSHeiko Schocher 12214c32614STim Schendekehl #define I2C_SOFT_DECLARATIONS 12314c32614STim Schendekehl 12414c32614STim Schendekehl #define GPIO_I2C_SCL AT91_PIO_PORTA, 24 12514c32614STim Schendekehl #define GPIO_I2C_SDA AT91_PIO_PORTA, 23 12614c32614STim Schendekehl 12714c32614STim Schendekehl #define I2C_INIT { \ 12814c32614STim Schendekehl at91_set_pio_periph(AT91_PIO_PORTA, 23, 0); \ 12914c32614STim Schendekehl at91_set_pio_multi_drive(AT91_PIO_PORTA, 23, 1); \ 13014c32614STim Schendekehl at91_set_pio_periph(AT91_PIO_PORTA, 24, 0); \ 13114c32614STim Schendekehl at91_set_pio_output(AT91_PIO_PORTA, 24, 0); \ 13214c32614STim Schendekehl at91_set_pio_multi_drive(AT91_PIO_PORTA, 24, 1); \ 13314c32614STim Schendekehl } 13414c32614STim Schendekehl 13514c32614STim Schendekehl #define I2C_ACTIVE at91_set_pio_output(AT91_PIO_PORTA, 23, 0) 13614c32614STim Schendekehl #define I2C_TRISTATE at91_set_pio_input(AT91_PIO_PORTA, 23, 0) 13714c32614STim Schendekehl #define I2C_SCL(bit) at91_set_pio_value(AT91_PIO_PORTA, 24, bit) 13814c32614STim Schendekehl #define I2C_SDA(bit) at91_set_pio_value(AT91_PIO_PORTA, 23, bit) 13914c32614STim Schendekehl #define I2C_DELAY udelay(100) 14014c32614STim Schendekehl #define I2C_READ at91_get_pio_value(AT91_PIO_PORTA, 23) 14114c32614STim Schendekehl 14214c32614STim Schendekehl /* DHCP/BOOTP options */ 14314c32614STim Schendekehl #ifdef CONFIG_CMD_DHCP 14414c32614STim Schendekehl #define CONFIG_BOOTP_BOOTFILESIZE 14514c32614STim Schendekehl #define CONFIG_BOOTP_BOOTPATH 14614c32614STim Schendekehl #define CONFIG_BOOTP_GATEWAY 14714c32614STim Schendekehl #define CONFIG_BOOTP_HOSTNAME 14814c32614STim Schendekehl #define CONFIG_SYS_AUTOLOAD "n" 14914c32614STim Schendekehl #endif 15014c32614STim Schendekehl 15114c32614STim Schendekehl /* File systems */ 15214c32614STim Schendekehl 15314c32614STim Schendekehl /* Boot command */ 15414c32614STim Schendekehl #define CONFIG_CMDLINE_TAG 15514c32614STim Schendekehl #define CONFIG_SETUP_MEMORY_TAGS 15614c32614STim Schendekehl #define CONFIG_INITRD_TAG 157*94db5120SWenyou.Yang@microchip.com #define CONFIG_BOOTCOMMAND "sf probe 0:0; " \ 158*94db5120SWenyou.Yang@microchip.com "sf read 0x22000000 0xc6000 0x294000; " \ 159*94db5120SWenyou.Yang@microchip.com "bootm 0x22000000" 16014c32614STim Schendekehl 16114c32614STim Schendekehl /* Misc. u-boot settings */ 16214c32614STim Schendekehl #define CONFIG_SYS_LONGHELP 16314c32614STim Schendekehl #define CONFIG_CMDLINE_EDITING 16414c32614STim Schendekehl 16514c32614STim Schendekehl #endif 166