10 Jan, 2012

38 commits

  • Signed-off-by: Jonas Gorski
    Acked-by: Florian Fainelli
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jonas Gorski
     
  • Arch setup code might want to use their own partition parsers, but still
    use the generic physmap flash driver.

    Signed-off-by: Jonas Gorski
    Acked-by: Florian Fainelli
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jonas Gorski
     
  • Recent BCM63XX devices support a variety of flash types (parallel, SPI,
    NAND) and share the partition layout. To prevent code duplication make
    the CFE partition parsing code a stand alone mtd parser to allow SPI or
    NAND flash drivers to use it.

    Signed-off-by: Jonas Gorski
    Acked-by: Florian Fainelli
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jonas Gorski
     
  • Replace raw printk's with their pr_XXX equivalent and unify broken up
    strings so they become grepable.

    Also replace the PFX definition with a pr_fmt().

    Signed-off-by: Jonas Gorski
    Acked-by: Florian Fainelli
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jonas Gorski
     
  • Signed-off-by: Jonas Gorski
    Acked-by: Florian Fainelli
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jonas Gorski
     
  • Signed-off-by: Jonas Gorski
    Acked-by: Florian Fainelli
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jonas Gorski
     
  • Signed-off-by: Heiko Schocher
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Heiko Schocher
     
  • When we do a non-full-page write, the length be set to FBCR should
    not be 'elbc_fcm_ctrl->index', it should be 'elbc_fcm_ctrl->index -
    elbc_fcm_ctrl->column'.

    Signed-off-by: Liu Shuo
    Signed-off-by: Li Yang
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Liu Shuo
     
  • On both of large-page chip and small-page chip, we always should use
    'elbc_fcm_ctrl->oob' to set the FPAR_LP_MS/FPAR_SP_MS bit of FPAR, don't
    use a overflowed 'column' to set it.

    Signed-off-by: Liu Shuo
    Signed-off-by: Li Yang
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Liu Shuo
     
  • This patch takes into account checkpatch, sparse and ECC
    comments.

    Signed-off-by: Robert Jarzmik
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Use block_isbad to check and skip the bad blocks reading.
    This will allow to get rid of the read errors if bad blocks
    are present initially.

    Cc: stable@kernel.org
    Signed-off-by: Roman Tereshonkov
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Roman Tereshonkov
     
  • stresstest needs at least two eraseblocks. Bail out gracefully if that
    condition is not met. Fixes the following 'division by zero' OOPS:

    [ 619.100000] mtd_stresstest: MTD device size 131072, eraseblock size 131072, page size 2048, count of eraseblocks 1, pages per eraseblock 64, OOB size 64
    [ 619.120000] mtd_stresstest: scanning for bad eraseblocks
    [ 619.120000] mtd_stresstest: scanned 1 eraseblocks, 0 are bad
    [ 619.130000] mtd_stresstest: doing operations
    [ 619.130000] mtd_stresstest: 0 operations done
    [ 619.140000] Division by zero in kernel.
    ...

    caused by

    /* Read or write up 2 eraseblocks at a time - hence 'ebcnt - 1' */
    eb %= (ebcnt - 1);

    Cc: stable@kernel.org
    Signed-off-by: Wolfram Sang
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Wolfram Sang
     
  • This patch converts the drivers in drivers/mtd/* to use the
    module_platform_driver() macro which makes the code smaller and a bit
    simpler.

    Signed-off-by: Axel Lin
    Acked by: Haojian Zhuang
    Signed-off-by: Artem Bityutskiy

    Signed-off-by: David Woodhouse

    Axel Lin
     
  • Add documentation for MSystems disk-on-chip docg3 chips
    sysfs entries, which enable and disable protection areas,
    giving or disabling access to the chip's memory.

    Signed-off-by: Robert Jarzmik
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • If doc_probe_device() returned an ERR_PTR, then we accidentally saved
    that to docg3_floors[floor] = mtd; which gets derefenced in the error
    handling when we call doc_release_device().

    I've reworked the error handling to take care of that and hopefully
    make it a little simpler.

    Signed-off-by: Dan Carpenter
    Acked-by: Robert Jarzmik
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Dan Carpenter
     
  • In ancient times it was necessary to manually initialize the bus field of an
    spi_driver to spi_bus_type. These days this is done in spi_driver_register(),
    so we can drop the manual assignment.

    The patch was generated using the following coccinelle semantic patch:
    //
    @@
    identifier _driver;
    @@
    struct spi_driver _driver = {
    .driver = {
    - .bus = &spi_bus_type,
    },
    };
    //

    Signed-off-by: Lars-Peter Clausen
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Lars-Peter Clausen
     
  • As each docg3 chip has 2 protection areas (DPS0 and DPS1),
    and because theses areas can prevent user access to the chip
    data, add for each floor the sysfs entries which insert the
    protection key into the right DPS.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Docg3 chips can work in 3 modes : normal MLC mode, fast
    mode and reliable mode. Normally, as docg3 is a MLC chip, it
    should be configured to work in normal mode.

    In both normal mode, each page is distinct. This
    means that writing to page 12 of blocks 14,15 writes only to
    that page, and reading from page 12 of blocks 14,15 reads
    only from that page.

    In reliable and fast modes, pages are coupled by pairs, and
    are clones one of each other. This means that the available
    capacity of the chip is halved. Pages are coupled in each
    block, and page of index 2*n contains the same data as page
    2*n+1 of the same block.

    In fast mode, the reads occur a bit faster, but are a bit
    less reliable that in normal mode.

    When reading from page 2*n, the chip reads bytes from both
    page 2*n and page 2*n+1, makes a logical and for each byte,
    and returns the result. As programming a page means
    "clearing bits", even if a bit was not cleared on one page
    because the flash is worn out, the other page has the bit
    cleared, and the result of the "AND" gives a correct result.

    When writing to page 2*n, the chip writes data to both page
    2*n and page 2*n+1.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Add functions to powerdown and powerup from suspend, in
    order to save power.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Credit for discovering the BCH algorith parameters, and bit
    reversing algorithm is to be give to Mike Dunn and Ivan
    Djelic.

    The BCH correction code relied upon the BCH library, where
    all data and ECC is bit-reversed. The BCH library works
    correctly when each input byte is bit-reversed, and
    accordingly ECC output is also bit-reversed.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Map the developped write and erase functions into the mtd
    structure.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Add erase capability to the docg3 driver. The erase block is
    made of 2 physical blocks, as both share all 64 pages. That
    makes an erase block of at least 64 kBytes.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Add write capability to the docg3 driver. The writes are
    possible on a single page (512 bytes + 16 bytes), even if
    that page is split on 2 physical pages on 2 blocks (each on
    one plane).

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Add OOB buffer area to store the OOB data until the actual
    page is written, so that it can be completed by hardware ECC
    generator.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Add the required registers and commands to erase and write
    flash pages / blocks.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Add OOB layout description for docg3, so that userspace can
    use this information to setup the data for write_oob().

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Add support for multiple floors, ie. cascaded docg3
    chips. There might be 4 docg3 chips cascaded, sharing the
    same address space, and providing up to 4 times the storage
    capacity of a unique chip.

    Each floor will be seen as an independant mtd device.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Fix the docg3 reads to be able to cope with all possible
    data buffer / oob buffer / file mode combinations from
    docg3_read_oob().
    This especially ensures that raw reads do not use ECC
    corrections, and AUTOOOB and PLACEOOB do use ECC
    correction.

    The approach is to empty docg3_read() and make it a wrapper
    to docg3_read_oob(). As docg3_read_oob() handles all the
    funny cases (no data buffer but oob buffer, data buffer but
    no oob buffer, ...), docg3_read() is just a special use of
    docg3_read_oob().

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • BCH registers are contiguous, not on every byte. Fix the
    register definitions.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • The protection areas boundaries were on 16bit registers, not
    8bit. This is consistent with block numbers, which can
    extend up to 4096 on bigger chips (and is 2048 on the
    docg3).

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Writeb was incorrectly traced as a 16 bits write, instead of
    a 8 bits write. Fix it by tracing the correct width.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Change the NOP debug log verbosity to very verbose to
    unburden log analysis.

    Signed-off-by: Robert Jarzmik
    Reviewed-by: Ivan Djelic
    Reviewed-by: Mike Dunn
    Signed-off-by: David Woodhouse

    Robert Jarzmik
     
  • Making MTD_NAND_OMAP2 depend on ARCH_OMAP2PLUS instead of
    oring with ARCH2/3/4.

    Reported-by: Russell King
    Signed-off-by: Shubhrajyoti D
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Shubhrajyoti D
     
  • This patch allows each CFI device map to use its own endianness. The
    globally defined CFI endianness (CONFIG_MTD_CFI_NOSWAP,
    CONFIG_MTD_CFI_BE_BYTE_SWAP or CONFIG_MTD_CFI_LE_BYTE_SWAP) becomes the
    default value which can be overridden by a driver for a particular device.

    Signed-off-by: Aaron Sierra
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Aaron Sierra
     
  • Some error paths in mtd_blkdevs were fixed in the following commit:

    commit 94735ec4044a6d318b83ad3c5794e931ed168d10
    mtd: mtd_blkdevs: fix error path in blktrans_open

    But on these error paths, the block device's `dev->open' count is
    already incremented before we check for errors. This meant that, while
    the error path was handled correctly on the first time through
    blktrans_open(), the device is erroneously considered already open on
    the second time through.

    This problem can be seen, for instance, when a UBI volume is
    simultaneously mounted as a UBIFS partition and read through its
    corresponding gluebi mtdblockX device. This results in blktrans_open()
    passing its error checks (with `dev->open > 0') without actually having
    a handle on the device. Here's a summarized log of the actions and
    results with nandsim:

    # modprobe nandsim
    # modprobe mtdblock
    # modprobe gluebi
    # modprobe ubifs
    # ubiattach /dev/ubi_ctrl -m 0
    ...
    # ubimkvol /dev/ubi0 -N test -s 16MiB
    ...
    # mount -t ubifs ubi0:test /mnt
    # ls /dev/mtdblock*
    /dev/mtdblock0 /dev/mtdblock1
    # cat /dev/mtdblock1 > /dev/null
    cat: can't open '/dev/mtdblock4': Device or resource busy
    # cat /dev/mtdblock1 > /dev/null

    CPU 0 Unable to handle kernel paging request at virtual address
    fffffff0, epc == 8031536c, ra == 8031f280
    Oops[#1]:
    ...
    Call Trace:
    [] ubi_leb_read+0x14/0x164
    [] gluebi_read+0xf0/0x148
    [] mtdblock_readsect+0x64/0x198
    [] mtd_blktrans_thread+0x330/0x3f4
    [] kthread+0x88/0x90
    [] kernel_thread_helper+0x10/0x18

    Cc: stable@kernel.org [3.0+]
    Signed-off-by: Brian Norris
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Brian Norris
     
  • Signed-off-by: Brian Norris
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Brian Norris
     
  • Macronix MX30LF1208AA is a 512 Mbit NAND with device code 0xF0.

    Signed-off-by: Brian Norris
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Brian Norris
     
  • Macronix is produing SLC NAND MX30LF1208AA, so add their manufacturer
    code to the manufacturer lists.

    Signed-off-by: Brian Norris
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Brian Norris
     

24 Dec, 2011

2 commits