mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* No oob scheme defined for oobsize 224 on imx6ull board
@ 2020-12-18  9:11 郑小军
  2021-01-06 10:35 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: 郑小军 @ 2020-12-18  9:11 UTC (permalink / raw)
  To: barebox

Hi, all
    I am trying to run barebox on my i.mx6ull board.  I inherit from
nxp-imx6ull-evk. When I added nand flash support, system crashed. I
found that the pointer "chip->legacy.set_features" and
"chip->legacy.get_features" in nand_mxs.c was NULL.
I replaced it with nand_set_features() and nand_get_features().
Barebox didn't crash again, but I get the errors:
        nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
        nand_base: Micron MT29F4G08ABAEAWP
        nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096,
OOB size: 224
        WARNING: at drivers/mtd/nand/nand_base.c:5591/nand_scan_tail()!
        WARNING: No oob scheme defined for oobsize 224
        mxs_nand 1806000.nand-controller@1806000.of: probe failed:
Invalid argument

dts:
&gpmi {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_gpmi_nand>;
nand-on-flash-bbt;
status = "okay";
};

Did I miss something?

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: No oob scheme defined for oobsize 224 on imx6ull board
  2020-12-18  9:11 No oob scheme defined for oobsize 224 on imx6ull board 郑小军
@ 2021-01-06 10:35 ` Sascha Hauer
  2021-01-07  2:27   ` =?gb18030?B?amFtZXN6eGo=?=
       [not found]   ` <tencent_38A3D28635D0E3DF1085571FDB818F5D420A@qq.com>
  0 siblings, 2 replies; 5+ messages in thread
From: Sascha Hauer @ 2021-01-06 10:35 UTC (permalink / raw)
  To: 郑小军; +Cc: barebox

Hi,

On Fri, Dec 18, 2020 at 05:11:11PM +0800, 郑小军 wrote:
> Hi, all
>     I am trying to run barebox on my i.mx6ull board.  I inherit from
> nxp-imx6ull-evk. When I added nand flash support, system crashed. I
> found that the pointer "chip->legacy.set_features" and
> "chip->legacy.get_features" in nand_mxs.c was NULL.
> I replaced it with nand_set_features() and nand_get_features().

This looks like the correct solution for this. Care to send a patch?

> Barebox didn't crash again, but I get the errors:
>         nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
>         nand_base: Micron MT29F4G08ABAEAWP
>         nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096,
> OOB size: 224
>         WARNING: at drivers/mtd/nand/nand_base.c:5591/nand_scan_tail()!
>         WARNING: No oob scheme defined for oobsize 224
>         mxs_nand 1806000.nand-controller@1806000.of: probe failed:
> Invalid argument

You are falling into:

	/*
	 * If no default placement scheme is given, select an appropriate one.
	 */
	if (!mtd->ooblayout &&
	    !(ecc->mode == NAND_ECC_SOFT && ecc->algo == NAND_ECC_BCH)) {
			...
	}

Normally mtd->ooblayout should be set at this point. the nand_mxs driver
currently misses to set it. I think you have to adopt
gpmi_ooblayout_ecc() and gpmi_ooblayout_free() from the Linux driver for
barebox.

This bug seems to trigger for NANDs with bigger page sizes. I only
tested the last NAND layer update with smaller page sizes. So it's not
you who misses something, it's me who missed something ;)

Regards,
  Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: No oob scheme defined for oobsize 224 on imx6ull board
  2021-01-06 10:35 ` Sascha Hauer
@ 2021-01-07  2:27   ` =?gb18030?B?amFtZXN6eGo=?=
       [not found]   ` <tencent_38A3D28635D0E3DF1085571FDB818F5D420A@qq.com>
  1 sibling, 0 replies; 5+ messages in thread
From: =?gb18030?B?amFtZXN6eGo=?= @ 2021-01-07  2:27 UTC (permalink / raw)
  To: =?gb18030?B?U2FzY2hhIEhhdWVy?=, =?gb18030?B?YmFyZWJveA==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 2583 bytes --]

Hi,
 
> 
> 
> ------------------ Original ------------------
> From: "Sascha Hauer" <sha@pengutronix.de>;
> Date: Wed, Jan 6, 2021 06:35 PM
> To: "֣С¾ü"<jameszxj@gmail.com>;
> Cc: "barebox"<barebox@lists.infradead.org>;
> Subject: Re: No oob scheme defined for oobsize 224 on imx6ull board
> 
> Hi,
> 
> On Fri, Dec 18, 2020 at 05:11:11PM +0800, ֣С¾ü wrote:
> > Hi, all
> >     I am trying to run barebox on my i.mx6ull board.  I inherit from
> > nxp-imx6ull-evk. When I added nand flash support, system crashed. I
> > found that the pointer "chip->legacy.set_features" and
> > "chip->legacy.get_features" in nand_mxs.c was NULL.
> > I replaced it with nand_set_features() and nand_get_features().
> 
> This looks like the correct solution for this. Care to send a patch?
I have sent a patch email. My first time send a patch to barebox, so if
the format is improper, feel free to tell me.

> 
> > Barebox didn't crash again, but I get the errors:
> >         nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
> >         nand_base: Micron MT29F4G08ABAEAWP
> >         nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096,
> > OOB size: 224
> >         WARNING: at drivers/mtd/nand/nand_base.c:5591/nand_scan_tail()!
> >         WARNING: No oob scheme defined for oobsize 224
> >         mxs_nand 1806000.nand-controller@1806000.of: probe failed:
> > Invalid argument
> 
> You are falling into:
> 
> /*
> * If no default placement scheme is given, select an appropriate one.
> */
> if (!mtd->ooblayout &&
>     !(ecc->mode == NAND_ECC_SOFT && ecc->algo == NAND_ECC_BCH)) {
> ...
> }
> 
> Normally mtd->ooblayout should be set at this point. the nand_mxs driver
> currently misses to set it. I think you have to adopt
> gpmi_ooblayout_ecc() and gpmi_ooblayout_free() from the Linux driver for
> barebox.
> 
> This bug seems to trigger for NANDs with bigger page sizes. I only
> tested the last NAND layer update with smaller page sizes. So it's not
> you who misses something, it's me who missed something ;)
> 
thanks, I'll try it. If it runs, I'll send another patch.

> Regards,
>   Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: No oob scheme defined for oobsize 224 on imx6ull board
       [not found]   ` <tencent_38A3D28635D0E3DF1085571FDB818F5D420A@qq.com>
@ 2021-02-23  0:21     ` =?gb18030?B?amFtZXN6eGo=?=
  2021-02-23  7:51     ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: =?gb18030?B?amFtZXN6eGo=?= @ 2021-02-23  0:21 UTC (permalink / raw)
  To: =?gb18030?B?YmFyZWJveA==?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 3011 bytes --]

Hi Sascha,

> 
> Subject: Re: No oob scheme defined for oobsize 224 on imx6ull board
> 
> Hi,
> 
> On Fri, Dec 18, 2020 at 05:11:11PM +0800, ֣С¾ü wrote:
> > Hi, all
> >     I am trying to run barebox on my i.mx6ull board.  I inherit from
> > nxp-imx6ull-evk. When I added nand flash support, system crashed. I
> > found that the pointer "chip->legacy.set_features" and
> > "chip->legacy.get_features" in nand_mxs.c was NULL.
> > I replaced it with nand_set_features() and nand_get_features().
> 
> This looks like the correct solution for this. Care to send a patch?
> 
> > Barebox didn't crash again, but I get the errors:
> >         nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
> >         nand_base: Micron MT29F4G08ABAEAWP
> >         nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096,
> > OOB size: 224
> >         WARNING: at drivers/mtd/nand/nand_base.c:5591/nand_scan_tail()!
> >         WARNING: No oob scheme defined for oobsize 224
> >         mxs_nand 1806000.nand-controller@1806000.of: probe failed:
> > Invalid argument
> 
> You are falling into:
> 
> /*
> * If no default placement scheme is given, select an appropriate one.
> */
> if (!mtd->ooblayout &&
>     !(ecc->mode == NAND_ECC_SOFT && ecc->algo == NAND_ECC_BCH)) {
> ...
> }
> 
> Normally mtd->ooblayout should be set at this point. the nand_mxs driver
> currently misses to set it. I think you have to adopt
> gpmi_ooblayout_ecc() and gpmi_ooblayout_free() from the Linux driver for
> barebox.
> 
> This bug seems to trigger for NANDs with bigger page sizes. I only
> tested the last NAND layer update with smaller page sizes. So it's not
> you who misses something, it's me who missed something ;)
> 

I'm trying to port gpmi_ooblayout_ecc() and gpmi_ooblayout_free() 
from Linux, barebox can run and load linux, but I encountered another error, 
barebox can not  write itself and kernel(linux) to nand device through 
barebox_update command. I traced the source and found that the 
bbu_std_file_handler() need unprotect device, but nand driver do not
supply the unlock function, so nand_unlock() return -ENOTSUPP, 
and bbu_std_file_handler() failed.
Linux driver just assign mtd->_unlock to NULL, but barebox assign it to 
nand_unlock(), I found nand_macronix.c supply ops.unlock_area
function, so mtd->_unlock is needed. 
So I make the nand_unlock() return -ENOSYS, it it the right way?

Although the gpmi_ooblayout_ecc() is worked, but the source included 
ugly debug codes, I'll send a patch after clean it.


> Regards,
>   Sascha
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: No oob scheme defined for oobsize 224 on imx6ull board
       [not found]   ` <tencent_38A3D28635D0E3DF1085571FDB818F5D420A@qq.com>
  2021-02-23  0:21     ` =?gb18030?B?amFtZXN6eGo=?=
@ 2021-02-23  7:51     ` Sascha Hauer
  1 sibling, 0 replies; 5+ messages in thread
From: Sascha Hauer @ 2021-02-23  7:51 UTC (permalink / raw)
  To: jameszxj; +Cc: barebox

On Mon, Feb 22, 2021 at 10:55:55PM +0800, jameszxj wrote:
>    Hi Sascha,
>    >
>    > Subject: Re: No oob scheme defined for oobsize 224 on imx6ull board
>    >
>    > Hi,
>    >
>    > On Fri, Dec 18, 2020 at 05:11:11PM +0800, 郑小军 wrote:
>    > > Hi, all
>    > >     I am trying to run barebox on my i.mx6ull board.  I inherit from
>    > > nxp-imx6ull-evk. When I added nand flash support, system crashed. I
>    > > found that the pointer "chip->legacy.set_features" and
>    > > "chip->legacy.get_features" in nand_mxs.c was NULL.
>    > > I replaced it with nand_set_features() and nand_get_features().
>    >
>    > This looks like the correct solution for this. Care to send a patch?
>    >
>    > > Barebox didn't crash again, but I get the errors:
>    > >         nand_base: device found, Manufacturer ID: 0x2c, Chip ID: 0xdc
>    > >         nand_base: Micron MT29F4G08ABAEAWP
>    > >         nand_base: 512 MiB, SLC, erase size: 256 KiB, page size: 4096,
>    > > OOB size: 224
>    > >         WARNING: at
>    drivers/mtd/nand/nand_base.c:5591/nand_scan_tail()!
>    > >         WARNING: No oob scheme defined for oobsize 224
>    > >         mxs_nand 1806000.nand-controller@1806000.of: probe failed:
>    > > Invalid argument
>    >
>    > You are falling into:
>    >
>    > /*
>    > * If no default placement scheme is given, select an appropriate one.
>    > */
>    > if (!mtd->ooblayout &&
>    >     !(ecc->mode == NAND_ECC_SOFT && ecc->algo == NAND_ECC_BCH)) {
>    > ...
>    > }
>    >
>    > Normally mtd->ooblayout should be set at this point. the nand_mxs driver
>    > currently misses to set it. I think you have to adopt
>    > gpmi_ooblayout_ecc() and gpmi_ooblayout_free() from the Linux driver for
>    > barebox.
>    >
>    > This bug seems to trigger for NANDs with bigger page sizes. I only
>    > tested the last NAND layer update with smaller page sizes. So it's not
>    > you who misses something, it's me who missed something ;)
>    >
>    I'm trying to port gpmi_ooblayout_ecc() and gpmi_ooblayout_free() from
>    Linux, barebox can run and
>    load linux, but I encountered another error, barebox can not write itself
>    or kernel(linux) to nand device through
>    barebox_update command. I traced the source and found that the
>    bbu_std_file_handler() need unprotect device, but nand driver do not
>    supply the unlock function, so nand_unlock() return -ENOTSUPP, and
>    bbu_std_file_handler() failed.

bbu_std_file_handler() checks for -ENOSYS, likely this error code
changed to -ENOTSUPP over time which should be fixed.
Anyway, bbu_std_file_handler() is the wrong function to write barebox to
NAND, this won't work. You'll need imx6_bbu_nand_register_handler() to
create a barebox update handler for NAND.

>    Linux driver just assign mtd->_unlock to NULL, but barebox assign it to
>    nand_unlock(), I found nand_macronix.c supply ops.unlock_area
>    function, so mtd->_unlock is needed. So I make the nand_unlock() return
>    -ENOSYS, it it the right way?

People use -ENOTSUP nowadays, I think using -ENOSYS for saying "I don't
need that operation" is deprecated. So we should rather extend the test
in bbu_std_file_handler() to also check for -ENOTSUP.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2021-02-23  7:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18  9:11 No oob scheme defined for oobsize 224 on imx6ull board 郑小军
2021-01-06 10:35 ` Sascha Hauer
2021-01-07  2:27   ` =?gb18030?B?amFtZXN6eGo=?=
     [not found]   ` <tencent_38A3D28635D0E3DF1085571FDB818F5D420A@qq.com>
2021-02-23  0:21     ` =?gb18030?B?amFtZXN6eGo=?=
2021-02-23  7:51     ` Sascha Hauer

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