at91sam9263ek: add mmc support

Add support for using the Atmel MCI driver on at91sam9263ek.
This change is modeled after the existing at91sam9260ek support.

Please note that this hooks up slot1 (MCI1) for SD. Not both.

Tested with at91bootstrap and u-boot on dataflash in slot 0
and fat-formatted 8GB SDHC in slot 1 on first revision
at91sam9263ek (which must use dataflash in slot0 to boot).

CONFIG_ATMEL_MCI_PORTB not tested.

Signed-off-by: Andreas Henriksson <andreas.henriksson@endian.se>
[remove empty line]
Signed-off-by: Andreas Bießmann <andreas.devel@googlemail.com>
This commit is contained in:
Andreas Henriksson 2014-01-27 19:18:59 +01:00 committed by Andreas Bießmann
parent de4fdfc1f2
commit 81724e09a0
3 changed files with 48 additions and 0 deletions

View file

@ -143,6 +143,31 @@ void at91_spi1_hw_init(unsigned long cs_mask)
}
#endif
#if defined(CONFIG_GENERIC_ATMEL_MCI)
void at91_mci_hw_init(void)
{
/* Enable mci clock */
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
writel(1 << ATMEL_ID_MCI1, &pmc->pcer);
at91_set_a_periph(AT91_PIO_PORTA, 6, PUP); /* MCI1_CK */
#if defined(CONFIG_ATMEL_MCI_PORTB)
at91_set_a_periph(AT91_PIO_PORTA, 21, PUP); /* MCI1_CDB */
at91_set_a_periph(AT91_PIO_PORTA, 22, PUP); /* MCI1_DB0 */
at91_set_a_periph(AT91_PIO_PORTA, 23, PUP); /* MCI1_DB1 */
at91_set_a_periph(AT91_PIO_PORTA, 24, PUP); /* MCI1_DB2 */
at91_set_a_periph(AT91_PIO_PORTA, 25, PUP); /* MCI1_DB3 */
#else
at91_set_a_periph(AT91_PIO_PORTA, 7, PUP); /* MCI1_CDA */
at91_set_a_periph(AT91_PIO_PORTA, 8, PUP); /* MCI1_DA0 */
at91_set_a_periph(AT91_PIO_PORTA, 9, PUP); /* MCI1_DA1 */
at91_set_a_periph(AT91_PIO_PORTA, 10, PUP); /* MCI1_DA2 */
at91_set_a_periph(AT91_PIO_PORTA, 11, PUP); /* MCI1_DA3 */
#endif
}
#endif
#ifdef CONFIG_MACB
void at91_macb_hw_init(void)
{

View file

@ -24,6 +24,7 @@
#include <net.h>
#endif
#include <netdev.h>
#include <atmel_mci.h>
DECLARE_GLOBAL_DATA_PTR;
@ -214,6 +215,15 @@ void lcd_show_board_info(void)
#endif /* CONFIG_LCD_INFO */
#endif
#ifdef CONFIG_GENERIC_ATMEL_MCI
int board_mmc_init(bd_t *bd)
{
at91_mci_hw_init();
return atmel_mci_init((void *)ATMEL_BASE_MCI1);
}
#endif
int board_early_init_f(void)
{
struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;

View file

@ -103,6 +103,7 @@
#define CONFIG_CMD_PING 1
#define CONFIG_CMD_DHCP 1
#define CONFIG_CMD_NAND 1
#define CONFIG_CMD_MMC
#define CONFIG_CMD_USB 1
/* SDRAM */
@ -123,6 +124,18 @@
#define DATAFLASH_TCSS (0x1a << 16)
#define DATAFLASH_TCHS (0x1 << 24)
/* MMC */
#ifdef CONFIG_CMD_MMC
#define CONFIG_MMC
#define CONFIG_GENERIC_MMC
#define CONFIG_GENERIC_ATMEL_MCI
#endif
/* FAT */
#ifdef CONFIG_CMD_FAT
#define CONFIG_DOS_PARTITION
#endif
/* NOR flash, if populated */
#ifdef CONFIG_SYS_USE_NORFLASH
#define CONFIG_SYS_FLASH_CFI 1