Patchwork [U-Boot,1/2] arm: at91: enable mci support for at91sam9g20ek.

login
register
mail settings
Submitter Wu, Josh
Date March 29, 2013, 6:28 a.m.
Message ID <1364538522-11853-2-git-send-email-josh.wu@atmel.com>
Download mbox | patch
Permalink /patch/232298/
State Accepted
Delegated to: Andreas BieƟmann
Headers show

Comments

Wu, Josh - March 29, 2013, 6:28 a.m.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
 arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c |    4 ++++
 board/atmel/at91sam9260ek/at91sam9260ek.c         |   10 ++++++++++
 include/configs/at91sam9260ek.h                   |   16 ++++++++++++++--
 3 files changed, 28 insertions(+), 2 deletions(-)

Patch

diff --git a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
index 19ec615..5e995e1 100644
--- a/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
+++ b/arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c
@@ -203,6 +203,10 @@  void at91_macb_hw_init(void)
 #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_MCI, &pmc->pcer);
+
 	at91_set_a_periph(AT91_PIO_PORTA, 8, 1);	/* MCCK */
 #if defined(CONFIG_ATMEL_MCI_PORTB)
 	at91_set_b_periph(AT91_PIO_PORTA, 1, 1);	/* MCCDB */
diff --git a/board/atmel/at91sam9260ek/at91sam9260ek.c b/board/atmel/at91sam9260ek/at91sam9260ek.c
index 3aa394a..1e7b33e 100644
--- a/board/atmel/at91sam9260ek/at91sam9260ek.c
+++ b/board/atmel/at91sam9260ek/at91sam9260ek.c
@@ -30,6 +30,7 @@ 
 #include <asm/arch/at91_pmc.h>
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/gpio.h>
+#include <atmel_mci.h>
 
 #if defined(CONFIG_RESET_PHY_R) && defined(CONFIG_MACB)
 # include <net.h>
@@ -143,6 +144,15 @@  static void at91sam9260ek_macb_hw_init(void)
 }
 #endif
 
+#ifdef CONFIG_GENERIC_ATMEL_MCI
+int board_mmc_init(bd_t *bd)
+{
+	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/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index ebcc69a..f6193bb 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -105,6 +105,8 @@ 
 #define CONFIG_CMD_PING		1
 #define CONFIG_CMD_DHCP		1
 #define CONFIG_CMD_NAND		1
+#define CONFIG_CMD_MMC
+#define CONFIG_CMD_FAT
 #define CONFIG_CMD_USB		1
 
 /*
@@ -158,6 +160,18 @@ 
 #define CONFIG_SYS_NAND_READY_PIN	AT91_PIN_PC13
 #endif
 
+/* 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 - no real flash on this board */
 #define CONFIG_SYS_NO_FLASH			1
 
@@ -170,13 +184,11 @@ 
 /* USB */
 #define CONFIG_USB_ATMEL
 #define CONFIG_USB_OHCI_NEW		1
-#define CONFIG_DOS_PARTITION		1
 #define CONFIG_SYS_USB_OHCI_CPU_INIT		1
 #define CONFIG_SYS_USB_OHCI_REGS_BASE		0x00500000	/* AT91SAM9260_UHP_BASE */
 #define CONFIG_SYS_USB_OHCI_SLOT_NAME		"at91sam9260"
 #define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS	2
 #define CONFIG_USB_STORAGE		1
-#define CONFIG_CMD_FAT			1
 
 #define CONFIG_SYS_LOAD_ADDR			0x22000000	/* load address */