26 Jan, 2017

5 commits

  • commit 10ad1d754a434c024ce7eeb1cec9f69fd3ecc863 upstream.

    We return success or possibly uninitialized values on these error paths
    instead of proper error codes.

    Fixes: 140623410536 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
    Signed-off-by: Dan Carpenter
    Reviewed-by: Marek Vasut
    Reviewed-by: Moritz Fischer
    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • commit 193e87143c290ec16838f5368adc0e0bc94eb931 upstream.

    There are CQSPI_MAX_CHIPSELECT elements in the ->f_pdata array so the >
    should be >=.

    Fixes: 140623410536 ('mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller')
    Signed-off-by: Dan Carpenter
    Reviewed-by: Marek Vasut
    Signed-off-by: Cyrille Pitchen
    Signed-off-by: Greg Kroah-Hartman

    Dan Carpenter
     
  • commit a2724663494f7313f53da10d8c0a729c5e3c4dea upstream.

    Remove the usage of modules functions to make this driver compile
    again. Otherwise an include of linux/modules.h would be needed.

    Fixes: 024366750c2e ("mtd: nand: xway: convert to normal platform driver")
    Signed-off-by: Hauke Mehrtens
    Signed-off-by: Boris Brezillon
    Signed-off-by: Greg Kroah-Hartman

    Hauke Mehrtens
     
  • commit 73529c872a189c747bdb528ce9b85b67b0e28dec upstream.

    The xway_nand driver accesses the ltq_ebu_membase symbol which is not
    exported. This also should not get exported and we should handle the
    EBU interface in a better way later. This quick fix just deactivated
    support for building as module.

    Fixes: 99f2b107924c ("mtd: lantiq: Add NAND support on Lantiq XWAY SoC.")
    Signed-off-by: Hauke Mehrtens
    Signed-off-by: Boris Brezillon
    Signed-off-by: Greg Kroah-Hartman

    Hauke Mehrtens
     
  • commit cf9e1672a66c49ed8903c01b4c380a2f2dc91b40 upstream.

    Semantics of NR_IRQS is different on machines with SPARSE_IRQ option
    disabled or enabled, in the latter case IRQs are allocated starting
    at least from the value specified by NR_IRQS and going upwards, so
    the check of (irq >= NR_IRQ) to decide about an error code returned by
    platform_get_irq() is completely invalid, don't attempt to overrule
    irq subsystem in the driver.

    The change fixes LPC32xx NAND MLC driver initialization on boot.

    Fixes: 8cb17b5ed017 ("irqchip: Add LPC32xx interrupt controller driver")
    Signed-off-by: Vladimir Zapolskiy
    Acked-by: Sylvain Lemieux
    Signed-off-by: Boris Brezillon
    Signed-off-by: Greg Kroah-Hartman

    Vladimir Zapolskiy
     

06 Nov, 2016

1 commit

  • Pull MTD fixes from Brian Norris:

    - MAINTAINERS updates to reflect some new maintainers/submaintainers.

    We have some great volunteers who've been developing and reviewing
    already. We're going to try a group maintainership model, so
    eventually you'll probably see pull requests from people besides me.

    - NAND fixes from Boris:
    "Three simple fixes:

    - fix a non-critical bug in the gpmi driver
    - fix a bug in the 'automatic NAND timings selection' feature
    introduced in 4.9-rc1
    - fix a false positive uninitialized-var warning"

    * tag 'for-linus-20161104' of git://git.infradead.org/linux-mtd:
    mtd: mtk: avoid warning in mtk_ecc_encode
    mtd: nand: Fix data interface configuration logic
    mtd: nand: gpmi: disable the clocks on errors
    MAINTAINERS: add more people to the MTD maintainer team
    MAINTAINERS: add a maintainer for the SPI NOR subsystem

    Linus Torvalds
     

28 Oct, 2016

