Skip to content

Commit

Permalink
mtd: spinand: macronix: Fix ECC Status Read
Browse files Browse the repository at this point in the history
The datasheet specifies the upper four bits are reserved.
Testing on real hardware shows that these bits can indeed be nonzero.

Signed-off-by: Emil Lenngren <emil.lenngren@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
  • Loading branch information
Emil Lenngren authored and Miquel Raynal committed Feb 5, 2019
1 parent 67c8800 commit f4cb4d7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/mtd/nand/spi/macronix.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <linux/mtd/spinand.h>

#define SPINAND_MFR_MACRONIX 0xC2
#define MACRONIX_ECCSR_MASK 0x0F

static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
Expand Down Expand Up @@ -55,7 +56,12 @@ static int mx35lf1ge4ab_get_eccsr(struct spinand_device *spinand, u8 *eccsr)
SPI_MEM_OP_DUMMY(1, 1),
SPI_MEM_OP_DATA_IN(1, eccsr, 1));

return spi_mem_exec_op(spinand->spimem, &op);
int ret = spi_mem_exec_op(spinand->spimem, &op);
if (ret)
return ret;

*eccsr &= MACRONIX_ECCSR_MASK;
return 0;
}

static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand,
Expand Down

0 comments on commit f4cb4d7

Please sign in to comment.