public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error
@ 2015-07-01 12:35 Masahiro Yamada
  2015-07-04 17:07 ` Masahiro Yamada
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Masahiro Yamada @ 2015-07-01 12:35 UTC (permalink / raw)
  To: u-boot

Since commit 09c3280754f8 (mtd, nand: Move common functions from
cmd_nand.c to common place), NAND commands would not work at all
on large devices.

    => nand read 80000000 10000 10000

    NAND read: Offset exceeds device limit
    => nand erase 100000 100000

    NAND erase: Offset exceeds device limit

The type of the "size" of "struct mtd_info" is uint64_t, while
mtd_arg_off_size() and mtd_arg_off() treat chipsize as int type.
The chipsize is wrapped around if the argument is given with 2GB
or larger.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mtd/mtd_uboot.c | 5 +++--
 include/linux/mtd/mtd.h | 5 +++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index 7197007..c517b9c 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -43,7 +43,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size,
 }
 
 int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
-		loff_t *maxsize, int devtype, int chipsize)
+		loff_t *maxsize, int devtype, uint64_t chipsize)
 {
 	if (!str2off(arg, off))
 		return get_part(arg, idx, off, size, maxsize, devtype);
@@ -59,7 +59,8 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
 }
 
 int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
-		 loff_t *size, loff_t *maxsize, int devtype, int chipsize)
+		     loff_t *size, loff_t *maxsize, int devtype,
+		     uint64_t chipsize)
 {
 	int ret;
 
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 33669da..552d4d6 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -484,8 +484,9 @@ int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
 int del_mtd_partitions(struct mtd_info *);
 
 int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
-		loff_t *maxsize, int devtype, int chipsize);
+		loff_t *maxsize, int devtype, uint64_t chipsize);
 int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
-		 loff_t *size, loff_t *maxsize, int devtype, int chipsize);
+		     loff_t *size, loff_t *maxsize, int devtype,
+		     uint64_t chipsize);
 #endif
 #endif /* __MTD_MTD_H__ */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error
  2015-07-01 12:35 [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error Masahiro Yamada
@ 2015-07-04 17:07 ` Masahiro Yamada
  2015-07-05  5:57   ` Heiko Schocher
  2015-07-06 21:30 ` Scott Wood
  2015-07-10 19:02 ` Tom Rini
  2 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2015-07-04 17:07 UTC (permalink / raw)
  To: u-boot

Hey, quick review and apply please?

NAND commands are not working!




2015-07-01 21:35 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
> Since commit 09c3280754f8 (mtd, nand: Move common functions from
> cmd_nand.c to common place), NAND commands would not work at all
> on large devices.
>
>     => nand read 80000000 10000 10000
>
>     NAND read: Offset exceeds device limit
>     => nand erase 100000 100000
>
>     NAND erase: Offset exceeds device limit
>
> The type of the "size" of "struct mtd_info" is uint64_t, while
> mtd_arg_off_size() and mtd_arg_off() treat chipsize as int type.
> The chipsize is wrapped around if the argument is given with 2GB
> or larger.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/mtd/mtd_uboot.c | 5 +++--
>  include/linux/mtd/mtd.h | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
> index 7197007..c517b9c 100644
> --- a/drivers/mtd/mtd_uboot.c
> +++ b/drivers/mtd/mtd_uboot.c
> @@ -43,7 +43,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size,
>  }
>
>  int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
> -               loff_t *maxsize, int devtype, int chipsize)
> +               loff_t *maxsize, int devtype, uint64_t chipsize)
>  {
>         if (!str2off(arg, off))
>                 return get_part(arg, idx, off, size, maxsize, devtype);
> @@ -59,7 +59,8 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
>  }
>
>  int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
> -                loff_t *size, loff_t *maxsize, int devtype, int chipsize)
> +                    loff_t *size, loff_t *maxsize, int devtype,
> +                    uint64_t chipsize)
>  {
>         int ret;
>
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index 33669da..552d4d6 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -484,8 +484,9 @@ int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
>  int del_mtd_partitions(struct mtd_info *);
>
>  int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
> -               loff_t *maxsize, int devtype, int chipsize);
> +               loff_t *maxsize, int devtype, uint64_t chipsize);
>  int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
> -                loff_t *size, loff_t *maxsize, int devtype, int chipsize);
> +                    loff_t *size, loff_t *maxsize, int devtype,
> +                    uint64_t chipsize);
>  #endif
>  #endif /* __MTD_MTD_H__ */
> --
> 1.9.1
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error
  2015-07-04 17:07 ` Masahiro Yamada
@ 2015-07-05  5:57   ` Heiko Schocher
  0 siblings, 0 replies; 6+ messages in thread
From: Heiko Schocher @ 2015-07-05  5:57 UTC (permalink / raw)
  To: u-boot

Hello Masahiro,

Am 04.07.2015 um 19:07 schrieb Masahiro Yamada:
> Hey, quick review and apply please?
>
> NAND commands are not working!
>
>
>
>
> 2015-07-01 21:35 GMT+09:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
>> Since commit 09c3280754f8 (mtd, nand: Move common functions from
>> cmd_nand.c to common place), NAND commands would not work at all
>> on large devices.
>>
>>      => nand read 80000000 10000 10000
>>
>>      NAND read: Offset exceeds device limit
>>      => nand erase 100000 100000
>>
>>      NAND erase: Offset exceeds device limit
>>
>> The type of the "size" of "struct mtd_info" is uint64_t, while
>> mtd_arg_off_size() and mtd_arg_off() treat chipsize as int type.
>> The chipsize is wrapped around if the argument is given with 2GB
>> or larger.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>   drivers/mtd/mtd_uboot.c | 5 +++--
>>   include/linux/mtd/mtd.h | 5 +++--
>>   2 files changed, 6 insertions(+), 4 deletions(-)

Thanks!

Acked-by: Heiko Schocher <hs@denx.de>

bye,
Heiko
>>
>> diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
>> index 7197007..c517b9c 100644
>> --- a/drivers/mtd/mtd_uboot.c
>> +++ b/drivers/mtd/mtd_uboot.c
>> @@ -43,7 +43,7 @@ static int get_part(const char *partname, int *idx, loff_t *off, loff_t *size,
>>   }
>>
>>   int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
>> -               loff_t *maxsize, int devtype, int chipsize)
>> +               loff_t *maxsize, int devtype, uint64_t chipsize)
>>   {
>>          if (!str2off(arg, off))
>>                  return get_part(arg, idx, off, size, maxsize, devtype);
>> @@ -59,7 +59,8 @@ int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
>>   }
>>
>>   int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
>> -                loff_t *size, loff_t *maxsize, int devtype, int chipsize)
>> +                    loff_t *size, loff_t *maxsize, int devtype,
>> +                    uint64_t chipsize)
>>   {
>>          int ret;
>>
>> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
>> index 33669da..552d4d6 100644
>> --- a/include/linux/mtd/mtd.h
>> +++ b/include/linux/mtd/mtd.h
>> @@ -484,8 +484,9 @@ int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
>>   int del_mtd_partitions(struct mtd_info *);
>>
>>   int mtd_arg_off(const char *arg, int *idx, loff_t *off, loff_t *size,
>> -               loff_t *maxsize, int devtype, int chipsize);
>> +               loff_t *maxsize, int devtype, uint64_t chipsize);
>>   int mtd_arg_off_size(int argc, char *const argv[], int *idx, loff_t *off,
>> -                loff_t *size, loff_t *maxsize, int devtype, int chipsize);
>> +                    loff_t *size, loff_t *maxsize, int devtype,
>> +                    uint64_t chipsize);
>>   #endif
>>   #endif /* __MTD_MTD_H__ */
>> --
>> 1.9.1
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>
>
>

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error
  2015-07-01 12:35 [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error Masahiro Yamada
  2015-07-04 17:07 ` Masahiro Yamada
@ 2015-07-06 21:30 ` Scott Wood
  2015-07-07  9:50   ` Masahiro Yamada
  2015-07-10 19:02 ` Tom Rini
  2 siblings, 1 reply; 6+ messages in thread
From: Scott Wood @ 2015-07-06 21:30 UTC (permalink / raw)
  To: u-boot

On Wed, 2015-07-01 at 21:35 +0900, Masahiro Yamada wrote:
> Since commit 09c3280754f8 (mtd, nand: Move common functions from
> cmd_nand.c to common place), NAND commands would not work at all
> on large devices.
> 
>     => nand read 80000000 10000 10000
> 
>     NAND read: Offset exceeds device limit
>     => nand erase 100000 100000
> 
>     NAND erase: Offset exceeds device limit
> 
> The type of the "size" of "struct mtd_info" is uint64_t, while
> mtd_arg_off_size() and mtd_arg_off() treat chipsize as int type.
> The chipsize is wrapped around if the argument is given with 2GB
> or larger.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
> 
>  drivers/mtd/mtd_uboot.c | 5 +++--
>  include/linux/mtd/mtd.h | 5 +++--
>  2 files changed, 6 insertions(+), 4 deletions(-)

Acked-by: Scott Wood <scottwood@freescale.com>

I'm assuming this patch will be merged via whatever tree merged the 
breakage...

-Scott

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error
  2015-07-06 21:30 ` Scott Wood
@ 2015-07-07  9:50   ` Masahiro Yamada
  0 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2015-07-07  9:50 UTC (permalink / raw)
  To: u-boot

Tom,
Could you directly apply this into your u-boot/master ?

Thanks,
Masahiro




2015-07-07 6:30 GMT+09:00 Scott Wood <scottwood@freescale.com>:
> On Wed, 2015-07-01 at 21:35 +0900, Masahiro Yamada wrote:
>> Since commit 09c3280754f8 (mtd, nand: Move common functions from
>> cmd_nand.c to common place), NAND commands would not work at all
>> on large devices.
>>
>>     => nand read 80000000 10000 10000
>>
>>     NAND read: Offset exceeds device limit
>>     => nand erase 100000 100000
>>
>>     NAND erase: Offset exceeds device limit
>>
>> The type of the "size" of "struct mtd_info" is uint64_t, while
>> mtd_arg_off_size() and mtd_arg_off() treat chipsize as int type.
>> The chipsize is wrapped around if the argument is given with 2GB
>> or larger.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>  drivers/mtd/mtd_uboot.c | 5 +++--
>>  include/linux/mtd/mtd.h | 5 +++--
>>  2 files changed, 6 insertions(+), 4 deletions(-)
>
> Acked-by: Scott Wood <scottwood@freescale.com>
>
> I'm assuming this patch will be merged via whatever tree merged the
> breakage...
>
> -Scott
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error
  2015-07-01 12:35 [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error Masahiro Yamada
  2015-07-04 17:07 ` Masahiro Yamada
  2015-07-06 21:30 ` Scott Wood
@ 2015-07-10 19:02 ` Tom Rini
  2 siblings, 0 replies; 6+ messages in thread
From: Tom Rini @ 2015-07-10 19:02 UTC (permalink / raw)
  To: u-boot

On Wed, Jul 01, 2015 at 09:35:49PM +0900, Masahiro Yamada wrote:

> Since commit 09c3280754f8 (mtd, nand: Move common functions from
> cmd_nand.c to common place), NAND commands would not work at all
> on large devices.
> 
>     => nand read 80000000 10000 10000
> 
>     NAND read: Offset exceeds device limit
>     => nand erase 100000 100000
> 
>     NAND erase: Offset exceeds device limit
> 
> The type of the "size" of "struct mtd_info" is uint64_t, while
> mtd_arg_off_size() and mtd_arg_off() treat chipsize as int type.
> The chipsize is wrapped around if the argument is given with 2GB
> or larger.
> 
> Acked-by: Heiko Schocher <hs@denx.de>
> Acked-by: Scott Wood <scottwood@freescale.com>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150710/0fb59a3e/attachment.sig>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-10 19:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-01 12:35 [U-Boot] [PATCH] mtd: fix false positive "Offset exceeds device limit" error Masahiro Yamada
2015-07-04 17:07 ` Masahiro Yamada
2015-07-05  5:57   ` Heiko Schocher
2015-07-06 21:30 ` Scott Wood
2015-07-07  9:50   ` Masahiro Yamada
2015-07-10 19:02 ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox