@@ -1028,6 +1028,16 @@ static void sunxi_nfc_hw_ecc_update_stats(struct nand_chip *nand,
}
}
+static int sunxi_nfc_read_column(struct nand_chip *nand, int page,
+ unsigned int column, void *buf, unsigned int len)
+{
+ /* Small-page NAND needs a new READ0/READ1/READOOB and the page address. */
+ if (nand_to_mtd(nand)->writesize <= 512)
+ return nand_read_page_op(nand, page, column, buf, len);
+
+ return nand_change_read_column_op(nand, column, buf, len, false);
+}
+
/* Shared across a read's transfers; buf remains the full-page buffer base. */
struct sunxi_nfc_ecc_read {
u8 *buf;
@@ -1111,10 +1121,10 @@ static int sunxi_nfc_hw_ecc_read_error(struct nand_chip *nand,
/* Check the physical representation for bitflips in erased pages. */
if (nand->options & NAND_NEED_SCRAMBLING)
- nand_change_read_column_op(nand, data_off, data, ecc->size, false);
+ sunxi_nfc_read_column(nand, read->page, data_off, data, ecc->size);
- nand_change_read_column_op(nand, nand_to_mtd(nand)->writesize + oob_off,
- oob, oob_len, false);
+ sunxi_nfc_read_column(nand, read->page, nand_to_mtd(nand)->writesize + oob_off,
+ oob, oob_len);
ret = nand_check_erased_ecc_chunk(data, ecc->size, oob, oob_len, NULL, 0,
ecc->strength);
@@ -1141,8 +1151,8 @@ static void sunxi_nfc_hw_ecc_read_extra_oob(struct nand_chip *nand,
return;
if (!cur_off || *cur_off != (offset + mtd->writesize))
- nand_change_read_column_op(nand, mtd->writesize + offset,
- NULL, 0, false);
+ sunxi_nfc_read_column(nand, page, mtd->writesize + offset,
+ NULL, 0);
if (!randomize)
sunxi_nfc_read_buf(nand, oob + offset, len);
@@ -1200,11 +1210,12 @@ static int sunxi_nfc_oob_read_batch(struct nand_chip *nand,
if (read->oob_required) {
/* Keep the existing PIO and DMA representations of parity. */
if (read->dma) {
- nand_change_read_column_op(nand, mtd->writesize + oob_off,
- oob, ecc->bytes + user_data_sz, false);
+ sunxi_nfc_read_column(nand, read->page,
+ mtd->writesize + oob_off,
+ oob, ecc->bytes + user_data_sz);
} else {
- nand_change_read_column_op(nand, mtd->writesize + oob_off,
- NULL, 0, false);
+ sunxi_nfc_read_column(nand, read->page,
+ mtd->writesize + oob_off, NULL, 0);
sunxi_nfc_randomizer_read_buf(nand, oob,
ecc->bytes + user_data_sz,
true, read->page);
@@ -1260,12 +1271,12 @@ static int sunxi_nfc_hw_ecc_read_chunk(struct nand_chip *nand,
int ret;
if (*cur_off != data_off)
- nand_change_read_column_op(nand, data_off, NULL, 0, false);
+ sunxi_nfc_read_column(nand, page, data_off, NULL, 0);
sunxi_nfc_randomizer_read_buf(nand, NULL, ecc->size, false, page);
if (data_off + ecc->size != oob_off)
- nand_change_read_column_op(nand, oob_off, NULL, 0, false);
+ sunxi_nfc_read_column(nand, page, oob_off, NULL, 0);
ret = sunxi_nfc_wait_cmd_fifo_empty(nfc);
if (ret)
@@ -2105,7 +2116,8 @@ static int sunxi_nand_hw_ecc_ctrl_init(struct nand_chip *nand,
ecc->write_oob = sunxi_nfc_hw_ecc_write_oob;
mtd_set_ooblayout(mtd, &sunxi_nand_ooblayout_ops);
- if (nfc->dmac || nfc->use_mdma) {
+ /* The DMA page sequencer uses large-page random-column commands. */
+ if (mtd->writesize > 512 && (nfc->dmac || nfc->use_mdma)) {
ecc->read_page = sunxi_nfc_hw_ecc_read_page_dma;
ecc->read_subpage = sunxi_nfc_hw_ecc_read_subpage_dma;
ecc->write_page = sunxi_nfc_hw_ecc_write_page_dma;