diff mbox series

[U-Boot] MTD: mxs_nand: Fix BCH read timeout error on boards requiring ECC

Message ID 20190103023652.8489-1-aford173@gmail.com
State Accepted
Commit 5ae585ba3a8bb2336d5cb6e1ef4c80a5ef445409
Delegated to: Stefano Babic
Headers show
Series [U-Boot] MTD: mxs_nand: Fix BCH read timeout error on boards requiring ECC | expand

Commit Message

Adam Ford Jan. 3, 2019, 2:36 a.m. UTC
The LogicPD board uses a Micron Flash with ECC.  To boot this from
SPL, the ECC needs to be correctly configured or the BCH engine
times out.

Signed-off-by: Adam Ford <aford173@gmail.com>

Comments

Stefan Agner Jan. 3, 2019, 3:55 p.m. UTC | #1
[this time using reply to all]

On 03.01.19 03:36, Adam Ford wrote:
> The LogicPD board uses a Micron Flash with ECC.  To boot this from
> SPL, the ECC needs to be correctly configured or the BCH engine
> times out.
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>

Looks good to me,

Acked-by: Stefan Agner <stefan.agner@toradex.com>

> 
> diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
> index e3341812a2..2d84bfffe2 100644
> --- a/drivers/mtd/nand/raw/mxs_nand.c
> +++ b/drivers/mtd/nand/raw/mxs_nand.c
> @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
>  
>  	nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
>  	nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> +
> +	if (is_mx6sx() || is_mx7())
> +		nand_info->max_ecc_strength_supported = 62;
> +	else
> +		nand_info->max_ecc_strength_supported = 40;
> +
>  	err = mxs_nand_alloc_buffers(nand_info);
>  	if (err)
>  		return err;
> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> index c628f3adec..ba85baac60 100644
> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
>  	/* setup flash layout (does not scan as we override that) */
>  	mtd->size = nand_chip.chipsize;
>  	nand_chip.scan_bbt(mtd);
> +	mxs_nand_setup_ecc(mtd);
>  
>  	return 0;
>  }
>
Jörg Krause Feb. 2, 2019, 1:21 p.m. UTC | #2
Hi,

On Thu, 2019-01-03 at 15:55 +0000, Stefan Agner wrote:
> [this time using reply to all]
> 
> On 03.01.19 03:36, Adam Ford wrote:
> > The LogicPD board uses a Micron Flash with ECC.  To boot this from
> > SPL, the ECC needs to be correctly configured or the BCH engine
> > times out.
> > 
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> 
> Looks good to me,
> 
> Acked-by: Stefan Agner <stefan.agner@toradex.com>

Tested on a custom i.MX6ULL board with Micron NAND flash.

Fixes:

"""
Trying to boot from NAND
MXS NAND: BCH read timeout
...
MXS NAND: BCH read timeout
"""

Tested-by: Jörg Krause <joerg.krause@embedded.rocks>

> > diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
> > index e3341812a2..2d84bfffe2 100644
> > --- a/drivers/mtd/nand/raw/mxs_nand.c
> > +++ b/drivers/mtd/nand/raw/mxs_nand.c
> > @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
> >  
> >  	nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
> >  	nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> > +
> > +	if (is_mx6sx() || is_mx7())
> > +		nand_info->max_ecc_strength_supported = 62;
> > +	else
> > +		nand_info->max_ecc_strength_supported = 40;
> > +
> >  	err = mxs_nand_alloc_buffers(nand_info);
> >  	if (err)
> >  		return err;
> > diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > index c628f3adec..ba85baac60 100644
> > --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
> >  	/* setup flash layout (does not scan as we override that) */
> >  	mtd->size = nand_chip.chipsize;
> >  	nand_chip.scan_bbt(mtd);
> > +	mxs_nand_setup_ecc(mtd);
> >  
> >  	return 0;
> >  }
> >
Tim Harvey Feb. 4, 2019, 6:17 p.m. UTC | #3
On Wed, Jan 2, 2019 at 6:37 PM Adam Ford <aford173@gmail.com> wrote:
>
> The LogicPD board uses a Micron Flash with ECC.  To boot this from
> SPL, the ECC needs to be correctly configured or the BCH engine
> times out.
>
> Signed-off-by: Adam Ford <aford173@gmail.com>
>
> diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
> index e3341812a2..2d84bfffe2 100644
> --- a/drivers/mtd/nand/raw/mxs_nand.c
> +++ b/drivers/mtd/nand/raw/mxs_nand.c
> @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
>
>         nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
>         nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> +
> +       if (is_mx6sx() || is_mx7())
> +               nand_info->max_ecc_strength_supported = 62;
> +       else
> +               nand_info->max_ecc_strength_supported = 40;
> +
>         err = mxs_nand_alloc_buffers(nand_info);
>         if (err)
>                 return err;
> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> index c628f3adec..ba85baac60 100644
> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
>         /* setup flash layout (does not scan as we override that) */
>         mtd->size = nand_chip.chipsize;
>         nand_chip.scan_bbt(mtd);
> +       mxs_nand_setup_ecc(mtd);
>
>         return 0;
>  }
> --
> 2.17.1
>

