aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch')
-rw-r--r--target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch66
1 files changed, 33 insertions, 33 deletions
diff --git a/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch b/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
index 9f4b044473..a5b51d4a90 100644
--- a/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
+++ b/target/linux/mediatek/patches-4.4/0072-mtd-backport-v4.7-0day-patches-from-Boris.patch
@@ -2335,16 +2335,16 @@ Signed-off-by: John Crispin <blogic@openwrt.org>
oob, ops, toread);
oobreadlen -= toread;
}
-@@ -2024,7 +2078,7 @@ static int nand_do_read_oob(struct mtd_i
- struct mtd_oob_ops *ops)
+@@ -2025,7 +2079,7 @@ static int nand_do_read_oob(struct mtd_i
{
+ unsigned int max_bitflips = 0;
int page, realpage, chipnr;
- struct nand_chip *chip = mtd->priv;
+ struct nand_chip *chip = mtd_to_nand(mtd);
struct mtd_ecc_stats stats;
int readlen = ops->ooblen;
int len;
-@@ -2036,10 +2090,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2037,10 +2091,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",
-@@ -2073,7 +2124,7 @@ static int nand_do_read_oob(struct mtd_i
+@@ -2074,7 +2125,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 */
-@@ -2232,19 +2283,20 @@ static int nand_write_page_swecc(struct
+@@ -2235,19 +2286,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);
}
-@@ -2261,12 +2313,11 @@ static int nand_write_page_hwecc(struct
+@@ -2264,12 +2316,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);
-@@ -2274,8 +2325,10 @@ static int nand_write_page_hwecc(struct
+@@ -2277,8 +2328,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);
-@@ -2303,11 +2356,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2306,11 +2359,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 */
-@@ -2335,8 +2387,10 @@ static int nand_write_subpage_hwecc(stru
+@@ -2338,8 +2390,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);
-@@ -2472,7 +2526,8 @@ static int nand_write_page(struct mtd_in
+@@ -2475,7 +2529,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
-@@ -2487,31 +2542,12 @@ static uint8_t *nand_fill_oob(struct mtd
+@@ -2490,31 +2545,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();
}
-@@ -2532,12 +2568,11 @@ static int nand_do_write_ops(struct mtd_
+@@ -2535,12 +2571,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;
-@@ -2662,7 +2697,7 @@ err_out:
+@@ -2665,7 +2700,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;
-@@ -2725,15 +2760,12 @@ static int nand_do_write_oob(struct mtd_
+@@ -2728,15 +2763,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) {
-@@ -2850,7 +2882,7 @@ out:
+@@ -2853,7 +2885,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);
-@@ -2882,7 +2914,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2885,7 +2917,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",
-@@ -2921,7 +2953,7 @@ int nand_erase_nand(struct mtd_info *mtd
+@@ -2924,7 +2956,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;
-@@ -3008,7 +3040,20 @@ static void nand_sync(struct mtd_info *m
+@@ -3011,7 +3043,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>
}
/**
-@@ -3097,7 +3142,7 @@ static int nand_suspend(struct mtd_info
+@@ -3100,7 +3145,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);
-@@ -3269,7 +3314,7 @@ ext_out:
+@@ -3272,7 +3317,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,
-@@ -3940,10 +3985,13 @@ ident_done:
+@@ -3943,10 +3988,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;
-@@ -3952,6 +4000,7 @@ static int nand_dt_init(struct mtd_info
+@@ -3955,6 +4003,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);
-@@ -3964,6 +4013,9 @@ static int nand_dt_init(struct mtd_info
+@@ -3967,6 +4016,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;
-@@ -3987,15 +4039,16 @@ int nand_scan_ident(struct mtd_info *mtd
+@@ -3990,15 +4042,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);
-@@ -4058,7 +4111,7 @@ EXPORT_SYMBOL(nand_scan_ident);
+@@ -4061,7 +4114,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;
-@@ -4086,10 +4139,10 @@ static bool nand_ecc_strength_good(struc
+@@ -4089,10 +4142,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) &&
-@@ -4116,19 +4169,15 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4119,19 +4172,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",
-@@ -4171,7 +4220,7 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4174,7 +4223,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:
-@@ -4249,10 +4298,8 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4252,10 +4301,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();
-@@ -4283,20 +4330,9 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4286,20 +4333,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
-@@ -4309,6 +4345,21 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4312,6 +4348,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) {
-@@ -4365,10 +4416,6 @@ int nand_scan_tail(struct mtd_info *mtd)
+@@ -4368,10 +4419,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
-@@ -4424,7 +4471,7 @@ EXPORT_SYMBOL(nand_scan);
+@@ -4427,7 +4474,7 @@ EXPORT_SYMBOL(nand_scan);
*/
void nand_release(struct mtd_info *mtd)
{