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

Pull mtd fixes from Miquel Raynal.

* 'mtd/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
mtd: rawnand: omap: Use BCH private fields in the specific OOB layout
mtd: spinand: Fix MTD_OPS_AUTO_OOB requests
mtd: rawnand: intel: check the mtd name only after setting the variable
mtd: rawnand: nandsim: Fix the logic when selecting Hamming soft ECC engine
mtd: rawnand: gpmi: fix dst bit offset when extracting raw payload

+27 -16
+1 -1
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
··· 1615 1615 /* Extract interleaved payload data and ECC bits */ 1616 1616 for (step = 0; step < nfc_geo->ecc_chunk_count; step++) { 1617 1617 if (buf) 1618 - nand_extract_bits(buf, step * eccsize, tmp_buf, 1618 + nand_extract_bits(buf, step * eccsize * 8, tmp_buf, 1619 1619 src_bit_off, eccsize * 8); 1620 1620 src_bit_off += eccsize * 8; 1621 1621
+3 -2
drivers/mtd/nand/raw/intel-nand-controller.c
··· 579 579 struct device *dev = &pdev->dev; 580 580 struct ebu_nand_controller *ebu_host; 581 581 struct nand_chip *nand; 582 - struct mtd_info *mtd = NULL; 582 + struct mtd_info *mtd; 583 583 struct resource *res; 584 584 char *resname; 585 585 int ret; ··· 647 647 ebu_host->ebu + EBU_ADDR_SEL(cs)); 648 648 649 649 nand_set_flash_node(&ebu_host->chip, dev->of_node); 650 + 651 + mtd = nand_to_mtd(&ebu_host->chip); 650 652 if (!mtd->name) { 651 653 dev_err(ebu_host->dev, "NAND label property is mandatory\n"); 652 654 return -EINVAL; 653 655 } 654 656 655 - mtd = nand_to_mtd(&ebu_host->chip); 656 657 mtd->dev.parent = dev; 657 658 ebu_host->dev = dev; 658 659
+3 -4
drivers/mtd/nand/raw/nandsim.c
··· 2210 2210 { 2211 2211 unsigned int eccsteps, eccbytes; 2212 2212 2213 + chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; 2214 + chip->ecc.algo = bch ? NAND_ECC_ALGO_BCH : NAND_ECC_ALGO_HAMMING; 2215 + 2213 2216 if (!bch) 2214 2217 return 0; 2215 2218 ··· 2236 2233 return -EINVAL; 2237 2234 } 2238 2235 2239 - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; 2240 - chip->ecc.algo = NAND_ECC_ALGO_BCH; 2241 2236 chip->ecc.size = 512; 2242 2237 chip->ecc.strength = bch; 2243 2238 chip->ecc.bytes = eccbytes; ··· 2274 2273 nsmtd = nand_to_mtd(chip); 2275 2274 nand_set_controller_data(chip, (void *)ns); 2276 2275 2277 - chip->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT; 2278 - chip->ecc.algo = NAND_ECC_ALGO_HAMMING; 2279 2276 /* The NAND_SKIP_BBTSCAN option is necessary for 'overridesize' */ 2280 2277 /* and 'badblocks' parameters to work */ 2281 2278 chip->options |= NAND_SKIP_BBTSCAN;
+9 -6
drivers/mtd/nand/raw/omap2.c
··· 15 15 #include <linux/jiffies.h> 16 16 #include <linux/sched.h> 17 17 #include <linux/mtd/mtd.h> 18 + #include <linux/mtd/nand-ecc-sw-bch.h> 18 19 #include <linux/mtd/rawnand.h> 19 20 #include <linux/mtd/partitions.h> 20 21 #include <linux/omap-dma.h> ··· 1867 1866 static int omap_sw_ooblayout_ecc(struct mtd_info *mtd, int section, 1868 1867 struct mtd_oob_region *oobregion) 1869 1868 { 1870 - struct nand_chip *chip = mtd_to_nand(mtd); 1869 + struct nand_device *nand = mtd_to_nanddev(mtd); 1870 + const struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv; 1871 1871 int off = BADBLOCK_MARKER_LENGTH; 1872 1872 1873 - if (section >= chip->ecc.steps) 1873 + if (section >= engine_conf->nsteps) 1874 1874 return -ERANGE; 1875 1875 1876 1876 /* 1877 1877 * When SW correction is employed, one OMAP specific marker byte is 1878 1878 * reserved after each ECC step. 1879 1879 */ 1880 - oobregion->offset = off + (section * (chip->ecc.bytes + 1)); 1881 - oobregion->length = chip->ecc.bytes; 1880 + oobregion->offset = off + (section * (engine_conf->code_size + 1)); 1881 + oobregion->length = engine_conf->code_size; 1882 1882 1883 1883 return 0; 1884 1884 } ··· 1887 1885 static int omap_sw_ooblayout_free(struct mtd_info *mtd, int section, 1888 1886 struct mtd_oob_region *oobregion) 1889 1887 { 1890 - struct nand_chip *chip = mtd_to_nand(mtd); 1888 + struct nand_device *nand = mtd_to_nanddev(mtd); 1889 + const struct nand_ecc_sw_bch_conf *engine_conf = nand->ecc.ctx.priv; 1891 1890 int off = BADBLOCK_MARKER_LENGTH; 1892 1891 1893 1892 if (section) ··· 1898 1895 * When SW correction is employed, one OMAP specific marker byte is 1899 1896 * reserved after each ECC step. 1900 1897 */ 1901 - off += ((chip->ecc.bytes + 1) * chip->ecc.steps); 1898 + off += ((engine_conf->code_size + 1) * engine_conf->nsteps); 1902 1899 if (off >= mtd->oobsize) 1903 1900 return -ERANGE; 1904 1901
+11 -3
drivers/mtd/nand/spi/core.c
··· 343 343 const struct nand_page_io_req *req) 344 344 { 345 345 struct nand_device *nand = spinand_to_nand(spinand); 346 + struct mtd_info *mtd = spinand_to_mtd(spinand); 346 347 struct spi_mem_dirmap_desc *rdesc; 347 348 unsigned int nbytes = 0; 348 349 void *buf = NULL; ··· 383 382 memcpy(req->databuf.in, spinand->databuf + req->dataoffs, 384 383 req->datalen); 385 384 386 - if (req->ooblen) 387 - memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, 388 - req->ooblen); 385 + if (req->ooblen) { 386 + if (req->mode == MTD_OPS_AUTO_OOB) 387 + mtd_ooblayout_get_databytes(mtd, req->oobbuf.in, 388 + spinand->oobbuf, 389 + req->ooboffs, 390 + req->ooblen); 391 + else 392 + memcpy(req->oobbuf.in, spinand->oobbuf + req->ooboffs, 393 + req->ooblen); 394 + } 389 395 390 396 return 0; 391 397 }