4 commits

  • Commit e96a8a3bb671 ("UBI: Fastmap: Do not add vol if it already
    exists") introduced a bug by changing the possible error codes returned
    by add_vol():
    - this function no longer returns NULL in case of allocation failure
    but return ERR_PTR(-ENOMEM)
    - when a duplicate entry in the volume RB tree is found it returns
    ERR_PTR(-EEXIST) instead of ERR_PTR(-EINVAL)

    Fix the tests done on add_vol() return val to match this new behavior.

    Fixes: e96a8a3bb671 ("UBI: Fastmap: Do not add vol if it already exists")
    Reported-by: Dan Carpenter
    Signed-off-by: Boris Brezillon
    Acked-by: Sheng Yong
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • When building with -Wmaybe-uninitialized, gcc produces a silly false positive
    warning for the mtk_ecc_encode function:

    drivers/mtd/nand/mtk_ecc.c: In function 'mtk_ecc_encode':
    drivers/mtd/nand/mtk_ecc.c:402:15: error: 'val' may be used uninitialized in this function [-Werror=maybe-uninitialized]

    The function for some reason contains a double byte swap on big-endian
    builds to get the OOB data into the correct order again, and is written
    in a slightly confusing way.

    Using a simple memcpy32_fromio() to read the data simplifies it a lot
    so it becomes more readable and produces no warning. However, the
    output might not have 32-bit alignment, so we have to use another
    memcpy to avoid taking alignment faults or writing beyond the end
    of the array.

    Signed-off-by: Arnd Bergmann
    Tested-by: RogerCC Lin
    Signed-off-by: Boris Brezillon

    Arnd Bergmann
     
  • When changing from one data interface setting to another, one has to
    ensure a specific sequence which is described in the ONFI spec.

    One of these constraints is that the CE line has go high after a reset
    before a command can be sent with the new data interface setting, which
    is not guaranteed by the current implementation.

    Rework the nand_reset() function and all the call sites to make sure the
    CE line is asserted and released when required.

    Also make sure to actually apply the new data interface setting on the
    first die.

    Signed-off-by: Boris Brezillon
    Fixes: d8e725dd8311 ("mtd: nand: automate NAND timings selection")
    Reviewed-by: Sascha Hauer
    Tested-by: Marc Gonzalez

    Boris Brezillon
     
  • We should disable the previously enabled GPMI clocks in the error paths.

    Also, when gpmi_enable_clk() fails simply return the error
    code immediately rather than jumping to to the 'err_out' label.

    Signed-off-by: Fabio Estevam
    Reviewed-by: Marek Vasut
    Acked-by: Han Xu
    Signed-off-by: Boris Brezillon

    Fabio Estevam
     

20 Oct, 2016

2 commits

  • drivers/mtd/ubi/eba.c: In function ‘try_recover_peb’:
    drivers/mtd/ubi/eba.c:744: warning: ‘vid_hdr’ is used uninitialized in this function

    The pointer vid_hdr is indeed not initialized, leading to a crash when
    it is dereferenced.

    Fix this by obtaining the pointer from the VID buffer, like is done
    everywhere else.

    Fixes: 3291b52f9ff0acc8 ("UBI: introduce the VID buffer concept")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Geert Uytterhoeven
     
  • Static analysis by CoverityScan detected the ec and pnum
    arguments are in the wrong order on a call to ubi_alloc_aeb.
    Swap the order to fix this.

    Fixes: 91f4285fe389a27 ("UBI: provide helpers to allocate and free aeb elements")
    Signed-off-by: Colin Ian King
    Reviewed-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Colin Ian King
     

12 Oct, 2016

3 commits

  • Merge more updates from Andrew Morton:

    - a few block updates that fell in my lap

    - lib/ updates

    - checkpatch

    - autofs

    - ipc

    - a ton of misc other things

    * emailed patches from Andrew Morton : (100 commits)
    mm: split gfp_mask and mapping flags into separate fields
    fs: use mapping_set_error instead of opencoded set_bit
    treewide: remove redundant #include
    hung_task: allow hung_task_panic when hung_task_warnings is 0
    kthread: add kerneldoc for kthread_create()
    kthread: better support freezable kthread workers
    kthread: allow to modify delayed kthread work
    kthread: allow to cancel kthread work
    kthread: initial support for delayed kthread work
    kthread: detect when a kthread work is used by more workers
    kthread: add kthread_destroy_worker()
    kthread: add kthread_create_worker*()
    kthread: allow to call __kthread_create_on_node() with va_list args
    kthread/smpboot: do not park in kthread_create_on_cpu()
    kthread: kthread worker API cleanup
    kthread: rename probe_kthread_data() to kthread_probe_data()
    scripts/tags.sh: enable code completion in VIM
    mm: kmemleak: avoid using __va() on addresses that don't have a lowmem mapping
    kdump, vmcoreinfo: report memory sections virtual addresses
    ipc/sem.c: add cond_resched in exit_sme
    ...

    Linus Torvalds
     
  • Kernel source files need not include explicitly
    because the top Makefile forces to include it with:

    -include $(srctree)/include/linux/kconfig.h

    This commit removes explicit includes except the following:

    * arch/s390/include/asm/facilities_src.h
    * tools/testing/radix-tree/linux/kernel.h

    These two are used for host programs.

    Link: http://lkml.kernel.org/r/1473656164-11929-1-git-send-email-yamada.masahiro@socionext.com
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Masahiro Yamada
     
  • Pull UBI/UBIFS updates from Richard Weinberger:
    "This pull request contains:

    - Fixes for both UBI and UBIFS
    - overlayfs support (O_TMPFILE, RENAME_WHITEOUT/EXCHANGE)
    - Code refactoring for the upcoming MLC support"

    [ Ugh, we just got rid of the "rename2()" naming for the extended rename
    functionality. And this re-introduces it in ubifs with the cross-
    renaming and whiteout support.

    But rather than do any re-organizations in the merge itself, the
    naming can be cleaned up later ]

    * tag 'upstream-4.9-rc1' of git://git.infradead.org/linux-ubifs: (27 commits)
    UBIFS: improve function-level documentation
    ubifs: fix host xattr_len when changing xattr
    ubifs: Use move variable in ubifs_rename()
    ubifs: Implement RENAME_EXCHANGE
    ubifs: Implement RENAME_WHITEOUT
    ubifs: Implement O_TMPFILE
    ubi: Fix Fastmap's update_vol()
    ubi: Fix races around ubi_refill_pools()
    ubi: Deal with interrupted erasures in WL
    UBI: introduce the VID buffer concept
    UBI: hide EBA internals
    UBI: provide an helper to query LEB information
    UBI: provide an helper to check whether a LEB is mapped or not
    UBI: add an helper to check lnum validity
    UBI: simplify LEB write and atomic LEB change code
    UBI: simplify recover_peb() code
    UBI: move the global ech and vidh variables into struct ubi_attach_info
    UBI: provide helpers to allocate and free aeb elements
    UBI: fastmap: use ubi_io_{read, write}_data() instead of ubi_io_{read, write}()
    UBI: fastmap: use ubi_rb_for_each_entry() in unmap_peb()
    ...

    Linus Torvalds
     

11 Oct, 2016

1 commit

  • Pull MTD updates from Brian Norris:
    "I've not been very active this cycle, so these are mostly from Boris,
    for the NAND flash subsystem.

    NAND:

    - Add the infrastructure to automate NAND timings configuration

    - Provide a generic DT property to maximize ECC strength

    - Some refactoring in the core bad block table handling, to help with
    improving some of the logic in error cases.

    - Minor cleanups and fixes

    MTD:

    - Add APIs for handling page pairing; this is necessary for reliably
    supporting MLC and TLC NAND flash, where paired-page disturbance
    affects reliability. Upper layers (e.g., UBI) should make use of
    these in the near future"

    * tag 'for-linus-20161008' of git://git.infradead.org/linux-mtd: (35 commits)
    mtd: nand: fix trivial spelling error
    mtdpart: Propagate _get/put_device()
    mtd: nand: Provide nand_cleanup() function to free NAND related resources
    mtd: Kill the OF_MTD Kconfig option
    mtd: nand: mxc: Test CONFIG_OF instead of CONFIG_OF_MTD
    mtd: nand: Fix nand_command_lp() for 8bits opcodes
    mtd: nand: sunxi: Support ECC maximization
    mtd: nand: Support maximizing ECC when using software BCH
    mtd: nand: Add an option to maximize the ECC strength
    mtd: nand: mxc: Add timing setup for v2 controllers
    mtd: nand: mxc: implement onfi get/set features
    mtd: nand: sunxi: switch from manual to automated timing config
    mtd: nand: automate NAND timings selection
    mtd: nand: Expose data interface for ONFI mode 0
    mtd: nand: Add function to convert ONFI mode to data_interface
    mtd: nand: convert ONFI mode into data interface
    mtd: nand: Introduce nand_data_interface
    mtd: nand: Create a NAND reset function
    mtd: nand: remove unnecessary 'extern' from function declarations
    MAINTAINERS: Add maintainer entry for Ingenic JZ4780 NAND driver
    ...

    Linus Torvalds
     

10 Oct, 2016

1 commit

  • Pull blk-mq irq/cpu mapping updates from Jens Axboe:
    "This is the block-irq topic branch for 4.9-rc. It's mostly from
    Christoph, and it allows drivers to specify their own mappings, and
    more importantly, to share the blk-mq mappings with the IRQ affinity
    mappings. It's a good step towards making this work better out of the
    box"

    * 'for-4.9/block-irq' of git://git.kernel.dk/linux-block:
    blk_mq: linux/blk-mq.h does not include all the headers it depends on
    blk-mq: kill unused blk_mq_create_mq_map()
    blk-mq: get rid of the cpumask in struct blk_mq_tags
    nvme: remove the post_scan callout
    nvme: switch to use pci_alloc_irq_vectors
    blk-mq: provide a default queue mapping for PCI device
    blk-mq: allow the driver to pass in a queue mapping
    blk-mq: remove ->map_queue
    blk-mq: only allocate a single mq_map per tag_set
    blk-mq: don't redistribute hardware queues on a CPU hotplug event

    Linus Torvalds
     

09 Oct, 2016

1 commit


08 Oct, 2016

1 commit

  • Pull ARM SoC cleanups from Arnd Bergmann:
    "The cleanups for v4.9 are a little larger that usual, but thankfully
    that is almost exclusively due to removing a significant number of
    files that have become obsolete after the still ongoing conversion of
    old board files to devicetree.

    - for mach-omap2, which is still the largest platform in arch/arm/,
    the conversion to DT is finally complete after the Nokia N900 is
    now fully supported there, along with the omap3 LDP, and we can
    remove those two board files. If no regressions are found, another
    large cleanup for the platform will happen as a follow-up, removing
    dead code and restructuring the platform based on being DT-only.

    - In mach-imx, similar work is ongoing, but has not come that far.
    This time, we remove the obsolete board file for the i.MX1
    generation, which like i.MX25, i.MX5, i.MX6, and i.MX7 is now
    DT-only. The remaining board files are for i.MX2 and i.MX3 machines
    based on old ARM926 or ARM1136 cores that should work with DT in
    principle.

    - realview has just been converted from board files to DT, and a lot
    of code gets removed in the process. This is the last
    ARM/Keil/Versatile derived platform that was still using board
    files, the other ones being integrator, versatile and vexpress. We
    can probably merge the remaining code into a single directory in
    the near future.

    - clps711x had completed the conversion in v4.8, but we accidentally
    left the files in place that should have been deleted then"

    * tag 'armsoc-cleanup' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (21 commits)
    ARM: select PCI_DOMAINS config from ARCH_MULTIPLATFORM
    ARM: stop *MIGHT_HAVE_PCI* config from being selected redundantly
    ARM: imx: (trivial) fix typo and grammar
    ARM: clps711x: remove extraneous files
    ARM: imx: use IS_ENABLED() instead of checking for built-in or module
    ARM: OMAP2+: use IS_ENABLED() instead of checking for built-in or module
    ARM: OMAP1: use IS_ENABLED() instead of checking for built-in or module
    ARM: imx: remove platform-mxc_rnga
    ARM: realview: imply device tree boot
    ARM: realview: no need to select SMP_ON_UP explicitly
    ARM: realview: delete the RealView board files
    ARM: imx: no need to select SMP_ON_UP explicitly
    ARM: i.MX: Move SOC_IMX1 into 'Device tree only'
    ARM: i.MX: Remove i.MX1 non-DT support
    ARM: i.MX: Remove i.MX1 Synertronixx SCB9328 board support
    ARM: i.MX: Remove i.MX1 Armadeus APF9328 board support
    ARM: mxs: remove obsolete startup code for TX28
    ARM: i.MX31 iomux: remove duplicates with alternate name
    ARM: i.MX31 iomux: remove plain duplicates
    ARM: OMAP2+: Drop legacy board file for LDP
    ...

    Linus Torvalds
     

04 Oct, 2016

2 commits

  • Introduced by commit fde85cfd2d07 ("mtd: nand: Fix nand_command_lp() for
    8bits opcodes") and I didn't have the heart to have Boris rewrite his
    pull request just for that. Anyway, there's some value in having stable
    commit hashes.

    Signed-off-by: Brian Norris

    Brian Norris
     
  • "
    Notable core changes:
    - add the infrastructure to automate NAND timings configuration
    - provide a generic DT property to maximize ECC strength

    The rest is just a bunch of minor drivers and core fixes/cleanup
    patches.
    "

    Also not noted: some refactoring in the core bad block table handling,
    to help with improving some of the logic in error cases.

    Signed-off-by: Brian Norris

    Brian Norris
     

03 Oct, 2016

19 commits

  • Usually Fastmap is free to consider every PEB in one of the pools
    as newer than the existing PEB. Since PEBs in a pool are by definition
    newer than everything else.
    But update_vol() missed the case that a pool can contain more than
    one candidate.

    Cc:
    Fixes: dbb7d2a88d ("UBI: Add fastmap core")
    Signed-off-by: Richard Weinberger
    Reviewed-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • When writing a new Fastmap the first thing that happens
    is refilling the pools in memory.
    At this stage it is possible that new PEBs from the new pools
    get already claimed and written with data.
    If this happens before the new Fastmap data structure hits the
    flash and we face power cut the freshly written PEB will not
    scanned and unnoticed.

    Solve the issue by locking the pools until Fastmap is written.

    Cc:
    Fixes: dbb7d2a88d ("UBI: Add fastmap core")
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • When Fastmap is used we can face here an -EBADMSG
    since Fastmap cannot know about unmaps.
    If the erasure was interrupted the PEB may show ECC
    errors and UBI would go to ro-mode as it assumes
    that the PEB was check during attach time, which is
    not the case with Fastmap.

    Cc:
    Fixes: dbb7d2a88d ("UBI: Add fastmap core")
    Signed-off-by: Richard Weinberger

    Richard Weinberger
     
  • Currently, all VID headers are allocated and freed using the
    ubi_zalloc_vid_hdr() and ubi_free_vid_hdr() function. These functions
    make sure to align allocation on ubi->vid_hdr_alsize and adjust the
    vid_hdr pointer to match the ubi->vid_hdr_shift requirements.
    This works fine, but is a bit convoluted.
    Moreover, the future introduction of LEB consolidation (needed to support
    MLC/TLC NANDs) will allows a VID buffer to contain more than one VID
    header.

    Hence the creation of a ubi_vid_io_buf struct to attach extra information
    to the VID header.

    We currently only store the actual pointer of the underlying buffer, but
    will soon add the number of VID headers contained in the buffer.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • Create a private ubi_eba_table struct to hide EBA internals and provide
    helpers to allocate, destroy, copy and assing an EBA table to a volume.

    Now that external EBA users are using helpers to query/modify the EBA
    state we can safely change the internal representation, which will be
    needed to support the LEB consolidation concept.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • This is part of our attempt to hide EBA internals from other part of the
    implementation in order to easily adapt it to the MLC needs.

    Here we are creating an ubi_eba_leb_desc struct to hide the way we keep
    track of the LEB to PEB mapping.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • This is part of the process of hiding UBI EBA's internal to other part of
    the UBI implementation, so that we can add new information to the EBA
    table without having to patch different places in the UBI code.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • ubi_leb_valid() is here to replace the
    lnum < 0 || lnum >= vol->reserved_pebs checks.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • ubi_eba_write_leb(), ubi_eba_write_leb_st() and
    ubi_eba_atomic_leb_change() are using a convoluted retry/exit path.
    Add the try_write_vid_and_data() function to simplify the retry logic
    and make sure we have a single exit path instead of manually releasing
    the resources in each error path.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • recover_peb() is using a convoluted retry/exit path. Add try_recover_peb()
    to simplify the retry logic and make sure we have a single exit path
    instead of manually releasing the resource in each error path.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • Even if it works fine with those global variables, attaching the
    temporary ech and vidh objects used during UBI scan to the
    ubi_attach_info object sounds like a more future-proof option.

    For example, attaching several UBI devices in parallel is prevented by
    this use of global variable. And also because global variables should
    be avoided in general.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • This not only hides the aeb allocation internals (which is always good in
    case we ever want to change the allocation system), but also helps us
    factorize the initialization of some common fields (ec and pnum).

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • ubi_io_{read,write}_data() are wrappers around ubi_io_{read/write}() that
    are used to read/write eraseblock payload data, which is exactly what
    fastmap does when calling ubi_io_{read,write}().

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • Use the ubi_rb_for_each_entry() macro instead of open-coding it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • Those functions are pretty much doing the same thing, except
    ubi_remove_av() is putting the aeb elements attached to the volume into
    the ai->erase list and the destroy_av() is freeing them.

    Rework destroy_av() to handle both cases.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • Volume creation/search code is duplicated in a few places (fastmap and
    non fastmap code). Create some helpers to factorize the code.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • vol->usable_size is already set to ubi->leb_size - vol->data_pad. Use
    vol->usable_size instead of recalculating it.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • scan_pool() does not mark the PEB for scrubing when bitflips are
    detected in the EC header of a free PEB (VID header region left to
    0xff).
    Make sure we scrub the PEB in this case.

    Signed-off-by: Boris Brezillon
    Fixes: dbb7d2a88d2a ("UBI: Add fastmap core")
    Signed-off-by: Richard Weinberger

    Boris Brezillon
     
  • process_pool_aeb() does several times the be32_to_cpu(new_vh->vol_id)
    operation. Create a temporary variable and do it once.

    Signed-off-by: Boris Brezillon
    Signed-off-by: Richard Weinberger

    Boris Brezillon