Skip to contentSkip to conversation

spl: Lightweight UBI and UBI fastmap support

PATCH Superseded Ladislav Michl 4 participants 20 messages Jan 4, 2016 – Jan 11, 2016

Subsystems (2)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover spl: Lightweight UBI and UBI fastmap support

This is an update of Thomas's patchset:
https://patchwork.ozlabs.org/patch/367305/
https://patchwork.ozlabs.org/patch/367306/

Changes from previous version:
- fixes ubi_calc_fm_size to include also sizeof(struct ubi_fm_sb)
- dropped private copy of ubi-media.h
- ubi-wrapper.h now contains only needed definitions from ubi.h and ubi-user.h
- used return values from errno.h
- added example implementation for igep00x0.

#1 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

---
 drivers/mtd/nand/nand_spl_simple.c | 64 ++++++++++++++++++++++++++++++++++++++
 include/nand.h                     |  1 +
 2 files changed, 65 insertions(+)
drivers/mtd/nand/nand_spl_simple.c +64 -0
index e69f662..2e1af53 100644
@@ -209,6 +209,70 @@ static int nand_read_page(int block, int page, void *dst)
 }
 #endif
 
+#ifdef CONFIG_SPL_UBI
+/*
+ * Temporary storage for non NAND page aligned and non NAND page sized
+ * reads. Note: This does not support runtime detected FLASH yet, but
+ * that should be reasonably easy to fix by making the buffer large
+ * enough :)
+ */
+static u8 scratch_buf[CONFIG_SYS_NAND_PAGE_SIZE];
+
+/**
+ * nand_spl_read_flash - Read data from flash into a buffer
+ * @pnum:	Number of the physical eraseblock
+ * @offset:	Data offset from the start of @pnum
+ * @len:	Data size to read
+ * @dest:	Address of the destination buffer
+ *
+ * This could be further optimized if we'd have a subpage read
+ * function in the simple code. On NAND which allows subpage reads
+ * this would spare quite some time to readout e.g. the VID header of
+ * UBI.
+ *
+ * Notes:
+ *
+ *	@offset + @len are not allowed to be larger than a physical
+ *	erase block. No sanity check done for simplicity reasons.
+ *
+ * To support runtime detected flash this needs to be extended by
+ * information about the actual flash geometry, but thats beyond the
+ * scope of this effort and for most applications where fast boot is
+ * required its a non issue anyway.
+ */
+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)
+{
+	u32 offs, page, read, toread = len;
+
+	/* Calculate the page number */
+	page = offset / CONFIG_SYS_NAND_PAGE_SIZE;
+
+	/* Offset to the start of a flash page */
+	offs = offset % CONFIG_SYS_NAND_PAGE_SIZE;
+
+	while (toread) {
+		/*
+		 * Non page aligned reads go to the scratch buffer.
+		 * Page aligned reads go directly to the destination.
+		 */
+		if (offs || toread < CONFIG_SYS_NAND_PAGE_SIZE) {
+			nand_read_page(pnum, page, scratch_buf);
+			read = min(len, toread);
+			read = min(read, CONFIG_SYS_NAND_PAGE_SIZE - offs);
+			memcpy(dest, scratch_buf + offs, read);
+			offs = 0;
+		} else {
+			nand_read_page(pnum, page, dest);
+			read = CONFIG_SYS_NAND_PAGE_SIZE;
+		}
+		page++;
+		toread -= read;
+		dest += read;
+	}
+	return 0;
+}
+#endif
+
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
 {
 	unsigned int block, lastblock;
include/nand.h +1 -0
index d2a53ab..b8bc952 100644
@@ -124,6 +124,7 @@ int nand_unlock(nand_info_t *meminfo, loff_t start, size_t length,
 int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest);
 void nand_deselect(void);
 
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
Signature · 1 line
2.1.4
#2 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 11 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

---
 drivers/mtd/nand/nand_spl_simple.c | 64
++++++++++++++++++++++++++++++++++++++ include/nand.h                    
|  1 +
 2 files changed, 65 insertions(+)

There is no changelog from the original submission. Also, CCing Scott.

Best regards,
Marek Vasut

#3 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 6 lines · Marek Vasut
Quoted 5 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

Quoted 8 lines
Quoted 6 lines
---
 drivers/mtd/nand/nand_spl_simple.c | 64
++++++++++++++++++++++++++++++++++++++ include/nand.h                    
|  1 +
 2 files changed, 65 insertions(+)

There is no changelog from the original submission. Also, CCing Scott.

It is the same patch, unmodified. What am I supposed to describe in changelog? Changelog for patch serie is in PATCHv2 0/3. Also, patch author and Heiko dropped from Cc by intent? Original, for reference: https://patchwork.ozlabs.org/patch/367305/

regards,
ladis

#4 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 14 lines · Ladislav Michl
Quoted 13 lines · Marek Vasut
Quoted 12 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

---

 drivers/mtd/nand/nand_spl_simple.c | 64

++++++++++++++++++++++++++++++++++++++ include/nand.h

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

| 1 +

 2 files changed, 65 insertions(+)

There is no changelog from the original submission. Also, CCing Scott.

It is the same patch, unmodified. What am I supposed to describe in changelog?

This should really be stated somewhere.

Quoted 1 line

Changelog for patch serie is in PATCHv2 0/3.

Per-patch changlog is far more favorable.

Quoted 1 line

Also, patch author and Heiko dropped from Cc by intent?

I don't see Heiko on CC in the patches posted to the list.

Quoted 4 lines

Original, for reference: https://patchwork.ozlabs.org/patch/367305/

regards,
ladis

Best regards,
Marek Vasut

#5 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

In reply to Ladislav Michl
Quoted 6 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

Where is your signoff?

Did Thomas really write this patch for U-Boot (if so, why isn't he on CC?) or is it taken from some other project?

Quoted 18 lines
---
 drivers/mtd/nand/nand_spl_simple.c | 64
++++++++++++++++++++++++++++++++++++++
 include/nand.h                     |  1 +
 2 files changed, 65 insertions(+)
drivers/mtd/nand/nand_spl_simple.c +2 -0
index e69f662..2e1af53 100644
@@ -209,6 +209,70 @@ static int nand_read_page(int block, int page, void
 *dst)
 }
 #endif
 
+#ifdef CONFIG_SPL_UBI
+/*

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void · line 224

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+ * Temporary storage for non NAND page aligned and non NAND page sized
+ * reads. Note: This does not support runtime detected FLASH yet, but
+ * that should be reasonably easy to fix by making the buffer large
+ * enough :)
+ */
+static u8 scratch_buf[CONFIG_SYS_NAND_PAGE_SIZE];
+
+/**
+ * nand_spl_read_flash - Read data from flash into a buffer
+ * @pnum:	Number of the physical eraseblock

s/pnum/block/g

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+ * @offset:	Data offset from the start of @pnum
+ * @len:	Data size to read
+ * @dest:	Address of the destination buffer
+ *
+ * This could be further optimized if we'd have a subpage read
+ * function in the simple code. On NAND which allows subpage reads
+ * this would spare quite some time to readout e.g. the VID header of
+ * UBI.
+ *
+ * Notes:

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void *dst) · line 243

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+ *
+ *	@offset + @len are not allowed to be larger than a physical
+ *	erase block. No sanity check done for simplicity reasons.
+ *
+ * To support runtime detected flash this needs to be extended by
+ * information about the actual flash geometry, but thats beyond the
+ * scope of this effort and for most applications where fast boot is
+ * required its a non issue anyway.
+ */
+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)

