From 111ec4c65208bb13f3957d5a1c84b228eb83bdde Mon Sep 17 00:00:00 2001 From: "Wu, Josh" Date: Mon, 2 Feb 2015 17:51:00 +0800 Subject: ARM: at91: at91sam9rlek: add mci support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch enable the MCI support for at91sam9rlek board. Signed-off-by: Josh Wu [rebase on ToT] Signed-off-by: Andreas Bießmann --- arch/arm/mach-at91/arm926ejs/at91sam9rl_devices.c | 17 +++++++++++++++++ board/atmel/at91sam9rlek/at91sam9rlek.c | 10 ++++++++++ include/configs/at91sam9rlek.h | 11 +++++++++++ 3 files changed, 38 insertions(+) diff --git a/arch/arm/mach-at91/arm926ejs/at91sam9rl_devices.c b/arch/arm/mach-at91/arm926ejs/at91sam9rl_devices.c index 0ec32c3ab9..857c864068 100644 --- a/arch/arm/mach-at91/arm926ejs/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/arm926ejs/at91sam9rl_devices.c @@ -101,3 +101,20 @@ void at91_spi0_hw_init(unsigned long cs_mask) } } #endif + +#ifdef CONFIG_GENERIC_ATMEL_MCI +void at91_mci_hw_init(void) +{ + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; + + at91_set_a_periph(AT91_PIO_PORTA, 2, 0); /* MCI CLK */ + at91_set_a_periph(AT91_PIO_PORTA, 1, 0); /* MCI CDA */ + at91_set_a_periph(AT91_PIO_PORTA, 0, 0); /* MCI DA0 */ + at91_set_a_periph(AT91_PIO_PORTA, 3, 0); /* MCI DA1 */ + at91_set_a_periph(AT91_PIO_PORTA, 4, 0); /* MCI DA2 */ + at91_set_a_periph(AT91_PIO_PORTA, 5, 0); /* MCI DA3 */ + + /* Enable clock */ + writel(1 << ATMEL_ID_MCI, &pmc->pcer); +} +#endif diff --git a/board/atmel/at91sam9rlek/at91sam9rlek.c b/board/atmel/at91sam9rlek/at91sam9rlek.c index 56ca1d4f7e..f995cef1e2 100644 --- a/board/atmel/at91sam9rlek/at91sam9rlek.c +++ b/board/atmel/at91sam9rlek/at91sam9rlek.c @@ -19,6 +19,7 @@ #include #include +#include #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB) #include #endif @@ -162,6 +163,15 @@ void lcd_show_board_info(void) #endif /* CONFIG_LCD_INFO */ #endif +#ifdef CONFIG_GENERIC_ATMEL_MCI +int board_mmc_init(bd_t *bis) +{ + at91_mci_hw_init(); + + return atmel_mci_init((void *)ATMEL_BASE_MCI); +} +#endif + int board_early_init_f(void) { struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC; diff --git a/include/configs/at91sam9rlek.h b/include/configs/at91sam9rlek.h index f435d71d25..2ed92d61d9 100644 --- a/include/configs/at91sam9rlek.h +++ b/include/configs/at91sam9rlek.h @@ -124,6 +124,17 @@ #endif +/* MMC */ +#define CONFIG_CMD_MMC + +#ifdef CONFIG_CMD_MMC +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_GENERIC_ATMEL_MCI +#define CONFIG_CMD_FAT +#define CONFIG_DOS_PARTITION +#endif + /* Ethernet - not present */ /* USB - not supported */ -- cgit v1.2.1