Skip to contentSkip to conversation

arm: at91: enable mmc support for at91sam9g20ek

PATCH New Josh Wu 1 participant 3 messages Mar 29, 2013

Subsystems (2)
lore
Share & tools
lore

Josh Wu

author
#0 lore raw

cover arm: at91: enable mmc support for at91sam9g20ek

This patch series enable mmc command support for at91sam9g20ek board. It also support save environment in mmc card.

Josh Wu (2):
arm: at91: enable mci support for at91sam9g20ek.
arm: at91: add at91sam9g20ek_mmc_config, which can save environment
in mmc card

 arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c |    4 +++
 board/atmel/at91sam9260ek/at91sam9260ek.c         |   10 ++++++
 boards.cfg                                        |    1 +
 include/configs/at91sam9260ek.h                   |   34 +++++++++++++++++++--
 4 files changed, 46 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.9.5
author
#1 lore raw

PATCH 1/2 arm: at91: enable mci support for at91sam9g20ek.

---
 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(-)
arch/arm/cpu/arm926ejs/at91/at91sam9260_devices.c +4 -0
index 19ec615..5e995e1 100644
@@ -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 */
board/atmel/at91sam9260ek/at91sam9260ek.c +10 -0
index 3aa394a..1e7b33e 100644
@@ -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;
include/configs/at91sam9260ek.h +14 -2
index ebcc69a..f6193bb 100644
@@ -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 */
 
Signature · 1 line
1.7.9.5
author
#2 lore raw

PATCH 2/2 arm: at91: add at91sam9g20ek_mmc_config, which can save environment in mmc card

In reply to Josh Wu
---
 boards.cfg                      |    1 +
 include/configs/at91sam9260ek.h |   18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
boards.cfg +1 -0
index 272a5fc..871f4b6 100644
@@ -94,6 +94,7 @@ at91sam9g10ek_dataflash_cs3  arm         arm926ejs   at91sam9261ek       atmel
 at91sam9g10ek_nandflash      arm         arm926ejs   at91sam9261ek       atmel          at91        at91sam9261ek:AT91SAM9G10,SYS_USE_NANDFLASH
 at91sam9g20ek_dataflash_cs0  arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS0
 at91sam9g20ek_dataflash_cs1  arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,SYS_USE_DATAFLASH_CS1
+at91sam9g20ek_mmc            arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,SYS_USE_MMC
 at91sam9g20ek_nandflash      arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,SYS_USE_NANDFLASH
 at91sam9g20ek_2mmc_nandflash arm         arm926ejs   at91sam9260ek       atmel          at91        at91sam9260ek:AT91SAM9G20,AT91SAM9G20EK_2MMC,SYS_USE_NANDFLASH
 at91sam9m10g45ek_nandflash   arm         arm926ejs   at91sam9m10g45ek    atmel          at91        at91sam9m10g45ek:AT91SAM9M10G45,SYS_USE_NANDFLASH
include/configs/at91sam9260ek.h +17 -1
index f6193bb..82cfa2a 100644
@@ -223,7 +223,7 @@
 				"mtdparts=atmel_nand:-(root) "		\
 				"rw rootfstype=jffs2"
 
-#else /* CONFIG_SYS_USE_NANDFLASH */
+#elif defined(CONFIG_SYS_USE_NANDFLASH)
 
 /* bootstrap + u-boot + env + linux in nandflash */
 #define CONFIG_ENV_IS_IN_NAND	1
@@ -238,6 +238,22 @@
 	"512k(dtb),6M(kernel)ro,-(rootfs) "				\
 	"root=/dev/mtdblock7 rw rootfstype=jffs2"
 
+#else	/* CONFIG_SYS_USE_MMC */
+/* bootstrap + u-boot + env + linux in mmc */
+#define CONFIG_ENV_IS_IN_MMC
+/* For FAT system, most cases it should be in the reserved sector */
+#define CONFIG_ENV_OFFSET		0x2000
+#define CONFIG_ENV_SIZE			0x1000
+#define CONFIG_SYS_MMC_ENV_DEV		0
+
+#define CONFIG_BOOTCOMMAND						\
+	"fatload mmc 0:1 0x22000000 uImage; bootm"
+#define CONFIG_BOOTARGS							\
+	"console=ttyS0,115200 earlyprintk "				\
+	"mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro,"		\
+	"256k(env),256k(env_redundant),256k(spare),"			\
+	"512k(dtb),6M(kernel)ro,-(rootfs) "				\
+	"root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait"
 #endif
 
 #define CONFIG_SYS_PROMPT		"U-Boot> "
Signature · 1 line
1.7.9.5