From ae5070d627fa04f42fc8b29400e2d189eb8b6bd2 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Thu, 1 Sep 2016 09:49:14 -0400 Subject: AT91: Correct misspelling of "redundent" in partition names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert P. J. Day Reviewed-by: Andreas Bießmann --- include/configs/at91-sama5_common.h | 2 +- include/configs/at91sam9rlek.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index b09ef33e574..13140bae1f8 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -74,7 +74,7 @@ #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk " \ "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ - "256K(env),256k(env_redundent),256k(spare)," \ + "256K(env),256k(env_redundant),256k(spare)," \ "512k(dtb),6M(kernel)ro,-(rootfs) " \ "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h index 5b3a3d1b481..23184ceba00 100644 --- a/include/configs/at91sam9rlek.h +++ b/include/configs/at91sam9rlek.h @@ -148,7 +148,7 @@ #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk " \ "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ - "256K(env),256k(env_redundent),256k(spare)," \ + "256K(env),256k(env_redundant),256k(spare)," \ "512k(dtb),6M(kernel)ro,-(rootfs) " \ "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" -- cgit v1.3.1 From 6f170c4d77381d18e5acee4ba92dfbd10107bc80 Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Mon, 17 Oct 2016 09:55:23 +0800 Subject: board: sama5d2_xplained: Move config options to defconfigs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Move the config options from the include/configs/sama5d2_xplained.h to configs/sama5d2_xplained_*_defconfig. Signed-off-by: Wenyou Yang Reviewed-by: Andreas Bießmann --- board/atmel/sama5d2_xplained/sama5d2_xplained.c | 2 ++ configs/sama5d2_xplained_mmc_defconfig | 31 ++++++++++++++++++++++++- configs/sama5d2_xplained_spiflash_defconfig | 31 ++++++++++++++++++++++++- include/configs/sama5d2_xplained.h | 25 -------------------- 4 files changed, 62 insertions(+), 27 deletions(-) (limited to 'include') diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index 93df7ba32a8..413a000d227 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -25,10 +25,12 @@ DECLARE_GLOBAL_DATA_PTR; +#ifndef CONFIG_DM_SPI int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus == 0 && cs == 0; } +#endif void spi_cs_activate(struct spi_slave *slave) { diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig index 23ab4d6d34d..08ecea64011 100644 --- a/configs/sama5d2_xplained_mmc_defconfig +++ b/configs/sama5d2_xplained_mmc_defconfig @@ -8,6 +8,9 @@ CONFIG_SPL_FAT_SUPPORT=y CONFIG_SPL_LIBDISK_SUPPORT=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_xplained" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_MMC" CONFIG_BOOTDELAY=3 @@ -21,14 +24,40 @@ CONFIG_CMD_BOOTZ=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_MMC=y CONFIG_CMD_SF=y +CONFIG_CMD_I2C=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_BLK=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_AT91_GENERIC_CLK=y +CONFIG_ATMEL_PIO4=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_AT91=y +CONFIG_DM_MMC=y +CONFIG_DM_MMC_OPS=y +CONFIG_ATMEL_SDHCI=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_AT91PIO4=y +CONFIG_ATMEL_USART=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_SPI=y CONFIG_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_OF_LIBFDT=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index f208dc2473f..b49d2adf676 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -7,6 +7,9 @@ CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y +CONFIG_DM_GPIO=y +CONFIG_DM_SERIAL=y +CONFIG_DEFAULT_DEVICE_TREE="at91-sama5d2_xplained" CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="SAMA5D2,SYS_USE_SERIALFLASH" CONFIG_BOOTDELAY=3 @@ -20,14 +23,40 @@ CONFIG_CMD_BOOTZ=y # CONFIG_CMD_FLASH is not set CONFIG_CMD_MMC=y CONFIG_CMD_SF=y +CONFIG_CMD_I2C=y CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_DHCP=y CONFIG_CMD_PING=y CONFIG_CMD_FAT=y +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_DM=y +CONFIG_SPL_DM=y +CONFIG_BLK=y +CONFIG_CLK=y +CONFIG_SPL_CLK=y +CONFIG_CLK_AT91=y +CONFIG_AT91_UTMI=y +CONFIG_AT91_H32MX=y +CONFIG_AT91_GENERIC_CLK=y +CONFIG_ATMEL_PIO4=y +CONFIG_DM_I2C=y +CONFIG_SYS_I2C_AT91=y +CONFIG_DM_MMC=y +CONFIG_DM_MMC_OPS=y +CONFIG_ATMEL_SDHCI=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y +CONFIG_SPI_FLASH_ATMEL=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_AT91PIO4=y +CONFIG_ATMEL_USART=y +CONFIG_DM_SPI=y +CONFIG_ATMEL_SPI=y CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y -CONFIG_OF_LIBFDT=y diff --git a/include/configs/sama5d2_xplained.h b/include/configs/sama5d2_xplained.h index 30fb9a4dfb6..435956d75ad 100644 --- a/include/configs/sama5d2_xplained.h +++ b/include/configs/sama5d2_xplained.h @@ -15,11 +15,6 @@ #include "at91-sama5_common.h" -/* serial console */ -#define CONFIG_ATMEL_USART -#define CONFIG_USART_BASE ATMEL_BASE_UART1 -#define CONFIG_USART_ID ATMEL_ID_UART1 - /* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -34,14 +29,8 @@ #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ -#undef CONFIG_AT91_GPIO -#define CONFIG_ATMEL_PIO4 - /* SerialFlash */ #ifdef CONFIG_CMD_SF -#define CONFIG_ATMEL_SPI -#define CONFIG_ATMEL_SPI0 -#define CONFIG_SPI_FLASH_ATMEL #define CONFIG_SF_DEFAULT_BUS 0 #define CONFIG_SF_DEFAULT_CS 0 #define CONFIG_SF_DEFAULT_SPEED 30000000 @@ -51,23 +40,9 @@ #undef CONFIG_CMD_NAND /* MMC */ - #ifdef CONFIG_CMD_MMC -#define CONFIG_MMC #define CONFIG_GENERIC_MMC #define CONFIG_SDHCI -#define CONFIG_ATMEL_SDHCI -#define CONFIG_ATMEL_SDHCI0 -#define CONFIG_ATMEL_SDHCI1 -#define CONFIG_SUPPORT_EMMC_BOOT -#endif - -/* USB */ - -#ifdef CONFIG_CMD_USB -#define CONFIG_USB_EHCI -#define CONFIG_USB_EHCI_ATMEL -#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3 #endif /* USB device */ -- cgit v1.3.1 From 0daa2e1870762ebf0a9ae97a6a923e938faddbc4 Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Mon, 17 Oct 2016 09:55:25 +0800 Subject: board: sama5d2_xplained: Set 'ethaddr' got from AT24MAC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If 'ethaddr' is not set, we will get the ethernet address from AT24MAC, and set it to 'ethaddr' variable. Signed-off-by: Wenyou Yang Signed-off-by: Songjun Wu Reviewed-by: Andreas Bießmann --- board/atmel/sama5d2_xplained/sama5d2_xplained.c | 51 +++++++++++++++++++++++++ include/configs/sama5d2_xplained.h | 6 +++ 2 files changed, 57 insertions(+) (limited to 'include') diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index 7ccadf214a1..cceccd2ac45 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -7,6 +7,8 @@ #include #include +#include +#include #include #include #include @@ -192,6 +194,55 @@ int board_eth_init(bd_t *bis) return rc; } +#ifdef CONFIG_CMD_I2C +static int set_ethaddr_from_eeprom(void) +{ + const int ETH_ADDR_LEN = 6; + unsigned char ethaddr[ETH_ADDR_LEN]; + const char *ETHADDR_NAME = "ethaddr"; + struct udevice *bus, *dev; + + if (getenv(ETHADDR_NAME)) + return 0; + + if (uclass_get_device_by_seq(UCLASS_I2C, 1, &bus)) { + printf("Cannot find I2C bus 1\n"); + return -1; + } + + if (dm_i2c_probe(bus, AT24MAC_ADDR, 0, &dev)) { + printf("Failed to probe I2C chip\n"); + return -1; + } + + if (dm_i2c_read(dev, AT24MAC_REG, ethaddr, ETH_ADDR_LEN)) { + printf("Failed to read ethernet address from EEPROM\n"); + return -1; + } + + if (!is_valid_ethaddr(ethaddr)) { + printf("The ethernet address read from EEPROM is not valid!\n"); + return -1; + } + + return eth_setenv_enetaddr(ETHADDR_NAME, ethaddr); +} +#else +static int set_ethaddr_from_eeprom(void) +{ + return 0; +} +#endif + +#ifdef CONFIG_MISC_INIT_R +int misc_init_r(void) +{ + set_ethaddr_from_eeprom(); + + return 0; +} +#endif + /* SPL */ #ifdef CONFIG_SPL_BUILD void spl_board_init(void) diff --git a/include/configs/sama5d2_xplained.h b/include/configs/sama5d2_xplained.h index 435956d75ad..7fb2bdcd4c2 100644 --- a/include/configs/sama5d2_xplained.h +++ b/include/configs/sama5d2_xplained.h @@ -15,6 +15,8 @@ #include "at91-sama5_common.h" +#define CONFIG_MISC_INIT_R + /* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -54,6 +56,10 @@ #define CONFIG_DOS_PARTITION #endif +/* I2C */ +#define AT24MAC_ADDR 0x5c +#define AT24MAC_REG 0x9a + /* Ethernet Hardware */ #define CONFIG_MACB #define CONFIG_RMII -- cgit v1.3.1 From 2992dd833d11cd988125b11ae72bc18e53b0b2ab Mon Sep 17 00:00:00 2001 From: Wenyou Yang Date: Mon, 17 Oct 2016 09:55:26 +0800 Subject: board: sama5d2_xplained: Enable an early debug UART MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable an early debug UART to debug problems when an ICE or other debug mechanism is not available. Signed-off-by: Wenyou Yang Reviewed-by: Simon Glass Reviewed-by: Andreas Bießmann --- board/atmel/sama5d2_xplained/sama5d2_xplained.c | 14 ++++++++++++++ configs/sama5d2_xplained_mmc_defconfig | 6 ++++++ configs/sama5d2_xplained_spiflash_defconfig | 6 ++++++ include/configs/sama5d2_xplained.h | 2 ++ 4 files changed, 28 insertions(+) (limited to 'include') diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index cceccd2ac45..c5337af4de6 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -141,12 +142,25 @@ static void board_uart1_hw_init(void) at91_periph_clk_enable(ATMEL_ID_UART1); } +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void) +{ + board_uart1_hw_init(); +} +#endif + +#ifdef CONFIG_BOARD_EARLY_INIT_F int board_early_init_f(void) { +#ifdef CONFIG_DEBUG_UART + debug_uart_init(); +#else board_uart1_hw_init(); +#endif return 0; } +#endif int board_init(void) { diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig index 08ecea64011..8a786f1a062 100644 --- a/configs/sama5d2_xplained_mmc_defconfig +++ b/configs/sama5d2_xplained_mmc_defconfig @@ -52,6 +52,12 @@ CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91PIO4=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ATMEL=y +CONFIG_DEBUG_UART_BASE=0xf8020000 +CONFIG_DEBUG_UART_CLOCK=0 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig index b49d2adf676..51594e71f71 100644 --- a/configs/sama5d2_xplained_spiflash_defconfig +++ b/configs/sama5d2_xplained_spiflash_defconfig @@ -51,6 +51,12 @@ CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_ATMEL=y CONFIG_PINCTRL=y CONFIG_PINCTRL_AT91PIO4=y +CONFIG_DEBUG_UART=y +CONFIG_DEBUG_UART_ATMEL=y +CONFIG_DEBUG_UART_BASE=0xf8020000 +CONFIG_DEBUG_UART_CLOCK=0 +CONFIG_DEBUG_UART_BOARD_INIT=y +CONFIG_DEBUG_UART_ANNOUNCE=y CONFIG_ATMEL_USART=y CONFIG_DM_SPI=y CONFIG_ATMEL_SPI=y diff --git a/include/configs/sama5d2_xplained.h b/include/configs/sama5d2_xplained.h index 7fb2bdcd4c2..f6946453e5d 100644 --- a/include/configs/sama5d2_xplained.h +++ b/include/configs/sama5d2_xplained.h @@ -15,6 +15,8 @@ #include "at91-sama5_common.h" +#define CONFIG_BOARD_EARLY_INIT_F + #define CONFIG_MISC_INIT_R /* SDRAM */ -- cgit v1.3.1