From patchwork Sat Mar 10 12:45:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_Bie=C3=9Fmann?= X-Patchwork-Id: 145856 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 7E44AB6F98 for ; Sat, 10 Mar 2012 23:45:57 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4FBD328089; Sat, 10 Mar 2012 13:45:54 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 TnBNnx0PqFj5; Sat, 10 Mar 2012 13:45:54 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B476428083; Sat, 10 Mar 2012 13:45:50 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C143728083 for ; Sat, 10 Mar 2012 13:45:47 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de 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 4cYSqgCmQN4l for ; Sat, 10 Mar 2012 13:45:46 +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 mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) by theia.denx.de (Postfix) with ESMTPS id 867F228082 for ; Sat, 10 Mar 2012 13:45:44 +0100 (CET) Received: by werb10 with SMTP id b10so2024169wer.3 for ; Sat, 10 Mar 2012 04:45:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=GKF8dAORhm0ssKdlDyqXEmDcuP6XSnTyTsaeMuwn+QU=; b=Gg6jdAk91XGmGv6SJ7PDEuyCdKGNlghmH5l6vGuNYpdv6a/MZZkZ0jPLj3A5kW5fF9 XtuSvPP+StynxAEAIHt456gcGX/oij3iPV7X1m/39gr8hd63Wxi0SSjRqBh6PpRUrRSf El4f0a4sIWr2jCQ/OH42Gn2xRlT8v5L+P1HSXuxv7GpZBkw3FKCjIPC3EVInhVx/CMxQ fk/Ekg2vRfBYa0FnOayCM/J1p0QeU9BAKeDvziFX6ehYHgdd+vmOOV185hngVZjPOmO2 sOjNZcjLn4HmqoT25D1Gh+ifoY7coX4hA38BVQX1bMEZ0sZcIntGsgD6MCdZV5VgVDmG T8ug== Received: by 10.180.106.9 with SMTP id gq9mr12750165wib.17.1331383544046; Sat, 10 Mar 2012 04:45:44 -0800 (PST) Received: from azuregos.er.corscience.de (DSL01.212.114.252.242.ip-pool.NEFkom.net. [212.114.252.242]) by mx.google.com with ESMTPS id d7sm25743032wiz.6.2012.03.10.04.45.42 (version=SSLv3 cipher=OTHER); Sat, 10 Mar 2012 04:45:43 -0800 (PST) From: =?UTF-8?q?Andreas=20Bie=C3=9Fmann?= To: u-boot@lists.denx.de Date: Sat, 10 Mar 2012 13:45:23 +0100 Message-Id: <1331383523-23670-1-git-send-email-andreas.devel@googlemail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <4F5B3A67.9030609@gmail.com> References: <4F5B3A67.9030609@gmail.com> MIME-Version: 1.0 Subject: [U-Boot] [PATCH v3] ATMEL: use generic mmc framework X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Sven Schnelle gen_atmel_mci works on AVR32 as well, so no need to use the legacy mmc driver. This also has the nice side effect of being able to use SDHC cards an those boards. Signed-off-by: Sven Schnelle Signed-off-by: Andreas Bießmann --- changes since v2: * remove board_mmc_init in atstk100x and atngw100 files in favour of cpu_mmc_init * add cpu_mmc_init to arch/avr32/lib/board.c * add CONFIG_SYS_MMC_MAX_BLK_COUNT 1 to _every_ changed board config * replace 'mmcinit' by 'mmc rescan' in provided environment arch/avr32/lib/board.c | 15 +++++++++++++++ {drivers/mmc => include}/atmel_mci.h | 8 +++++--- include/configs/atngw100.h | 4 +++- include/configs/atstk1002.h | 4 +++- include/configs/atstk1003.h | 5 +++-- include/configs/atstk1004.h | 6 ++++-- include/configs/atstk1006.h | 4 +++- include/configs/favr-32-ezkit.h | 4 +++- include/configs/hammerhead.h | 4 +++- include/configs/mimc200.h | 4 +++- include/mmc.h | 1 - 11 files changed, 45 insertions(+), 14 deletions(-) rename {drivers/mmc => include}/atmel_mci.h (98%) diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c index 63fe297..e110d23 100644 --- a/arch/avr32/lib/board.c +++ b/arch/avr32/lib/board.c @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef CONFIG_BITBANGMII #include @@ -32,11 +33,15 @@ #include #include +#include #ifndef CONFIG_IDENT_STRING #define CONFIG_IDENT_STRING "" #endif +#ifdef CONFIG_ATMEL_MCI +#include +#endif DECLARE_GLOBAL_DATA_PTR; unsigned long monitor_flash_len; @@ -49,6 +54,13 @@ static int __do_nothing(void) int board_postclk_init(void) __attribute__((weak, alias("__do_nothing"))); int board_early_init_r(void) __attribute__((weak, alias("__do_nothing"))); +/* provide cpu_mmc_init, to overwrite provide board_mmc_init */ +int cpu_mmc_init(bd_t *bd) +{ + /* This calls the atmel_mci_init in gen_atmel_mci.c */ + return atmel_mci_init((void *)ATMEL_BASE_MMCI); +} + #ifdef CONFIG_SYS_DMA_ALLOC_LEN #include #include @@ -324,6 +336,9 @@ void board_init_r(gd_t *new_gd, ulong dest_addr) eth_initialize(gd->bd); #endif +#ifdef CONFIG_GENERIC_ATMEL_MCI + mmc_initialize(gd->bd); +#endif for (;;) { main_loop(); } diff --git a/drivers/mmc/atmel_mci.h b/include/atmel_mci.h similarity index 98% rename from drivers/mmc/atmel_mci.h rename to include/atmel_mci.h index 90ab6a8..0158f97 100644 --- a/drivers/mmc/atmel_mci.h +++ b/include/atmel_mci.h @@ -19,8 +19,10 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ -#ifndef __CPU_AT32AP_ATMEL_MCI_H__ -#define __CPU_AT32AP_ATMEL_MCI_H__ +#ifndef __ATMEL_MCI_H__ +#define __ATMEL_MCI_H__ + +int atmel_mci_init(void *regs); #ifndef __ASSEMBLY__ @@ -242,4 +244,4 @@ typedef struct atmel_mci { #define mmci_writel(reg,value) \ writel((value), (void *)ATMEL_BASE_MMCI + MMCI_##reg) -#endif /* __CPU_AT32AP_ATMEL_MCI_H__ */ +#endif /* __ATMEL_MCI_H__ */ diff --git a/include/configs/atngw100.h b/include/configs/atngw100.h index 8f9ed23..5e3155d 100644 --- a/include/configs/atngw100.h +++ b/include/configs/atngw100.h @@ -128,7 +128,9 @@ #define CONFIG_SYS_NR_PIOS 5 #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #define CONFIG_ATMEL_SPI #define CONFIG_SPI_FLASH diff --git a/include/configs/atstk1002.h b/include/configs/atstk1002.h index 44ce242..bb426f1 100644 --- a/include/configs/atstk1002.h +++ b/include/configs/atstk1002.h @@ -151,7 +151,9 @@ #define CONFIG_SYS_NR_PIOS 5 #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #define CONFIG_SYS_DCACHE_LINESZ 32 #define CONFIG_SYS_ICACHE_LINESZ 32 diff --git a/include/configs/atstk1003.h b/include/configs/atstk1003.h index c5e357f..67ff39b 100644 --- a/include/configs/atstk1003.h +++ b/include/configs/atstk1003.h @@ -100,7 +100,7 @@ "console=ttyS0 root=/dev/mmcblk0p1 rootwait" #define CONFIG_BOOTCOMMAND \ - "mmcinit; ext2load mmc 0:1 0x10400000 /boot/uImage; bootm" + "mmc rescan; ext2load mmc 0:1 0x10400000 /boot/uImage; bootm" /* * Only interrupt autoboot if is pressed. Otherwise, garbage @@ -135,7 +135,9 @@ #define CONFIG_PORTMUX_PIO #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #define CONFIG_SYS_DCACHE_LINESZ 32 #define CONFIG_SYS_ICACHE_LINESZ 32 diff --git a/include/configs/atstk1004.h b/include/configs/atstk1004.h index 3814732..5134b7f 100644 --- a/include/configs/atstk1004.h +++ b/include/configs/atstk1004.h @@ -100,7 +100,7 @@ "console=ttyS0 root=/dev/mmcblk0p1 rootwait" #define CONFIG_BOOTCOMMAND \ - "mmcinit; ext2load mmc 0:1 0x10200000 /boot/uImage; bootm" + "mmc rescan; ext2load mmc 0:1 0x10200000 /boot/uImage; bootm" /* * Only interrupt autoboot if is pressed. Otherwise, garbage @@ -135,7 +135,9 @@ #define CONFIG_PORTMUX_PIO #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #define CONFIG_SYS_DCACHE_LINESZ 32 #define CONFIG_SYS_ICACHE_LINESZ 32 diff --git a/include/configs/atstk1006.h b/include/configs/atstk1006.h index a30aa70..29fdd12 100644 --- a/include/configs/atstk1006.h +++ b/include/configs/atstk1006.h @@ -151,7 +151,9 @@ #define CONFIG_SYS_NR_PIOS 5 #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #define CONFIG_SYS_DCACHE_LINESZ 32 #define CONFIG_SYS_ICACHE_LINESZ 32 diff --git a/include/configs/favr-32-ezkit.h b/include/configs/favr-32-ezkit.h index 757636d..71d2473 100644 --- a/include/configs/favr-32-ezkit.h +++ b/include/configs/favr-32-ezkit.h @@ -150,7 +150,9 @@ #define CONFIG_SYS_NR_PIOS 5 #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #define CONFIG_SYS_DCACHE_LINESZ 32 #define CONFIG_SYS_ICACHE_LINESZ 32 diff --git a/include/configs/hammerhead.h b/include/configs/hammerhead.h index 94e680c..532feb2 100644 --- a/include/configs/hammerhead.h +++ b/include/configs/hammerhead.h @@ -124,7 +124,9 @@ #define CONFIG_SYS_NR_PIOS 5 #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #define CONFIG_SYS_DCACHE_LINESZ 32 #define CONFIG_SYS_ICACHE_LINESZ 32 diff --git a/include/configs/mimc200.h b/include/configs/mimc200.h index d8d8256..d5797cb 100644 --- a/include/configs/mimc200.h +++ b/include/configs/mimc200.h @@ -129,7 +129,9 @@ #define CONFIG_SYS_NR_PIOS 5 #define CONFIG_SYS_HSDRAMC #define CONFIG_MMC -#define CONFIG_ATMEL_MCI +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_GENERIC_MMC +#define CONFIG_SYS_MMC_MAX_BLK_COUNT 1 #if defined(CONFIG_LCD) #define CONFIG_CMD_BMP diff --git a/include/mmc.h b/include/mmc.h index 30c2375..f52df70 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -322,7 +322,6 @@ int mmc_switch_part(int dev_num, unsigned int part_num); int mmc_getcd(struct mmc *mmc); #ifdef CONFIG_GENERIC_MMC -int atmel_mci_init(void *regs); #define mmc_host_is_spi(mmc) ((mmc)->host_caps & MMC_MODE_SPI) struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode); #else