01 Jun, 2020

1 commit

  • This introduces mtdpstore, which is similar to mtdoops but more
    powerful. It uses pstore/blk, and aims to store panic and oops logs to
    a flash partition, where pstore can later read back and present as files
    in the mounted pstore filesystem.

    To make mtdpstore work, the "blkdev" of pstore/blk should be set
    as MTD device name or MTD device number. For more details, see
    Documentation/admin-guide/pstore-blk.rst

    This solves a number of issues:
    - Work duplication: both of pstore and mtdoops do the same job storing
    panic/oops log. They have very similar logic, registering to kmsg
    dumper and storing logs to several chunks one by one.
    - Layer violations: drivers should provides methods instead of polices.
    MTD should provide read/write/erase operations, and allow a higher
    level drivers to provide the chunk management, kmsg dump
    configuration, etc.
    - Missing features: pstore provides many additional features, including
    presenting the logs as files, logging dump time and count, and
    supporting other frontends like pmsg, console, etc.

    Signed-off-by: WeiXiong Liao
    Link: https://lore.kernel.org/lkml/20200511233229.27745-11-keescook@chromium.org/
    Link: https://lore.kernel.org/r/1589266715-4168-1-git-send-email-liaoweixiong@allwinnertech.com
    Signed-off-by: Kees Cook

    WeiXiong Liao
     

16 Sep, 2019

5 commits


28 Jun, 2019

1 commit

  • Cypress' HyperBus is Low Signal Count, High Performance Double Data Rate
    Bus interface between a host system master and one or more slave
    interfaces. HyperBus is used to connect microprocessor, microcontroller,
    or ASIC devices with random access NOR flash memory (called HyperFlash)
    or self refresh DRAM (called HyperRAM).

    Its a 8-bit data bus (DQ[7:0]) with Read-Write Data Strobe (RWDS)
    signal and either Single-ended clock(3.0V parts) or Differential clock
    (1.8V parts). It uses ChipSelect lines to select b/w multiple slaves.
    At bus level, it follows a separate protocol described in HyperBus
    specification[1].

    HyperFlash follows CFI AMD/Fujitsu Extended Command Set (0x0002) similar
    to that of existing parallel NORs. Since HyperBus is x8 DDR bus,
    its equivalent to x16 parallel NOR flash with respect to bits per clock
    cycle. But HyperBus operates at >166MHz frequencies.
    HyperRAM provides direct random read/write access to flash memory
    array.

    But, HyperBus memory controllers seem to abstract implementation details
    and expose a simple MMIO interface to access connected flash.

    Add support for registering HyperFlash devices with MTD framework. MTD
    maps framework along with CFI chip support framework are used to support
    communicating with flash.

    Framework is modelled along the lines of spi-nor framework. HyperBus
    memory controller (HBMC) drivers calls hyperbus_register_device() to
    register a single HyperFlash device. HyperFlash core parses MMIO access
    information from DT, sets up the map_info struct, probes CFI flash and
    registers it with MTD framework.

    Some HBMC masters need calibration/training sequence[3] to be carried
    out, in order for DLL inside the controller to lock, by reading a known
    string/pattern. This is done by repeatedly reading CFI Query
    Identification String. Calibration needs to be done before trying to detect
    flash as part of CFI flash probe.

    HyperRAM is not supported at the moment.

    HyperBus specification can be found at[1]
    HyperFlash datasheet can be found at[2]

    [1] https://www.cypress.com/file/213356/download
    [2] https://www.cypress.com/file/213346/download
    [3] http://www.ti.com/lit/ug/spruid7b/spruid7b.pdf
    Table 12-5741. HyperFlash Access Sequence

    Signed-off-by: Vignesh Raghavendra
    Signed-off-by: Miquel Raynal

    Vignesh Raghavendra
     

07 May, 2019

1 commit


12 Nov, 2018

1 commit


15 Mar, 2018

1 commit


02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

23 Jun, 2017

