ath79: ar934x: fix mounting issues if subpage is not supported
[openwrt/staging/chunkeey.git] / target / linux / ath79 / files / drivers / mtd / nand / raw / ar934x_nand.c
index 5f0026b4759d80efd57d34c285b27583ee34f460..7ba7b68d572390b8f2339c637fbcd8316f2d341c 100644 (file)
@@ -1266,7 +1266,6 @@ static int ar934x_nfc_setup_hwecc(struct ar934x_nfc *nfc)
                 * Writing a subpage separately is not supported, because
                 * the controller only does ECC on full-page accesses.
                 */
-               nand->options = NAND_NO_SUBPAGE_WRITE;
 
                nand->ecc.size = 512;
                nand->ecc.bytes = 7;
@@ -1325,6 +1324,9 @@ static int ar934x_nfc_attach_chip(struct nand_chip *nand)
        if (ret)
                return ret;
 
+       if (mtd->writesize == 2048)
+               nand->options |= NAND_NO_SUBPAGE_WRITE;
+
        if (nand->ecc.mode == NAND_ECC_HW) {
                ret = ar934x_nfc_setup_hwecc(nfc);
                if (ret)