19 Dec, 2017

2 commits


07 Dec, 2017

2 commits

  • mclk and hclk need to be disabled. Since pm_runtime_disable does
    not disable the clocks, use pm_runtime_force_suspend instead.

    Found by Linux Driver Verification project (linuxtesting.org).

    Signed-off-by: Takuo Koguchi
    Acked-by: Maxime Ripard
    Signed-off-by: Mark Brown

    Takuo Koguchi
     
  • The R-Car Gen2 Hardware User Manual Rev. 2.00 states:

    If the master/slave mode select bit (MSTR) is modified while the SPI
    function enable bit (SPE) is set to 1 (that is, this module is
    enabled), the subsequent operation cannot be guaranteed.

    Hence do not set SPCR_SPE when setting SPCR_MSTR, just like the
    .set_config_register() implementations for other RSPI variants do.

    Note that when booted from QSPI, the boot loader will have set SPCR_MSTR
    already, hence usually the bit is never modified by the Linux driver.

    Reported-by: Yoshihiro Shimoda
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Mark Brown

    Geert Uytterhoeven
     

27 Nov, 2017

1 commit

  • The Armada 3700 SPI controller has 2 ranges of prescaler coefficients.
    One ranging from 0 to 15 by steps of 1, and one ranging from 0 to 30 by
    steps of 2.

    This commit fixes the prescaler coefficients that are over 15 so that it
    uses the correct range of values. The prescaling coefficient is rounded
    to the upper value if it is odd.

    This was tested on Espressobin with spidev and a locigal analyser.

    Signed-off-by: Maxime Chevallier
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Maxime Chevallier
     

24 Nov, 2017

1 commit

  • When the core is configured in C_SPI_MODE > 0, it integrates a
    lookup table that automatically configures the core in dual or quad mode
    based on the command (first byte on the tx fifo).

    Unfortunately, that list mode_?_memoy_*.mif does not contain all the
    supported commands by the flash.

    Since 4.14 spi-nor automatically tries to probe the flash using SFDP
    (command 0x5a), and that command is not part of the list_mode table.

    Whit the right combination of C_SPI_MODE and C_SPI_MEMORY this leads
    into a stall that can only be recovered with a soft rest.

    This patch detects this kind of stall and returns -EIO to the caller on
    those commands. spi-nor can handle this error properly:

    m25p80 spi0.0: Detected stall. Check C_SPI_MODE and C_SPI_MEMORY. 0x21 0x2404
    m25p80 spi0.0: SPI transfer failed: -5
    spi_master spi0: failed to transfer one message from queue
    m25p80 spi0.0: s25sl064p (8192 Kbytes)

    Signed-off-by: Ricardo Ribalda Delgado
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Ricardo Ribalda
     

11 Nov, 2017

8 commits


04 Nov, 2017

2 commits


03 Nov, 2017

3 commits

  • Signed-off-by: Angelo Dureghello
    Signed-off-by: Mark Brown

    Angelo Dureghello
     
  • On systems where some controllers get a dynamic ID assigned and some have
    a fixed number from DT, the current implemention might run into an IDR
    collision if the dynamic controllers gets probed first and get an IDR number,
    which is later requested by the controller with the fixed numbering. When
    this happens the fixed controller will fail to register with the SPI core.

    Fix this by skipping all known alias numbers when assigning the dynamic IDs.

    Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias)
    Signed-off-by: Lucas Stach
    Signed-off-by: Mark Brown

    Lucas Stach
     
  • …el/git/gregkh/driver-core

    Pull initial SPDX identifiers from Greg KH:
    "License cleanup: add SPDX license identifiers to some files

    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: Kate Stewart <kstewart@linuxfoundation.org>
    Reviewed-by: Philippe Ombredanne <pombredanne@nexb.com>
    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

    * tag 'spdx_identifiers-4.14-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
    License cleanup: add SPDX license identifier to uapi header files with a license
    License cleanup: add SPDX license identifier to uapi header files with no license
    License cleanup: add SPDX GPL-2.0 license identifier to files with no license

    Linus Torvalds
     

02 Nov, 2017

3 commits

  • The assignment of status to zero is never read, status is either
    updated in the next iteration of the of the loop or several
    lines after the end of the loop. Remove it, cleans up clang warning:

    drivers/spi/spi-orion.c:674:4: warning: Value stored to 'status'
    is never read

    Signed-off-by: Colin Ian King
    Signed-off-by: Mark Brown

    Colin Ian King
     
  • DMA supports 32-bit words only,
    even if BITLEN1 of SITMDR2 register is 16bit.

    Fixes: b0d0ce8b6b91 ("spi: sh-msiof: Add DMA support")
    Signed-off-by: Hiromitsu Yamasaki
    Signed-off-by: Simon Horman
    Acked-by: Geert Uytterhoeven
    Acked-by: Dirk Behme
    Signed-off-by: Mark Brown

    Hiromitsu Yamasaki
     
  • 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
     

31 Oct, 2017

4 commits

  • If the code that requests any chip select GPIOs fails, the cleanup of
    spi_bitbang_start() by calling spi_bitbang_stop() is not done.

    Fix this by moving spi_bitbang_start() to after the code that requets
    GPIOs. The GPIOs are dev managed and don't need explicit cleanup.
    Since spi_bitbang_start() is now the last operation, it doesn't need
    to be cleaned up in the failure path.

    CC: Shawn Guo
    CC: Sascha Hauer
    CC: Fabio Estevam
    CC: Mark Brown
    Reviewed-by: Oleksij Rempel
    Signed-off-by: Trent Piepho
    Signed-off-by: Mark Brown

    Trent Piepho
     
  • Take an extra reference to the controller before deregistering it to
    prevent use-after-free in the interrupt handler in case an interrupt
    fires before the line is disabled.

    Fixes: b1353d1c1d45 ("spi: Add Analog Devices AXI SPI Engine controller support")
    Acked-by: Lars-Peter Clausen
    Signed-off-by: Johan Hovold
    Signed-off-by: Mark Brown

    Johan Hovold
     
  • Document the fact that a reference to the controller is dropped as part
    of deregistration.

    This is an odd pattern as the reference is typically taken in
    __spi_alloc_controller() rather than spi_register_controller(). Most
    controller drivers gets it right these days and notably the
    device-managed interface relies on this behaviour.

    Signed-off-by: Johan Hovold
    Signed-off-by: Mark Brown

    Johan Hovold
     
  • The controller is typically freed as part of device_unregister() so
    store the bus id before deregistration to avoid use-after-free when the
    id is later released.

    Fixes: 9b61e302210e ("spi: Pick spi bus number from Linux idr or spi alias")
    Signed-off-by: Johan Hovold
    Signed-off-by: Mark Brown
    Cc: stable

    Johan Hovold
     

25 Oct, 2017

2 commits


17 Oct, 2017

1 commit

  • On systems where some controllers get a dynamic ID assigned and some have
    a fixed number from DT, the current implemention might run into an IDR
    collision if the dynamic controllers gets probed first and get an IDR number,
    which is later requested by the controller with the fixed numbering. When
    this happens the fixed controller will fail to register with the SPI core.

    Fix this by skipping all known alias numbers when assigning the dynamic IDs.

    Fixes: 9b61e302210e (spi: Pick spi bus number from Linux idr or spi alias)
    Signed-off-by: Lucas Stach
    Signed-off-by: Mark Brown

    Lucas Stach
     

14 Oct, 2017

1 commit

  • drivers/spi/spi-sprd-adi.c:409:3-8: No need to set .owner here. The core will do it.

    Remove .owner field if calls are used which set it automatically

    Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci

    Fixes: 7e2903cb91df ("spi: Add ADI driver for Spreadtrum platform")
    Signed-off-by: Fengguang Wu
    Signed-off-by: Mark Brown

    Wu Fengguang
     

12 Oct, 2017

1 commit

  • There was an inversion in how the error path in bcm_qspi_probe() is done
    which would make us trip over a KASAN use-after-free report. Turns out
    that qspi->dev_ids does not get allocated until later in the probe
    process. Fix this by introducing a new lable: qspi_resource_err which
    takes care of cleaning up the SPI master instance.

    Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
    Signed-off-by: Florian Fainelli
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Florian Fainelli
     

10 Oct, 2017

2 commits

  • The spi device mode should be configured in the controller before the
    chip-select is asserted, so that a clock polarity configuration change
    is not interpreted as a clock tick by the device.

    This patch moves the mode setting to the 'prepare_message' function
    instead of the 'transfer_one' function.

    By doing so, this patch also removes redundant code in
    a3700_spi_clock_set.

    This was tested on EspressoBin board, with spidev.

    Signed-off-by: Maxime Chevallier
    Signed-off-by: Mark Brown

    Maxime Chevallier
     
  • When waiting for transfer completion, a3700_spi_wait_completion
    returns a boolean indicating if a timeout occurred.

    The function was returning 'true' everytime, failing to detect any
    timeout.

    This patch makes it return 'false' when a timeout is reached.

    Signed-off-by: Maxime Chevallier
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Maxime Chevallier
     

09 Oct, 2017

1 commit


06 Oct, 2017

1 commit

  • With CONFIG_HWSPINLOCK=m, the new driver fails to link as a built-in driver:

    drivers/spi/spi-sprd-adi.o: In function `sprd_adi_remove':
    spi-sprd-adi.c:(.text+0x18): undefined reference to `hwspin_lock_free'
    drivers/spi/spi-sprd-adi.o: In function `sprd_adi_probe':
    spi-sprd-adi.c:(.text+0xfc): undefined reference to `of_hwspin_lock_get_id'
    spi-sprd-adi.c:(.text+0x108): undefined reference to `hwspin_lock_request_specific'
    spi-sprd-adi.c:(.text+0x268): undefined reference to `hwspin_lock_free'

    This adds a hard Kconfig dependency on HWSPINLOCK for the !COMPILE_TEST
    case, and allows compile-testing with HWSPINLOCK completely disabled,
    which will then rely on the existing stub API.

    Fixes: 7e2903cb91df ("spi: Add ADI driver for Spreadtrum platform")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Mark Brown

    Arnd Bergmann
     

04 Oct, 2017

2 commits


28 Sep, 2017

1 commit

  • This is a straight forward addition of runtime and system sleep pm operations
    that handle clk and pinctrl (for runtime pm) and spi_master_{suspend,resume}
    (for system sleep).

    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Mark Brown

    Uwe Kleine-König
     

26 Sep, 2017

2 commits