1 commit

  • This makes TRX parsing code reusable with other platforms and parsers.

    Please note this patch doesn't really change anything in the existing
    code, just moves it. There is still some place for improvement (e.g.
    working on non-hacky method of checking rootfs format) but it's not
    really a subject of this change.

    Signed-off-by: Rafał Miłecki
    Signed-off-by: Brian Norris

    Rafał Miłecki
     

15 Apr, 2014

2 commits

  • Signed-off-by: Brian Norris
    Reviewed-by: Marek Vasut
    Acked-by: Huang Shijie

    Brian Norris
     
  • This patch cloned most of the m25p80.c. In theory, it adds a new spi-nor layer.

    Before this patch, the layer is like:

    MTD
    ------------------------
    m25p80
    ------------------------
    spi bus driver
    ------------------------
    SPI NOR chip

    After this patch, the layer is like:
    MTD
    ------------------------
    spi-nor
    ------------------------
    m25p80
    ------------------------
    spi bus driver
    ------------------------
    SPI NOR chip

    With the spi-nor controller driver(Freescale Quadspi), it looks like:
    MTD
    ------------------------
    spi-nor
    ------------------------
    fsl-quadspi
    ------------------------
    SPI NOR chip

    New APIs:
    spi_nor_scan: used to scan a spi-nor flash.

    Signed-off-by: Huang Shijie
    Acked-by: Marek Vasut
    [Brian: rebased to include additional m25p_ids[] entry]
    Signed-off-by: Brian Norris

    Huang Shijie
     

05 Apr, 2013

1 commit

  • The MTD subsystem has historically tried to be as configurable as possible. The
    side-effect of this is that its configuration menu is rather large, and we are
    gradually shrinking it. For example, we recently merged partitions support with
    the mtdcore.

    This patch does the next step - it merges the mtdchar module to mtdcore. And in
    this case this is not only about eliminating too fine-grained separation and
    simplifying the configuration menu. This is also about eliminating seemingly
    useless kernel module.

    Indeed, mtdchar is a module that allows user-space making use of MTD devices
    via /dev/mtd* character devices. If users do not enable it, they simply cannot
    use MTD devices at all. They cannot read or write the flash contents. Is it a
    sane and useful setup? I believe not. And everyone just enables mtdchar.

    Having mtdchar separate is also a little bit harmful. People sometimes miss the
    fact that they need to enable an additional configuration option to have
    user-space MTD interfaces, and then they wonder why on earth the kernel does
    not allow using the flash? They spend time asking around.

    Thus, let's just get rid of this module and make it part of mtd core.

    Note, mtdchar had additional configuration option to enable OTP interfaces,
    which are present on some flashes. I removed that option as well - it saves a
    really tiny amount space.

    [dwmw2: Strictly speaking, you can mount file systems on MTD devices just
    fine without the mtdchar (or mtdblock) devices; you just can't do
    other manipulations directly on the underlying device. But still I
    agree that it makes sense to make this unconditional. And Yay! we
    get to kill off an instance of checking CONFIG_foo_MODULE, which is
    an abomination that should never happen.]

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

    Artem Bityutskiy
     

29 Sep, 2012

1 commit

  • This driver provides parser detecting partitions on BCM47XX flash
    memories. It has many differences in comparison to BCM63XX, like:
    1) Different CFE with no more trivial MAGICs
    2) More partitions types (board_data, ML, POT)
    3) Supporting more than 1 flash on a device
    which resulted in decision of writing new parser.

    It uses generic mtd interface and was successfully tested with Netgear
    WNDR4500 router which has 2 flash memories: serial one and NAND one.

    Signed-off-by: Rafał Miłecki
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Rafał Miłecki
     

10 Jan, 2012

1 commit

  • 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
     

11 Sep, 2011

1 commit


25 May, 2011

1 commit

  • Now that none of the drivers use CONFIG_MTD_PARTITIONS we can remove
    it from Kconfig and the last remaining uses.

    Signed-off-by: Jamie Iles
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jamie Iles
     

11 Mar, 2011