Thanks Adam,

This resolves failed booting on Gateworks Ventana IMX6 with NAND SPL
for MT29F2G08AB 2Gbit (oob=64)

Acked-by: Tim Harvey <tharvey@gateworks.com>

Tested-by: Tim Harvey <tharvey@gateworks.com>
for GW5100 with MT29F2G08AB 2Gbit (oob=64)
Adam Ford Feb. 10, 2019, 1:30 p.m. UTC | #4
On Mon, Feb 4, 2019 at 12:17 PM Tim Harvey <tharvey@gateworks.com> wrote:
>
> On Wed, Jan 2, 2019 at 6:37 PM Adam Ford <aford173@gmail.com> wrote:
> >
> > The LogicPD board uses a Micron Flash with ECC.  To boot this from
> > SPL, the ECC needs to be correctly configured or the BCH engine
> > times out.
> >
> > Signed-off-by: Adam Ford <aford173@gmail.com>
> >
> > diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
> > index e3341812a2..2d84bfffe2 100644
> > --- a/drivers/mtd/nand/raw/mxs_nand.c
> > +++ b/drivers/mtd/nand/raw/mxs_nand.c
> > @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
> >
> >         nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
> >         nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> > +
> > +       if (is_mx6sx() || is_mx7())
> > +               nand_info->max_ecc_strength_supported = 62;
> > +       else
> > +               nand_info->max_ecc_strength_supported = 40;
> > +
> >         err = mxs_nand_alloc_buffers(nand_info);
> >         if (err)
> >                 return err;
> > diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > index c628f3adec..ba85baac60 100644
> > --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
> >         /* setup flash layout (does not scan as we override that) */
> >         mtd->size = nand_chip.chipsize;
> >         nand_chip.scan_bbt(mtd);
> > +       mxs_nand_setup_ecc(mtd);
> >
> >         return 0;
> >  }
> > --
> > 2.17.1
> >
>
> Thanks Adam,

Scott / Stefano,

Any chance this can get reviewed and/or applied for the next release?
We've got a few people who have their respective tested-by comments.

