Skip to contentSkip to conversation

NAND feature update

PATCH New DENX Support System 1 participant 1 message Aug 20, 2006

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NAND feature update

Hello list,

inside the automatic U-Boot patch tracking system a new ticket [DNX#2006082142000017] was created:

<snip>

Quoted 98 lines

Wolfgang,

this patch implements functionaly I found useful to have and hopefuly others can benefit from it too. Please drop all my previous NAND related,
not yet applied patches. Once (if) applied I will rediff the rest.

Now you can do:

# mtdparts
[snip]
device nand0 <omapnand.0>, # parts = 5
 #: name                        size            offset         
mask_flags
 0: kernel0                     0x00400000      0x00000000      0
 1: rootfs0                     0x02800000      0x00400000      0
 2: kernel1                     0x00400000      0x02c00000      0
 3: rootfs1                     0x02800000      0x03000000      0
 4: data                        0x02800000      0x05800000      0
# nand write 10400000 kernel1 100000
NAND write: device 0 offset 0x2c00000, size 0x100000  1048576 bytes
written: OK
# nboot kernel0
Loading from NAND 128MiB 3,3V 8-bit, offset 0x0
...
# nand era kernel1
NAND erase: device 0 offset 0x2c00000, size 0x400000 OK

or

# nand era nand0,2
NAND erase: device 0 offset 0x2c00000, size 0x400000 OK
# chpart rootfs1
partition changed to nand0,3
# fsload /boot/uImage
### JFFS2 loading '/boot/uImage' to 0x10400000
...

etc...

Best regards,
ladis

CHANGELOG
* Patch by Ladislav Michl, 18 Aug 2006:
chpart, nboot and NAND subsystem related commands now accept also
partition
name to specify offset.

common/cmd_jffs2.c +0 -0
index 201c3c1..90b2930 100644
@@ -1300,7 +1303,7 @@ static void list_partitions(void)
  * Given partition identifier in form of <dev_type><dev_num>,<part_num>

find
* corresponding device and verify partition number.
*
- * @param id string describing device and partition
+ * @param id string describing device and partition or partition name
* @param dev pointer to the requested device (output)
* @param part_num verified partition number (output)
* @param part pointer to requested partition (output)

common/cmd_jffs2.c +12 -0
@@ -1309,11 +1312,23 @@ static void list_partitions(void)
 int find_dev_and_part(const char *id, struct mtd_device **dev,
 		u8 *part_num, struct part_info **part)
 {
+	struct list_head *dentry, *pentry;
 	u8 type, dnum, pnum;
 	const char *p;
 
 	DEBUGF("--- find_dev_and_part ---\nid = %s\n", id);
 
+	list_for_each(dentry, &devices) {
+		*part_num = 0;
+		*dev = list_entry(dentry, struct mtd_device, link);
+		list_for_each(pentry, &(*dev)->parts) {
+			*part = list_entry(pentry, struct part_info, link);
+			if (strcmp((*part)->name, id) == 0)
+				return 0;
+			(*part_num)++;
+		}
+	}
+
 	p = id;
 	*dev = NULL;
 	*part = NULL;
common/cmd_nand.c +0 -0
index 21adb1b..2c9268c 100644

common/cmd_nand.c #endif · line 37

Quoted 2 lines
common/cmd_nand.c +0 -0
@@ -36,6 +36,15 @@ #endif
 #include <jffs2/jffs2.h>
 #include <nand.h>

</snip>

Your U-Boot support team