Kernel: bump 4.4 to 4.4.124 for 17.01
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.4 / 0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
index f1f4971..5edd9c3 100644 (file)
@@ -1954,7 +1954,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        int ctrl = NAND_CTRL_CLE | NAND_CTRL_CHANGE;
  
        /* Write out the command to the device */
-@@ -708,7 +733,7 @@ static void nand_command(struct mtd_info
+@@ -710,7 +735,7 @@ static void nand_command(struct mtd_info
  static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
                            int column, int page_addr)
  {
@@ -1963,7 +1963,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /* Emulate NAND_CMD_READOOB */
        if (command == NAND_CMD_READOOB) {
-@@ -832,7 +857,7 @@ static void panic_nand_get_device(struct
+@@ -837,7 +862,7 @@ static void panic_nand_get_device(struct
  static int
  nand_get_device(struct mtd_info *mtd, int new_state)
  {
@@ -1972,7 +1972,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        spinlock_t *lock = &chip->controller->lock;
        wait_queue_head_t *wq = &chip->controller->wq;
        DECLARE_WAITQUEUE(wait, current);
-@@ -952,7 +977,7 @@ static int __nand_unlock(struct mtd_info
+@@ -957,7 +982,7 @@ static int __nand_unlock(struct mtd_info
  {
        int ret = 0;
        int status, page;
@@ -1981,7 +1981,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /* Submit address of first page to unlock */
        page = ofs >> chip->page_shift;
-@@ -987,7 +1012,7 @@ int nand_unlock(struct mtd_info *mtd, lo
+@@ -992,7 +1017,7 @@ int nand_unlock(struct mtd_info *mtd, lo
  {
        int ret = 0;
        int chipnr;
@@ -1990,7 +1990,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        pr_debug("%s: start = 0x%012llx, len = %llu\n",
                        __func__, (unsigned long long)ofs, len);
-@@ -1050,7 +1075,7 @@ int nand_lock(struct mtd_info *mtd, loff
+@@ -1055,7 +1080,7 @@ int nand_lock(struct mtd_info *mtd, loff
  {
        int ret = 0;
        int chipnr, status, page;
@@ -1999,7 +1999,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        pr_debug("%s: start = 0x%012llx, len = %llu\n",
                        __func__, (unsigned long long)ofs, len);
-@@ -1309,13 +1334,12 @@ static int nand_read_page_raw_syndrome(s
+@@ -1314,13 +1339,12 @@ static int nand_read_page_raw_syndrome(s
  static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
                                uint8_t *buf, int oob_required, int page)
  {
@@ -2014,7 +2014,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        unsigned int max_bitflips = 0;
  
        chip->ecc.read_page_raw(mtd, chip, buf, 1, page);
-@@ -1323,8 +1347,10 @@ static int nand_read_page_swecc(struct m
+@@ -1328,8 +1352,10 @@ static int nand_read_page_swecc(struct m
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
                chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  
@@ -2027,7 +2027,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        eccsteps = chip->ecc.steps;
        p = buf;
-@@ -1356,14 +1382,14 @@ static int nand_read_subpage(struct mtd_
+@@ -1361,14 +1387,14 @@ static int nand_read_subpage(struct mtd_
                        uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi,
                        int page)
  {
@@ -2045,7 +2045,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /* Column address within the page aligned to ECC size (256bytes) */
        start_step = data_offs / chip->ecc.size;
-@@ -1391,12 +1417,13 @@ static int nand_read_subpage(struct mtd_
+@@ -1396,12 +1422,13 @@ static int nand_read_subpage(struct mtd_
         * The performance is faster if we position offsets according to
         * ecc.pos. Let's make sure that there are no gaps in ECC positions.
         */
@@ -2065,7 +2065,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        if (gaps) {
                chip->cmdfunc(mtd, NAND_CMD_RNDOUT, mtd->writesize, -1);
                chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
-@@ -1405,20 +1432,23 @@ static int nand_read_subpage(struct mtd_
+@@ -1410,20 +1437,23 @@ static int nand_read_subpage(struct mtd_
                 * Send the command to read the particular ECC bytes take care
                 * about buswidth alignment in read_buf.
                 */
@@ -2095,7 +2095,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        p = bufpoi + data_col_addr;
        for (i = 0; i < eccfrag_len ; i += chip->ecc.bytes, p += chip->ecc.size) {
-@@ -1426,6 +1456,16 @@ static int nand_read_subpage(struct mtd_
+@@ -1431,6 +1461,16 @@ static int nand_read_subpage(struct mtd_
  
                stat = chip->ecc.correct(mtd, p,
                        &chip->buffers->ecccode[i], &chip->buffers->ecccalc[i]);
@@ -2112,7 +2112,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                if (stat < 0) {
                        mtd->ecc_stats.failed++;
                } else {
-@@ -1449,13 +1489,12 @@ static int nand_read_subpage(struct mtd_
+@@ -1454,13 +1494,12 @@ static int nand_read_subpage(struct mtd_
  static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
                                uint8_t *buf, int oob_required, int page)
  {
@@ -2127,7 +2127,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        unsigned int max_bitflips = 0;
  
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
-@@ -1465,8 +1504,10 @@ static int nand_read_page_hwecc(struct m
+@@ -1470,8 +1509,10 @@ static int nand_read_page_hwecc(struct m
        }
        chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
  
@@ -2140,7 +2140,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        eccsteps = chip->ecc.steps;
        p = buf;
-@@ -1475,6 +1516,15 @@ static int nand_read_page_hwecc(struct m
+@@ -1480,6 +1521,15 @@ static int nand_read_page_hwecc(struct m
                int stat;
  
                stat = chip->ecc.correct(mtd, p, &ecc_code[i], &ecc_calc[i]);
@@ -2156,7 +2156,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                if (stat < 0) {
                        mtd->ecc_stats.failed++;
                } else {
-@@ -1502,12 +1552,11 @@ static int nand_read_page_hwecc(struct m
+@@ -1507,12 +1557,11 @@ static int nand_read_page_hwecc(struct m
  static int nand_read_page_hwecc_oob_first(struct mtd_info *mtd,
        struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
  {
@@ -2170,7 +2170,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        uint8_t *ecc_calc = chip->buffers->ecccalc;
        unsigned int max_bitflips = 0;
  
-@@ -1516,8 +1565,10 @@ static int nand_read_page_hwecc_oob_firs
+@@ -1521,8 +1570,10 @@ static int nand_read_page_hwecc_oob_firs
        chip->read_buf(mtd, chip->oob_poi, mtd->oobsize);
        chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
  
@@ -2183,7 +2183,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
                int stat;
-@@ -1527,6 +1578,15 @@ static int nand_read_page_hwecc_oob_firs
+@@ -1532,6 +1583,15 @@ static int nand_read_page_hwecc_oob_firs
                chip->ecc.calculate(mtd, p, &ecc_calc[i]);
  
                stat = chip->ecc.correct(mtd, p, &ecc_code[i], NULL);
@@ -2199,7 +2199,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                if (stat < 0) {
                        mtd->ecc_stats.failed++;
                } else {
-@@ -1554,6 +1614,7 @@ static int nand_read_page_syndrome(struc
+@@ -1559,6 +1619,7 @@ static int nand_read_page_syndrome(struc
        int i, eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;
        int eccsteps = chip->ecc.steps;
@@ -2207,7 +2207,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        uint8_t *p = buf;
        uint8_t *oob = chip->oob_poi;
        unsigned int max_bitflips = 0;
-@@ -1573,19 +1634,29 @@ static int nand_read_page_syndrome(struc
+@@ -1578,19 +1639,29 @@ static int nand_read_page_syndrome(struc
                chip->read_buf(mtd, oob, eccbytes);
                stat = chip->ecc.correct(mtd, p, oob, NULL);
  
@@ -2244,7 +2244,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        }
  
        /* Calculate remaining oob bytes */
-@@ -1598,14 +1669,17 @@ static int nand_read_page_syndrome(struc
+@@ -1603,14 +1674,17 @@ static int nand_read_page_syndrome(struc
  
  /**
   * nand_transfer_oob - [INTERN] Transfer oob to client buffer
@@ -2264,7 +2264,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        switch (ops->mode) {
  
        case MTD_OPS_PLACE_OOB:
-@@ -1613,31 +1687,12 @@ static uint8_t *nand_transfer_oob(struct
+@@ -1618,31 +1692,12 @@ static uint8_t *nand_transfer_oob(struct
                memcpy(oob, chip->oob_poi + ops->ooboffs, len);
                return oob + len;
  
@@ -2302,7 +2302,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        default:
                BUG();
        }
-@@ -1655,7 +1710,7 @@ static uint8_t *nand_transfer_oob(struct
+@@ -1660,7 +1715,7 @@ static uint8_t *nand_transfer_oob(struct
   */
  static int nand_setup_read_retry(struct mtd_info *mtd, int retry_mode)
  {
@@ -2311,7 +2311,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        pr_debug("setting READ RETRY mode %d\n", retry_mode);
  
-@@ -1680,12 +1735,11 @@ static int nand_do_read_ops(struct mtd_i
+@@ -1685,12 +1740,11 @@ static int nand_do_read_ops(struct mtd_i
                            struct mtd_oob_ops *ops)
  {
        int chipnr, page, realpage, col, bytes, aligned, oob_required;
@@ -2326,7 +2326,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        uint8_t *bufpoi, *oob, *buf;
        int use_bufpoi;
-@@ -1772,7 +1826,7 @@ read_retry:
+@@ -1777,7 +1831,7 @@ read_retry:
                                int toread = min(oobreadlen, max_oobsize);
  
                                if (toread) {
@@ -2335,7 +2335,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                                                oob, ops, toread);
                                        oobreadlen -= toread;
                                }
-@@ -2025,7 +2079,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2030,7 +2084,7 @@ static int nand_do_read_oob(struct mtd_i
  {
        unsigned int max_bitflips = 0;
        int page, realpage, chipnr;
@@ -2344,7 +2344,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        struct mtd_ecc_stats stats;
        int readlen = ops->ooblen;
        int len;
-@@ -2037,10 +2091,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2042,10 +2096,7 @@ static int nand_do_read_oob(struct mtd_i
  
        stats = mtd->ecc_stats;
  
@@ -2356,7 +2356,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        if (unlikely(ops->ooboffs >= len)) {
                pr_debug("%s: attempt to start read outside oob\n",
-@@ -2074,7 +2125,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2079,7 +2130,7 @@ static int nand_do_read_oob(struct mtd_i
                        break;
  
                len = min(len, readlen);
@@ -2365,7 +2365,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
                if (chip->options & NAND_NEED_READRDY) {
                        /* Apply delay or wait for ready/busy pin */
-@@ -2235,19 +2286,20 @@ static int nand_write_page_swecc(struct
+@@ -2240,19 +2291,20 @@ static int nand_write_page_swecc(struct
                                 const uint8_t *buf, int oob_required,
                                 int page)
  {
@@ -2390,7 +2390,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        return chip->ecc.write_page_raw(mtd, chip, buf, 1, page);
  }
-@@ -2264,12 +2316,11 @@ static int nand_write_page_hwecc(struct
+@@ -2269,12 +2321,11 @@ static int nand_write_page_hwecc(struct
                                  const uint8_t *buf, int oob_required,
                                  int page)
  {
@@ -2404,7 +2404,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
                chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
-@@ -2277,8 +2328,10 @@ static int nand_write_page_hwecc(struct
+@@ -2282,8 +2333,10 @@ static int nand_write_page_hwecc(struct
                chip->ecc.calculate(mtd, p, &ecc_calc[i]);
        }
  
@@ -2417,7 +2417,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
  
-@@ -2306,11 +2359,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2311,11 +2364,10 @@ static int nand_write_subpage_hwecc(stru
        int ecc_size      = chip->ecc.size;
        int ecc_bytes     = chip->ecc.bytes;
        int ecc_steps     = chip->ecc.steps;
@@ -2430,7 +2430,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        for (step = 0; step < ecc_steps; step++) {
                /* configure controller for WRITE access */
-@@ -2338,8 +2390,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2343,8 +2395,10 @@ static int nand_write_subpage_hwecc(stru
        /* copy calculated ECC for whole page to chip->buffer->oob */
        /* this include masked-value(0xFF) for unwritten subpages */
        ecc_calc = chip->buffers->ecccalc;
@@ -2443,7 +2443,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /* write OOB buffer to NAND device */
        chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
-@@ -2475,7 +2529,8 @@ static int nand_write_page(struct mtd_in
+@@ -2480,7 +2534,8 @@ static int nand_write_page(struct mtd_in
  static uint8_t *nand_fill_oob(struct mtd_info *mtd, uint8_t *oob, size_t len,
                              struct mtd_oob_ops *ops)
  {
@@ -2453,7 +2453,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /*
         * Initialise to all 0xFF, to avoid the possibility of left over OOB
-@@ -2490,31 +2545,12 @@ static uint8_t *nand_fill_oob(struct mtd
+@@ -2495,31 +2550,12 @@ static uint8_t *nand_fill_oob(struct mtd
                memcpy(chip->oob_poi + ops->ooboffs, oob, len);
                return oob + len;
  
@@ -2491,7 +2491,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        default:
                BUG();
        }
-@@ -2535,12 +2571,11 @@ static int nand_do_write_ops(struct mtd_
+@@ -2540,12 +2576,11 @@ static int nand_do_write_ops(struct mtd_
                             struct mtd_oob_ops *ops)
  {
        int chipnr, realpage, page, blockmask, column;
@@ -2506,7 +2506,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        uint8_t *oob = ops->oobbuf;
        uint8_t *buf = ops->datbuf;
-@@ -2665,7 +2700,7 @@ err_out:
+@@ -2670,7 +2705,7 @@ err_out:
  static int panic_nand_write(struct mtd_info *mtd, loff_t to, size_t len,
                            size_t *retlen, const uint8_t *buf)
  {
@@ -2515,7 +2515,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        int chipnr = (int)(to >> chip->chip_shift);
        struct mtd_oob_ops ops;
        int ret;
-@@ -2728,15 +2763,12 @@ static int nand_do_write_oob(struct mtd_
+@@ -2733,15 +2768,12 @@ static int nand_do_write_oob(struct mtd_
                             struct mtd_oob_ops *ops)
  {
        int chipnr, page, status, len;
@@ -2533,7 +2533,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /* Do not allow write past end of page */
        if ((ops->ooboffs + ops->ooblen) > len) {
-@@ -2853,7 +2885,7 @@ out:
+@@ -2858,7 +2890,7 @@ out:
   */
  static int single_erase(struct mtd_info *mtd, int page)
  {
@@ -2542,7 +2542,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        /* Send commands to erase a block */
        chip->cmdfunc(mtd, NAND_CMD_ERASE1, -1, page);
        chip->cmdfunc(mtd, NAND_CMD_ERASE2, -1, -1);
-@@ -2885,7 +2917,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2890,7 +2922,7 @@ int nand_erase_nand(struct mtd_info *mtd
                    int allowbbt)
  {
        int page, status, pages_per_block, ret, chipnr;
@@ -2551,7 +2551,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        loff_t len;
  
        pr_debug("%s: start = 0x%012llx, len = %llu\n",
-@@ -2924,7 +2956,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2929,7 +2961,7 @@ int nand_erase_nand(struct mtd_info *mtd
        while (len) {
                /* Check if we have a bad block, we do not erase bad blocks! */
                if (nand_block_checkbad(mtd, ((loff_t) page) <<
@@ -2560,7 +2560,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                        pr_warn("%s: attempt to erase a bad block at page 0x%08x\n",
                                    __func__, page);
                        instr->state = MTD_ERASE_FAILED;
-@@ -3011,7 +3043,20 @@ static void nand_sync(struct mtd_info *m
+@@ -3016,7 +3048,20 @@ static void nand_sync(struct mtd_info *m
   */
  static int nand_block_isbad(struct mtd_info *mtd, loff_t offs)
  {
@@ -2582,7 +2582,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  }
  
  /**
-@@ -3100,7 +3145,7 @@ static int nand_suspend(struct mtd_info
+@@ -3105,7 +3150,7 @@ static int nand_suspend(struct mtd_info
   */
  static void nand_resume(struct mtd_info *mtd)
  {
@@ -2591,7 +2591,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        if (chip->state == FL_PM_SUSPENDED)
                nand_release_device(mtd);
-@@ -3272,7 +3317,7 @@ ext_out:
+@@ -3277,7 +3322,7 @@ ext_out:
  
  static int nand_setup_read_retry_micron(struct mtd_info *mtd, int retry_mode)
  {
@@ -2600,7 +2600,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        uint8_t feature[ONFI_SUBFEATURE_PARAM_LEN] = {retry_mode};
  
        return chip->onfi_set_features(mtd, chip, ONFI_FEATURE_ADDR_READ_RETRY,
-@@ -3943,10 +3988,13 @@ ident_done:
+@@ -3948,10 +3993,13 @@ ident_done:
        return type;
  }
  
@@ -2617,7 +2617,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        if (of_get_nand_bus_width(dn) == 16)
                chip->options |= NAND_BUSWIDTH_16;
-@@ -3955,6 +4003,7 @@ static int nand_dt_init(struct mtd_info
+@@ -3960,6 +4008,7 @@ static int nand_dt_init(struct mtd_info
                chip->bbt_options |= NAND_BBT_USE_FLASH;
  
        ecc_mode = of_get_nand_ecc_mode(dn);
@@ -2625,7 +2625,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        ecc_strength = of_get_nand_ecc_strength(dn);
        ecc_step = of_get_nand_ecc_step_size(dn);
  
-@@ -3967,6 +4016,9 @@ static int nand_dt_init(struct mtd_info
+@@ -3972,6 +4021,9 @@ static int nand_dt_init(struct mtd_info
        if (ecc_mode >= 0)
                chip->ecc.mode = ecc_mode;
  
@@ -2635,7 +2635,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        if (ecc_strength >= 0)
                chip->ecc.strength = ecc_strength;
  
-@@ -3990,15 +4042,16 @@ int nand_scan_ident(struct mtd_info *mtd
+@@ -3995,15 +4047,16 @@ int nand_scan_ident(struct mtd_info *mtd
                    struct nand_flash_dev *table)
  {
        int i, nand_maf_id, nand_dev_id;
@@ -2658,7 +2658,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        if (!mtd->name && mtd->dev.parent)
                mtd->name = dev_name(mtd->dev.parent);
-@@ -4061,7 +4114,7 @@ EXPORT_SYMBOL(nand_scan_ident);
+@@ -4066,7 +4119,7 @@ EXPORT_SYMBOL(nand_scan_ident);
   */
  static bool nand_ecc_strength_good(struct mtd_info *mtd)
  {
@@ -2667,7 +2667,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        struct nand_ecc_ctrl *ecc = &chip->ecc;
        int corr, ds_corr;
  
-@@ -4089,10 +4142,10 @@ static bool nand_ecc_strength_good(struc
+@@ -4094,10 +4147,10 @@ static bool nand_ecc_strength_good(struc
   */
  int nand_scan_tail(struct mtd_info *mtd)
  {
@@ -2680,7 +2680,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /* New bad blocks should be marked in OOB, flash-based BBT, or both */
        BUG_ON((chip->bbt_options & NAND_BBT_NO_OOB_BBM) &&
-@@ -4119,19 +4172,15 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4124,19 +4177,15 @@ int nand_scan_tail(struct mtd_info *mtd)
        /*
         * If no default placement scheme is given, select an appropriate one.
         */
@@ -2703,7 +2703,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                        break;
                default:
                        pr_warn("No oob scheme defined for oobsize %d\n",
-@@ -4174,7 +4223,7 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4179,7 +4228,7 @@ int nand_scan_tail(struct mtd_info *mtd)
                        ecc->write_oob = nand_write_oob_std;
                if (!ecc->read_subpage)
                        ecc->read_subpage = nand_read_subpage;
@@ -2712,7 +2712,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                        ecc->write_subpage = nand_write_subpage_hwecc;
  
        case NAND_ECC_HW_SYNDROME:
-@@ -4252,10 +4301,8 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4257,10 +4306,8 @@ int nand_scan_tail(struct mtd_info *mtd)
                }
  
                /* See nand_bch_init() for details. */
@@ -2725,7 +2725,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
                if (!ecc->priv) {
                        pr_warn("BCH ECC initialization failed!\n");
                        BUG();
-@@ -4286,20 +4333,9 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4291,20 +4338,9 @@ int nand_scan_tail(struct mtd_info *mtd)
        if (!ecc->write_oob_raw)
                ecc->write_oob_raw = ecc->write_oob;
  
@@ -2749,7 +2749,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
  
        /*
         * Set the number of read / write steps for one page depending on ECC
-@@ -4312,6 +4348,21 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4317,6 +4353,21 @@ int nand_scan_tail(struct mtd_info *mtd)
        }
        ecc->total = ecc->steps * ecc->bytes;
  
@@ -2771,7 +2771,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        /* Allow subpage writes up to ecc.steps. Not possible for MLC flash */
        if (!(chip->options & NAND_NO_SUBPAGE_WRITE) && nand_is_slc(chip)) {
                switch (ecc->steps) {
-@@ -4368,10 +4419,6 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4373,10 +4424,6 @@ int nand_scan_tail(struct mtd_info *mtd)
        mtd->_block_markbad = nand_block_markbad;
        mtd->writebufsize = mtd->writesize;
  
@@ -2782,7 +2782,7 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
        /*
         * Initialize bitflip_threshold to its default prior scan_bbt() call.
         * scan_bbt() might invoke mtd_read(), thus bitflip_threshold must be
-@@ -4427,7 +4474,7 @@ EXPORT_SYMBOL(nand_scan);
+@@ -4432,7 +4479,7 @@ EXPORT_SYMBOL(nand_scan);
   */
  void nand_release(struct mtd_info *mtd)
  {