* [U-Boot] [PATCH] nand: fix up badblock skipping
@ 2018-10-19 8:15 Jiri Valek
2018-10-24 13:56 ` Miquel Raynal
0 siblings, 1 reply; 4+ messages in thread
From: Jiri Valek @ 2018-10-19 8:15 UTC (permalink / raw)
To: u-boot
From: Jiri Valek <valek@2n.cz>
Currently the badblock skipping fails. SPL loader fails to boot from NAND.
End up on message "SPL: failed to boot from all boot devices"
Signed-off-by: Jiri Valek <jirik.valek@seznam.cz>
---
drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
index 2d7bbe83cc..56618c95dc 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
*/
while (is_badblock(mtd, offs, 1)) {
page = page + nand_page_per_block;
+ offs = offs + mtd.erasesize;
/* Check i we've reached the end of flash. */
if (page >= mtd->size >> chip->page_shift)
return -ENOMEM;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] nand: fix up badblock skipping
2018-10-19 8:15 [U-Boot] [PATCH] nand: fix up badblock skipping Jiri Valek
@ 2018-10-24 13:56 ` Miquel Raynal
2018-12-08 16:16 ` Stefano Babic
0 siblings, 1 reply; 4+ messages in thread
From: Miquel Raynal @ 2018-10-24 13:56 UTC (permalink / raw)
To: u-boot
Hi Jiri,
Jiri Valek <jirik.valek@seznam.cz> wrote on Fri, 19 Oct 2018 10:15:55
+0200:
> From: Jiri Valek <valek@2n.cz>
>
> Currently the badblock skipping fails. SPL loader fails to boot from NAND.
> End up on message "SPL: failed to boot from all boot devices"
>
> Signed-off-by: Jiri Valek <jirik.valek@seznam.cz>
> ---
>
> drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> index 2d7bbe83cc..56618c95dc 100644
> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> @@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
> */
> while (is_badblock(mtd, offs, 1)) {
> page = page + nand_page_per_block;
> + offs = offs + mtd.erasesize;
> /* Check i we've reached the end of flash. */
> if (page >= mtd->size >> chip->page_shift)
> return -ENOMEM;
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Thanks,
Miquèl
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH] nand: fix up badblock skipping
2018-10-24 13:56 ` Miquel Raynal
@ 2018-12-08 16:16 ` Stefano Babic
2019-02-05 9:03 ` [U-Boot] [PATCH v2] " Jiri Valek
0 siblings, 1 reply; 4+ messages in thread
From: Stefano Babic @ 2018-12-08 16:16 UTC (permalink / raw)
To: u-boot
Hi Jiri, Miquel,
On 24/10/18 15:56, Miquel Raynal wrote:
> Hi Jiri,
>
> Jiri Valek <jirik.valek@seznam.cz> wrote on Fri, 19 Oct 2018 10:15:55
> +0200:
>
>> From: Jiri Valek <valek@2n.cz>
>>
>> Currently the badblock skipping fails. SPL loader fails to boot from NAND.
>> End up on message "SPL: failed to boot from all boot devices"
>>
>> Signed-off-by: Jiri Valek <jirik.valek@seznam.cz>
>> ---
>>
>> drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
>> index 2d7bbe83cc..56618c95dc 100644
>> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
>> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
>> @@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
>> */
>> while (is_badblock(mtd, offs, 1)) {
>> page = page + nand_page_per_block;
>> + offs = offs + mtd.erasesize;
>> /* Check i we've reached the end of flash. */
>> if (page >= mtd->size >> chip->page_shift)
>> return -ENOMEM;
>
> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
>
I agree that secto must be skipped, but implementation looks wrong. mtd
is a pointer, and the above line should be off + mtd->erasesize. Do you
build with it ? I tried to apply it, as expected it cannot be compiled
clean.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
* [U-Boot] [PATCH v2] nand: fix up badblock skipping
2018-12-08 16:16 ` Stefano Babic
@ 2019-02-05 9:03 ` Jiri Valek
0 siblings, 0 replies; 4+ messages in thread
From: Jiri Valek @ 2019-02-05 9:03 UTC (permalink / raw)
To: u-boot
Hi all,
yes you are right. I had checked out older version of u-boot.
off + mtd->erasesize
this is OK. I`m sending patch v2.
On 08. 12. 18 17:16, Stefano Babic wrote:
> Hi Jiri, Miquel,
>
> On 24/10/18 15:56, Miquel Raynal wrote:
>> Hi Jiri,
>>
>> Jiri Valek <jirik.valek@seznam.cz> wrote on Fri, 19 Oct 2018 10:15:55
>> +0200:
>>
>>> From: Jiri Valek <valek@2n.cz>
>>>
>>> Currently the badblock skipping fails. SPL loader fails to boot from NAND.
>>> End up on message "SPL: failed to boot from all boot devices"
>>>
>>> Signed-off-by: Jiri Valek <jirik.valek@seznam.cz>
>>> ---
>>>
>>> drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
>>> index 2d7bbe83cc..56618c95dc 100644
>>> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
>>> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
>>> @@ -239,6 +239,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int size, void *buf)
>>> */
>>> while (is_badblock(mtd, offs, 1)) {
>>> page = page + nand_page_per_block;
>>> + offs = offs + mtd.erasesize;
>>> /* Check i we've reached the end of flash. */
>>> if (page >= mtd->size >> chip->page_shift)
>>> return -ENOMEM;
>>
>> Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
>>
>
> I agree that secto must be skipped, but implementation looks wrong. mtd
> is a pointer, and the above line should be off + mtd->erasesize. Do you
> build with it ? I tried to apply it, as expected it cannot be compiled
> clean.
>
> Best regards,
> Stefano Babic
>
---
Changes for v2:
- Repaired "mtd" to struct pinter
drivers/mtd/nand/raw/mxs_nand_spl.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c
b/drivers/mtd/nand/raw/mxs_nand_spl.c
index c628f3adec..ddaaba87a3 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -240,6 +240,7 @@ int nand_spl_load_image(uint32_t offs, unsigned int
size, void *buf)
*/
while (is_badblock(mtd, offs, 1)) {
page = page + nand_page_per_block;
+ offs = offs + mtd->erasesize;
/* Check i we've reached the end of flash. */
if (page >= mtd->size >> chip->page_shift)
return -ENOMEM;
--
2.11.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-02-05 9:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-19 8:15 [U-Boot] [PATCH] nand: fix up badblock skipping Jiri Valek
2018-10-24 13:56 ` Miquel Raynal
2018-12-08 16:16 ` Stefano Babic
2019-02-05 9:03 ` [U-Boot] [PATCH v2] " Jiri Valek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox