1. 20 3月, 2018 2 次提交
  2. 16 2月, 2018 2 次提交
  3. 20 1月, 2018 1 次提交
  4. 06 1月, 2018 1 次提交
  5. 18 12月, 2017 1 次提交
    • A
      mtd: cfi: convert inline functions to macros · 9e343e87
      Arnd Bergmann 提交于
      The map_word_() functions, dating back to linux-2.6.8, try to perform
      bitwise operations on a 'map_word' structure. This may have worked
      with compilers that were current then (gcc-3.4 or earlier), but end
      up being rather inefficient on any version I could try now (gcc-4.4 or
      higher). Specifically we hit a problem analyzed in gcc PR81715 where we
      fail to reuse the stack space for local variables.
      
      This can be seen immediately in the stack consumption for
      cfi_staa_erase_varsize() and other functions that (with CONFIG_KASAN)
      can be up to 2200 bytes. Changing the inline functions into macros brings
      this down to 1280 bytes.  Without KASAN, the same problem exists, but
      the stack consumption is lower to start with, my patch shrinks it from
      920 to 496 bytes on with arm-linux-gnueabi-gcc-5.4, and saves around
      1KB in .text size for cfi_cmdset_0020.c, as it avoids copying map_word
      structures for each call to one of these helpers.
      
      With the latest gcc-8 snapshot, the problem is fixed in upstream gcc,
      but nobody uses that yet, so we should still work around it in mainline
      kernels and probably backport the workaround to stable kernels as well.
      We had a couple of other functions that suffered from the same gcc bug,
      and all of those had a simpler workaround involving dummy variables
      in the inline function. Unfortunately that did not work here, the
      macro hack was the best I could come up with.
      
      It would also be helpful to have someone to a little performance testing
      on the patch, to see how much it helps in terms of CPU utilitzation.
      
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715
      Cc: stable@vger.kernel.org
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NRichard Weinberger <richard@nod.at>
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      9e343e87
  6. 16 12月, 2017 1 次提交
    • M
      mtd: nand: add ->exec_op() implementation · 8878b126
      Miquel Raynal 提交于
      Introduce a new interface to instruct NAND controllers to send specific
      NAND operations. The new interface takes the form of a single method
      called ->exec_op(). This method is designed to replace ->cmd_ctrl(),
      ->cmdfunc() and ->read/write_byte/word/buf() hooks.
      
      ->exec_op() is passed a set of instructions describing the operation
      to execute. Each instruction has a type (ADDR, CMD, DATA, WAITRDY)
      and delay. The delay is here to help simple controllers wait enough
      time between each instruction, advanced controllers with integrated
      timings control can ignore these delays.
      
      Controllers that natively support complex operations (operations
      formed of several instructions) can use the NAND op parser
      infrastructure. This infrastructure allows controller drivers to
      describe the sequence of instructions they support (called
      nand_op_pattern) and a hook for each of these supported sequences. The
      core then tries to find the best match for a given NAND operation, and
      calls the associated hook.
      
      Various other helpers are also added to ease NAND controller drivers
      writing.
      
      This new interface should ease support of vendor specific operations
      in that NAND manufacturer drivers now have a way to check if the
      controller they are connected to supports a specific operation, and
      complain or refuse to probe the NAND chip when that's not the case.
      Suggested-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      Signed-off-by: NMiquel Raynal <miquel.raynal@free-electrons.com>
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      8878b126
  7. 14 12月, 2017 5 次提交
  8. 13 12月, 2017 2 次提交
  9. 14 11月, 2017 1 次提交
  10. 07 11月, 2017 1 次提交
  11. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      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 <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  12. 11 10月, 2017 1 次提交
    • K
      mtd: spi-nor: add spi_nor_init() function · 46dde01f
      Kamal Dasu 提交于
      This patch extracts some chunks from spi_nor_init_params and spi_nor_scan()
       and moves them into a new spi_nor_init() function.
      
      Indeed, spi_nor_init() regroups all the required SPI flash commands to be
      sent to the SPI flash memory before performing any runtime operations
      (Fast Read, Page Program, Sector Erase, ...). Hence spi_nor_init():
      1) removes the flash protection if applicable for certain vendors.
      2) sets the Quad Enable bit, if needed, before using Quad SPI protocols.
      3) makes the memory enter its (stateful) 4-byte address mode, if needed,
         for SPI flash memory > 128Mbits not supporting the 4-byte address
         instruction set.
      
      spi_nor_scan() now ends by calling spi_nor_init() once the probe phase has
      completed. Further patches could also use spi_nor_init() to implement the
      mtd->_resume() handler for the spi-nor framework.
      Signed-off-by: NKamal Dasu <kdasu.kdev@gmail.com>
      Signed-off-by: NCyrille Pitchen <cyrille.pitchen@wedev4u.fr>
      46dde01f
  13. 07 10月, 2017 1 次提交
  14. 18 9月, 2017 1 次提交
  15. 30 8月, 2017 1 次提交
  16. 23 8月, 2017 2 次提交
  17. 15 8月, 2017 1 次提交
    • A
      mtd: only use __xipram annotation when XIP_KERNEL is set · 129f6c48
      Arnd Bergmann 提交于
      When XIP_KERNEL is enabled, some functions are defined in the .data
      ELF section because we require them to be in RAM whenever we communicate
      with the flash chip. However this causes problems when FTRACE is
      enabled and gcc emits calls to __gnu_mcount_nc in the function
      prolog:
      
      drivers/built-in.o: In function `cfi_chip_setup':
      :(.data+0x272fc): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o
      drivers/built-in.o: In function `cfi_probe_chip':
      :(.data+0x27de8): relocation truncated to fit: R_ARM_CALL against symbol `__gnu_mcount_nc' defined in .text section in arch/arm/kernel/built-in.o
      /tmp/ccY172rP.s: Assembler messages:
      /tmp/ccY172rP.s:70: Warning: ignoring changed section attributes for .data
      /tmp/ccY172rP.s: Error: 1 warning, treating warnings as errors
      make[5]: *** [drivers/mtd/chips/cfi_probe.o] Error 1
      /tmp/ccK4rjeO.s: Assembler messages:
      /tmp/ccK4rjeO.s:421: Warning: ignoring changed section attributes for .data
      /tmp/ccK4rjeO.s: Error: 1 warning, treating warnings as errors
      make[5]: *** [drivers/mtd/chips/cfi_util.o] Error 1
      /tmp/ccUvhCYR.s: Assembler messages:
      /tmp/ccUvhCYR.s:1895: Warning: ignoring changed section attributes for .data
      /tmp/ccUvhCYR.s: Error: 1 warning, treating warnings as errors
      
      Specifically, this does not work because the .data section is not
      marked executable, which leads LD to not generate trampolines for
      long calls.
      
      This moves the __xipram functions into their own .xiptext section instead.
      The section is still placed next to .data and located in RAM but is marked
      executable, which avoids the build errors.
      
      Also, we only need to place the XIP functions into a separate section
      if both CONFIG_XIP_KERNEL and CONFIG_MTD_XIP are set: When only MTD_XIP
      is used, the whole kernel is still in RAM and we do not need to worry
      about pulling out the rug under it. When only XIP_KERNEL but not MTD_XIP
      is set, the kernel is in some form of ROM, but we never write to it.
      
      Note that MTD_XIP has been broken on ARM since around 2011 or 2012. I
      have sent another patch[2] to fix compilation, which I plan to merge
      through arm-soc unless there are objections. The obvious alternative
      to that would be to completely rip out the MTD_XIP support from the
      kernel, since obviously nobody has been using it in a long while.
      
      Link: [1] https://patchwork.kernel.org/patch/8109771/
      Link: [2] https://patchwork.kernel.org/patch/9855225/Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      129f6c48
  18. 13 8月, 2017 1 次提交
  19. 03 8月, 2017 1 次提交
  20. 02 8月, 2017 2 次提交
  21. 22 7月, 2017 1 次提交
  22. 18 7月, 2017 1 次提交
  23. 23 6月, 2017 1 次提交
    • R
      mtd: partitions: add support for partition parsers · 1a0915be
      Rafał Miłecki 提交于
      Some devices have partitions that are kind of containers with extra
      subpartitions / volumes instead of e.g. a simple filesystem data. To
      support such cases we need to first create normal flash device
      partitions and then take care of these special ones.
      
      It's very common case for home routers. Depending on the vendor there
      are formats like TRX, Seama, TP-Link, WRGG & more. All of them are used
      to embed few partitions into a single one / single firmware file.
      
      Ideally all vendors would use some well documented / standardized format
      like UBI (and some probably start doing so), but there are still
      countless devices on the market using these poor vendor specific
      formats.
      
      This patch extends MTD subsystem by allowing to specify list of parsers
      that should be tried for a given partition. Supporting such poor formats
      is highly unlikely to be the top priority so these changes try to
      minimize maintenance cost to the minimum. It reuses existing code for
      these new parsers and just adds a one property and one new function.
      
      This implementation requires setting partition parsers in a flash
      parser. A proper change of bcm47xxpart will follow and in the future we
      will hopefully also find a solution for doing it with ofpart
      ("fixed-partitions").
      Signed-off-by: NRafał Miłecki <rafal@milecki.pl>
      Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
      1a0915be
  24. 10 6月, 2017 2 次提交
    • M
      mtd: nand: add a shorthand to generate nand_ecc_caps structure · a03c6017
      Masahiro Yamada 提交于
      struct nand_ecc_caps was designed as flexible as possible to support
      multiple stepsizes (like sunxi_nand.c).
      
      So, we need to write multiple arrays even for the simplest case.
      I guess many controllers support a single stepsize, so here is a
      shorthand macro for the case.
      
      It allows to describe like ...
      
      NAND_ECC_CAPS_SINGLE(denali_pci_ecc_caps, denali_calc_ecc_bytes, 512, 8, 15);
      
      ... instead of
      
      static const int denali_pci_ecc_strengths[] = {8, 15};
      static const struct nand_ecc_step_info denali_pci_ecc_stepinfo = {
              .stepsize = 512,
              .strengths = denali_pci_ecc_strengths,
              .nstrengths = ARRAY_SIZE(denali_pci_ecc_strengths),
      };
      static const struct nand_ecc_caps denali_pci_ecc_caps = {
              .stepinfos = &denali_pci_ecc_stepinfo,
              .nstepinfos = 1,
              .calc_ecc_bytes = denali_calc_ecc_bytes,
      };
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      a03c6017
    • M
      mtd: nand: add generic helpers to check, match, maximize ECC settings · 2c8f8afa
      Masahiro Yamada 提交于
      Driver are responsible for setting up ECC parameters correctly.
      Those include:
        - Check if ECC parameters specified (usually by DT) are valid
        - Meet the chip's ECC requirement
        - Maximize ECC strength if NAND_ECC_MAXIMIZE flag is set
      
      The logic can be generalized by factoring out common code.
      
      This commit adds 3 helpers to the NAND framework:
      nand_check_ecc_caps - Check if preset step_size and strength are valid
      nand_match_ecc_req - Match the chip's requirement
      nand_maximize_ecc - Maximize the ECC strength
      
      To use the helpers above, a driver needs to provide:
        - Data array of supported ECC step size and strength
        - A hook that calculates ECC bytes from the combination of
          step_size and strength.
      
      By using those helpers, code duplication among drivers will be
      reduced.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      2c8f8afa
  25. 01 6月, 2017 3 次提交
    • B
      mtd: nand: Drop the ->errstat() hook · 7d135bcc
      Boris Brezillon 提交于
      The ->errstat() hook is no longer implemented NAND controller drivers.
      Get rid of it before someone starts abusing it.
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      7d135bcc
    • B
      mtd: nand: Pass the CS line to ->setup_data_interface() · 104e442a
      Boris Brezillon 提交于
      Some NAND controllers can assign different NAND timings to different
      CS lines. Pass the CS line information to ->setup_data_interface() so
      that the NAND controller driver knows which CS line is concerned by
      the setup_data_interface() request.
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      104e442a
    • T
      mtd: nand: add support for Micron on-die ECC · 9748e1d8
      Thomas Petazzoni 提交于
      Now that the core NAND subsystem has support for on-die ECC, this commit
      brings the necessary code to support on-die ECC on Micron NANDs.
      
      In micron_nand_init(), we detect if the Micron NAND chip supports on-die
      ECC mode, by checking a number of conditions:
      
       - It must be an ONFI NAND
       - It must be a SLC NAND
      
       - Enabling *and* disabling on-die ECC must work
      
       - The on-die ECC must be correcting 4 bits per 512 bytes of data. Some
         Micron NAND chips have an on-die ECC able to correct 8 bits per 512
         bytes of data, but they work slightly differently and therefore we
         don't support them in this patch.
      
      Then, if the on-die ECC cannot be disabled (some Micron NAND have on-die
      ECC forcefully enabled), we bail out, as we don't support such
      NANDs. Indeed, the implementation of raw_read()/raw_write() make the
      assumption that on-die ECC can be disabled. Support for Micron NANDs
      with on-die ECC forcefully enabled can easily be added, but in the
      absence of such HW for testing, we preferred to simply bail out.
      
      If the on-die ECC is supported, and requested in the Device Tree, then
      it is indeed enabled, by using custom implementations of the
      ->read_page(), ->read_page_raw(), ->write_page() and ->write_page_raw()
      operation to properly handle the on-die ECC.
      
      In the non-raw functions, we need to enable the internal ECC engine
      before issuing the NAND_CMD_READ0 or NAND_CMD_SEQIN commands, which is
      why we set the NAND_ECC_CUSTOM_PAGE_ACCESS option at initialization
      time (it asks the NAND core to let the NAND driver issue those
      commands).
      Signed-off-by: NThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com>
      9748e1d8
  26. 30 5月, 2017 1 次提交
  27. 16 5月, 2017 2 次提交