adam
>
> This resolves failed booting on Gateworks Ventana IMX6 with NAND SPL
> for MT29F2G08AB 2Gbit (oob=64)
>
> Acked-by: Tim Harvey <tharvey@gateworks.com>
>
> Tested-by: Tim Harvey <tharvey@gateworks.com>
> for GW5100 with MT29F2G08AB 2Gbit (oob=64)
Adam Ford Feb. 10, 2019, 1:48 p.m. UTC | #5
On Sun, Feb 10, 2019 at 7:30 AM Adam Ford <aford173@gmail.com> wrote:
>
> On Mon, Feb 4, 2019 at 12:17 PM Tim Harvey <tharvey@gateworks.com> wrote:
> >
> > On Wed, Jan 2, 2019 at 6:37 PM Adam Ford <aford173@gmail.com> wrote:
> > >
> > > The LogicPD board uses a Micron Flash with ECC.  To boot this from
> > > SPL, the ECC needs to be correctly configured or the BCH engine
> > > times out.
> > >
> > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > >
> > > diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
> > > index e3341812a2..2d84bfffe2 100644
> > > --- a/drivers/mtd/nand/raw/mxs_nand.c
> > > +++ b/drivers/mtd/nand/raw/mxs_nand.c
> > > @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
> > >
> > >         nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
> > >         nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> > > +
> > > +       if (is_mx6sx() || is_mx7())
> > > +               nand_info->max_ecc_strength_supported = 62;
> > > +       else
> > > +               nand_info->max_ecc_strength_supported = 40;
> > > +
> > >         err = mxs_nand_alloc_buffers(nand_info);
> > >         if (err)
> > >                 return err;
> > > diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > index c628f3adec..ba85baac60 100644
> > > --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
> > >         /* setup flash layout (does not scan as we override that) */
> > >         mtd->size = nand_chip.chipsize;
> > >         nand_chip.scan_bbt(mtd);
> > > +       mxs_nand_setup_ecc(mtd);
> > >
> > >         return 0;
> > >  }
> > > --
> > > 2.17.1
> > >
> >
> > Thanks Adam,
>
 Scott / Stefano,

I had to use Scott's other -email.


 Any chance this can get reviewed and/or applied for the next release?
 We've got a few people who have their respective tested-by comments.

adam
> >
> > This resolves failed booting on Gateworks Ventana IMX6 with NAND SPL
> > for MT29F2G08AB 2Gbit (oob=64)
> >
> > Acked-by: Tim Harvey <tharvey@gateworks.com>
> >
> > Tested-by: Tim Harvey <tharvey@gateworks.com>
> > for GW5100 with MT29F2G08AB 2Gbit (oob=64)
Crystal Wood Feb. 12, 2019, 9:38 p.m. UTC | #6
On Sun, 2019-02-10 at 07:48 -0600, Adam Ford wrote:
> On Sun, Feb 10, 2019 at 7:30 AM Adam Ford <aford173@gmail.com> wrote:
> > 
> > On Mon, Feb 4, 2019 at 12:17 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > > 
> > > On Wed, Jan 2, 2019 at 6:37 PM Adam Ford <aford173@gmail.com> wrote:
> > > > 
> > > > The LogicPD board uses a Micron Flash with ECC.  To boot this from
> > > > SPL, the ECC needs to be correctly configured or the BCH engine
> > > > times out.
> > > > 
> > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > 
> > > > diff --git a/drivers/mtd/nand/raw/mxs_nand.c
> > > > b/drivers/mtd/nand/raw/mxs_nand.c
> > > > index e3341812a2..2d84bfffe2 100644
> > > > --- a/drivers/mtd/nand/raw/mxs_nand.c
> > > > +++ b/drivers/mtd/nand/raw/mxs_nand.c
> > > > @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
> > > > 
> > > >         nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
> > > >         nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> > > > +
> > > > +       if (is_mx6sx() || is_mx7())
> > > > +               nand_info->max_ecc_strength_supported = 62;
> > > > +       else
> > > > +               nand_info->max_ecc_strength_supported = 40;
> > > > +
> > > >         err = mxs_nand_alloc_buffers(nand_info);
> > > >         if (err)
> > > >                 return err;
> > > > diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > index c628f3adec..ba85baac60 100644
> > > > --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
> > > >         /* setup flash layout (does not scan as we override that) */
> > > >         mtd->size = nand_chip.chipsize;
> > > >         nand_chip.scan_bbt(mtd);
> > > > +       mxs_nand_setup_ecc(mtd);
> > > > 
> > > >         return 0;
> > > >  }
> > > > --
> > > > 2.17.1
> > > > 
> > > 
> > > Thanks Adam,
> 
>  Scott / Stefano,
> 
> I had to use Scott's other -email.
> 
> 
>  Any chance this can get reviewed and/or applied for the next release?
>  We've got a few people who have their respective tested-by comments.

I haven't been involved in U-Boot for a while now.

-Scott
Adam Ford Feb. 12, 2019, 9:44 p.m. UTC | #7
On Tue, Feb 12, 2019 at 3:41 PM Scott Wood <oss@buserror.net> wrote:
>
> On Sun, 2019-02-10 at 07:48 -0600, Adam Ford wrote:
> > On Sun, Feb 10, 2019 at 7:30 AM Adam Ford <aford173@gmail.com> wrote:
> > >
> > > On Mon, Feb 4, 2019 at 12:17 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > > >
> > > > On Wed, Jan 2, 2019 at 6:37 PM Adam Ford <aford173@gmail.com> wrote:
> > > > >
> > > > > The LogicPD board uses a Micron Flash with ECC.  To boot this from
> > > > > SPL, the ECC needs to be correctly configured or the BCH engine
> > > > > times out.
> > > > >
> > > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > >
> > > > > diff --git a/drivers/mtd/nand/raw/mxs_nand.c
> > > > > b/drivers/mtd/nand/raw/mxs_nand.c
> > > > > index e3341812a2..2d84bfffe2 100644
> > > > > --- a/drivers/mtd/nand/raw/mxs_nand.c
> > > > > +++ b/drivers/mtd/nand/raw/mxs_nand.c
> > > > > @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
> > > > >
> > > > >         nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
> > > > >         nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> > > > > +
> > > > > +       if (is_mx6sx() || is_mx7())
> > > > > +               nand_info->max_ecc_strength_supported = 62;
> > > > > +       else
> > > > > +               nand_info->max_ecc_strength_supported = 40;
> > > > > +
> > > > >         err = mxs_nand_alloc_buffers(nand_info);
> > > > >         if (err)
> > > > >                 return err;
> > > > > diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > index c628f3adec..ba85baac60 100644
> > > > > --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
> > > > >         /* setup flash layout (does not scan as we override that) */
> > > > >         mtd->size = nand_chip.chipsize;
> > > > >         nand_chip.scan_bbt(mtd);
> > > > > +       mxs_nand_setup_ecc(mtd);
> > > > >
> > > > >         return 0;
> > > > >  }
> > > > > --
> > > > > 2.17.1
> > > > >
> > > >
> > > > Thanks Adam,
> >
> >  Scott / Stefano,
> >
> > I had to use Scott's other -email.
> >
> >
> >  Any chance this can get reviewed and/or applied for the next release?
> >  We've got a few people who have their respective tested-by comments.
>
> I haven't been involved in U-Boot for a while now.

Tom / Stefano,

Patchwork is showing this is being delegated to Scott, but he's saying
he isn't the right person.  Is there someone else who can review
and/or apply a few of these patches designated to Scott?  Both of the
patches I care about deligated to him are imx6 related

thanks,

adam
>
> -Scott
>
>
Tom Rini Feb. 12, 2019, 11:05 p.m. UTC | #8
On Tue, Feb 12, 2019 at 03:44:05PM -0600, Adam Ford wrote:
> On Tue, Feb 12, 2019 at 3:41 PM Scott Wood <oss@buserror.net> wrote:
> >
> > On Sun, 2019-02-10 at 07:48 -0600, Adam Ford wrote:
> > > On Sun, Feb 10, 2019 at 7:30 AM Adam Ford <aford173@gmail.com> wrote:
> > > >
> > > > On Mon, Feb 4, 2019 at 12:17 PM Tim Harvey <tharvey@gateworks.com> wrote:
> > > > >
> > > > > On Wed, Jan 2, 2019 at 6:37 PM Adam Ford <aford173@gmail.com> wrote:
> > > > > >
> > > > > > The LogicPD board uses a Micron Flash with ECC.  To boot this from
> > > > > > SPL, the ECC needs to be correctly configured or the BCH engine
> > > > > > times out.
> > > > > >
> > > > > > Signed-off-by: Adam Ford <aford173@gmail.com>
> > > > > >
> > > > > > diff --git a/drivers/mtd/nand/raw/mxs_nand.c
> > > > > > b/drivers/mtd/nand/raw/mxs_nand.c
> > > > > > index e3341812a2..2d84bfffe2 100644
> > > > > > --- a/drivers/mtd/nand/raw/mxs_nand.c
> > > > > > +++ b/drivers/mtd/nand/raw/mxs_nand.c
> > > > > > @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
> > > > > >
> > > > > >         nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
> > > > > >         nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> > > > > > +
> > > > > > +       if (is_mx6sx() || is_mx7())
> > > > > > +               nand_info->max_ecc_strength_supported = 62;
> > > > > > +       else
> > > > > > +               nand_info->max_ecc_strength_supported = 40;
> > > > > > +
> > > > > >         err = mxs_nand_alloc_buffers(nand_info);
> > > > > >         if (err)
> > > > > >                 return err;
> > > > > > diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > > b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > > index c628f3adec..ba85baac60 100644
> > > > > > --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > > +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> > > > > > @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
> > > > > >         /* setup flash layout (does not scan as we override that) */
> > > > > >         mtd->size = nand_chip.chipsize;
> > > > > >         nand_chip.scan_bbt(mtd);
> > > > > > +       mxs_nand_setup_ecc(mtd);
> > > > > >
> > > > > >         return 0;
> > > > > >  }
> > > > > > --
> > > > > > 2.17.1
> > > > > >
> > > > >
> > > > > Thanks Adam,
> > >
> > >  Scott / Stefano,
> > >
> > > I had to use Scott's other -email.
> > >
> > >
> > >  Any chance this can get reviewed and/or applied for the next release?
> > >  We've got a few people who have their respective tested-by comments.
> >
> > I haven't been involved in U-Boot for a while now.
> 
> Tom / Stefano,
> 
> Patchwork is showing this is being delegated to Scott, but he's saying
> he isn't the right person.  Is there someone else who can review
> and/or apply a few of these patches designated to Scott?  Both of the
> patches I care about deligated to him are imx6 related

