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-6.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux

Pull mtd fixes from Miquel Raynal:
"Raw NAND fixes:
- fsl_upm: Fix an off-by one test in fun_exec_op()
- Rockchip:
- Align hwecc vs. raw page helper layouts
- Fix oobfree offset and description
- Meson: Fix OOB available bytes for ECC
- Omap ELM: Fix incorrect type in assignment

SPI-NOR fix:
- Avoid holes in struct spi_mem_op

Hyperbus fix:
- Add Tudor as reviewer in MAINTAINERS

SPI-NAND fixes:
- Winbond and Toshiba: Fix ecc_get_status"

* tag 'mtd/fixes-for-6.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
mtd: rawnand: fsl_upm: Fix an off-by one test in fun_exec_op()
mtd: spi-nor: avoid holes in struct spi_mem_op
MAINTAINERS: Add myself as reviewer for HYPERBUS
mtd: rawnand: rockchip: Align hwecc vs. raw page helper layouts
mtd: rawnand: rockchip: fix oobfree offset and description
mtd: rawnand: meson: fix OOB available bytes for ECC
mtd: rawnand: omap_elm: Fix incorrect type in assignment
mtd: spinand: winbond: Fix ecc_get_status
mtd: spinand: toshiba: Fix ecc_get_status

+50 -41
+1
MAINTAINERS
··· 9660 9660 9661 9661 HYPERBUS SUPPORT 9662 9662 M: Vignesh Raghavendra <vigneshr@ti.com> 9663 + R: Tudor Ambarus <tudor.ambarus@linaro.org> 9663 9664 L: linux-mtd@lists.infradead.org 9664 9665 S: Supported 9665 9666 Q: http://patchwork.ozlabs.org/project/linux-mtd/list/
+1 -1
drivers/mtd/nand/raw/fsl_upm.c
··· 135 135 unsigned int i; 136 136 int ret; 137 137 138 - if (op->cs > NAND_MAX_CHIPS) 138 + if (op->cs >= NAND_MAX_CHIPS) 139 139 return -EINVAL; 140 140 141 141 if (check_only)
+1 -2
drivers/mtd/nand/raw/meson_nand.c
··· 1278 1278 struct meson_nfc *nfc = nand_get_controller_data(nand); 1279 1279 struct meson_nfc_nand_chip *meson_chip = to_meson_nand(nand); 1280 1280 struct mtd_info *mtd = nand_to_mtd(nand); 1281 - int nsectors = mtd->writesize / 1024; 1282 1281 int raw_writesize; 1283 1282 int ret; 1284 1283 ··· 1303 1304 nand->options |= NAND_NO_SUBPAGE_WRITE; 1304 1305 1305 1306 ret = nand_ecc_choose_conf(nand, nfc->data->ecc_caps, 1306 - mtd->oobsize - 2 * nsectors); 1307 + mtd->oobsize - 2); 1307 1308 if (ret) { 1308 1309 dev_err(nfc->dev, "failed to ECC init\n"); 1309 1310 return -EINVAL;
+12 -12
drivers/mtd/nand/raw/omap_elm.c
··· 177 177 switch (info->bch_type) { 178 178 case BCH8_ECC: 179 179 /* syndrome fragment 0 = ecc[9-12B] */ 180 - val = cpu_to_be32(*(u32 *) &ecc[9]); 180 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[9]); 181 181 elm_write_reg(info, offset, val); 182 182 183 183 /* syndrome fragment 1 = ecc[5-8B] */ 184 184 offset += 4; 185 - val = cpu_to_be32(*(u32 *) &ecc[5]); 185 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[5]); 186 186 elm_write_reg(info, offset, val); 187 187 188 188 /* syndrome fragment 2 = ecc[1-4B] */ 189 189 offset += 4; 190 - val = cpu_to_be32(*(u32 *) &ecc[1]); 190 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[1]); 191 191 elm_write_reg(info, offset, val); 192 192 193 193 /* syndrome fragment 3 = ecc[0B] */ ··· 197 197 break; 198 198 case BCH4_ECC: 199 199 /* syndrome fragment 0 = ecc[20-52b] bits */ 200 - val = (cpu_to_be32(*(u32 *) &ecc[3]) >> 4) | 200 + val = ((__force u32)cpu_to_be32(*(u32 *)&ecc[3]) >> 4) | 201 201 ((ecc[2] & 0xf) << 28); 202 202 elm_write_reg(info, offset, val); 203 203 204 204 /* syndrome fragment 1 = ecc[0-20b] bits */ 205 205 offset += 4; 206 - val = cpu_to_be32(*(u32 *) &ecc[0]) >> 12; 206 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[0]) >> 12; 207 207 elm_write_reg(info, offset, val); 208 208 break; 209 209 case BCH16_ECC: 210 - val = cpu_to_be32(*(u32 *) &ecc[22]); 210 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[22]); 211 211 elm_write_reg(info, offset, val); 212 212 offset += 4; 213 - val = cpu_to_be32(*(u32 *) &ecc[18]); 213 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[18]); 214 214 elm_write_reg(info, offset, val); 215 215 offset += 4; 216 - val = cpu_to_be32(*(u32 *) &ecc[14]); 216 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[14]); 217 217 elm_write_reg(info, offset, val); 218 218 offset += 4; 219 - val = cpu_to_be32(*(u32 *) &ecc[10]); 219 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[10]); 220 220 elm_write_reg(info, offset, val); 221 221 offset += 4; 222 - val = cpu_to_be32(*(u32 *) &ecc[6]); 222 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[6]); 223 223 elm_write_reg(info, offset, val); 224 224 offset += 4; 225 - val = cpu_to_be32(*(u32 *) &ecc[2]); 225 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[2]); 226 226 elm_write_reg(info, offset, val); 227 227 offset += 4; 228 - val = cpu_to_be32(*(u32 *) &ecc[0]) >> 16; 228 + val = (__force u32)cpu_to_be32(*(u32 *)&ecc[0]) >> 16; 229 229 elm_write_reg(info, offset, val); 230 230 break; 231 231 default:
+25 -20
drivers/mtd/nand/raw/rockchip-nand-controller.c
··· 562 562 * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 563 563 * 564 564 * The rk_nfc_ooblayout_free() function already has reserved 565 - * these 4 bytes with: 565 + * these 4 bytes together with 2 bytes for BBM 566 + * by reducing it's length: 566 567 * 567 - * oob_region->offset = NFC_SYS_DATA_SIZE + 2; 568 + * oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; 568 569 */ 569 570 if (!i) 570 571 memcpy(rk_nfc_oob_ptr(chip, i), ··· 598 597 int pages_per_blk = mtd->erasesize / mtd->writesize; 599 598 int ret = 0, i, boot_rom_mode = 0; 600 599 dma_addr_t dma_data, dma_oob; 601 - u32 reg; 600 + u32 tmp; 602 601 u8 *oob; 603 602 604 603 nand_prog_page_begin_op(chip, page, 0, NULL, 0); ··· 625 624 * 626 625 * 0xFF 0xFF 0xFF 0xFF | BBM OOB1 OOB2 OOB3 | ... 627 626 * 627 + * The code here just swaps the first 4 bytes with the last 628 + * 4 bytes without losing any data. 629 + * 630 + * The chip->oob_poi data layout: 631 + * 632 + * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3 633 + * 628 634 * Configure the ECC algorithm supported by the boot ROM. 629 635 */ 630 636 if ((page < (pages_per_blk * rknand->boot_blks)) && ··· 642 634 } 643 635 644 636 for (i = 0; i < ecc->steps; i++) { 645 - if (!i) { 646 - reg = 0xFFFFFFFF; 647 - } else { 637 + if (!i) 638 + oob = chip->oob_poi + (ecc->steps - 1) * NFC_SYS_DATA_SIZE; 639 + else 648 640 oob = chip->oob_poi + (i - 1) * NFC_SYS_DATA_SIZE; 649 - reg = oob[0] | oob[1] << 8 | oob[2] << 16 | 650 - oob[3] << 24; 651 - } 652 641 653 - if (!i && boot_rom_mode) 654 - reg = (page & (pages_per_blk - 1)) * 4; 642 + tmp = oob[0] | oob[1] << 8 | oob[2] << 16 | oob[3] << 24; 655 643 656 644 if (nfc->cfg->type == NFC_V9) 657 - nfc->oob_buf[i] = reg; 645 + nfc->oob_buf[i] = tmp; 658 646 else 659 - nfc->oob_buf[i * (oob_step / 4)] = reg; 647 + nfc->oob_buf[i * (oob_step / 4)] = tmp; 660 648 } 661 649 662 650 dma_data = dma_map_single(nfc->dev, (void *)nfc->page_buf, ··· 815 811 goto timeout_err; 816 812 } 817 813 818 - for (i = 1; i < ecc->steps; i++) { 819 - oob = chip->oob_poi + (i - 1) * NFC_SYS_DATA_SIZE; 814 + for (i = 0; i < ecc->steps; i++) { 815 + if (!i) 816 + oob = chip->oob_poi + (ecc->steps - 1) * NFC_SYS_DATA_SIZE; 817 + else 818 + oob = chip->oob_poi + (i - 1) * NFC_SYS_DATA_SIZE; 819 + 820 820 if (nfc->cfg->type == NFC_V9) 821 821 tmp = nfc->oob_buf[i]; 822 822 else 823 823 tmp = nfc->oob_buf[i * (oob_step / 4)]; 824 + 824 825 *oob++ = (u8)tmp; 825 826 *oob++ = (u8)(tmp >> 8); 826 827 *oob++ = (u8)(tmp >> 16); ··· 942 933 if (section) 943 934 return -ERANGE; 944 935 945 - /* 946 - * The beginning of the OOB area stores the reserved data for the NFC, 947 - * the size of the reserved data is NFC_SYS_DATA_SIZE bytes. 948 - */ 949 936 oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2; 950 - oob_region->offset = NFC_SYS_DATA_SIZE + 2; 937 + oob_region->offset = 2; 951 938 952 939 return 0; 953 940 }
+2 -2
drivers/mtd/nand/spi/toshiba.c
··· 73 73 { 74 74 struct nand_device *nand = spinand_to_nand(spinand); 75 75 u8 mbf = 0; 76 - struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, &mbf); 76 + struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf); 77 77 78 78 switch (status & STATUS_ECC_MASK) { 79 79 case STATUS_ECC_NO_BITFLIPS: ··· 92 92 if (spi_mem_exec_op(spinand->spimem, &op)) 93 93 return nanddev_get_ecc_conf(nand)->strength; 94 94 95 - mbf >>= 4; 95 + mbf = *(spinand->scratchbuf) >> 4; 96 96 97 97 if (WARN_ON(mbf > nanddev_get_ecc_conf(nand)->strength || !mbf)) 98 98 return nanddev_get_ecc_conf(nand)->strength;
+2 -2
drivers/mtd/nand/spi/winbond.c
··· 108 108 { 109 109 struct nand_device *nand = spinand_to_nand(spinand); 110 110 u8 mbf = 0; 111 - struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, &mbf); 111 + struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, spinand->scratchbuf); 112 112 113 113 switch (status & STATUS_ECC_MASK) { 114 114 case STATUS_ECC_NO_BITFLIPS: ··· 126 126 if (spi_mem_exec_op(spinand->spimem, &op)) 127 127 return nanddev_get_ecc_conf(nand)->strength; 128 128 129 - mbf >>= 4; 129 + mbf = *(spinand->scratchbuf) >> 4; 130 130 131 131 if (WARN_ON(mbf > nanddev_get_ecc_conf(nand)->strength || !mbf)) 132 132 return nanddev_get_ecc_conf(nand)->strength;
+2 -2
drivers/mtd/spi-nor/spansion.c
··· 361 361 */ 362 362 static int cypress_nor_set_addr_mode_nbytes(struct spi_nor *nor) 363 363 { 364 - struct spi_mem_op op = {}; 364 + struct spi_mem_op op; 365 365 u8 addr_mode; 366 366 int ret; 367 367 ··· 492 492 const struct sfdp_parameter_header *bfpt_header, 493 493 const struct sfdp_bfpt *bfpt) 494 494 { 495 - struct spi_mem_op op = {}; 495 + struct spi_mem_op op; 496 496 int ret; 497 497 498 498 ret = cypress_nor_set_addr_mode_nbytes(nor);
+4
include/linux/spi/spi-mem.h
··· 101 101 u8 nbytes; 102 102 u8 buswidth; 103 103 u8 dtr : 1; 104 + u8 __pad : 7; 104 105 u16 opcode; 105 106 } cmd; 106 107 ··· 109 108 u8 nbytes; 110 109 u8 buswidth; 111 110 u8 dtr : 1; 111 + u8 __pad : 7; 112 112 u64 val; 113 113 } addr; 114 114 ··· 117 115 u8 nbytes; 118 116 u8 buswidth; 119 117 u8 dtr : 1; 118 + u8 __pad : 7; 120 119 } dummy; 121 120 122 121 struct { 123 122 u8 buswidth; 124 123 u8 dtr : 1; 125 124 u8 ecc : 1; 125 + u8 __pad : 6; 126 126 enum spi_mem_data_dir dir; 127 127 unsigned int nbytes; 128 128 union {