From patchwork Wed Mar 16 16:41:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyrille Pitchen X-Patchwork-Id: 598527 X-Patchwork-Delegate: andreas.biessmann@googlemail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3qQHLb35lcz9sC3 for ; Thu, 17 Mar 2016 03:41:27 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 809D5A7666; Wed, 16 Mar 2016 17:41:19 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lT6SY8gdfnfI; Wed, 16 Mar 2016 17:41:19 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 27084A764B; Wed, 16 Mar 2016 17:41:19 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8C6A0A764B for ; Wed, 16 Mar 2016 17:41:00 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yPr6J_N3U67w for ; Wed, 16 Mar 2016 17:41:00 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from eusmtp01.atmel.com (eusmtp01.atmel.com [212.144.249.242]) by theia.denx.de (Postfix) with ESMTPS id 56F53A763B for ; Wed, 16 Mar 2016 17:40:54 +0100 (CET) Received: from tenerife.corp.atmel.com (10.161.101.13) by eusmtp01.atmel.com (10.161.101.30) with Microsoft SMTP Server id 14.3.235.1; Wed, 16 Mar 2016 17:40:49 +0100 From: Cyrille Pitchen To: Date: Wed, 16 Mar 2016 17:41:25 +0100 Message-ID: <1458146488-26900-1-git-send-email-cyrille.pitchen@atmel.com> X-Mailer: git-send-email 1.8.2.2 In-Reply-To: <56E98A25.3080405@atmel.com> References: <56E98A25.3080405@atmel.com> MIME-Version: 1.0 Cc: marex@denx.de, u-boot@lists.denx.de, Anthony.Harivel@emtrion.de Subject: [U-Boot] [PATCH 1/4] rework board config files X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" --- 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