public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Ilya Yanok <yanok@emcraft.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] jffs2: add sector_size field to part_info structure
Date: Mon, 13 Oct 2008 09:53:48 +0400	[thread overview]
Message-ID: <1223877234-720-2-git-send-email-yanok@emcraft.com> (raw)
In-Reply-To: <1223877234-720-1-git-send-email-yanok@emcraft.com>

This patch adds sector_size field to part_info structure (used
by new JFFS2 code).

Signed-off-by: Ilya Yanok <yanok@emcraft.com>
---
 common/cmd_jffs2.c          |   13 ++++++++++++-
 include/jffs2/load_kernel.h |    1 +
 2 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index c6920c9..e7f07bf 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -339,11 +339,13 @@ static int part_validate_nor(struct mtdids *id, struct part_info *part)
 	extern flash_info_t flash_info[];
 	flash_info_t *flash;
 	int offset_aligned;
-	u32 end_offset;
+	u32 end_offset, sector_size = 0;
 	int i;
 
 	flash = &flash_info[id->num];
 
+	part->sector_size = 0;
+
 	offset_aligned = 0;
 	for (i = 0; i < flash->sector_count; i++) {
 		if ((flash->start[i] - flash->start[0]) == part->offset) {
@@ -359,6 +361,11 @@ static int part_validate_nor(struct mtdids *id, struct part_info *part)
 
 	end_offset = part->offset + part->size;
 	for (i = 0; i < flash->sector_count; i++) {
+		if (i) {
+			sector_size = flash->start[i] - flash->start[i-1];
+			if (part->sector_size < sector_size)
+				part->sector_size = sector_size;
+		}
 		if ((flash->start[i] - flash->start[0]) == end_offset)
 			return 0;
 	}
@@ -389,6 +396,8 @@ static int part_validate_nand(struct mtdids *id, struct part_info *part)
 
 	nand = &nand_info[id->num];
 
+	part->sector_size = nand->erasesize;
+
 	if ((unsigned long)(part->offset) % nand->erasesize) {
 		printf("%s%d: partition (%s) start offset alignment incorrect\n",
 				MTD_DEV_TYPE(id->type), id->num, part->name);
@@ -424,6 +433,8 @@ static int part_validate_onenand(struct mtdids *id, struct part_info *part)
 
 	mtd = &onenand_mtd;
 
+	part->sector_size = mtd->erasesize;
+
 	if ((unsigned long)(part->offset) % mtd->erasesize) {
 		printf("%s%d: partition (%s) start offset"
 			"alignment incorrect\n",
diff --git a/include/jffs2/load_kernel.h b/include/jffs2/load_kernel.h
index 551fd0c..c0442a2 100644
--- a/include/jffs2/load_kernel.h
+++ b/include/jffs2/load_kernel.h
@@ -50,6 +50,7 @@ struct part_info {
 	u32 offset;			/* offset within device */
 	void *jffs2_priv;		/* used internaly by jffs2 */
 	u32 mask_flags;			/* kernel MTD mask flags */
+	u32 sector_size;		/* size of sector */
 	struct mtd_device *dev;		/* parent device */
 };
 
-- 
1.5.6.1

  reply	other threads:[~2008-10-13  5:53 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-13  5:53 [U-Boot] [PATCH/RFC] Some speed improvements to U-Boot JFFS2 code Ilya Yanok
2008-10-13  5:53 ` Ilya Yanok [this message]
2008-10-13  8:17   ` [U-Boot] [PATCH] jffs2: add sector_size field to part_info structure Wolfgang Denk
2008-10-15 12:35     ` Ilya Yanok
2008-10-13  5:53 ` [U-Boot] [PATCH] jffs2: rewrite jffs2 scanning code based on Linux one Ilya Yanok
2008-10-13  5:53 ` [U-Boot] [PATCH] jffs2: summary support Ilya Yanok
2008-10-13  5:53 ` [U-Boot] [PATCH] jffs2: fix searching for latest version in jffs2_1pass_list_inodes() Ilya Yanok
2008-10-13  5:53 ` [U-Boot] [PATCH] jffs2: add buffer to cache flash accesses Ilya Yanok
2008-10-13  5:53 ` [U-Boot] [PATCH] jffs2: cache data_crc results Ilya Yanok
2008-10-14  9:25   ` Michael Lawnick
2008-10-13  8:14 ` [U-Boot] [PATCH/RFC] Some speed improvements to U-Boot JFFS2 code Wolfgang Denk
2008-10-15 12:44   ` Ilya Yanok
2008-10-16 12:36     ` Michael Lawnick
2008-11-01  1:00       ` Ilya Yanok
2008-11-02 16:02         ` Wolfgang Denk
2008-11-02 19:08           ` Ilya Yanok
2008-11-04 11:14         ` Michael Lawnick
2008-11-04 12:31           ` Michael Lawnick
2008-11-04 13:14             ` Joakim Tjernlund
2008-11-05  7:59               ` Michael Lawnick
2008-11-11  6:49             ` Alexey Neyman
2008-11-11  8:19               ` Joakim Tjernlund

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1223877234-720-2-git-send-email-yanok@emcraft.com \
    --to=yanok@emcraft.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox