Re: [U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure

2008-12-09 Thread Wolfgang Denk
Dear Ilya Yanok,

In message <[EMAIL PROTECTED]> you wrote:
> This patch adds sector_size field to part_info structure (used
> by new JFFS2 code).
> 
> Signed-off-by: Ilya Yanok <[EMAIL PROTECTED]>
> ---
>  common/cmd_jffs2.c  |   20 +---
>  include/jffs2/load_kernel.h |1 +
>  2 files changed, 18 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [EMAIL PROTECTED]
They say a little knowledge is a dangerous thing,  but it is not  one
half so bad as a lot of ignorance.   - Terry Pratchett, _Equal Rites_
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure

2008-11-13 Thread Ben Warren
Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 19:49 Thu 13 Nov , Ilya Yanok wrote:
>   
>> This patch adds sector_size field to part_info structure (used
>> by new JFFS2 code).
>>
>> Signed-off-by: Ilya Yanok <[EMAIL PROTECTED]>
>> ---
>>  common/cmd_jffs2.c  |   20 +---
>>  include/jffs2/load_kernel.h |1 +
>>  2 files changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
>> index 791a572..e2bf198 100644
>> --- a/common/cmd_jffs2.c
>> +++ b/common/cmd_jffs2.c
>> @@ -339,11 +339,15 @@ 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;
>> 
> please spit in two lines
>   
Why do you waste peoples' time with this pedantic nit-picking?  There's 
absolutely nothing wrong with having them both on the same line, 
especially if it's the only thing you can object to in the patch.

regards,
Ben
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure

2008-11-13 Thread Jean-Christophe PLAGNIOL-VILLARD
On 19:49 Thu 13 Nov , Ilya Yanok wrote:
> This patch adds sector_size field to part_info structure (used
> by new JFFS2 code).
> 
> Signed-off-by: Ilya Yanok <[EMAIL PROTECTED]>
> ---
>  common/cmd_jffs2.c  |   20 +---
>  include/jffs2/load_kernel.h |1 +
>  2 files changed, 18 insertions(+), 3 deletions(-)
> 
> diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
> index 791a572..e2bf198 100644
> --- a/common/cmd_jffs2.c
> +++ b/common/cmd_jffs2.c
> @@ -339,11 +339,15 @@ 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;
please spit in two lines

Best Regards,
J.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/6] jffs2: add sector_size field to part_info structure

2008-11-13 Thread Ilya Yanok
This patch adds sector_size field to part_info structure (used
by new JFFS2 code).

Signed-off-by: Ilya Yanok <[EMAIL PROTECTED]>
---
 common/cmd_jffs2.c  |   20 +---
 include/jffs2/load_kernel.h |1 +
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/common/cmd_jffs2.c b/common/cmd_jffs2.c
index 791a572..e2bf198 100644
--- a/common/cmd_jffs2.c
+++ b/common/cmd_jffs2.c
@@ -339,11 +339,15 @@ 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];
 
+   /* size of last sector */
+   part->sector_size = flash->size -
+   (flash->start[flash->sector_count-1] - flash->start[0]);
+
offset_aligned = 0;
for (i = 0; i < flash->sector_count; i++) {
if ((flash->start[i] - flash->start[0]) == part->offset) {
@@ -358,12 +362,18 @@ static int part_validate_nor(struct mtdids *id, struct 
part_info *part)
}
 
end_offset = part->offset + part->size;
+   offset_aligned = 0;
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;
+   offset_aligned = 1;
}
 
-   if (flash->size == end_offset)
+   if (offset_aligned || flash->size == end_offset)
return 0;
 
printf("%s%d: partition (%s) size alignment incorrect\n",
@@ -389,6 +399,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 +436,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

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot