[U-Boot] [PATCH 1/2] AVR32: use generic mmc framework

Sven Schnelle svens at stackframe.org
Wed Oct 12 15:09:08 CEST 2011


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 AVR32 boards.

Signed-off-by: Sven Schnelle <svens at stackframe.org>
---
 arch/avr32/lib/board.c            |    3 +++
 board/atmel/atngw100/atngw100.c   |    9 +++++++++
 board/atmel/atstk1000/atstk1000.c |    9 +++++++++
 include/configs/atngw100.h        |    4 +++-
 include/configs/atstk1002.h       |    4 +++-
 include/configs/atstk1003.h       |    3 ++-
 include/configs/atstk1004.h       |    4 +++-
 include/configs/atstk1006.h       |    4 +++-
 include/configs/favr-32-ezkit.h   |    3 ++-
 include/configs/hammerhead.h      |    3 ++-
 include/configs/mimc200.h         |    3 ++-
 include/mmc.h                     |    1 -
 12 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/arch/avr32/lib/board.c b/arch/avr32/lib/board.c
index 3e1cc0d..694755c 100644
--- a/arch/avr32/lib/board.c
+++ b/arch/avr32/lib/board.c
@@ -334,6 +334,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/board/atmel/atngw100/atngw100.c b/board/atmel/atngw100/atngw100.c
index 59577b8..af22403 100644
--- a/board/atmel/atngw100/atngw100.c
+++ b/board/atmel/atngw100/atngw100.c
@@ -139,3 +139,12 @@ void spi_cs_deactivate(struct spi_slave *slave)
 	gpio_set_value(ATNGW100_DATAFLASH_CS_PIN, 1);
 }
 #endif /* CONFIG_ATMEL_SPI */
+
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bd)
+{
+        /* This calls the atmel_mci_init in gen_atmel_mci.c */
+        return atmel_mci_init((void *)ATMEL_BASE_MMCI);
+
+}
+#endif
diff --git a/board/atmel/atstk1000/atstk1000.c b/board/atmel/atstk1000/atstk1000.c
index 58048a4..93f8e43 100644
--- a/board/atmel/atstk1000/atstk1000.c
+++ b/board/atmel/atstk1000/atstk1000.c
@@ -139,3 +139,12 @@ int board_eth_init(bd_t *bi)
 	return 0;
 }
 #endif
+
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bd)
+{
+        /* This calls the atmel_mci_init in gen_atmel_mci.c */
+        return atmel_mci_init((void *)ATMEL_BASE_MMCI);
+
+}
+#endif
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..a426f15 100644
--- a/include/configs/atstk1003.h
+++ b/include/configs/atstk1003.h
@@ -135,7 +135,8 @@
 #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_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
diff --git a/include/configs/atstk1004.h b/include/configs/atstk1004.h
index 3814732..1b4a1af 100644
--- a/include/configs/atstk1004.h
+++ b/include/configs/atstk1004.h
@@ -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..1c8da9f 100644
--- a/include/configs/favr-32-ezkit.h
+++ b/include/configs/favr-32-ezkit.h
@@ -150,7 +150,8 @@
 #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_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
diff --git a/include/configs/hammerhead.h b/include/configs/hammerhead.h
index 94e680c..5570bdb 100644
--- a/include/configs/hammerhead.h
+++ b/include/configs/hammerhead.h
@@ -124,7 +124,8 @@
 #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_DCACHE_LINESZ		32
 #define CONFIG_SYS_ICACHE_LINESZ		32
diff --git a/include/configs/mimc200.h b/include/configs/mimc200.h
index d8d8256..8031a05 100644
--- a/include/configs/mimc200.h
+++ b/include/configs/mimc200.h
@@ -129,7 +129,8 @@
 #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
 
 #if defined(CONFIG_LCD)
 #define CONFIG_CMD_BMP
diff --git a/include/mmc.h b/include/mmc.h
index 53aff9b..2607b4f 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -316,7 +316,6 @@ int board_mmc_getcd(u8 *cd, struct mmc *mmc);
 int mmc_switch_part(int dev_num, unsigned int part_num);
 
 #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
-- 
1.7.6.3



More information about the U-Boot mailing list