Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'mtd/fixes-for-7.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux

Pull mtd fixes from Miquel Raynal:
"Besides an out-of-bound bug, this is about properly supporting Winbond
octal SPI NAND chips which use a specific pattern for stuffing more
address bits in some operations. This uses the spi-mem flag in SPI
NAND that was added to the spi-mem layer just before the merge window
through the spi tree"

* tag 'mtd/fixes-for-7.1-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
mtd: spinand: winbond: Fix ODTR write VCR on W35NxxJW
mtd: spinand: winbond: Set the packed page read flag to W35N02/04JW
mtd: spinand: Add support for packed read data ODTR commands
mtd: spi-nor: debugfs: fix out-of-bounds read in spi_nor_params_show()

+34 -7
+21 -3
drivers/mtd/nand/spi/core.c
··· 100 100 return op; 101 101 } 102 102 103 + static struct spi_mem_op 104 + spinand_fill_page_read_packed_op(struct spinand_device *spinand, u64 addr) 105 + { 106 + struct spi_mem_op op = spinand->op_templates->page_read; 107 + 108 + op.cmd.opcode |= addr >> 16; 109 + op.addr.val = addr & 0xFFFF; 110 + 111 + return op; 112 + } 113 + 103 114 struct spi_mem_op 104 115 spinand_fill_prog_exec_op(struct spinand_device *spinand, u64 addr) 105 116 { ··· 464 453 { 465 454 struct nand_device *nand = spinand_to_nand(spinand); 466 455 unsigned int row = nanddev_pos_to_row(nand, &req->pos); 467 - struct spi_mem_op op = SPINAND_OP(spinand, page_read, row); 456 + bool packed = spinand->flags & SPINAND_ODTR_PACKED_PAGE_READ; 457 + struct spi_mem_op op = packed ? 458 + SPINAND_OP(spinand, page_read_packed, row) : 459 + SPINAND_OP(spinand, page_read, row); 468 460 469 461 return spi_mem_exec_op(spinand->spimem, &op); 470 462 } ··· 1503 1489 if (!spi_mem_supports_op(spinand->spimem, &tmpl->blk_erase)) 1504 1490 return -EOPNOTSUPP; 1505 1491 1506 - tmpl->page_read = (struct spi_mem_op)SPINAND_PAGE_READ_8D_8D_0_OP(0); 1507 - if (!spi_mem_supports_op(spinand->spimem, &tmpl->page_read)) 1492 + if (spinand->flags & SPINAND_ODTR_PACKED_PAGE_READ) 1493 + tmpl->page_read = (struct spi_mem_op)SPINAND_PAGE_READ_PACKED_8D_8D_0_OP(0); 1494 + else 1495 + tmpl->page_read = (struct spi_mem_op)SPINAND_PAGE_READ_8D_8D_0_OP(0); 1496 + if (!spi_mem_supports_op(spinand->spimem, &tmpl->page_read)) { 1508 1497 return -EOPNOTSUPP; 1498 + } 1509 1499 1510 1500 tmpl->prog_exec = (struct spi_mem_op)SPINAND_PROG_EXEC_8D_8D_0_OP(0); 1511 1501 if (!spi_mem_supports_op(spinand->spimem, &tmpl->prog_exec))
+3 -3
drivers/mtd/nand/spi/winbond.c
··· 99 99 100 100 #define SPINAND_WINBOND_WRITE_VCR_8D_8D_8D(reg, buf) \ 101 101 SPI_MEM_OP(SPI_MEM_DTR_OP_RPT_CMD(0x81, 8), \ 102 - SPI_MEM_DTR_OP_ADDR(4, reg, 8), \ 102 + SPI_MEM_DTR_OP_ADDR(4, reg << 8, 8), \ 103 103 SPI_MEM_OP_NO_DUMMY, \ 104 104 SPI_MEM_DTR_OP_DATA_OUT(2, buf, 8)) 105 105 ··· 518 518 SPINAND_INFO_OP_VARIANTS(&read_cache_octal_variants, 519 519 &write_cache_octal_variants, 520 520 &update_cache_octal_variants), 521 - 0, 521 + SPINAND_ODTR_PACKED_PAGE_READ, 522 522 SPINAND_INFO_VENDOR_OPS(&winbond_w35_ops), 523 523 SPINAND_ECCINFO(&w35n01jw_ooblayout, NULL), 524 524 SPINAND_CONFIGURE_CHIP(w35n0xjw_vcr_cfg)), ··· 529 529 SPINAND_INFO_OP_VARIANTS(&read_cache_octal_variants, 530 530 &write_cache_octal_variants, 531 531 &update_cache_octal_variants), 532 - 0, 532 + SPINAND_ODTR_PACKED_PAGE_READ, 533 533 SPINAND_INFO_VENDOR_OPS(&winbond_w35_ops), 534 534 SPINAND_ECCINFO(&w35n01jw_ooblayout, NULL), 535 535 SPINAND_CONFIGURE_CHIP(w35n0xjw_vcr_cfg)),
+3 -1
drivers/mtd/spi-nor/debugfs.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 + #include <linux/array_size.h> 3 4 #include <linux/debugfs.h> 4 5 #include <linux/mtd/spi-nor.h> 5 6 #include <linux/spi/spi.h> ··· 93 92 seq_printf(s, "address nbytes\t%u\n", nor->addr_nbytes); 94 93 95 94 seq_puts(s, "flags\t\t"); 96 - spi_nor_print_flags(s, nor->flags, snor_f_names, sizeof(snor_f_names)); 95 + spi_nor_print_flags(s, nor->flags, snor_f_names, 96 + ARRAY_SIZE(snor_f_names)); 97 97 seq_puts(s, "\n"); 98 98 99 99 seq_puts(s, "\nopcodes\n");
+7
include/linux/mtd/spinand.h
··· 290 290 SPI_MEM_OP_NO_DUMMY, \ 291 291 SPI_MEM_OP_NO_DATA) 292 292 293 + #define SPINAND_PAGE_READ_PACKED_8D_8D_0_OP(addr) \ 294 + SPI_MEM_OP(SPI_MEM_DTR_OP_PACKED_CMD(0x13, addr >> 16, 8), \ 295 + SPI_MEM_DTR_OP_ADDR(2, addr & 0xffff, 8), \ 296 + SPI_MEM_OP_NO_DUMMY, \ 297 + SPI_MEM_OP_NO_DATA) 298 + 293 299 #define SPINAND_PAGE_READ_FROM_CACHE_8D_8D_8D_OP(addr, ndummy, buf, len, freq) \ 294 300 SPI_MEM_OP(SPI_MEM_DTR_OP_RPT_CMD(0x9d, 8), \ 295 301 SPI_MEM_DTR_OP_ADDR(2, addr, 8), \ ··· 489 483 #define SPINAND_HAS_PROG_PLANE_SELECT_BIT BIT(2) 490 484 #define SPINAND_HAS_READ_PLANE_SELECT_BIT BIT(3) 491 485 #define SPINAND_NO_RAW_ACCESS BIT(4) 486 + #define SPINAND_ODTR_PACKED_PAGE_READ BIT(5) 492 487 493 488 /** 494 489 * struct spinand_ondie_ecc_conf - private SPI-NAND on-die ECC engine structure