2 commits

  • Add a driver for allowing an mtd device to be used as a block device for
    swapping. The block device is volatile, and the mapping of swapped pages
    is not stored on flash.

    Signed-off-by: Jarkko Lavinen
    Tested-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Jarkko Lavinen
     
  • Move mtdconcat to be an integral part of the mtd core. It's a tiny bit
    of code, which bears 'say Y if you don't know what to do' note in the
    Kconfig. OTOH there are several ugly ifdefs depending on the MTD_CONCAT.
    So, making MTD_CONCAT support mandatory will allow us to clean up code a
    lot.

    Kconfig entry is changed to be a bool defaulting to Y, so all code
    pieces depending on it, will have MTD_CONCAT Kconfig symbol and
    CONFIG_MTD_CONCAT define. This will be removed in one of next patches.

    Signed-off-by: Dmitry Eremin-Solenikov
    Acked-by: Stefan Roese
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Dmitry Eremin-Solenikov
     

04 Dec, 2010

1 commit

  • MTD_OF_PARTS should be possible on all architectures, not just
    powerpc and microblaze, and it probably should not be a user
    selectable option. Neither does it need to be in a separate module.

    Also, rework MTD Kconfig to group options dependant on MTD_PARTITIONS
    into a if/endif block. Do the same for MTD_REDBOOT_PARTS.

    Signed-off-by: Grant Likely
    Signed-off-by: Artem Bityutskiy
    Signed-off-by: David Woodhouse

    Grant Likely
     

10 May, 2010

1 commit


27 Apr, 2010

1 commit


27 Feb, 2010

1 commit

  • This implements new readwrite SmartMedia/xd FTL.

    mtd driver must have support proper ECC and badblock verification
    based on oob parts for 512 bytes nand.

    Also mtd driver must define read_oob and write_oob, which are used
    to read and write both data and oob together.

    Signed-off-by: Maxim Levitsky
    Signed-off-by: David Woodhouse

    Maxim Levitsky
     

24 Mar, 2009

1 commit


06 Jan, 2009

1 commit


05 Jan, 2009

1 commit

  • We have two components to manage LPDDR flash memories in Linux.
    1. It is a driver for chip probing and reading its capabilities
    2. It is a device operations driver.

    Signed-off-by: Alexey Korolev
    Acked-by: Jared Hulbert
    Signed-off-by: David Woodhouse

    Alexey Korolev
     

10 Dec, 2008

1 commit


23 Apr, 2008

1 commit


03 Feb, 2008

1 commit


23 Aug, 2007

1 commit


03 Aug, 2007

1 commit

  • We want drivers/mtd/{mtdcore, mtdsuper, mtdpart}.c to be built and linked
    into the same mtd.ko module. Fix the Makefile to ensure this, and remove
    duplicate MODULE_ declarations in mtdpart.c, as mtdcore.c already has them.

    Signed-off-by: Satyam Sharma
    Signed-off-by: David Woodhouse

    Satyam Sharma
     

29 Jun, 2007

1 commit

  • Kernel oops and panic messages are invaluable when debugging crashes.
    These messages often don't make it to flash based logging methods (say a
    syslog on jffs2) due to the overheads involved in writing to flash.

    This patch allows you to turn an MTD partition into a circular log
    buffer where kernel oops and panic messages are written to. The messages
    are obtained by registering a console driver and checking
    oops_in_progress. Erases are performed in advance to maximise the
    chances of a saving messages.

    To activate it, add console=ttyMTDx to the kernel commandline (where x
    is the mtd device number to use).

    Signed-off-by: Richard Purdie
    Signed-off-by: David Woodhouse

    Richard Purdie
     

11 May, 2007

1 commit


27 Apr, 2007

