[U-Boot] No nandflash found if CONFIG_CMD_UBI is enabled.

Anders Darander anders.darander at gmail.com
Tue Jun 2 09:08:38 CEST 2009


Hi!

I'm trying to enable the UBI-support in U-Boot (later intending to
also enable the UBIFS-support). This is on a AT91SAM9260-based system.
I've verified the same behaviour using both the
at91sam9260ek_nandflash_config and a forward-ported patch for the
Olimex sam9_l9260 board. Currently I'm concentrating on the
at91sam9260ek_nandflash_config, as this one is in the U-Boot
repository.

However, once I enable the UBI-support, the nand-flash chip is not detected...
I've tried to trace the problem, and I've found that it is
timer-related. It seems that once I enable CONFIG_CMD_UBI, the timer
does not work (the debug-printf in the get_ticks()-function in the
supplied patch is not printing). If I comment out CONFIG_CMD_UBI,
U-Boot continously prints stuff like:
Debug: timestamp=6
Debug: timestamp=10215
Debug: timestamp=21556
which is expected.

I'm compiling by running:
make clean
make at91sam9260ek_nandflash_config
make
and then flashing u-boot.bin to the board.

The supplied patch works, unless the '#define CONFIG_CMD_UBI       1'
is uncommented, in which case the get_ticks function in
cpu/arm926ejs/at91/timer.c never seems to be called. I've sofar been
unable to understand why.

The U-Boot versions used are from the u-boot.git and u-boot-at91.git
repositories, as check out yesterday and today:
U-Boot, with the latest commit 5520ab1f7685721314dcfb7cdcc7c15e6571473f
U-Boot-at91, with the latest commit f8ddcd58221cab63dd25c2324dd2032487f748b1

I've also verifed the same behaviour with both the CodeSourcery's
toolchain (Sourcery G++ Lite 2008q1-126, gcc 4.2.3), as well as my own
build through buildroot (gcc 4.3.3).

Regards,
Anders

The modifications I've done, as produced by 'git diff':
diff --git a/cpu/arm926ejs/at91/timer.c b/cpu/arm926ejs/at91/timer.c
index c84cb5e..a0a409e 100644
--- a/cpu/arm926ejs/at91/timer.c
+++ b/cpu/arm926ejs/at91/timer.c
@@ -91,6 +91,7 @@ unsigned long long get_ticks(void)
 	else			/* we have rollover of incrementer */
 		timestamp += (0xFFFFFFFF - lastinc) + now;
 	lastinc = now;
+	printf("Debug: timestamp=%lu\n", timestamp);
 	return timestamp;
 }

diff --git a/include/configs/at91sam9260ek.h b/include/configs/at91sam9260ek.h
index e46c9d6..e32de31 100644
--- a/include/configs/at91sam9260ek.h
+++ b/include/configs/at91sam9260ek.h
@@ -85,11 +85,14 @@
 #undef CONFIG_CMD_IMLS
 #undef CONFIG_CMD_LOADS
 #undef CONFIG_CMD_SOURCE
+#undef CONFIG_CMD_FLASH

 #define CONFIG_CMD_PING		1
 #define CONFIG_CMD_DHCP		1
 #define CONFIG_CMD_NAND		1
 #define CONFIG_CMD_USB		1
+#define CONFIG_CMD_MTDPARTS     1
+//#define CONFIG_CMD_UBI          1

 /* SDRAM */
 #define CONFIG_NR_DRAM_BANKS		1
@@ -126,6 +129,17 @@
 #define CONFIG_SYS_NAND_READY_PIN		AT91_PIN_PC13
 #endif

+/* Ubi */
+#define CONFIG_SYS_USE_UBI
+#define CONFIG_RBTREE
+#define CONFIG_MTD_PARTITIONS
+#define MTDIDS_DEFAULT		"nand0=at_nand"
+#define MTDPARTS_DEFAULT	"mtdparts=at91_nand:128k(bootstrap),"	\
+					"256k(U-Boot),"			\
+					"128k(U-Bootenv1),"		\
+					"128k(U-Bootenv2),"		\
+					"-(ubifs)"
+
 /* NOR flash - no real flash on this board */
 #define CONFIG_SYS_NO_FLASH			1

@@ -189,11 +203,10 @@
 #define CONFIG_ENV_SIZE		0x20000		/* 1 sector = 128 kB */
 #define CONFIG_BOOTCOMMAND	"nand read 0x22000000 0xA0000 0x200000; bootm"
 #define CONFIG_BOOTARGS		"console=ttyS0,115200 "			\
-				"root=/dev/mtdblock5 "			\
 				"mtdparts=at91_nand:128k(bootstrap)ro,"	\
 				"256k(uboot)ro,128k(env1)ro,"		\
-				"128k(env2)ro,2M(linux),-(root) "	\
-				"rw rootfstype=jffs2"
+				"128k(env2)ro,-(ubifs) "	\
+				"ubi.mtd=4"

 #endif


-- 
Anders Darander


More information about the U-Boot mailing list