
--- board/atmel/sama5d2_xplained/Kconfig | 14 ++++++++++++++ board/atmel/sama5d2_xplained/sama5d2_xplained.c | 14 +++++++++----- drivers/mmc/Kconfig | 6 ++++++ include/configs/at91-sama5_common.h | 10 ++++++++++ include/configs/sama5d2_xplained.h | 15 ++------------- 5 files changed, 41 insertions(+), 18 deletions(-)
diff --git a/board/atmel/sama5d2_xplained/Kconfig b/board/atmel/sama5d2_xplained/Kconfig index 55712e97454b..d4106b90f599 100644 --- a/board/atmel/sama5d2_xplained/Kconfig +++ b/board/atmel/sama5d2_xplained/Kconfig @@ -12,4 +12,18 @@ config SYS_SOC config SYS_CONFIG_NAME default "sama5d2_xplained"
+config ATMEL_SPI0 + bool "SPI0" + default y + +config ATMEL_SDHCI0 + bool "SDHCI0" + select ATMEL_SDHCI + default y + +config ATMEL_SDHCI1 + bool "SDHCI1" + select ATMEL_SDHCI + default y + endif diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c index 10edf28a9bd6..4dd83e5e991f 100644 --- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c +++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c @@ -25,6 +25,7 @@
DECLARE_GLOBAL_DATA_PTR;
+#ifndef CONFIG_DM_SPI int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus == 0 && cs == 0; @@ -39,7 +40,9 @@ void spi_cs_deactivate(struct spi_slave *slave) { atmel_pio4_set_pio_output(AT91_PIO_PORTA, 17, 1); } +#endif
+#ifdef CONFIG_ATMEL_SPI0 static void board_spi0_hw_init(void) { atmel_pio4_set_a_periph(AT91_PIO_PORTA, 14, 0); @@ -50,6 +53,7 @@ static void board_spi0_hw_init(void)
at91_periph_clk_enable(ATMEL_ID_SPI0); } +#endif
static void board_usb_hw_init(void) { @@ -157,6 +161,7 @@ static void board_gmac_hw_init(void) at91_periph_clk_enable(ATMEL_ID_GMAC); }
+#ifdef CONFIG_ATMEL_SDHCI0 static void board_sdhci0_hw_init(void) { atmel_pio4_set_a_periph(AT91_PIO_PORTA, 0, 0); /* SDMMC0_CK */ @@ -176,7 +181,9 @@ static void board_sdhci0_hw_init(void) at91_enable_periph_generated_clk(ATMEL_ID_SDMMC0, GCK_CSS_PLLA_CLK, 1); } +#endif
+#ifdef CONFIG_ATMEL_SDHCI1 static void board_sdhci1_hw_init(void) { atmel_pio4_set_e_periph(AT91_PIO_PORTA, 18, 0); /* SDMMC1_DAT0 */ @@ -192,6 +199,7 @@ static void board_sdhci1_hw_init(void) at91_enable_periph_generated_clk(ATMEL_ID_SDMMC1, GCK_CSS_PLLA_CLK, 1); } +#endif
int board_mmc_init(bd_t *bis) { @@ -230,17 +238,15 @@ int board_init(void) /* address of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
-#ifdef CONFIG_ATMEL_SPI +#ifdef CONFIG_ATMEL_SPI0 board_spi0_hw_init(); #endif -#ifdef CONFIG_ATMEL_SDHCI #ifdef CONFIG_ATMEL_SDHCI0 board_sdhci0_hw_init(); #endif #ifdef CONFIG_ATMEL_SDHCI1 board_sdhci1_hw_init(); #endif -#endif #ifdef CONFIG_MACB board_gmac_hw_init(); #endif @@ -289,14 +295,12 @@ void spl_board_init(void) #ifdef CONFIG_SYS_USE_SERIALFLASH board_spi0_hw_init(); #endif -#ifdef CONFIG_ATMEL_SDHCI #ifdef CONFIG_ATMEL_SDHCI0 board_sdhci0_hw_init(); #endif #ifdef CONFIG_ATMEL_SDHCI1 board_sdhci1_hw_init(); #endif -#endif }
static void ddrc_conf(struct atmel_mpddrc_config *ddrc) diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index dc8532fe9373..b3d085119ac8 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -49,4 +49,10 @@ config MMC_UNIPHIER help This selects support for the SD/MMC Host Controller on UniPhier SoCs.
+config ATMEL_SDHCI + bool "Atmel SD Host Controller Interface" + depends on ARCH_AT91 + help + This enables support for the Atmel SD/eMMC controller + endmenu diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index 6525b5c3701e..0297fd781dc6 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -104,6 +104,16 @@ "sf read 0x21000000 0x60000 0xc000; " \ "sf read 0x22000000 0x6c000 0x394000; " \ "bootz 0x22000000 - 0x21000000" +#elif CONFIG_SYS_USE_QSPIFLASH +/* u-boot env in QSPI flash, by default is bus 0 and cs 0 */ +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_OFFSET 0x10000 +#define CONFIG_ENV_SIZE 0x10000 +#define CONFIG_ENV_SECT_SIZE 0x10000 +#define CONFIG_BOOTCOMMAND "sf probe 0; " \ + "sf read 0x21000000 0x60000 0x10000; " \ + "sf read 0x22000000 0x70000 0x500000; " \ + "bootz 0x22000000 - 0x21000000" #endif
#endif diff --git a/include/configs/sama5d2_xplained.h b/include/configs/sama5d2_xplained.h index 272257ea0edd..3391a0ea5b45 100644 --- a/include/configs/sama5d2_xplained.h +++ b/include/configs/sama5d2_xplained.h @@ -16,6 +16,8 @@ #include "at91-sama5_common.h"
/* serial console */ +#undef CONFIG_BAUDRATE +#define CONFIG_BAUDRATE 57600 #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_UART1 #define CONFIG_USART_ID ATMEL_ID_UART1 @@ -37,16 +39,6 @@ #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 -#endif - /* NAND flash */ #undef CONFIG_CMD_NAND
@@ -57,9 +49,6 @@ #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