Skip to content

Commit 793cfd5

Browse files
committed
Merge tag 'mtd/fixes-for-6.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull mtd fixes from Miquel Raynal: "Core fix: - mtdblock: Tolerate corrected bit-flips Raw NAND fixes: - meson: Fix bitmask for length in command word - stm32_fmc2: - Remove unsupported EDO mode - Use timings.mode instead of checking tRC_min. The first patch is the real fix but nowadays we use timings.mode instead of bare timings, so in order to ease the backports, the fix was split into two steps, the first one easy to backport on older kernels, the second one just as a follow-up so recent stable kernels would look like the mainline" * tag 'mtd/fixes-for-6.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: mtd: rawnand: meson: fix bitmask for length in command word mtdblock: tolerate corrected bit-flips mtd: rawnand: stm32_fmc2: use timings.mode instead of checking tRC_min mtd: rawnand: stm32_fmc2: remove unsupported EDO mode
2 parents 43fef9a + 93942b7 commit 793cfd5

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

drivers/mtd/mtdblock.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
153153
mtdblk->cache_state = STATE_EMPTY;
154154
ret = mtd_read(mtd, sect_start, sect_size,
155155
&retlen, mtdblk->cache_data);
156-
if (ret)
156+
if (ret && !mtd_is_bitflip(ret))
157157
return ret;
158158
if (retlen != sect_size)
159159
return -EIO;
@@ -188,8 +188,12 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
188188
pr_debug("mtdblock: read on \"%s\" at 0x%lx, size 0x%x\n",
189189
mtd->name, pos, len);
190190

191-
if (!sect_size)
192-
return mtd_read(mtd, pos, len, &retlen, buf);
191+
if (!sect_size) {
192+
ret = mtd_read(mtd, pos, len, &retlen, buf);
193+
if (ret && !mtd_is_bitflip(ret))
194+
return ret;
195+
return 0;
196+
}
193197

194198
while (len > 0) {
195199
unsigned long sect_start = (pos/sect_size)*sect_size;
@@ -209,7 +213,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
209213
memcpy (buf, mtdblk->cache_data + offset, size);
210214
} else {
211215
ret = mtd_read(mtd, pos, size, &retlen, buf);
212-
if (ret)
216+
if (ret && !mtd_is_bitflip(ret))
213217
return ret;
214218
if (retlen != size)
215219
return -EIO;

drivers/mtd/nand/raw/meson_nand.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ static void meson_nfc_cmd_access(struct nand_chip *nand, int raw, bool dir,
280280

281281
if (raw) {
282282
len = mtd->writesize + mtd->oobsize;
283-
cmd = (len & GENMASK(5, 0)) | scrambler | DMA_DIR(dir);
283+
cmd = (len & GENMASK(13, 0)) | scrambler | DMA_DIR(dir);
284284
writel(cmd, nfc->reg_base + NFC_REG_CMD);
285285
return;
286286
}
@@ -544,7 +544,7 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len)
544544
if (ret)
545545
goto out;
546546

547-
cmd = NFC_CMD_N2M | (len & GENMASK(5, 0));
547+
cmd = NFC_CMD_N2M | (len & GENMASK(13, 0));
548548
writel(cmd, nfc->reg_base + NFC_REG_CMD);
549549

550550
meson_nfc_drain_cmd(nfc);
@@ -568,7 +568,7 @@ static int meson_nfc_write_buf(struct nand_chip *nand, u8 *buf, int len)
568568
if (ret)
569569
return ret;
570570

571-
cmd = NFC_CMD_M2N | (len & GENMASK(5, 0));
571+
cmd = NFC_CMD_M2N | (len & GENMASK(13, 0));
572572
writel(cmd, nfc->reg_base + NFC_REG_CMD);
573573

574574
meson_nfc_drain_cmd(nfc);

drivers/mtd/nand/raw/stm32_fmc2_nand.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,6 +1531,9 @@ static int stm32_fmc2_nfc_setup_interface(struct nand_chip *chip, int chipnr,
15311531
if (IS_ERR(sdrt))
15321532
return PTR_ERR(sdrt);
15331533

1534+
if (conf->timings.mode > 3)
1535+
return -EOPNOTSUPP;
1536+
15341537
if (chipnr == NAND_DATA_IFACE_CHECK_ONLY)
15351538
return 0;
15361539

0 commit comments

Comments
 (0)