mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: mxc_nand: always copy_spare() for page write
@ 2024-07-02  8:45 Sascha Hauer
  2024-07-03  8:53 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2024-07-02  8:45 UTC (permalink / raw)
  To: Barebox List

When doing a page write we always have to copy the OOB data in place,
as the controller will always write it. Not copying it means we write
random data to the OOB area.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/mtd/nand/raw/mxc_nand.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index a5500f7dda..c2a03ed0d1 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -759,8 +759,7 @@ static int mxc_nand_write_page_ecc(struct nand_chip *chip, const uint8_t *buf,
 	struct mxc_nand_host *host = nand_get_controller_data(chip);
 	int ret;
 
-	if (oob_required)
-		copy_spare(mtd, false, chip->oob_poi);
+	copy_spare(mtd, false, chip->oob_poi);
 
 	host->devtype_data->enable_hwecc(chip, true);
 
@@ -776,8 +775,7 @@ static int mxc_nand_write_page_raw(struct nand_chip *chip, const uint8_t *buf,
 {
 	struct mtd_info *mtd = nand_to_mtd(chip);
 
-	if (oob_required)
-		copy_spare(mtd, false, chip->oob_poi);
+	copy_spare(mtd, false, chip->oob_poi);
 
 	return nand_prog_page_op(chip, page, 0, buf, mtd->writesize);
 }
-- 
2.39.2




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

* Re: [PATCH] mtd: nand: mxc_nand: always copy_spare() for page write
  2024-07-02  8:45 [PATCH] mtd: nand: mxc_nand: always copy_spare() for page write Sascha Hauer
@ 2024-07-03  8:53 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2024-07-03  8:53 UTC (permalink / raw)
  To: Barebox List, Sascha Hauer


On Tue, 02 Jul 2024 10:45:22 +0200, Sascha Hauer wrote:
> When doing a page write we always have to copy the OOB data in place,
> as the controller will always write it. Not copying it means we write
> random data to the OOB area.
> 
> 

Applied, thanks!

[1/1] mtd: nand: mxc_nand: always copy_spare() for page write
      https://git.pengutronix.de/cgit/barebox/commit/?id=d74c84582591 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-07-03  8:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-02  8:45 [PATCH] mtd: nand: mxc_nand: always copy_spare() for page write Sascha Hauer
2024-07-03  8:53 ` Sascha Hauer

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