This name is too generic and doesn't suggest what's different compared to nand_spl_load_image (they both read data from flash into a buffer).

How about nand_spl_read_block()?

Quoted 7 lines
drivers/mtd/nand/nand_spl_simple.c +7 -0
+{
+	u32 offs, page, read, toread = len;
+
+	/* Calculate the page number */
+	page = offset / CONFIG_SYS_NAND_PAGE_SIZE;
+
+	/* Offset to the start of a flash page */

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void *dst) · line 260

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+	offs = offset % CONFIG_SYS_NAND_PAGE_SIZE;
+
+	while (toread) {
+		/*
+		 * Non page aligned reads go to the scratch buffer.
+		 * Page aligned reads go directly to the destination.
+		 */
+		if (offs || toread < CONFIG_SYS_NAND_PAGE_SIZE) {
+			nand_read_page(pnum, page, scratch_buf);
+			read = min(len, toread);

toread is always <= len, so this is pointless. As this is the only use of len after the toread init, once this is gone you could also eliminate toread and just use len.

-Scott

#6 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 9 lines · Scott Wood
Quoted 6 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

Where is your signoff?

I'm only messenger and have nothing to do with this part of patch. The other part which I touched has my signoff.

Quoted 2 lines

Did Thomas really write this patch for U-Boot (if so, why isn't he on CC?) or is it taken from some other project?

Ha! It is my mailer which broke Cc. Thomas was on Cc list and still is in my sent-mail folder. Also apologize to Marek, let's see how Cc will end this time. And yes, patch was written for U-Boot: https://patchwork.ozlabs.org/patch/367305/

Quoted 52 lines
Quoted 18 lines
---
 drivers/mtd/nand/nand_spl_simple.c | 64
++++++++++++++++++++++++++++++++++++++
 include/nand.h                     |  1 +
 2 files changed, 65 insertions(+)
drivers/mtd/nand/nand_spl_simple.c +2 -0
index e69f662..2e1af53 100644
@@ -209,6 +209,70 @@ static int nand_read_page(int block, int page, void
 *dst)
 }
 #endif
 
+#ifdef CONFIG_SPL_UBI
+/*

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void · line 224

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+ * Temporary storage for non NAND page aligned and non NAND page sized
+ * reads. Note: This does not support runtime detected FLASH yet, but
+ * that should be reasonably easy to fix by making the buffer large
+ * enough :)
+ */
+static u8 scratch_buf[CONFIG_SYS_NAND_PAGE_SIZE];
+
+/**
+ * nand_spl_read_flash - Read data from flash into a buffer
+ * @pnum:	Number of the physical eraseblock

s/pnum/block/g

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+ * @offset:	Data offset from the start of @pnum
+ * @len:	Data size to read
+ * @dest:	Address of the destination buffer
+ *
+ * This could be further optimized if we'd have a subpage read
+ * function in the simple code. On NAND which allows subpage reads
+ * this would spare quite some time to readout e.g. the VID header of
+ * UBI.
+ *
+ * Notes:

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void *dst) · line 243

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+ *
+ *	@offset + @len are not allowed to be larger than a physical
+ *	erase block. No sanity check done for simplicity reasons.
+ *
+ * To support runtime detected flash this needs to be extended by
+ * information about the actual flash geometry, but thats beyond the
+ * scope of this effort and for most applications where fast boot is
+ * required its a non issue anyway.
+ */
+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)
Quoted 4 lines

This name is too generic and doesn't suggest what's different compared to nand_spl_load_image (they both read data from flash into a buffer).

How about nand_spl_read_block()?

ok.

Quoted 13 lines
Quoted 13 lines
drivers/mtd/nand/nand_spl_simple.c +13 -0
+{
+	u32 offs, page, read, toread = len;
+
+	/* Calculate the page number */
+	page = offset / CONFIG_SYS_NAND_PAGE_SIZE;
+
+	/* Offset to the start of a flash page */
+	offs = offset % CONFIG_SYS_NAND_PAGE_SIZE;
+
+	while (toread) {
+		/*
+		 * Non page aligned reads go to the scratch buffer.
+		 * Page aligned reads go directly to the destination.
Quoted 8 lines

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void *dst) · line 260

Quoted 4 lines
drivers/mtd/nand/nand_spl_simple.c +4 -0
+		 */
+		if (offs || toread < CONFIG_SYS_NAND_PAGE_SIZE) {
+			nand_read_page(pnum, page, scratch_buf);
+			read = min(len, toread);

toread is always <= len, so this is pointless. As this is the only use of len after the toread init, once this is gone you could also eliminate toread and just use len.

ok, will change that.

Quoted 1 line

-Scott

#7 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 7 lines · Ladislav Michl
Quoted 6 lines · Scott Wood
Quoted 5 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Where is your signoff?

I'm only messenger and have nothing to do with this part of patch. The other part which I touched has my signoff.

A signoff is also supposed to be used when passing on someone else's patch, at least according to the Linux DCO process.

-Scott

#8 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

In reply to Ladislav Michl
Quoted 14 lines · Ladislav Michl
Quoted 9 lines · Scott Wood
Quoted 6 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

Where is your signoff?

I'm only messenger and have nothing to do with this part of patch. The other part which I touched has my signoff.

Quoted 6 lines
Quoted 2 lines

Did Thomas really write this patch for U-Boot (if so, why isn't he on CC?) or is it taken from some other project?

Ha! It is my mailer which broke Cc. Thomas was on Cc list and still is in my sent-mail folder. Also apologize to Marek, let's see how Cc will end this time. And yes, patch was written for U-Boot: https://patchwork.ozlabs.org/patch/367305/

Well, seems to be mailman configuration:
https://mail.python.org/pipermail/mailman-users/2006-May/051194.html
so those who received post via mailman are seeing striped Cc line. Thanks to Nathan Lynch for pointing it out.
Full Cc list:
Cc: Scott Wood <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Marek Vasut <[email protected]>

Quoted 52 lines
Quoted 52 lines
Quoted 18 lines
---
 drivers/mtd/nand/nand_spl_simple.c | 64
++++++++++++++++++++++++++++++++++++++
 include/nand.h                     |  1 +
 2 files changed, 65 insertions(+)
drivers/mtd/nand/nand_spl_simple.c +2 -0
index e69f662..2e1af53 100644
@@ -209,6 +209,70 @@ static int nand_read_page(int block, int page, void
 *dst)
 }
 #endif
 
+#ifdef CONFIG_SPL_UBI
+/*

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void · line 224

Quoted 10 lines
drivers/mtd/nand/nand_spl_simple.c +10 -0
+ * Temporary storage for non NAND page aligned and non NAND page sized
+ * reads. Note: This does not support runtime detected FLASH yet, but
+ * that should be reasonably easy to fix by making the buffer large
+ * enough :)
+ */
+static u8 scratch_buf[CONFIG_SYS_NAND_PAGE_SIZE];
+
+/**
+ * nand_spl_read_flash - Read data from flash into a buffer
+ * @pnum:	Number of the physical eraseblock

s/pnum/block/g

Quoted 20 lines
drivers/mtd/nand/nand_spl_simple.c +20 -0
+ * @offset:	Data offset from the start of @pnum
+ * @len:	Data size to read
+ * @dest:	Address of the destination buffer
+ *
+ * This could be further optimized if we'd have a subpage read
+ * function in the simple code. On NAND which allows subpage reads
+ * this would spare quite some time to readout e.g. the VID header of
+ * UBI.
+ *
+ * Notes:
+ *
+ *	@offset + @len are not allowed to be larger than a physical
+ *	erase block. No sanity check done for simplicity reasons.
+ *
+ * To support runtime detected flash this needs to be extended by
+ * information about the actual flash geometry, but thats beyond the
+ * scope of this effort and for most applications where fast boot is
+ * required its a non issue anyway.
+ */
+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)
Quoted 6 lines
Quoted 4 lines

This name is too generic and doesn't suggest what's different compared to nand_spl_load_image (they both read data from flash into a buffer).

How about nand_spl_read_block()?

ok.

Thinking about it more, I'd rather see nand_spl_read_peb(int peb, ... but that is not consistent with other nand reading functions.

Quoted 22 lines
Quoted 13 lines
Quoted 13 lines
drivers/mtd/nand/nand_spl_simple.c +13 -0
+{
+	u32 offs, page, read, toread = len;
+
+	/* Calculate the page number */
+	page = offset / CONFIG_SYS_NAND_PAGE_SIZE;
+
+	/* Offset to the start of a flash page */
+	offs = offset % CONFIG_SYS_NAND_PAGE_SIZE;
+
+	while (toread) {
+		/*
+		 * Non page aligned reads go to the scratch buffer.
+		 * Page aligned reads go directly to the destination.
Quoted 8 lines

drivers/mtd/nand/nand_spl_simple.c static int nand_read_page(int block, int page, void · line 261

Quoted 4 lines
drivers/mtd/nand/nand_spl_simple.c +4 -0
+		 */
+		if (offs || toread < CONFIG_SYS_NAND_PAGE_SIZE) {
+			nand_read_page(pnum, page, scratch_buf);
+			read = min(len, toread);

toread is always <= len, so this is pointless. As this is the only use of len after the toread init, once this is gone you could also eliminate toread and just use len.

Quoted 1 line

ok, will change that.

What about something like this? Changelog will be appended to v3. Btw, any comments to other patches in this serie?

-- >8 --

From: Thomas Gleixner <[email protected]>
Subject: nand_spl_simple: Add a simple NAND read function

To support UBI in SPL we need a simple NAND read function. Add one to nand_spl_simple and keep it as simple as it goes.

drivers/mtd/nand/nand_spl_simple.c +62 -0
index e69f662..cf80903 100644
@@ -209,6 +209,68 @@ static int nand_read_page(int block, int page, void *dst)
 }
 #endif
 
+#ifdef CONFIG_SPL_UBI
+/*
+ * Temporary storage for non NAND page aligned and non NAND page sized
+ * reads. Note: This does not support runtime detected FLASH yet, but
+ * that should be reasonably easy to fix by making the buffer large
+ * enough :)
+ */
+static u8 scratch_buf[CONFIG_SYS_NAND_PAGE_SIZE];
+
+/**
+ * nand_spl_read_block - Read data from physical eraseblock into a buffer
+ * @block:	Number of the physical eraseblock
+ * @offset:	Data offset from the start of @peb
+ * @len:	Data size to read
+ * @dst:	Address of the destination buffer
+ *
+ * This could be further optimized if we'd have a subpage read
+ * function in the simple code. On NAND which allows subpage reads
+ * this would spare quite some time to readout e.g. the VID header of
+ * UBI.
+ *
+ * Notes:
+ *	@offset + @len are not allowed to be larger than a physical
+ *	erase block. No sanity check done for simplicity reasons.
+ *
+ * To support runtime detected flash this needs to be extended by
+ * information about the actual flash geometry, but thats beyond the
+ * scope of this effort and for most applications where fast boot is
+ * required it is not an issue anyway.
+ */
+int nand_spl_read_block(int block, int offset, int len, void *dst)
+{
+	int page, read;
+
+	/* Calculate the page number */
+	page = offset / CONFIG_SYS_NAND_PAGE_SIZE;
+
+	/* Offset to the start of a flash page */
+	offset = offset % CONFIG_SYS_NAND_PAGE_SIZE;
+
+	while (len) {
+		/*
+		 * Non page aligned reads go to the scratch buffer.
+		 * Page aligned reads go directly to the destination.
+		 */
+		if (offset || len < CONFIG_SYS_NAND_PAGE_SIZE) {
+			nand_read_page(block, page, scratch_buf);
+			read = min(len, CONFIG_SYS_NAND_PAGE_SIZE - offset);
+			memcpy(dst, scratch_buf + offset, read);
+			offset = 0;
+		} else {
+			nand_read_page(block, page, dst);
+			read = CONFIG_SYS_NAND_PAGE_SIZE;
+		}
+		page++;
+		len -= read;
+		dst += read;
+	}
+	return 0;
+}
+#endif
+
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst)
 {
 	unsigned int block, lastblock;
include/nand.h +1 -0
index d2a53ab..2f9a1ec 100644
@@ -124,6 +124,7 @@ int nand_unlock(nand_info_t *meminfo, loff_t start, size_t length,
 int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
 
 int nand_spl_load_image(uint32_t offs, unsigned int size, void *dst);
+int nand_spl_read_block(int block, int offset, int len, void *dst);
 void nand_deselect(void);
 
 #ifdef CONFIG_SYS_NAND_SELECT_DEVICE
#9 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 27 lines · Ladislav Michl
Quoted 19 lines · Ladislav Michl
Quoted 9 lines · Scott Wood
Quoted 6 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

Where is your signoff?

I'm only messenger and have nothing to do with this part of patch. The other
part which I touched has my signoff.

Quoted 3 lines

Did Thomas really write this patch for U-Boot (if so, why isn't he on CC?) or
is it taken from some other project?

Quoted 6 lines

Ha! It is my mailer which broke Cc. Thomas was on Cc list and still is in my
sent-mail folder. Also apologize to Marek, let's see how Cc will end this time.
And yes, patch was written for U-Boot:
https://patchwork.ozlabs.org/patch/367305/

Quoted 11 lines

Well, seems to be mailman configuration:
https://mail.python.org/pipermail/mailman-users/2006-May/051194.html
so those who received post via mailman are seeing striped Cc line. Thanks to Nathan Lynch for pointing it out.
Full Cc list:
Cc: Scott Wood <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Marek Vasut <[email protected]>

Oh right, I forgot about that mailman bug.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)

This name is too generic and doesn't suggest what's different compared to
nand_spl_load_image (they both read data from flash into a buffer).

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

How about nand_spl_read_block()?

ok.

Thinking about it more, I'd rather see nand_spl_read_peb(int peb, ... but that is not consistent with other nand reading functions.

"peb" is cryptic, and what sort of non-physical erase block does the core NAND code deal with that warrants distinction?

Quoted 32 lines
Quoted 25 lines
Quoted 16 lines
Quoted 16 lines
drivers/mtd/nand/nand_spl_simple.c +15 -0
+{
+	u32 offs, page, read, toread = len;
+
+	/* Calculate the page number */
+	page = offset / CONFIG_SYS_NAND_PAGE_SIZE;
+
+	/* Offset to the start of a flash page */
+	offs = offset % CONFIG_SYS_NAND_PAGE_SIZE;
+
+	while (toread) {
+		/*
+		 * Non page aligned reads go to the scratch buffer.
+		 * Page aligned reads go directly to the destination.
+		 */
+		if (offs || toread < CONFIG_SYS_NAND_PAGE_SIZE) {
Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+			nand_read_page(pnum, page, scratch_buf);
+			read = min(len, toread);

toread is always <= len, so this is pointless. As this is the only use of len
after the toread init, once this is gone you could also eliminate toread and
just use len.

Quoted 1 line

ok, will change that.

What about something like this? Changelog will be appended to v3. Btw, any comments to other patches in this serie?

-- >8 --

Quoted 8 lines

From: Thomas Gleixner <[email protected]>
Subject: nand_spl_simple: Add a simple NAND read function

To support UBI in SPL we need a simple NAND read function. Add one to nand_spl_simple and keep it as simple as it goes.

-Scott

#10 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 50 lines · Scott Wood
Quoted 27 lines · Ladislav Michl
Quoted 19 lines · Ladislav Michl
Quoted 9 lines · Scott Wood
Quoted 6 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add one to nand_spl_simple and keep it as simple as it goes.

Where is your signoff?

I'm only messenger and have nothing to do with this part of patch. The other
part which I touched has my signoff.

Quoted 3 lines

Did Thomas really write this patch for U-Boot (if so, why isn't he on CC?) or
is it taken from some other project?

Quoted 6 lines

Ha! It is my mailer which broke Cc. Thomas was on Cc list and still is in my
sent-mail folder. Also apologize to Marek, let's see how Cc will end this time.
And yes, patch was written for U-Boot:
https://patchwork.ozlabs.org/patch/367305/

Quoted 11 lines

Well, seems to be mailman configuration:
https://mail.python.org/pipermail/mailman-users/2006-May/051194.html
so those who received post via mailman are seeing striped Cc line. Thanks to Nathan Lynch for pointing it out.
Full Cc list:
Cc: Scott Wood <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Marek Vasut <[email protected]>

Oh right, I forgot about that mailman bug.

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines

+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)

This name is too generic and doesn't suggest what's different compared to
nand_spl_load_image (they both read data from flash into a buffer).

How about nand_spl_read_block()?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

ok.

Thinking about it more, I'd rather see nand_spl_read_peb(int peb, ... but that is not consistent with other nand reading functions.

"peb" is cryptic, and what sort of non-physical erase block does the core NAND code deal with that warrants distinction?

PEB is the standard UBI term, no problem there ...

[...]

Best regards,
Marek Vasut

#11 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 56 lines · Marek Vasut
Quoted 7 lines · Scott Wood
Quoted 6 lines · Ladislav Michl
Quoted 5 lines · Ladislav Michl
Quoted 4 lines · Scott Wood
Quoted 3 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add

one

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
Quoted 3 lines

to nand_spl_simple and keep it as simple as it goes.

Where is your signoff?

I'm only messenger and have nothing to do with this part of patch. The other
part which I touched has my signoff.

Quoted 1 line

Did Thomas really write this patch for U-Boot (if so, why isn't he

on

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

CC?) or
is it taken from some other project?

Ha! It is my mailer which broke Cc. Thomas was on Cc list and still is in my
sent-mail folder. Also apologize to Marek, let's see how Cc will end this time.
And yes, patch was written for U-Boot:
https://patchwork.ozlabs.org/patch/367305/

Quoted 3 lines
Quoted 3 lines

Well, seems to be mailman configuration:
https://mail.python.org/pipermail/mailman-users/2006-May/051194.html
so those who received post via mailman are seeing striped Cc line.

Thanks

Quoted 21 lines
Quoted 8 lines

to Nathan Lynch for pointing it out.
Full Cc list:
Cc: Scott Wood <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Marek Vasut <[email protected]>

Oh right, I forgot about that mailman bug.

Quoted 10 lines
Quoted 9 lines
Quoted 7 lines

+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)

This name is too generic and doesn't suggest what's different compared to
nand_spl_load_image (they both read data from flash into a buffer).

How about nand_spl_read_block()?

ok.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Thinking about it more, I'd rather see nand_spl_read_peb(int peb, ... but that is not consistent with other nand reading functions.

"peb" is cryptic, and what sort of non-physical erase block does the core NAND code deal with that warrants distinction?

PEB is the standard UBI term, no problem there ...

This isn't UBI code (hence the reference to "core NAND code"), even if it's mainly meant to support UBI.

-Scott

#12 lore raw

PATCH v2 1/3 nand_spl_simple: Add a simple flash read function

Quoted 69 lines · Scott Wood
Quoted 68 lines · Marek Vasut
Quoted 7 lines · Scott Wood
Quoted 6 lines · Ladislav Michl
Quoted 5 lines · Ladislav Michl
Quoted 4 lines · Scott Wood
Quoted 3 lines · Ladislav Michl

From: Thomas Gleixner <[email protected]>

To support UBI in SPL we need a simple flash read function. Add

one

Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

to nand_spl_simple and keep it as simple as it goes.

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

Where is your signoff?

I'm only messenger and have nothing to do with this part of patch. The other
part which I touched has my signoff.

Quoted 2 lines

Did Thomas really write this patch for U-Boot (if so, why isn't he

on

Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Quoted 2 lines

CC?) or
is it taken from some other project?

Ha! It is my mailer which broke Cc. Thomas was on Cc list and still is in my
sent-mail folder. Also apologize to Marek, let's see how Cc will end this time.
And yes, patch was written for U-Boot:
https://patchwork.ozlabs.org/patch/367305/

Quoted 3 lines
Quoted 3 lines

Well, seems to be mailman configuration:
https://mail.python.org/pipermail/mailman-users/2006-May/051194.html
so those who received post via mailman are seeing striped Cc line.

Thanks

Quoted 26 lines
Quoted 8 lines

to Nathan Lynch for pointing it out.
Full Cc list:
Cc: Scott Wood <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Heiko Schocher <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Marek Vasut <[email protected]>

Oh right, I forgot about that mailman bug.

Quoted 14 lines
Quoted 11 lines
Quoted 9 lines

+int nand_spl_read_flash(u32 pnum, u32 offset, u32 len, void *dest)

This name is too generic and doesn't suggest what's different compared to
nand_spl_load_image (they both read data from flash into a buffer).

How about nand_spl_read_block()?

ok.

Thinking about it more, I'd rather see nand_spl_read_peb(int peb, ... but that is not consistent with other nand reading functions.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

"peb" is cryptic, and what sort of non-physical erase block does the core NAND code deal with that warrants distinction?

PEB is the standard UBI term, no problem there ...

This isn't UBI code (hence the reference to "core NAND code"), even if it's mainly meant to support UBI.

Ah, gotcha.

#13 lore raw

PATCH v2 2/3 spl: Lightweight UBI and UBI fastmap support

In reply to Ladislav Michl

From: Thomas Gleixner <[email protected]>

Booting a payload out of NAND FLASH from the SPL is a crux today, as it requires hard partioned FLASH. Not a brilliant idea with the reliability of todays NAND FLASH chips.

The upstream UBI + UBI fastmap implementation which is about to brought to u-boot is too heavy weight for SPLs as it provides way more functionality than needed for a SPL and does not even fit into the restricted SPL areas which are loaded from the SoC boot ROM.

So this provides a fast and lightweight implementation of UBI scanning and UBI fastmap attach. The scan and logical to physical block mapping code is developed from scratch, while the fastmap implementation is lifted from the linux kernel source and stripped down to fit the SPL needs.

The text foot print on the board which I used for development is:

6854 0 0 6854 1abd
drivers/mtd/ubispl/built-in.o

Attaching a NAND chip with 4096 physical eraseblocks (4 blocks are reserved for the SPL) takes:

In full scan mode:      1172ms
In fastmap mode:          95ms

The code requires quite some storage. The largest and unknown part of it is the number of fastmap blocks to read. Therefor the data structure is not put into the BSS. The code requires a pointer to free memory handed in which is initialized by the UBI attach code itself.

See doc/README.ubispl for further information on how to use it.

This shares the ubi-media.h and crc32 implementation of drivers/mtd/ubi There is no way to share the fastmap code, as UBISPL only utilizes the slightly modified functions ubi_attach_fastmap() and ubi_scan_fastmap() from the original kernel ubi fastmap implementation.

---
 README                           |   4 +
 doc/README.ubispl                | 143 ++++++
 drivers/Makefile                 |   1 +
 drivers/mtd/ubispl/Makefile      |   1 +
 drivers/mtd/ubispl/ubi-wrapper.h | 106 +++++
 drivers/mtd/ubispl/ubispl.c      | 928 +++++++++++++++++++++++++++++++++++++++
 drivers/mtd/ubispl/ubispl.h      | 136 ++++++
 include/ubispl.h                 |  90 ++++
 8 files changed, 1409 insertions(+)
 create mode 100644 doc/README.ubispl
 create mode 100644 drivers/mtd/ubispl/Makefile
 create mode 100644 drivers/mtd/ubispl/ubi-wrapper.h
 create mode 100644 drivers/mtd/ubispl/ubispl.c
 create mode 100644 drivers/mtd/ubispl/ubispl.h
 create mode 100644 include/ubispl.h
README +4 -0
index 43f307f..b6d01a9 100644
@@ -3654,6 +3654,10 @@ FIT uImage format:
 		Support for NAND boot using simple NAND drivers that
 		expose the cmd_ctrl() interface.
 
+		CONFIG_SPL_UBI
+		Support for a lightweight UBI (fastmap) scanner and
+		loader
+
 		CONFIG_SPL_MTD_SUPPORT
 		Support for the MTD subsystem within SPL.  Useful for
 		environment on NAND support within SPL.
doc/README.ubispl new file +143 -0

143 lines not on this page · raw message

drivers/Makefile +1 -0
index 9c5c6c0..ab169a1 100644
@@ -26,6 +26,7 @@ obj-$(CONFIG_SPL_MTD_SUPPORT) += mtd/
 obj-$(CONFIG_SPL_NAND_SUPPORT) += mtd/nand/
 obj-$(CONFIG_SPL_ONENAND_SUPPORT) += mtd/onenand/
 obj-$(CONFIG_SPL_SPI_FLASH_SUPPORT) += mtd/spi/
+obj-$(CONFIG_SPL_UBI) += mtd/ubispl/
 obj-$(CONFIG_SPL_DMA_SUPPORT) += dma/
 obj-$(CONFIG_SPL_ETH_SUPPORT) += net/
 obj-$(CONFIG_SPL_ETH_SUPPORT) += net/phy/
drivers/mtd/ubispl/Makefile new file +1 -0
new file mode 100644
index 0000000..740dbed
@@ -0,0 +1 @@
+obj-y += ubispl.o ../ubi/crc32.o
drivers/mtd/ubispl/ubi-wrapper.h new file +106 -0

106 lines not on this page · raw message

drivers/mtd/ubispl/ubispl.c new file +928 -0

928 lines not on this page · raw message

drivers/mtd/ubispl/ubispl.h new file +136 -0

136 lines not on this page · raw message

include/ubispl.h new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.1.4
#14 lore raw

PATCH v2 2/3 spl: Lightweight UBI and UBI fastmap support

Hi,

I cannot work on ubispl till next week, so just one quick additional patch before v3 in case anyone wants to give it a try.
Move vol_id check to ubi_scan_vid_hdr to verify it has meaningfull value before testing ubi->toload (in my case 0x7FFFEFFF was read causing test_bit hang)

ladis

drivers/mtd/ubispl/ubispl.c +6 -10
index a779759..c38beb7 100644
@@ -123,19 +123,12 @@ static int ubi_rescan_fm_vid_hdr(struct ubi_scan_info *ubi,
 /* Insert the logic block into the volume info */
 static int ubi_add_peb_to_vol(struct ubi_scan_info *ubi,
 			      struct ubi_vid_hdr *vh, u32 vol_id,
-			      u32 vol_type, u32 pnum, u32 lnum)
+			      u32 pnum, u32 lnum)
 {
 	struct ubi_vol_info *vi = ubi->volinfo + vol_id;
 	u32 *ltp;
 
 	/*
-	 * We only care about static volumes with an id <
-	 * UBI_SPL_VOL_IDS.
-	 */
-	if (vol_id >= UBI_SPL_VOL_IDS || vol_type != UBI_VID_STATIC)
-		return 0;
-
-	/*
 	 * If the volume is larger than expected, yell and give up :(
 	 */
 	if (lnum >= UBI_MAX_VOL_LEBS) {
@@ -218,13 +211,16 @@ static int ubi_scan_vid_hdr(struct ubi_scan_info *ubi, struct ubi_vid_hdr *vh,
 	if (vol_id == UBI_FM_SB_VOLUME_ID)
 		return ubi->fm_enabled ? UBI_FASTMAP_ANCHOR : 0;
 
+	/* We only care about static volumes with an id < UBI_SPL_VOL_IDS */
+	if (vol_id >= UBI_SPL_VOL_IDS || vh->vol_type != UBI_VID_STATIC)
+		return 0;
+
 	/* We are only interested in the volumes to load */
 	if (!test_bit(vol_id, ubi->toload))
 		return 0;
 
 	lnum = be32_to_cpu(vh->lnum);
-
-	return ubi_add_peb_to_vol(ubi, vh, vol_id, vh->vol_type, pnum, lnum);
+	return ubi_add_peb_to_vol(ubi, vh, vol_id, pnum, lnum);
 }
 
 static int assign_aeb_to_av(struct ubi_scan_info *ubi, u32 pnum, u32 lnum,
#15 lore raw

PATCH v2 2/3 spl: Lightweight UBI and UBI fastmap support

Quoted 7 lines · Ladislav Michl

Hi,

I cannot work on ubispl till next week, so just one quick additional patch before v3 in case anyone wants to give it a try.
Move vol_id check to ubi_scan_vid_hdr to verify it has meaningfull value before testing ubi->toload (in my case 0x7FFFEFFF was read causing test_bit hang)

The MW opens mid-January or so, so that's fine.

I'm leaving review of the MTD parts to the more experienced people.

Quoted 36 lines

ladis

drivers/mtd/ubispl/ubispl.c +5 -8
index a779759..c38beb7 100644
@@ -123,19 +123,12 @@ static int ubi_rescan_fm_vid_hdr(struct ubi_scan_info
 *ubi, /* Insert the logic block into the volume info */
 static int ubi_add_peb_to_vol(struct ubi_scan_info *ubi,
 			      struct ubi_vid_hdr *vh, u32 vol_id,
-			      u32 vol_type, u32 pnum, u32 lnum)
+			      u32 pnum, u32 lnum)
 {
 	struct ubi_vol_info *vi = ubi->volinfo + vol_id;
 	u32 *ltp;
 
 	/*
-	 * We only care about static volumes with an id <
-	 * UBI_SPL_VOL_IDS.
-	 */
-	if (vol_id >= UBI_SPL_VOL_IDS || vol_type != UBI_VID_STATIC)
-		return 0;
-
-	/*
 	 * If the volume is larger than expected, yell and give up :(
 	 */
 	if (lnum >= UBI_MAX_VOL_LEBS) {
@@ -218,13 +211,16 @@ static int ubi_scan_vid_hdr(struct ubi_scan_info
 *ubi, struct ubi_vid_hdr *vh, if (vol_id == UBI_FM_SB_VOLUME_ID)
 		return ubi->fm_enabled ? UBI_FASTMAP_ANCHOR : 0;
 
+	/* We only care about static volumes with an id < UBI_SPL_VOL_IDS */
+	if (vol_id >= UBI_SPL_VOL_IDS || vh->vol_type != UBI_VID_STATIC)
+		return 0;
+
 	/* We are only interested in the volumes to load */

drivers/mtd/ubispl/ubispl.c static int ubi_scan_vid_hdr(struct ubi_scan_info · line 226

Quoted 10 lines
drivers/mtd/ubispl/ubispl.c +1 -2
 	if (!test_bit(vol_id, ubi->toload))
 		return 0;
 
 	lnum = be32_to_cpu(vh->lnum);
-
-	return ubi_add_peb_to_vol(ubi, vh, vol_id, vh->vol_type, pnum, lnum);
+	return ubi_add_peb_to_vol(ubi, vh, vol_id, pnum, lnum);
 }
 
 static int assign_aeb_to_av(struct ubi_scan_info *ubi, u32 pnum, u32 lnum,

Best regards,
Marek Vasut

#16 lore raw

PATCH v2 3/3 igep00x0: UBIize

In reply to Ladislav Michl

This patch converts IGEP board to use UBI volumes for environment, u-boot, kernel... With exception of first four sectors read by SoC boot ROM whole NAND is UBI managed. Code is too big, so I dropped CONFIG_SPL_EXT_SUPPORT to make it fit. It is meant more likely as a test of Thomas' patch, so more people can play with that. Thanks to Marek Vasut for pointing me to Thomas' work and arguing so well towards UBI that I had no other choice than giving it a try.

---
 board/isee/igep00x0/igep00x0.c    | 48 +++++++++++++++++++++++++++++
 common/spl/Makefile               |  5 ++-
 common/spl/spl.c                  | 13 ++++++++
 common/spl/spl_ubi.c              | 36 ++++++++++++++++++++++
 include/configs/omap3_igep00x0.h  | 64 ++++++++++++++++++---------------------
 include/configs/ti_armv7_common.h |  1 -
 include/spl.h                     |  4 +++
 7 files changed, 134 insertions(+), 37 deletions(-)
 create mode 100644 common/spl/spl_ubi.c
board/isee/igep00x0/igep00x0.c +48 -0
index e2fce50..006fae6 100644
@@ -10,6 +10,9 @@
 #include <ns16550.h>
 #include <twl4030.h>
 #include <netdev.h>
+#include <nand.h>
+#include <ubispl.h>
+#include <spl.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/mem.h>
@@ -212,3 +215,48 @@ int board_eth_init(bd_t *bis)
 #endif
 }
 #endif
+
+#ifdef CONFIG_SPL_OS_BOOT
+int spl_start_uboot(void)
+{
+	/* break into full u-boot on 'c' */
+	if (serial_tstc() && serial_getc() == 'c')
+		return 1;
+
+	return 0;
+}
+#endif
+
+#ifdef CONFIG_SPL_BUILD
+int spl_board_ubi_load_image(u32 boot_device)
+{
+	int ret;
+	struct image_header *header;
+	struct ubispl_info info;
+	struct ubispl_load volumes[4];
+
+	info.ubi = (struct ubi_scan_info *)
+		(CONFIG_SYS_SPL_MALLOC_START + CONFIG_SYS_SPL_MALLOC_SIZE);
+	info.fastmap = 1;
+	info.read = nand_spl_read_flash;
+
+	info.peb_offset = 4;
+	info.peb_size = CONFIG_SYS_NAND_BLOCK_SIZE;
+	info.vid_offset = 512;
+	info.leb_start = 2048;
+	info.peb_count = 4096 - info.peb_offset;
+
+	header = (struct image_header *)
+		(CONFIG_SYS_TEXT_BASE - sizeof(struct image_header));
+	memset(volumes, 0, sizeof(volumes));
+	volumes[0].name = "loader";
+	volumes[0].vol_id = 0;
+	volumes[0].load_addr = (void *)header;
+
+	ret = ubispl_load_volumes(&info, volumes, 1);
+	if (!ret)
+		spl_parse_image_header(header);
+
+	return ret;
+}
+#endif
common/spl/Makefile +4 -1
index 10a4589..e4535c4 100644
@@ -10,10 +10,13 @@
 
 ifdef CONFIG_SPL_BUILD
 obj-$(CONFIG_SPL_FRAMEWORK) += spl.o
-obj-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
 obj-$(CONFIG_SPL_YMODEM_SUPPORT) += spl_ymodem.o
+ifndef CONFIG_SPL_UBI
+obj-$(CONFIG_SPL_NOR_SUPPORT) += spl_nor.o
 obj-$(CONFIG_SPL_NAND_SUPPORT) += spl_nand.o
 obj-$(CONFIG_SPL_ONENAND_SUPPORT) += spl_onenand.o
+endif
+obj-$(CONFIG_SPL_UBI) += spl_ubi.o
 obj-$(CONFIG_SPL_NET_SUPPORT) += spl_net.o
 obj-$(CONFIG_SPL_MMC_SUPPORT) += spl_mmc.o
 obj-$(CONFIG_SPL_USB_SUPPORT) += spl_usb.o
common/spl/spl.c +13 -0
index 6e6dee7..048a325 100644
@@ -286,6 +286,18 @@ static int spl_load_image(u32 boot_device)
 	case BOOT_DEVICE_MMC2_2:
 		return spl_mmc_load_image(boot_device);
 #endif
+#ifdef CONFIG_SPL_UBI
+#ifdef CONFIG_SPL_NAND_SUPPORT
+	case BOOT_DEVICE_NAND:
+#endif
+#ifdef CONFIG_SPL_ONENAND_SUPPORT
+	case BOOT_DEVICE_ONENAND:
+#endif
+#ifdef CONFIG_SPL_NOR_SUPPORT
+	case BOOT_DEVICE_NOR:
+#endif
+		return spl_ubi_load_image(boot_device);
+#else
 #ifdef CONFIG_SPL_NAND_SUPPORT
 	case BOOT_DEVICE_NAND:
 		return spl_nand_load_image();
@@ -298,6 +310,7 @@ static int spl_load_image(u32 boot_device)
 	case BOOT_DEVICE_NOR:
 		return spl_nor_load_image();
 #endif
+#endif /* CONFIG_SPL_UBI */
 #ifdef CONFIG_SPL_YMODEM_SUPPORT
 	case BOOT_DEVICE_UART:
 		return spl_ymodem_load_image();
common/spl/spl_ubi.c new file +36 -0
new file mode 100644
index 0000000..a292841
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2016
+ * Ladislav Michl <[email protected]>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ */
+#include <common.h>
+#include <config.h>
+#include <spl.h>
+#include <asm/io.h>
+#include <nand.h>
+
+__weak int spl_board_ubi_load_image(u32 boot_device)
+{
+	return -EINVAL;
+}
+
+int spl_ubi_load_image(u32 boot_device)
+{
+	int ret;
+
+#ifdef CONFIG_SPL_NAND_SUPPORT
+	if (boot_device == BOOT_DEVICE_NAND)
+		nand_init();
+#endif
+
+	ret = spl_board_ubi_load_image(boot_device);
+
+#ifdef CONFIG_SPL_NAND_SUPPORT
+	if (boot_device == BOOT_DEVICE_NAND)
+		nand_deselect();
+#endif
+
+	return ret;
+}
+
include/configs/omap3_igep00x0.h +29 -35

110 lines not on this page · raw message

include/configs/ti_armv7_common.h +0 -1
index 2087eb1..45bdd75 100644
@@ -232,7 +232,6 @@
 #define CONFIG_SPL_LIBDISK_SUPPORT
 #define CONFIG_SPL_MMC_SUPPORT
 #define CONFIG_SPL_FAT_SUPPORT
-#define CONFIG_SPL_EXT_SUPPORT
 #endif
 
 #define CONFIG_SYS_THUMB_BUILD
include/spl.h +4 -0
index 92cdc04..1ab9295 100644
@@ -40,6 +40,7 @@ u32 spl_boot_mode(void);
 void spl_set_header_raw_uboot(void);
 void spl_parse_image_header(const struct image_header *header);
 void spl_board_prepare_for_linux(void);
+int spl_board_ubi_load_image(u32 boot_device);
 void __noreturn jump_to_image_linux(void *arg);
 int spl_start_uboot(void);
 void spl_display_print(void);
@@ -53,6 +54,9 @@ int spl_onenand_load_image(void);
 /* NOR SPL functions */
 int spl_nor_load_image(void);
 
+/* UBI SPL functions */
+int spl_ubi_load_image(u32 boot_device);
+
 /* MMC SPL functions */
 int spl_mmc_load_image(u32 boot_device);
 
Signature · 1 line
2.1.4
#17 lore raw

v2 cover spl: Lightweight UBI and UBI fastmap support

In reply to Ladislav Michl

Hello Ladislav Michl,

Soory for the late reply, but I am in holidays...

Am 04.01.2016 um 16:52 schrieb Ladislav Michl:

Quoted 11 lines

This is an update of Thomas's patchset:
https://patchwork.ozlabs.org/patch/367305/
https://patchwork.ozlabs.org/patch/367306/

Changes from previous version:
- fixes ubi_calc_fm_size to include also sizeof(struct ubi_fm_sb)
- dropped private copy of ubi-media.h
- ubi-wrapper.h now contains only needed definitions from ubi.h and ubi-user.h
- used return values from errno.h
- added example implementation for igep00x0.

Just seen at my automated builds [1], that your patches break the smartweb build [2] ... reason is that "git am" for them fail with current u-boot ... search for "2016-01-07 10:43:30,943" in [2]

What did you use as base for the patches?

Also checking them with chckpatch drop error/warnings ... Can you have a look at them?

search in [2] for "2016-01-07 10:43:29,064:INFO" (Only the first patch is in the log, as tbot fails at the first error ...)

bye,
Heiko
[1] http://xeidos.ddns.net/buildbot/waterfall
[2] log of the build:
http://xeidos.ddns.net/buildbot/builders/smartweb_dfu/builds/40/steps/shell/logs/tbotlog

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#18 lore raw

v2 cover spl: Lightweight UBI and UBI fastmap support

Dear Heiko Schocher,

On Thu, Jan 07, 2016 at 11:47:27AM +0100, Heiko Schocher wrote:
[...]

Quoted 5 lines

Just seen at my automated builds [1], that your patches break the smartweb build [2] ... reason is that "git am" for them fail with current u-boot ... search for "2016-01-07 10:43:30,943" in [2]

What did you use as base for the patches?

Current git with this patch provided here:
http://lists.denx.de/pipermail/u-boot/2016-January/239941.html
I will make it part of serie if it is not safe to apply it now.

Quoted 2 lines

Also checking them with chckpatch drop error/warnings ... Can you have a look at them?

Fixed in new version. However I left those warnings present also in Linux driver untouched.

Regards,
ladis

#19 lore raw

v2 cover spl: Lightweight UBI and UBI fastmap support

Hello Ladislav Michl,

Am 10.01.2016 um 15:00 schrieb Ladislav Michl:

Quoted 14 lines

Dear Heiko Schocher,

On Thu, Jan 07, 2016 at 11:47:27AM +0100, Heiko Schocher wrote:
[...]

Quoted 5 lines

Just seen at my automated builds [1], that your patches break the smartweb build [2] ... reason is that "git am" for them fail with current u-boot ... search for "2016-01-07 10:43:30,943" in [2]

What did you use as base for the patches?

Current git with this patch provided here:
http://lists.denx.de/pipermail/u-boot/2016-January/239941.html
I will make it part of serie if it is not safe to apply it now.

Quoted 5 lines
Quoted 2 lines

Also checking them with chckpatch drop error/warnings ... Can you have a look at them?

Fixed in new version. However I left those warnings present also in Linux driver untouched.

Yes, just saw the v3 on the ML, thanks! I try the patches out.

bye,
Heiko

Quoted 4 lines

Regards,
ladis

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany