Message ID | d087411f-c2fd-75a8-6041-31623aba53ae@salutedevices.com |
---|---|
State | New |
Delegated to: | Neil Armstrong |
Headers | show |
Series | [v1] mtd: rawnand: meson: always use OOB bytes during write | expand |
On Sun, Dec 22, 2024 at 10:23 PM Arseniy Krasnov <avkrasnov@salutedevices.com> wrote: > > If 'oob_required' is not set by the caller (for example 'oobbuf' is NULL), > then driver doesn't copy OOB data from 'oob_poi' to special controller > structures, so zeroes will be written as OOB. But, generic raw NAND logic > in 'nand_base.c' already handles case when OOB is not required to write by > filling 'oob_poi' with 0xFF's. So let's remove 'oob_required' check to > always read 'oob_poi' data for OOB. > > Kernel driver (drivers/mtd/nand/raw/meson_nand.c) works in the same way, > so need to keep same behaviour here. > > Fixes: c2e8c4d09a7a ("mtd: rawnand: Meson NAND controller support") > Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com> > --- > drivers/mtd/nand/raw/meson_nand.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c > index 81122315f4..82a12ac061 100644 > --- a/drivers/mtd/nand/raw/meson_nand.c > +++ b/drivers/mtd/nand/raw/meson_nand.c > @@ -607,9 +607,7 @@ static int meson_nfc_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *ch > memcpy(meson_chip->data_buf, buf, mtd->writesize); > > memset(meson_chip->info_buf, 0, chip->ecc.steps * PER_INFO_BYTE); > - > - if (oob_required) > - meson_nfc_set_user_byte(chip, chip->oob_poi); > + meson_nfc_set_user_byte(chip, chip->oob_poi); > Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> I will queue it > return meson_nfc_write_page_sub(chip, page, false); > } > -- > 2.30.1
On 23.12.2024 15:57, Michael Nazzareno Trimarchi wrote: > On Sun, Dec 22, 2024 at 10:23 PM Arseniy Krasnov > <avkrasnov@salutedevices.com> wrote: >> >> If 'oob_required' is not set by the caller (for example 'oobbuf' is NULL), >> then driver doesn't copy OOB data from 'oob_poi' to special controller >> structures, so zeroes will be written as OOB. But, generic raw NAND logic >> in 'nand_base.c' already handles case when OOB is not required to write by >> filling 'oob_poi' with 0xFF's. So let's remove 'oob_required' check to >> always read 'oob_poi' data for OOB. >> >> Kernel driver (drivers/mtd/nand/raw/meson_nand.c) works in the same way, >> so need to keep same behaviour here. >> >> Fixes: c2e8c4d09a7a ("mtd: rawnand: Meson NAND controller support") >> Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com> >> --- >> drivers/mtd/nand/raw/meson_nand.c | 4 +--- >> 1 file changed, 1 insertion(+), 3 deletions(-) >> >> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c >> index 81122315f4..82a12ac061 100644 >> --- a/drivers/mtd/nand/raw/meson_nand.c >> +++ b/drivers/mtd/nand/raw/meson_nand.c >> @@ -607,9 +607,7 @@ static int meson_nfc_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *ch >> memcpy(meson_chip->data_buf, buf, mtd->writesize); >> >> memset(meson_chip->info_buf, 0, chip->ecc.steps * PER_INFO_BYTE); >> - >> - if (oob_required) >> - meson_nfc_set_user_byte(chip, chip->oob_poi); >> + meson_nfc_set_user_byte(chip, chip->oob_poi); >> > > Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> > > I will queue it Thanks. You mean it will be merged to https://source.denx.de/u-boot/custodians/u-boot-nand-flash ? > >> return meson_nfc_write_page_sub(chip, page, false); >> } >> -- >> 2.30.1 > > >
Hi Yes Michael On Tue, Dec 24, 2024 at 8:55 AM Arseniy Krasnov <avkrasnov@salutedevices.com> wrote: > > > > On 23.12.2024 15:57, Michael Nazzareno Trimarchi wrote: > > On Sun, Dec 22, 2024 at 10:23 PM Arseniy Krasnov > > <avkrasnov@salutedevices.com> wrote: > >> > >> If 'oob_required' is not set by the caller (for example 'oobbuf' is NULL), > >> then driver doesn't copy OOB data from 'oob_poi' to special controller > >> structures, so zeroes will be written as OOB. But, generic raw NAND logic > >> in 'nand_base.c' already handles case when OOB is not required to write by > >> filling 'oob_poi' with 0xFF's. So let's remove 'oob_required' check to > >> always read 'oob_poi' data for OOB. > >> > >> Kernel driver (drivers/mtd/nand/raw/meson_nand.c) works in the same way, > >> so need to keep same behaviour here. > >> > >> Fixes: c2e8c4d09a7a ("mtd: rawnand: Meson NAND controller support") > >> Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com> > >> --- > >> drivers/mtd/nand/raw/meson_nand.c | 4 +--- > >> 1 file changed, 1 insertion(+), 3 deletions(-) > >> > >> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c > >> index 81122315f4..82a12ac061 100644 > >> --- a/drivers/mtd/nand/raw/meson_nand.c > >> +++ b/drivers/mtd/nand/raw/meson_nand.c > >> @@ -607,9 +607,7 @@ static int meson_nfc_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *ch > >> memcpy(meson_chip->data_buf, buf, mtd->writesize); > >> > >> memset(meson_chip->info_buf, 0, chip->ecc.steps * PER_INFO_BYTE); > >> - > >> - if (oob_required) > >> - meson_nfc_set_user_byte(chip, chip->oob_poi); > >> + meson_nfc_set_user_byte(chip, chip->oob_poi); > >> > > > > Reviewed-by: Michael Trimarchi <michael@amarulasolutions.com> > > > > I will queue it > > Thanks. You mean it will be merged to https://source.denx.de/u-boot/custodians/u-boot-nand-flash ? > > > > > >> return meson_nfc_write_page_sub(chip, page, false); > >> } > >> -- > >> 2.30.1 > > > > > >
diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c index 81122315f4..82a12ac061 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -607,9 +607,7 @@ static int meson_nfc_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *ch memcpy(meson_chip->data_buf, buf, mtd->writesize); memset(meson_chip->info_buf, 0, chip->ecc.steps * PER_INFO_BYTE); - - if (oob_required) - meson_nfc_set_user_byte(chip, chip->oob_poi); + meson_nfc_set_user_byte(chip, chip->oob_poi); return meson_nfc_write_page_sub(chip, page, false); }
If 'oob_required' is not set by the caller (for example 'oobbuf' is NULL), then driver doesn't copy OOB data from 'oob_poi' to special controller structures, so zeroes will be written as OOB. But, generic raw NAND logic in 'nand_base.c' already handles case when OOB is not required to write by filling 'oob_poi' with 0xFF's. So let's remove 'oob_required' check to always read 'oob_poi' data for OOB. Kernel driver (drivers/mtd/nand/raw/meson_nand.c) works in the same way, so need to keep same behaviour here. Fixes: c2e8c4d09a7a ("mtd: rawnand: Meson NAND controller support") Signed-off-by: Arseniy Krasnov <avkrasnov@salutedevices.com> --- drivers/mtd/nand/raw/meson_nand.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)