09 Jun, 2017

2 commits

  • Add imx6ul device type in spi driver to enable the ERR008517 workaround
    or not by dts easily.

    Signed-off-by: Robin Gong
    (cherry picked from commit 85c6cc2243919f2c46b335ec8b5be70294942e4d)
    (cherry picked from commit 296305f200abd5982a4934b82e7aaf11a3dfc354)

    Conflicts:
    drivers/spi/spi-imx.c

    Robin Gong
     
  • To workaroud the TKT238285, the safe way is use XCH mode in SDMA
    script to simulate as PIO mode which never report such issue. Meanwhile,
    set tx threashold as 0. But this workaroud will bring performance impacted,
    below performance data is collected by 'dd' with SPI-NOR flash on i.mx6dl
    sabresd board:

    mode write data read data
    --PIO 194KB/s 644KB/s
    --DMA normal
    (SMC, tx_thresh=32) 222KB/s 1.4MB/s
    --DMA(XCH, tx_thresh=0) 210KB/s 1.0MB/s

    Signed-off-by: Robin Gong
    (cherry picked from commit 01be65fa5617aa192307ca38b6fc6128f3f0c3f7)
    (cherry picked from commit 646a751a4d1d0e227a762b461d9b8f92605c26b1)
    (cherry picked from commit b334993950b24ced30fcfc70c126b65bf4cb4cff)

    Conflicts:
    drivers/spi/spi-imx.c

    Robin Gong
     

08 Jun, 2017

3 commits

  • On i.MX7ULP sillicon, system suspend go through VLLS mode that gate
    off pinctrl and modules power, then all registers are reset to HW
    default value. To support the feature, driver needs to recover all
    registers status.

    Signed-off-by: Gao Pan

    Gao Pan
     
  • Add i.MX7ULP lpspi bus driver which can continue operating
    in stop modes provided an appropriate clock is available.

    It is also designed for low CPU overhead with DMA offloading
    of FIFO register accesses.

    Signed-off-by: Gao Pan

    Gao Pan
     
  • A null dereference or Oops exception might occurs when reading at once the
    whole content of an spi-nor of big enough size that requires an scatterlist
    table that does not fit into one single page.

    The spi_map_buf function is ignoring the chained sg case by dereferenceing
    the scatterlist elements in an array fashion. This wrongly assumes that
    the allocation of the scatterlist elements are contiguous. This is true as
    long as the scatterlist table fits within a PAGE_SIZE. However, for
    allocation where the scatter table is bigger than that, the pages allocated
    by sg_alloc might not be contigous.

    The sg table can be properly walked by sg_next instead of using an array.

    Signed-off-by: Juan Gutierrez
    Signed-off-by: Mark Brown

    Juan Gutierrez
     

23 Feb, 2017

6 commits

  • SPI IOMUX is changed into reset state in LPSR mode. As a result,
    spi can't work again.

    This patch sets spi IOMUX to default state.

    (cherry-picked from commit 2c8603c31831bb355f6be5b015377fb8fbd89844)

    Signed-off-by: Gao Pan

    Gao Pan
     
  • This commit 06634f8a25f4c5e4ff0c0ef5368a48eb394db63b cherry-picked wrong,
    and that cause SPI DMA mode never works. Actually, no need this patch since
    this patch has already been upsteaminged as below:

    commit f8bb820da4ae863c676156627973a950129559fb
    Author: Robin Gong
    Date: Thu Apr 16 10:54:18 2015 +0800

    spi: check tx_buf and rx_buf in spi_unmap_msg

    Signed-off-by: Robin Gong

    Robin Gong
     
  • This is done in preperation for low power mode. Convert all clk_enable
    to clk_prepare_enable and clk_disable to clk_disable_unprepare. Make sure
    PLL3 power down when entering low power mode.

    Signed-off-by: Bai Ping
    (cherry picked from commit 1808b31fdae576e775159a05cde9b45e404bb6e2)

    Bai Ping
     
  • Some spi device drivers use the same tx_buf and rx_buf repeatly for better
    performance such as driver/input/touchsreen/ads7846.c, but spi core grab tx_buf
    /rx_buf of transfer and set them as dummy_tx/dummy_rx once they are NULL. Thus,
    in the second time the tx_buf/rx_buf will be replaced by dummy_tx/dummy_rx and
    the data which produced by the last tx or rx may be wrongly sent to the device
    or handled by the upper level protocol. This patch just keep the orignal value
    of tx_buf/rx_buf if they are NULL after this transfer processed.

    Signed-off-by: Robin Gong
    Signed-off-by: Mark Brown
    (cherry picked from commit bcd1c2dc8b54060ccb864130a83277d2dc1ff24e)

    Robin Gong
     
  • There is official workaound for TKT238285, so remove the limitation
    for i.mx6dl.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • We set both wartermark of txfifo and rxfifo 32 as half of fifo length 64.
    That will cause easy rxfifo overflow:
    If there is 31 bytes in rxfifo, rx script will wait the next dma request
    (the 32th data come into the rxfifo) and schedule out to tx script. Once
    tx script start to run, the rx script need to wait tx script finish even
    if its priority higher than tx. Meanwhile, spi slave device may input
    data continous, plus the rx data which triggered by new tx script(32 bytes).
    That will quickly consume whole 64 bytes fifo, so we keep 16bytes availbale
    even in the worst case new tx script triggered during two rx transfer. That
    may slow down tx slightly, but better than overflow and RX DMA timeout.

    Signed-off-by: Robin Gong
    (cherry picked from commit 16043ad0ad96aa04a90614e473aa17980af4b8af)
    (cherry picked from commit 819efee83b7b1f47685dca6fad6bbe17f1c42092)
    (cherry picked from commit 5c4c7d05bbba0ea2b26ef2f3ae83119d5eada235)

    Robin Gong
     