I've assigned the mxs related patches to Stefano, thanks!
Stefano Babic Feb. 13, 2019, 7:42 a.m. UTC | #9
On 13/02/19 00:05, Tom Rini wrote:
> On Tue, Feb 12, 2019 at 03:44:05PM -0600, Adam Ford wrote:
>> On Tue, Feb 12, 2019 at 3:41 PM Scott Wood <oss@buserror.net> wrote:
>>>
>>> On Sun, 2019-02-10 at 07:48 -0600, Adam Ford wrote:
>>>> On Sun, Feb 10, 2019 at 7:30 AM Adam Ford <aford173@gmail.com> wrote:
>>>>>
>>>>> On Mon, Feb 4, 2019 at 12:17 PM Tim Harvey <tharvey@gateworks.com> wrote:
>>>>>>
>>>>>> On Wed, Jan 2, 2019 at 6:37 PM Adam Ford <aford173@gmail.com> wrote:
>>>>>>>
>>>>>>> The LogicPD board uses a Micron Flash with ECC.  To boot this from
>>>>>>> SPL, the ECC needs to be correctly configured or the BCH engine
>>>>>>> times out.
>>>>>>>
>>>>>>> Signed-off-by: Adam Ford <aford173@gmail.com>
>>>>>>>
>>>>>>> diff --git a/drivers/mtd/nand/raw/mxs_nand.c
>>>>>>> b/drivers/mtd/nand/raw/mxs_nand.c
>>>>>>> index e3341812a2..2d84bfffe2 100644
>>>>>>> --- a/drivers/mtd/nand/raw/mxs_nand.c
>>>>>>> +++ b/drivers/mtd/nand/raw/mxs_nand.c
>>>>>>> @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
>>>>>>>
>>>>>>>         nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
>>>>>>>         nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
>>>>>>> +
>>>>>>> +       if (is_mx6sx() || is_mx7())
>>>>>>> +               nand_info->max_ecc_strength_supported = 62;
>>>>>>> +       else
>>>>>>> +               nand_info->max_ecc_strength_supported = 40;
>>>>>>> +
>>>>>>>         err = mxs_nand_alloc_buffers(nand_info);
>>>>>>>         if (err)
>>>>>>>                 return err;
>>>>>>> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c
>>>>>>> b/drivers/mtd/nand/raw/mxs_nand_spl.c
>>>>>>> index c628f3adec..ba85baac60 100644
>>>>>>> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
>>>>>>> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
>>>>>>> @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
>>>>>>>         /* setup flash layout (does not scan as we override that) */
>>>>>>>         mtd->size = nand_chip.chipsize;
>>>>>>>         nand_chip.scan_bbt(mtd);
>>>>>>> +       mxs_nand_setup_ecc(mtd);
>>>>>>>
>>>>>>>         return 0;
>>>>>>>  }
>>>>>>> --
>>>>>>> 2.17.1
>>>>>>>
>>>>>>
>>>>>> Thanks Adam,
>>>>
>>>>  Scott / Stefano,
>>>>
>>>> I had to use Scott's other -email.
>>>>
>>>>
>>>>  Any chance this can get reviewed and/or applied for the next release?
>>>>  We've got a few people who have their respective tested-by comments.
>>>
>>> I haven't been involved in U-Boot for a while now.
>>
>> Tom / Stefano,
>>
>> Patchwork is showing this is being delegated to Scott, but he's saying
>> he isn't the right person.  Is there someone else who can review
>> and/or apply a few of these patches designated to Scott?  Both of the
>> patches I care about deligated to him are imx6 related
> 
> I've assigned the mxs related patches to Stefano, thanks!
> 

