]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
at91sam9263ek: add mmc support
authorAndreas Henriksson <andreas.henriksson@endian.se>
Mon, 27 Jan 2014 18:18:59 +0000 (19:18 +0100)
committerAndreas Bießmann <andreas.devel@googlemail.com>
Sun, 9 Mar 2014 17:24:52 +0000 (18:24 +0100)
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>
arch/arm/cpu/arm926ejs/at91/at91sam9263_devices.c
board/atmel/at91sam9263ek/at91sam9263ek.c
include/configs/at91sam9263ek.h

index 99a39134defaef6b4f3fbf55fa1993c4a0b07635..6b51d5f355f93c929657d494cab362c125dfd212 100644 (file)
@@ -143,6 +143,31 @@ void at91_spi1_hw_init(unsigned long cs_mask)
 }
 #endif
 
 }
 #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)
 {
 #ifdef CONFIG_MACB
 void at91_macb_hw_init(void)
 {
index d42a1730cc38fe338f70526190dda0ad71349d00..4b1455465a5e2cf55f118337bd6246b11a57f678 100644 (file)
@@ -24,6 +24,7 @@
 #include <net.h>
 #endif
 #include <netdev.h>
 #include <net.h>
 #endif
 #include <netdev.h>
+#include <atmel_mci.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -214,6 +215,15 @@ void lcd_show_board_info(void)
 #endif /* CONFIG_LCD_INFO */
 #endif
 
 #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;
 int board_early_init_f(void)
 {
        struct at91_pmc *pmc = (struct at91_pmc *)ATMEL_BASE_PMC;
index b9aa03603968d0a3e71cd49de0d3c8cf56887f8a..48c12ea8801985eb47e2788dcea33c63dc04b5bf 100644 (file)
 #define CONFIG_CMD_PING                1
 #define CONFIG_CMD_DHCP                1
 #define CONFIG_CMD_NAND                1
 #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 */
 #define CONFIG_CMD_USB         1
 
 /* SDRAM */
 #define DATAFLASH_TCSS                 (0x1a << 16)
 #define DATAFLASH_TCHS                 (0x1 << 24)
 
 #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
 /* NOR flash, if populated */
 #ifdef CONFIG_SYS_USE_NORFLASH
 #define CONFIG_SYS_FLASH_CFI                   1