1 commit

  • UBI (Latin: "where?") manages multiple logical volumes on a single
    flash device, specifically supporting NAND flash devices. UBI provides
    a flexible partitioning concept which still allows for wear-levelling
    across the whole flash device.

    In a sense, UBI may be compared to the Logical Volume Manager
    (LVM). Whereas LVM maps logical sector numbers to physical HDD sector
    numbers, UBI maps logical eraseblocks to physical eraseblocks.

    More information may be found at
    http://www.linux-mtd.infradead.org/doc/ubi.html

    Partitioning/Re-partitioning

    An UBI volume occupies a certain number of erase blocks. This is
    limited by a configured maximum volume size, which could also be
    viewed as the partition size. Each individual UBI volume's size can
    be changed independently of the other UBI volumes, provided that the
    sum of all volume sizes doesn't exceed a certain limit.

    UBI supports dynamic volumes and static volumes. Static volumes are
    read-only and their contents are protected by CRC check sums.

    Bad eraseblocks handling

    UBI transparently handles bad eraseblocks. When a physical
    eraseblock becomes bad, it is substituted by a good physical
    eraseblock, and the user does not even notice this.

    Scrubbing

    On a NAND flash bit flips can occur on any write operation,
    sometimes also on read. If bit flips persist on the device, at first
    they can still be corrected by ECC, but once they accumulate,
    correction will become impossible. Thus it is best to actively scrub
    the affected eraseblock, by first copying it to a free eraseblock
    and then erasing the original. The UBI layer performs this type of
    scrubbing under the covers, transparently to the UBI volume users.

    Erase Counts

    UBI maintains an erase count header per eraseblock. This frees
    higher-level layers (like file systems) from doing this and allows
    for centralized erase count management instead. The erase counts are
    used by the wear-levelling algorithm in the UBI layer. The algorithm
    itself is exchangeable.

    Booting from NAND

    For booting directly from NAND flash the hardware must at least be
    capable of fetching and executing a small portion of the NAND
    flash. Some NAND flash controllers have this kind of support. They
    usually limit the window to a few kilobytes in erase block 0. This
    "initial program loader" (IPL) must then contain sufficient logic to
    load and execute the next boot phase.

    Due to bad eraseblocks, which may be randomly scattered over the
    flash device, it is problematic to store the "secondary program
    loader" (SPL) statically. Also, due to bit-flips it may become
    corrupted over time. UBI allows to solve this problem gracefully by
    storing the SPL in a small static UBI volume.

    UBI volumes vs. static partitions

    UBI volumes are still very similar to static MTD partitions:

    * both consist of eraseblocks (logical eraseblocks in case of UBI
    volumes, and physical eraseblocks in case of static partitions;
    * both support three basic operations - read, write, erase.

    But UBI volumes have the following advantages over traditional
    static MTD partitions:

    * there are no eraseblock wear-leveling constraints in case of UBI
    volumes, so the user should not care about this;
    * there are no bit-flips and bad eraseblocks in case of UBI volumes.

    So, UBI volumes may be considered as flash devices with relaxed
    restrictions.

    Where can it be found?

    Documentation, kernel code and applications can be found in the MTD
    gits.

    What are the applications for?

    The applications help to create binary flash images for two purposes: pfi
    files (partial flash images) for in-system update of UBI volumes, and plain
    binary images, with or without OOB data in case of NAND, for a manufacturing
    step. Furthermore some tools are/and will be created that allow flash content
    analysis after a system has crashed..

    Who did UBI?

    The original ideas, where UBI is based on, were developed by Andreas
    Arnez, Frank Haverkamp and Thomas Gleixner. Josh W. Boyer and some others
    were involved too. The implementation of the kernel layer was done by Artem
    B. Bityutskiy. The user-space applications and tools were written by Oliver
    Lohmann with contributions from Frank Haverkamp, Andreas Arnez, and Artem.
    Joern Engel contributed a patch which modifies JFFS2 so that it can be run on
    a UBI volume. Thomas Gleixner did modifications to the NAND layer. Alexander
    Schmidt made some testing work as well as core functionality improvements.

    Signed-off-by: Artem B. Bityutskiy
    Signed-off-by: Frank Haverkamp

    Artem B. Bityutskiy
     

29 Nov, 2006

1 commit


22 Sep, 2006

1 commit


07 Nov, 2005

2 commits