Ok, thanks - I take care of this.

Regards,
Stefano
Stefano Babic Feb. 16, 2019, 10:26 a.m. UTC | #10
> The LogicPD board uses a Micron Flash with ECC.  To boot this from
> SPL, the ECC needs to be correctly configured or the BCH engine
> times out.
> Signed-off-by: Adam Ford <aford173@gmail.com>
> Acked-by: Stefan Agner <stefan.agner@toradex.com>
> Tested-by: Jörg Krause <joerg.krause@embedded.rocks>
> Acked-by: Tim Harvey <tharvey@gateworks.com>
> Tested-by: Tim Harvey <tharvey@gateworks.com>
> diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
> index e3341812a2..2d84bfffe2 100644
> --- a/drivers/mtd/nand/raw/mxs_nand.c
> +++ b/drivers/mtd/nand/raw/mxs_nand.c
> @@ -1163,6 +1163,12 @@ int mxs_nand_init_spl(struct nand_chip *nand)
>  
>  	nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
>  	nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
> +
> +	if (is_mx6sx() || is_mx7())
> +		nand_info->max_ecc_strength_supported = 62;
> +	else
> +		nand_info->max_ecc_strength_supported = 40;
> +
>  	err = mxs_nand_alloc_buffers(nand_info);
>  	if (err)
>  		return err;
> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
> index c628f3adec..ba85baac60 100644
> --- a/drivers/mtd/nand/raw/mxs_nand_spl.c
> +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
> @@ -201,6 +201,7 @@ static int mxs_nand_init(void)
>  	/* setup flash layout (does not scan as we override that) */
>  	mtd->size = nand_chip.chipsize;
>  	nand_chip.scan_bbt(mtd);
> +	mxs_nand_setup_ecc(mtd);
>  
>  	return 0;
>  }

Applied to u-boot-imx, master, thanks !

Best regards,
Stefano Babic
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
index e3341812a2..2d84bfffe2 100644
--- a/drivers/mtd/nand/raw/mxs_nand.c
+++ b/drivers/mtd/nand/raw/mxs_nand.c
@@ -1163,6 +1163,12 @@  int mxs_nand_init_spl(struct nand_chip *nand)
 
 	nand_info->gpmi_regs = (struct mxs_gpmi_regs *)MXS_GPMI_BASE;
 	nand_info->bch_regs = (struct mxs_bch_regs *)MXS_BCH_BASE;
+
+	if (is_mx6sx() || is_mx7())
+		nand_info->max_ecc_strength_supported = 62;
+	else
+		nand_info->max_ecc_strength_supported = 40;
+
 	err = mxs_nand_alloc_buffers(nand_info);
 	if (err)
 		return err;
diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
index c628f3adec..ba85baac60 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -201,6 +201,7 @@  static int mxs_nand_init(void)
 	/* setup flash layout (does not scan as we override that) */
 	mtd->size = nand_chip.chipsize;
 	nand_chip.scan_bbt(mtd);
+	mxs_nand_setup_ecc(mtd);
 
 	return 0;
 }