26 Jan, 2017

1 commit

  • commit a2dd8af00ca7fff4972425a4a6b19dd1840dc807 upstream.

    The commit 7c7289a40425 ("spi: pxa2xx: Default thresholds to PXA
    configuration") while splitting up CE4100 code obviously missed a break
    condition in one chunk. Add it here.

    Looks like we have no active user of CE4100, though better to fix this later
    than never.

    Fixes: commit 7c7289a40425 ("spi: pxa2xx: Default thresholds to PXA configuration")
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     

15 Jan, 2017

1 commit

  • commit 7243e0b20729d372e97763617a7a9c89f29b33e1 upstream.

    The calculation of SPR and SPPR doesn't round correctly at several
    places which might result in baud rates that are too big. For example
    with tclk_hz = 250000001 and target rate 25000000 it determined a
    divider of 10 which is wrong.

    Instead of fixing all the corner cases replace the calculation by an
    algorithm without a loop which should even be quicker to execute apart
    from being correct.

    Fixes: df59fa7f4bca ("spi: orion: support armada extended baud rates")
    Signed-off-by: Uwe Kleine-König
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Uwe Kleine-König
     

30 Oct, 2016

2 commits


26 Oct, 2016

1 commit

  • When we get a spurious interrupt in fsl_espi_irq, we end up
    processing four uninitalized bytes of data, as shown in this
    warning message:

    drivers/spi/spi-fsl-espi.c: In function 'fsl_espi_irq':
    drivers/spi/spi-fsl-espi.c:462:4: warning: 'rx_data' may be used uninitialized in this function [-Wmaybe-uninitialized]

    This adds another check so we skip the data in this case.

    Fixes: 6319a68011b8 ("spi/fsl-espi: avoid infinite loops on fsl_espi_cpu_irq()")
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Arnd Bergmann
     

25 Oct, 2016

1 commit

  • Instantiated SPI device nodes are marked with OF_POPULATE. This was
    introduced in bd6c164. On unloading, loaded device nodes will of course
    be unmarked. The problem are nodes that fail during initialisation: If a
    node fails, it won't be unloaded and hence not be unmarked.

    If a SPI driver module is unloaded and reloaded, it will skip nodes that
    failed before.

    Skip device nodes that are already populated and mark them only in case
    of success.

    Note that the same issue exists for I2C.

    Fixes: bd6c164 ("spi: Mark instantiated device nodes with OF_POPULATE")
    Signed-off-by: Ralf Ramsauer
    Reviewed-by: Geert Uytterhoeven
    Acked-by: Pantelis Antoniou
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org

    Ralf Ramsauer
     

12 Oct, 2016

1 commit

  • A good practice is to prefix the names of functions by the name
    of the subsystem.

    The kthread worker API is a mix of classic kthreads and workqueues. Each
    worker has a dedicated kthread. It runs a generic function that process
    queued works. It is implemented as part of the kthread subsystem.

    This patch renames the existing kthread worker API to use
    the corresponding name from the workqueues API prefixed by
    kthread_:

    __init_kthread_worker() -> __kthread_init_worker()
    init_kthread_worker() -> kthread_init_worker()
    init_kthread_work() -> kthread_init_work()
    insert_kthread_work() -> kthread_insert_work()
    queue_kthread_work() -> kthread_queue_work()
    flush_kthread_work() -> kthread_flush_work()
    flush_kthread_worker() -> kthread_flush_worker()

    Note that the names of DEFINE_KTHREAD_WORK*() macros stay
    as they are. It is common that the "DEFINE_" prefix has
    precedence over the subsystem names.

    Note that INIT() macros and init() functions use different
    naming scheme. There is no good solution. There are several
    reasons for this solution:

    + "init" in the function names stands for the verb "initialize"
    aka "initialize worker". While "INIT" in the macro names
    stands for the noun "INITIALIZER" aka "worker initializer".

    + INIT() macros are used only in DEFINE() macros

    + init() functions are used close to the other kthread()
    functions. It looks much better if all the functions
    use the same scheme.

    + There will be also kthread_destroy_worker() that will
    be used close to kthread_cancel_work(). It is related
    to the init() function. Again it looks better if all
    functions use the same naming scheme.

    + there are several precedents for such init() function
    names, e.g. amd_iommu_init_device(), free_area_init_node(),
    jump_label_init_type(), regmap_init_mmio_clk(),

    + It is not an argument but it was inconsistent even before.

    [arnd@arndb.de: fix linux-next merge conflict]
    Link: http://lkml.kernel.org/r/20160908135724.1311726-1-arnd@arndb.de
    Link: http://lkml.kernel.org/r/1470754545-17632-3-git-send-email-pmladek@suse.com
    Suggested-by: Andrew Morton
    Signed-off-by: Petr Mladek
    Cc: Oleg Nesterov
    Cc: Tejun Heo
    Cc: Ingo Molnar
    Cc: Peter Zijlstra
    Cc: Steven Rostedt
    Cc: "Paul E. McKenney"
    Cc: Josh Triplett
    Cc: Thomas Gleixner
    Cc: Jiri Kosina
    Cc: Borislav Petkov
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Petr Mladek
     

01 Oct, 2016

6 commits


30 Sep, 2016

2 commits


29 Sep, 2016

1 commit


27 Sep, 2016

2 commits

  • The driver uses custom chip_info coming from platform data for chip selects
    implemented as GPIOs. If the system lacks board files setting up the
    platform data, it is not possible to use GPIOs as chip selects.

    This adds support for GPIO descriptors so that regardless of the underlying
    firmware interface (DT, ACPI or platform data) the driver can request GPIOs
    used as chip selects and configure them accordingly.

    The custom chip_info GPIO support is still left there to make sure the
    existing systems keep working as expected.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Mark Brown

    Mika Westerberg
     
  • It is possible that master->cs_gpios is NULL after spi_bitbang_start(),
    this happens if the master has no CS GPIOs specified in DT. Check for
    this case after spi_bitbang_start() to prevent NULL pointer dereference
    in the subsequent for loop, which accesses the master->cs_gpios field.

    Signed-off-by: Marek Vasut
    Cc: Martin Kaiser
    Cc: Mark Brown
    Signed-off-by: Mark Brown

    Marek Vasut
     

25 Sep, 2016

4 commits


17 Sep, 2016

2 commits


16 Sep, 2016

2 commits

  • The two power management functions are define inside of an #ifdef
    but referenced unconditionally, which is obviously broken when
    CONFIG_PM_SLEEP is not set:

    drivers/spi/spi-bcm-qspi.c:1300:13: error: 'bcm_qspi_suspend' undeclared here (not in a function)
    drivers/spi/spi-bcm-qspi.c:1301:13: error: 'bcm_qspi_resume' undeclared here (not in a function)

    This replaces the #ifdef with a __maybe_unused annotation that lets
    the compiler figure out whether to drop the functions itself,
    and uses SIMPLE_DEV_PM_OPS() to refer to the functions.

    This will also fill the freeze/thaw/poweroff/restore callback
    pointers in addition to suspend/resume, but as far as I can tell,
    this is what we want.

    Signed-off-by: Arnd Bergmann
    Fixes: fa236a7ef240 ("spi: bcm-qspi: Add Broadcom MSPI driver")
    Signed-off-by: Mark Brown

    Arnd Bergmann
     
  • The header isn't actually needed here, but including it leads
    to a build warning when CONFIG_MTD is disabled:

    include/linux/mtd/cfi.h:76:2: #warning No CONFIG_MTD_CFI_Ix selected. No NOR chip support can work. [-Werror=cpp]

    Fixes: fa236a7ef240 (spi: bcm-qspi: Add Broadcom MSPI driver)
    Signed-off-by: Arnd Bergmann
    Signed-off-by: Mark Brown

    Arnd Bergmann
     

15 Sep, 2016

3 commits