Commit 81724e09a018cf002be1bbb1a89b4b25e5b6f5c4

Authored by Andreas Henriksson
Committed by Andreas Bießmann
1 parent de4fdfc1f2

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>

Showing 3 changed files with 48 additions and 0 deletions Side-by-side Diff

arch/arm/cpu/arm926ejs/at91/at91sam9263_devices.c
... ... @@ -143,6 +143,31 @@
143 143 }
144 144 #endif
145 145  
  146 +#if defined(CONFIG_GENERIC_ATMEL_MCI)
  147 +void at91_mci_hw_init(void)
  148 +{
  149 + /* Enable mci clock */
  150 + struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
  151 + writel(1 << ATMEL_ID_MCI1, &pmc->pcer);
  152 +
  153 + at91_set_a_periph(AT91_PIO_PORTA, 6, PUP); /* MCI1_CK */
  154 +
  155 +#if defined(CONFIG_ATMEL_MCI_PORTB)
  156 + at91_set_a_periph(AT91_PIO_PORTA, 21, PUP); /* MCI1_CDB */
  157 + at91_set_a_periph(AT91_PIO_PORTA, 22, PUP); /* MCI1_DB0 */
  158 + at91_set_a_periph(AT91_PIO_PORTA, 23, PUP); /* MCI1_DB1 */
  159 + at91_set_a_periph(AT91_PIO_PORTA, 24, PUP); /* MCI1_DB2 */
  160 + at91_set_a_periph(AT91_PIO_PORTA, 25, PUP); /* MCI1_DB3 */
  161 +#else
  162 + at91_set_a_periph(AT91_PIO_PORTA, 7, PUP); /* MCI1_CDA */
  163 + at91_set_a_periph(AT91_PIO_PORTA, 8, PUP); /* MCI1_DA0 */
  164 + at91_set_a_periph(AT91_PIO_PORTA, 9, PUP); /* MCI1_DA1 */
  165 + at91_set_a_periph(AT91_PIO_PORTA, 10, PUP); /* MCI1_DA2 */
  166 + at91_set_a_periph(AT91_PIO_PORTA, 11, PUP); /* MCI1_DA3 */
  167 +#endif
  168 +}
  169 +#endif
  170 +
146 171 #ifdef CONFIG_MACB
147 172 void at91_macb_hw_init(void)
148 173 {
board/atmel/at91sam9263ek/at91sam9263ek.c
... ... @@ -24,6 +24,7 @@
24 24 #include <net.h>
25 25 #endif
26 26 #include <netdev.h>
  27 +#include <atmel_mci.h>
27 28  
28 29 DECLARE_GLOBAL_DATA_PTR;
29 30  
... ... @@ -212,6 +213,15 @@
212 213 lcd_puts ("\n");
213 214 }
214 215 #endif /* CONFIG_LCD_INFO */
  216 +#endif
  217 +
  218 +#ifdef CONFIG_GENERIC_ATMEL_MCI
  219 +int board_mmc_init(bd_t *bd)
  220 +{
  221 + at91_mci_hw_init();
  222 +
  223 + return atmel_mci_init((void *)ATMEL_BASE_MCI1);
  224 +}
215 225 #endif
216 226  
217 227 int board_early_init_f(void)
include/configs/at91sam9263ek.h
... ... @@ -103,6 +103,7 @@
103 103 #define CONFIG_CMD_PING 1
104 104 #define CONFIG_CMD_DHCP 1
105 105 #define CONFIG_CMD_NAND 1
  106 +#define CONFIG_CMD_MMC
106 107 #define CONFIG_CMD_USB 1
107 108  
108 109 /* SDRAM */
... ... @@ -122,6 +123,18 @@
122 123 #define AT91_SPI_CLK 15000000
123 124 #define DATAFLASH_TCSS (0x1a << 16)
124 125 #define DATAFLASH_TCHS (0x1 << 24)
  126 +
  127 +/* MMC */
  128 +#ifdef CONFIG_CMD_MMC
  129 +#define CONFIG_MMC
  130 +#define CONFIG_GENERIC_MMC
  131 +#define CONFIG_GENERIC_ATMEL_MCI
  132 +#endif
  133 +
  134 +/* FAT */
  135 +#ifdef CONFIG_CMD_FAT
  136 +#define CONFIG_DOS_PARTITION
  137 +#endif
125 138  
126 139 /* NOR flash, if populated */
127 140 #ifdef CONFIG_SYS_USE_NORFLASH