27 May, 2020

1 commit


23 Mar, 2020

2 commits


08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

26 Feb, 2020

1 commit


24 Feb, 2020

2 commits

  • [ Upstream commit b0177aca7aea7e8917d4e463334b51facb293d02 ]

    Make use of a core helper to ensure the desired width is respected
    when calling spi-mem operators.

    Otherwise only the SPI controller will be matched with the flash chip,
    which might lead to wrong widths. Also consider the width specified by
    the user in the device tree.

    Fixes: 84d043185dbe ("spi: Add a driver for the Freescale/NXP QuadSPI controller")
    Signed-off-by: Michael Walle
    Link: https://lore.kernel.org/r/20200114154613.8195-1-michael@walle.cc
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Michael Walle
     
  • [ Upstream commit bc3a8b295e5bca9d1ec2622a6ba38289f9fd3d8a ]

    Why it does not work at the moment:
    - num_chipselect sets the number of cs-gpios that are in the DT.
    This comes from drivers/spi/spi.c
    - num_chipselect gets set with devm_spi_register_controller, that is
    called in drivers/spi/spi.c
    - devm_spi_register_controller got called after num_chipselect has
    been used.

    How this commit fixes the issue:
    - devm_spi_register_controller gets called before num_chipselect is
    being used.

    Fixes: c7a402599504 ("spi: lpspi: use the core way to implement cs-gpio function")
    Signed-off-by: Philippe Schenker
    Link: https://lore.kernel.org/r/20191204141312.1411251-1-philippe.schenker@toradex.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Philippe Schenker
     

01 Feb, 2020

2 commits

  • [ Upstream commit f0cf17ed76cffa365001d263ced1f130ec794917 ]

    Add Intel Comet Lake-H LPSS SPI PCI IDs.

    Signed-off-by: Jarkko Nikula
    Link: https://lore.kernel.org/r/20191029115802.6779-1-jarkko.nikula@linux.intel.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Jarkko Nikula
     
  • [ Upstream commit 19b61392c5a852b4e8a0bf35aecb969983c5932d ]

    dw_spi_irq() and dw_spi_transfer_one concurrent calls.

    I find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,
    dw->len==4, and dw->tx_end==1.

    When tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one
    may concurrent visit dw_spi, so I think dw_spi structure lack of protection.

    Otherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,
    store dw rx/tx instructions and other cores handle irq load dw rx/tx
    instructions may out of order.

    [ 1025.321302] Call trace:
    ...
    [ 1025.321319] __crash_kexec+0x98/0x148
    [ 1025.321323] panic+0x17c/0x314
    [ 1025.321329] die+0x29c/0x2e8
    [ 1025.321334] die_kernel_fault+0x68/0x78
    [ 1025.321337] __do_kernel_fault+0x90/0xb0
    [ 1025.321346] do_page_fault+0x88/0x500
    [ 1025.321347] do_translation_fault+0xa8/0xb8
    [ 1025.321349] do_mem_abort+0x68/0x118
    [ 1025.321351] el1_da+0x20/0x8c
    [ 1025.321362] dw_writer+0xc8/0xd0
    [ 1025.321364] interrupt_transfer+0x60/0x110
    [ 1025.321365] dw_spi_irq+0x48/0x70
    ...

    Signed-off-by: wuxu.wu
    Link: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    wuxu.wu
     

18 Jan, 2020

5 commits

  • commit 057b8945f78f76d0b04eeb5c27cd9225e5e7ad86 upstream.

    In fsl_lpspi_probe an SPI controller is allocated either via
    spi_alloc_slave or spi_alloc_master. In all but one error cases this
    controller is put by going to error handling code. This commit fixes the
    case when pm_runtime_get_sync fails and it should go to the error
    handling path.

    Fixes: 944c01a889d9 ("spi: lpspi: enable runtime pm for lpspi")
    Signed-off-by: Navid Emamdoost
    Link: https://lore.kernel.org/r/20190930034602.1467-1-navid.emamdoost@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Navid Emamdoost
     
  • commit 2de860b4a7a0bd5a4b5bd3bff0e6a615495df4ba upstream.

    As platform_get_irq_byname() now prints an error when the interrupt
    does not exist, scary warnings may be printed for optional interrupts:

    renesas_spi e6b10000.spi: IRQ rx not found
    renesas_spi e6b10000.spi: IRQ mux not found

    Fix this by calling platform_get_irq_byname_optional() instead.
    Remove the no longer needed printing of platform_get_irq errors, as the
    remaining calls to platform_get_irq() and platform_get_irq_byname() take
    care of that.

    Fixes: 7723f4c5ecdb8d83 ("driver core: platform: Add an error message to platform_get_irq*()")
    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Stephen Boyd
    Link: https://lore.kernel.org/r/20191016143101.28738-1-geert+renesas@glider.be
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     
  • commit fed8d8c7a6dc2a76d7764842853d81c770b0788e upstream.

    The driver does the wrong thing when cs_change is set on a non-last
    xfer in a message. When cs_change is set, the driver deactivates the
    CS and leaves it off until a later xfer again has cs_change set whereas
    it should be briefly toggling CS off and on again.

    This patch brings the behaviour of the driver back in line with the
    documentation and common sense. The delay of 10 us is the same as is
    used by the default spi_transfer_one_message() function in spi.c.
    [gregory: rebased on for-5.5 from spi tree]
    Fixes: 8090d6d1a415 ("spi: atmel: Refactor spi-atmel to use SPI framework queue")
    Signed-off-by: Mans Rullgard
    Acked-by: Nicolas Ferre
    Signed-off-by: Gregory CLEMENT
    Link: https://lore.kernel.org/r/20191018153504.4249-1-gregory.clement@bootlin.com
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Mans Rullgard
     
  • commit b2662a164f9dc48da8822e56600686d639056282 upstream.

    In DMA mode we have a maximum transfer size, past that the driver
    falls back to PIO (see the check at the top of pxa2xx_spi_transfer_one).
    Falling back to PIO for big transfers defeats the point of a dma engine,
    hence set the max transfer size to inform spi clients that they need
    to do something smarter.

    This was uncovered by the drm_mipi_dbi spi panel code, which does
    large spi transfers, but stopped splitting them after:

    commit e143364b4c1774f68e923a5a0bb0fca28ac25888
    Author: Noralf Trønnes
    Date: Fri Jul 19 17:59:10 2019 +0200

    drm/tinydrm: Remove tinydrm_spi_max_transfer_size()

    After this commit the code relied on the spi core to split transfers
    into max dma-able blocks, which also papered over the PIO fallback issue.

    Fix this by setting the overall max transfer size to the DMA limit,
    but only when the controller runs in DMA mode.

    Fixes: e143364b4c17 ("drm/tinydrm: Remove tinydrm_spi_max_transfer_size()")
    Cc: Sam Ravnborg
    Cc: Noralf Trønnes
    Cc: Andy Shevchenko
    Reported-and-tested-by: Andy Shevchenko
    Cc: Daniel Mack
    Cc: Haojian Zhuang
    Cc: Robert Jarzmik
    Cc: Mark Brown
    Cc: linux-arm-kernel@lists.infradead.org
    Cc: linux-spi@vger.kernel.org
    Signed-off-by: Daniel Vetter
    Link: https://lore.kernel.org/r/20191017064426.30814-1-daniel.vetter@ffwll.ch
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Daniel Vetter
     
  • commit 5e9c5236b7b86779b53b762f7e66240c3f18314b upstream.

    The original code used an incorrect SPI register to initialize the SPI
    controller in sprd_spi_init_hw(), thus fix it.

    Fixes: e7d973a31c24 ("spi: sprd: Add SPI driver for Spreadtrum SC9860")
    Signed-off-by: Huanpeng Xin
    Signed-off-by: Baolin Wang
    Link: https://lore.kernel.org/r/b4f7f89ec0fdc595335687bfbd9f962213bc4a1d.1575443510.git.baolin.wang7@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Huanpeng Xin
     

12 Jan, 2020

6 commits

  • [ Upstream commit 007773e16a6f3f49d1439554078c3ba8af131998 ]

    Make use of a core helper to ensure the desired width is respected
    when calling spi-mem operators.

    Otherwise only the SPI controller will be matched with the flash chip,
    which might lead to wrong widths. Also consider the width specified by
    the user in the device tree.

    Fixes: a5356aef6a90 ("spi: spi-mem: Add driver for NXP FlexSPI controller")
    Signed-off-by: Michael Walle
    Link: https://lore.kernel.org/r/20191211195730.26794-1-michael@walle.cc
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Michael Walle
     
  • [ Upstream commit c52c91bb9aa6bd8c38dbf9776158e33038aedd43 ]

    When switching ChipSelect from default CS0 to any other CS, driver fails
    to update the bits in system control module register that control which
    CS is mapped for MMIO access. This causes reads to fail when driver
    tries to access QSPI flash on CS1/2/3.

    Fix this by updating appropriate bits whenever active CS changes.

    Reported-by: Andreas Dannenberg
    Signed-off-by: Vignesh Raghavendra
    Link: https://lore.kernel.org/r/20191211155216.30212-1-vigneshr@ti.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Vignesh Raghavendra
     
  • [ Upstream commit a841e2853e1afecc2ee692b8cc5bff606bc84e4c ]

    The driver forgets to call pci_release_regions() in probe failure
    and remove.
    Add the missed calls to fix it.

    Signed-off-by: Chuhong Yuan
    Link: https://lore.kernel.org/r/20191206075500.18525-1-hslester96@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Chuhong Yuan
     
  • [ Upstream commit 7251953d784baf7e5416afabe030a0e81de1a938 ]

    The Freescale MPC8xxx had a special quirk for handling a
    single hardwired chipselect, the case when we're using neither
    GPIO nor native chip select: when inspecting the device tree
    and finding zero "cs-gpios" on the device node the code would
    assume we have a single hardwired chipselect that leaves the
    device always selected.

    This quirk is not handled by the new core code, so we need
    to check the "cs-gpios" explicitly in the driver and set
    pdata->max_chipselect = 1 which will later fall through to
    the SPI master ->num_chipselect.

    Make sure not to assign the chip select handler in this
    case: there is no handling needed since the chip is always
    selected, and this is what the old code did as well.

    Cc: Christophe Leroy
    Reported-by: Christophe Leroy
    Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors")
    Signed-off-by: Linus Walleij
    Tested-by: Christophe Leroy (No tested the
    Link: https://lore.kernel.org/r/20191128083718.39177-3-linus.walleij@linaro.org
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Linus Walleij
     
  • [ Upstream commit f106904968e2a075e64653b9b79dda9f0f070ab5 ]

    This makes the driver actually support looking up GPIO
    descriptor. A coding mistake in the initial descriptor
    support patch was that it was failing to turn on the very
    feature it was implementing. Mea culpa.

    Cc: Christophe Leroy
    Reported-by: Christophe Leroy
    Fixes: 0f0581b24bd0 ("spi: fsl: Convert to use CS GPIO descriptors")
    Signed-off-by: Linus Walleij
    Tested-by: Christophe Leroy
    Link: https://lore.kernel.org/r/20191128083718.39177-1-linus.walleij@linaro.org
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Linus Walleij
     
  • [ Upstream commit 9c7315c9fca5de203538163cf42699bb10328902 ]

    LPSS SPI on Intel Jasper Lake is compatible with Intel Ice Lake which
    follows Intel Cannon Lake. Add PCI IDs of Jasper Lake.

    Signed-off-by: Jarkko Nikula
    Link: https://lore.kernel.org/r/20191125125159.15404-1-jarkko.nikula@linux.intel.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Jarkko Nikula
     

09 Jan, 2020

2 commits

  • commit 9cd34efbd3012171c102910ce17ee632a3cccb44 upstream.

    Rx threshold means the value to inform the receiver when the number of words
    in Rx FIFO is equal to or more than the value. Similarly, Tx threshold means
    the value to inform the sender when the number of words in Tx FIFO is equal
    to or less than the value. The controller triggers the driver to start
    the transfer.

    In case of Rx, the driver wants to detect that the specified number of words
    N are in Rx FIFO, so the value of Rx threshold should be N. In case of Tx,
    the driver wants to detect that the same number of spaces as Rx are in
    Tx FIFO, so the value of Tx threshold should be (FIFO size - N).

    For example, in order for the driver to receive at least 3 words from
    Rx FIFO, set 3 to Rx threshold.
    +-+-+-+-+-+-+-+-+
    | | | | | |*|*|*|
    +-+-+-+-+-+-+-+-+

    In order for the driver to send at least 3 words to Tx FIFO, because
    it needs at least 3 spaces, set 8(FIFO size) - 3 = 5 to Tx threshold.
    +-+-+-+-+-+-+-+-+
    |*|*|*|*|*| | | |
    +-+-+-+-+-+-+-+-+

    This adds new function uniphier_spi_set_fifo_threshold() to set
    threshold value to the register.

    And more, FIFO counts by 'words', so this renames 'fill_bytes' with
    'fill_words', and fixes the calculation using bytes_per_words.

    Fixes: 37ffab817098 ("spi: uniphier: introduce polling mode")
    Cc: Keiji Hayashibara
    Signed-off-by: Kunihiko Hayashi
    Link: https://lore.kernel.org/r/1577149107-30670-2-git-send-email-hayashi.kunihiko@socionext.com
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Kunihiko Hayashi
     
  • commit ca59d5a51690d5b9340343dc36792a252e9414ae upstream.

    When used in Extended SPI mode on LS1021A, the DSPI controller wants to
    have the least significant 16-bit word written first to the TX FIFO.

    In fact, the LS1021A reference manual says:

    33.5.2.4.2 Draining the TX FIFO

    When Extended SPI Mode (DSPIx_MCR[XSPI]) is enabled, if the frame size
    of SPI Data to be transmitted is more than 16 bits, then it causes two
    Data entries to be popped from TX FIFO simultaneously which are
    transferred to the shift register. The first of the two popped entries
    forms the 16 least significant bits of the SPI frame to be transmitted.

    So given the following TX buffer:

    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
    | 0x0 | 0x1 | 0x2 | 0x3 | 0x4 | 0x5 | 0x6 | 0x7 | 0x8 | 0x9 | 0xa | 0xb |
    +-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+-----+
    | 32-bit word 1 | 32-bit word 2 | 32-bit word 3 |
    +-----------------------+-----------------------+-----------------------+

    The correct way that a little-endian system should transmit it on the
    wire when bits_per_word is 32 is:

    0x03020100
    0x07060504
    0x0b0a0908

    But it is actually transmitted as following, as seen with a scope:

    0x01000302
    0x05040706
    0x09080b0a

    It appears that this patch has been submitted at least once before:
    https://lkml.org/lkml/2018/9/21/286
    but in that case Chuanhua Han did not manage to explain the problem
    clearly enough and the patch did not get merged, leaving XSPI mode
    broken.

    Fixes: 8fcd151d2619 ("spi: spi-fsl-dspi: XSPI FIFO handling (in TCFQ mode)")
    Cc: Esben Haabendal
    Cc: Chuanhua Han
    Signed-off-by: Vladimir Oltean
    Link: https://lore.kernel.org/r/20191228135536.14284-1-olteanv@gmail.com
    Signed-off-by: Mark Brown
    Cc: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Vladimir Oltean
     

31 Dec, 2019

13 commits

  • commit 63aa6a692595d47a0785297b481072086b9272d2 upstream.

    Unlike irq_of_parse_and_map() which has a dummy definition on SPARC,
    of_irq_to_resource() hasn't.

    But as platform_get_irq() can be used instead and is generic, use it.

    Reported-by: kbuild test robot
    Suggested-by: Mark Brown
    Fixes: 3194d2533eff ("spi: fsl: don't map irq during probe")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christophe Leroy
    Link: https://lore.kernel.org/r/091a277fd0b3356dca1e29858c1c96983fc9cb25.1576172743.git.christophe.leroy@c-s.fr
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Christophe Leroy
     
  • commit 3194d2533efffae8b815d84729ecc58b6a9000ab upstream.

    With lastest kernel, the following warning is observed at startup:

    [ 1.500609] ------------[ cut here ]------------
    [ 1.505225] remove_proc_entry: removing non-empty directory 'irq/22', leaking at least 'fsl_spi'
    [ 1.514234] WARNING: CPU: 0 PID: 1 at fs/proc/generic.c:682 remove_proc_entry+0x198/0x1c0
    [ 1.522403] CPU: 0 PID: 1 Comm: swapper Not tainted 5.4.0-s3k-dev-02248-g93532430a4ff #2564
    [ 1.530724] NIP: c0197694 LR: c0197694 CTR: c0050d80
    [ 1.535762] REGS: df4a5af0 TRAP: 0700 Not tainted (5.4.0-02248-g93532430a4ff)
    [ 1.543818] MSR: 00029032 CR: 22028222 XER: 00000000
    [ 1.550524]
    [ 1.550524] GPR00: c0197694 df4a5ba8 df4a0000 00000054 00000000 00000000 00004a38 00000010
    [ 1.550524] GPR08: c07c5a30 00000800 00000000 00001032 22000208 00000000 c0004b14 00000000
    [ 1.550524] GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 c0830000 c07fc078
    [ 1.550524] GPR24: c08e8ca0 df665d10 df60ea98 c07c9db8 00000001 df5d5ae3 df5d5a80 df43f8e3
    [ 1.585327] NIP [c0197694] remove_proc_entry+0x198/0x1c0
    [ 1.590628] LR [c0197694] remove_proc_entry+0x198/0x1c0
    [ 1.595829] Call Trace:
    [ 1.598280] [df4a5ba8] [c0197694] remove_proc_entry+0x198/0x1c0 (unreliable)
    [ 1.605321] [df4a5bd8] [c0067acc] unregister_irq_proc+0x5c/0x70
    [ 1.611238] [df4a5bf8] [c005fbc4] free_desc+0x3c/0x80
    [ 1.616286] [df4a5c18] [c005fe2c] irq_free_descs+0x70/0xa8
    [ 1.621778] [df4a5c38] [c033d3fc] of_fsl_spi_probe+0xdc/0x3cc
    [ 1.627525] [df4a5c88] [c02f0f64] platform_drv_probe+0x44/0xa4
    [ 1.633350] [df4a5c98] [c02eee44] really_probe+0x1ac/0x418
    [ 1.638829] [df4a5cc8] [c02ed3e8] bus_for_each_drv+0x64/0xb0
    [ 1.644481] [df4a5cf8] [c02ef950] __device_attach+0xd4/0x128
    [ 1.650132] [df4a5d28] [c02ed61c] bus_probe_device+0xa0/0xbc
    [ 1.655783] [df4a5d48] [c02ebbe8] device_add+0x544/0x74c
    [ 1.661096] [df4a5d88] [c0382b78] of_platform_device_create_pdata+0xa4/0x100
    [ 1.668131] [df4a5da8] [c0382cf4] of_platform_bus_create+0x120/0x20c
    [ 1.674474] [df4a5df8] [c0382d50] of_platform_bus_create+0x17c/0x20c
    [ 1.680818] [df4a5e48] [c0382e88] of_platform_bus_probe+0x9c/0xf0
    [ 1.686907] [df4a5e68] [c0751404] __machine_initcall_cmpcpro_cmpcpro_declare_of_platform_devices+0x74/0x1a4
    [ 1.696629] [df4a5e98] [c072a4cc] do_one_initcall+0x8c/0x1d4
    [ 1.702282] [df4a5ef8] [c072a768] kernel_init_freeable+0x154/0x204
    [ 1.708455] [df4a5f28] [c0004b2c] kernel_init+0x18/0x110
    [ 1.713769] [df4a5f38] [c00122ac] ret_from_kernel_thread+0x14/0x1c
    [ 1.719926] Instruction dump:
    [ 1.722889] 2c030000 4182004c 3863ffb0 3c80c05f 80e3005c 388436a0 3c60c06d 7fa6eb78
    [ 1.730630] 7fe5fb78 38840280 38634178 4be8c611 4bffff6c 3c60c071 7fe4fb78
    [ 1.738556] ---[ end trace 05d0720bf2e352e2 ]---

    The problem comes from the error path which calls
    irq_dispose_mapping() while the IRQ has been requested with
    devm_request_irq().

    IRQ doesn't need to be mapped with irq_of_parse_and_map(). The only
    need is to get the IRQ virtual number. For that, use
    of_irq_to_resource() instead of the
    irq_of_parse_and_map()/irq_dispose_mapping() pair.

    Fixes: 500a32abaf81 ("spi: fsl: Call irq_dispose_mapping in err path")
    Cc: stable@vger.kernel.org
    Signed-off-by: Christophe Leroy
    Link: https://lore.kernel.org/r/518cfb83347d5372748e7fe72f94e2e9443d0d4a.1575905123.git.christophe.leroy@c-s.fr
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Christophe Leroy
     
  • [ Upstream commit 61acd19f9c56fa0809285346bd0bd4a926ab0da0 ]

    To fix a regression on the Cadence SPI driver, this patch reverts
    commit 6046f5407ff0 ("spi: cadence: Fix default polarity of native
    chipselect").

    This patch was not the correct fix for the issue. The SPI framework
    calls the set_cs line with the logic level it desires on the chip select
    line, as such the old is_high handling was correct. However, this was
    broken by the fact that before commit 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH
    setting when using native and GPIO CS") all controllers that offered
    the use of a GPIO chip select had SPI_CS_HIGH applied, even for hardware
    chip selects. This caused the value passed into the driver to be inverted.
    Which unfortunately makes it look like a logical enable the chip select
    value.

    Since the core was corrected to not unconditionally apply SPI_CS_HIGH,
    the Cadence driver, whilst using the hardware chip select, will deselect
    the chip select every time we attempt to communicate with the device,
    which results in failed communications.

    Fixes: 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS")
    Signed-off-by: Charles Keepax
    Acked-by: Linus Walleij
    Link: https://lore.kernel.org/r/20191126164140.6240-1-ckeepax@opensource.cirrus.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Charles Keepax
     
  • [ Upstream commit ada9e3fcc175db4538f5b5e05abf5dedf626e550 ]

    This patch reverts commit 6e0a32d6f376 ("spi: dw: Fix default polarity
    of native chipselect").

    The SPI framework always called the set_cs callback with the logic
    level it desired on the chip select line, which is what the drivers
    original handling supported. commit f3186dd87669 ("spi: Optionally
    use GPIO descriptors for CS GPIOs") changed these symantics, but only
    in the case of drivers that also support GPIO chip selects, to true
    meaning apply slave select rather than logic high. This left things in
    an odd state where a driver that only supports hardware chip selects,
    the core would handle polarity but if the driver supported GPIOs as
    well the driver should handle polarity. At this point the reverted
    change was applied to change the logic in the driver to match new
    system.

    This was then broken by commit 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH
    setting when using native and GPIO CS") which reverted the core back
    to consistently calling set_cs with a logic level.

    This fix reverts the driver code back to its original state to match
    the current core code. This is probably a better fix as a) the set_cs
    callback is always called with consistent symantics and b) the
    inversion for SPI_CS_HIGH can be handled in the core and doesn't need
    to be coded in each driver supporting it.

    Fixes: 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS")
    Signed-off-by: Charles Keepax
    Acked-by: Linus Walleij
    Link: https://lore.kernel.org/r/20191127153936.29719-1-ckeepax@opensource.cirrus.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Charles Keepax
     
  • [ Upstream commit cd050abeba2a95fe5374eec28ad2244617bcbab6 ]

    The driver forgets to call pm_runtime_disable in probe failure
    and remove.
    Add the missed calls to fix it.

    Signed-off-by: Chuhong Yuan
    Link: https://lore.kernel.org/r/20191118024848.21645-1-hslester96@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Chuhong Yuan
     
  • [ Upstream commit 04358e40ba96d687c0811c21d9dede73f5244a98 ]

    The driver misses calling clk_unprepare in probe failure and remove.
    Add the calls to fix it.

    Signed-off-by: Chuhong Yuan
    Link: https://lore.kernel.org/r/20191115083122.12278-1-hslester96@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Chuhong Yuan
     
  • [ Upstream commit 5eb263ef08b5014cfc2539a838f39d2fd3531423 ]

    pxa2xx_spi_init_pdata misses checks for devm_clk_get and
    platform_get_irq.
    Add checks for them to fix the bugs.

    Since ssp->clk and ssp->irq are used in probe, they are mandatory here.
    So we cannot use _optional() for devm_clk_get and platform_get_irq.

    Signed-off-by: Chuhong Yuan
    Link: https://lore.kernel.org/r/20191109080943.30428-1-hslester96@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Chuhong Yuan
     
  • [ Upstream commit e9a8ba9769a0e354341bc6cc01b98aadcea1dfe9 ]

    The channels spfi->tx_ch and spfi->rx_ch are not set to NULL after they
    are released. As a result, they will be released again, either on the
    error handling branch in the same function or in the corresponding
    remove function, i.e. img_spfi_remove(). This patch fixes the bug by
    setting the two members to NULL.

    Signed-off-by: Pan Bian
    Link: https://lore.kernel.org/r/1573007769-20131-1-git-send-email-bianpan2016@163.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Pan Bian
     
  • [ Upstream commit 1403cfa69d310781f9548951c97725c67ffcf613 ]

    The SPI_LOOP is set in spi->mode but not propagated to the register.
    A previous patch removed the bit during a cleanup.

    Fixes: e1bc204894ea ("spi: dw: fix potential variable assignment error")
    Signed-off-by: Thor Thayer
    Link: https://lore.kernel.org/r/1572985330-5525-1-git-send-email-thor.thayer@linux.intel.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Thor Thayer
     
  • [ Upstream commit a725272bda77e61c1b4de85c7b0c875b2ea639b6 ]

    The driver forgets to disable and unprepare clk when probe fails and
    remove.
    Add the calls to fix the problem.

    Signed-off-by: Chuhong Yuan
    Reviewed-by: Palmer Dabbelt
    Link: https://lore.kernel.org/r/20191101121745.13413-1-hslester96@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Chuhong Yuan
     
  • [ Upstream commit 91ea1d70607e374b014b4b9bea771ce661f9f64b ]

    When rebooting the system, we should lock the watchdog after
    configuration to make sure the watchdog can reboot the system
    successfully.

    Signed-off-by: Lingling Xu
    Signed-off-by: Baolin Wang
    Link: https://lore.kernel.org/r/7b04711127434555e3a1a86bc6be99860cd86668.1572257085.git.baolin.wang@linaro.org
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Lingling Xu
     
  • [ Upstream commit d3b0ffa1d75d5305ebe34735598993afbb8a869d ]

    In spi_gpio_probe an SPI master is allocated via spi_alloc_master, but
    this controller should be released if devm_add_action_or_reset fails,
    otherwise memory leaks. In order to avoid leak spi_contriller_put must
    be called in case of failure for devm_add_action_or_reset.

    Fixes: 8b797490b4db ("spi: gpio: Make sure spi_master_put() is called in every error path")
    Signed-off-by: Navid Emamdoost
    Link: https://lore.kernel.org/r/20190930205241.5483-1-navid.emamdoost@gmail.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Navid Emamdoost
     
  • [ Upstream commit 9f918a728cf86b2757b6a7025e1f46824bfe3155 ]

    This change is necessary for spidev devices (e.g. /dev/spidev3.0) working
    in the slave mode (like NXP's dspi driver for Vybrid SoC).

    When SPI HW works in this mode - the master is responsible for providing
    CS and CLK signals. However, when some fault happens - like for example
    distortion on SPI lines - the SPI Linux driver needs a chance to recover
    from this abnormal situation and prepare itself for next (correct)
    transmission.

    This change doesn't pose any threat on drivers working in master mode as
    spi_slave_abort() function checks if SPI slave mode is supported.

    Signed-off-by: Lukasz Majewski
    Link: https://lore.kernel.org/r/20190924110547.14770-2-lukma@denx.de
    Signed-off-by: Mark Brown
    Reported-by: kbuild test robot
    Link: https://lore.kernel.org/r/20190925091143.15468-2-lukma@denx.de
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Lukasz Majewski
     

16 Dec, 2019

1 commit

  • This is the 5.4.3 stable release

    Conflicts:
    drivers/cpufreq/imx-cpufreq-dt.c
    drivers/spi/spi-fsl-qspi.c

    The conflict is very minor, fixed it when do the merge. The imx-cpufreq-dt.c
    is just one line code-style change, using upstream one, no any function change.

    The spi-fsl-qspi.c has minor conflicts when merge upstream fixes: c69b17da53b2
    spi: spi-fsl-qspi: Clear TDH bits in FLSHCR register

    After merge, basic boot sanity test and basic qspi test been done on i.mx

    Signed-off-by: Jason Liu

    Jason Liu
     

13 Dec, 2019

4 commits

  • commit 15f794bd977a0135328fbdd8a83cc64c1d267b39 upstream.

    Even if the flag use_gpio_descriptors is set, it is possible that
    cs_gpiods was not allocated, which leads to a kernel crash.

    Reported-by: "kernelci.org bot"
    Fixes: 3e5ec1db8bfe ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS")
    Signed-off-by: Gregory CLEMENT
    Link: https://lore.kernel.org/r/20191024141309.22434-1-gregory.clement@bootlin.com
    Signed-off-by: Mark Brown
    Cc:
    Signed-off-by: Greg Kroah-Hartman

    Gregory CLEMENT
     
  • commit 3e5ec1db8bfee845d9f8560d1c64aeaccd586398 upstream.

    When improving the CS GPIO support at core level, the SPI_CS_HIGH
    has been enabled for all the CS lines used for a given SPI controller.

    However, the SPI framework allows to have on the same controller native
    CS and GPIO CS. The native CS may not support the SPI_CS_HIGH, so they
    should not be setup automatically.

    With this patch the setting is done only for the CS that will use a
    GPIO as CS

    Fixes: f3186dd87669 ("spi: Optionally use GPIO descriptors for CS GPIOs")
    Cc:
    Signed-off-by: Gregory CLEMENT
    Link: https://lore.kernel.org/r/20191018152929.3287-1-gregory.clement@bootlin.com
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Gregory CLEMENT
     
  • commit 7cbb16b2122c09f2ae393a1542fed628505b9da6 upstream.

    Until a few years ago, this driver was only used with CS GPIO. The
    only exception is CS0 on AT91RM9200 which has to use internal CS. A
    limitation of the internal CS is that they don't support CS High.

    So by using the CS GPIO the CS high configuration was available except
    for the particular case CS0 on RM9200.

    When the support for the internal chip-select was added, the check of
    the CS high support was not updated. Due to this the driver accepts
    this configuration for all the SPI controller v2 (used by all SoCs
    excepting the AT91RM9200) whereas the hardware doesn't support it for
    infernal CS.

    This patch fixes the test to match the hardware capabilities.

    Fixes: 4820303480a1 ("spi: atmel: add support for the internal chip-select of the spi controller")
    Cc:
    Signed-off-by: Gregory CLEMENT
    Link: https://lore.kernel.org/r/20191017141846.7523-3-gregory.clement@bootlin.com
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Gregory CLEMENT
     
  • commit 3c0af1dd2fe78adc02fe21f6cfe7d6cb8602573e upstream.

    spi_master_put() must only be called in .probe() in case of error.

    As devm_spi_register_master() is used during probe, spi_master_put()
    mustn't be called in .remove() callback.

    It fixes the following kernel WARNING/Oops when executing
    echo "58003000.spi" > /sys/bus/platform/drivers/stm32-qspi/unbind :

    ------------[ cut here ]------------
    WARNING: CPU: 1 PID: 496 at fs/kernfs/dir.c:1504 kernfs_remove_by_name_ns+0x9c/0xa4
    kernfs: can not remove 'uevent', no directory
    Modules linked in:
    CPU: 1 PID: 496 Comm: sh Not tainted 5.3.0-rc1-00219-ga0e07bb51a37 #62
    Hardware name: STM32 (Device Tree Support)
    [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [] (show_stack) from [] (dump_stack+0xb4/0xc8)
    [] (dump_stack) from [] (__warn.part.3+0xbc/0xd8)
    [] (__warn.part.3) from [] (warn_slowpath_fmt+0x68/0x8c)
    [] (warn_slowpath_fmt) from [] (kernfs_remove_by_name_ns+0x9c/0xa4)
    [] (kernfs_remove_by_name_ns) from [] (device_del+0x128/0x358)
    [] (device_del) from [] (device_unregister+0x24/0x64)
    [] (device_unregister) from [] (spi_unregister_controller+0x88/0xe8)
    [] (spi_unregister_controller) from [] (release_nodes+0x1bc/0x200)
    [] (release_nodes) from [] (device_release_driver_internal+0xec/0x1ac)
    [] (device_release_driver_internal) from [] (unbind_store+0x60/0xd4)
    [] (unbind_store) from [] (kernfs_fop_write+0xe8/0x1c4)
    [] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x1c0)
    [] (__vfs_write) from [] (vfs_write+0xa4/0x184)
    [] (vfs_write) from [] (ksys_write+0x58/0xd0)
    [] (ksys_write) from [] (ret_fast_syscall+0x0/0x54)
    Exception stack(0xdd289fa8 to 0xdd289ff0)
    9fa0: 0000006c 000e20e8 00000001 000e20e8 0000000d 00000000
    9fc0: 0000006c 000e20e8 b6f87da0 00000004 0000000d 0000000d 00000000 00000000
    9fe0: 00000004 bee639b0 b6f2286b b6eaf6c6
    ---[ end trace 1b15df8a02d76aef ]---
    ------------[ cut here ]------------
    WARNING: CPU: 1 PID: 496 at fs/kernfs/dir.c:1504 kernfs_remove_by_name_ns+0x9c/0xa4
    kernfs: can not remove 'online', no directory
    Modules linked in:
    CPU: 1 PID: 496 Comm: sh Tainted: G W 5.3.0-rc1-00219-ga0e07bb51a37 #62
    Hardware name: STM32 (Device Tree Support)
    [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [] (show_stack) from [] (dump_stack+0xb4/0xc8)
    [] (dump_stack) from [] (__warn.part.3+0xbc/0xd8)
    [] (__warn.part.3) from [] (warn_slowpath_fmt+0x68/0x8c)
    [] (warn_slowpath_fmt) from [] (kernfs_remove_by_name_ns+0x9c/0xa4)
    [] (kernfs_remove_by_name_ns) from [] (device_remove_attrs+0x20/0x5c)
    [] (device_remove_attrs) from [] (device_del+0x134/0x358)
    [] (device_del) from [] (device_unregister+0x24/0x64)
    [] (device_unregister) from [] (spi_unregister_controller+0x88/0xe8)
    [] (spi_unregister_controller) from [] (release_nodes+0x1bc/0x200)
    [] (release_nodes) from [] (device_release_driver_internal+0xec/0x1ac)
    [] (device_release_driver_internal) from [] (unbind_store+0x60/0xd4)
    [] (unbind_store) from [] (kernfs_fop_write+0xe8/0x1c4)
    [] (kernfs_fop_write) from [] (__vfs_write+0x2c/0x1c0)
    [] (__vfs_write) from [] (vfs_write+0xa4/0x184)
    [] (vfs_write) from [] (ksys_write+0x58/0xd0)
    [] (ksys_write) from [] (ret_fast_syscall+0x0/0x54)
    Exception stack(0xdd289fa8 to 0xdd289ff0)
    9fa0: 0000006c 000e20e8 00000001 000e20e8 0000000d 00000000
    9fc0: 0000006c 000e20e8 b6f87da0 00000004 0000000d 0000000d 00000000 00000000
    9fe0: 00000004 bee639b0 b6f2286b b6eaf6c6
    ---[ end trace 1b15df8a02d76af0 ]---
    8] lr : [] psr: 40010013
    sp : dd289dac ip : 00000000 fp : 00000000
    r10: 00000000 r9 : def6ec58 r8 : dd289e54
    r7 : 00000000 r6 : c0abb234 r5 : 00000000 r4 : c0d26a30
    r3 : ddab5080 r2 : 00000000 r1 : c0abb234 r0 : 00000000
    Flags: nZcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
    Control: 10c5387d Table: dd11c06a DAC: 00000051
    Process sh (pid: 496, stack limit = 0xe13a592d)
    Stack: (0xdd289dac to 0xdd28a000)
    9da0: c0d26a30 00000000 c0abb234 00000000 c02e4ac8
    9dc0: 00000000 c0976b44 def6ec00 dea53810 dd289e54 c02e864c c0a61a48 c0a4a5ec
    9de0: c0d630a8 def6ec00 c0d04c48 c02e86e0 def6ec00 de909338 c0d04c48 c05833b0
    9e00: 00000000 c0638144 dd289e54 def59900 00000000 475b3ee5 def6ec00 00000000
    9e20: def6ec00 def59b80 dd289e54 def59900 00000000 c05835f8 def6ec00 c0638dac
    9e40: 0000000a dea53810 c0d04c48 c058c580 dea53810 def59500 def59b80 475b3ee5
    9e60: ddc63e00 dea53810 dea3fe10 c0d63a0c dea53810 ddc63e00 dd289f78 dd240d10
    9e80: 00000000 c0588a44 c0d59a20 0000000d c0d63a0c c0586840 0000000d dd240d00
    9ea0: 00000000 00000000 ddc63e00 c02e64e8 00000000 00000000 c0d04c48 dd9bbcc0
    9ec0: c02e6400 dd289f78 00000000 000e20e8 0000000d c0266b44 00000055 00000cc0
    9ee0: 000000e3 000e3000 dd11c000 dd11c000 00000000 00000000 00000000 00000000
    9f00: ffeee38c dff99688 00000000 475b3ee5 00000001 dd289fb0 ddab5080 ddaa5800
    9f20: 00000817 000e30ec dd9e7720 475b3ee5 ddaa583c 0000000d dd9bbcc0 000e20e8
    9f40: dd289f78 00000000 000e20e8 0000000d 00000000 c02694c0 00000000 00000000
    9f60: c0d04c48 dd9bbcc0 00000000 00000000 dd9bbcc0 c0269710 00000000 00000000
    9f80: 000a91f4 475b3ee5 0000006c 000e20e8 b6f87da0 00000004 c0101204 dd288000
    9fa0: 00000004 c0101000 0000006c 000e20e8 00000001 000e20e8 0000000d 00000000
    9fc0: 0000006c 000e20e8 b6f87da0 00000004 0000000d 0000000d 00000000 00000000
    9fe0: 00000004 bee639b0 b6f2286b b6eaf6c6 600e0030 00000001 00000000 00000000
    [] (kernfs_find_ns) from [] (0xdef6ec00)
    Code: ebf8eeab c0dc50b8 e92d40f0 e292c000 (e1d035b0)
    ---[ end trace 1b15df8a02d76af1 ]---

    Fixes: a88eceb17ac7 ("spi: stm32-qspi: add spi_master_put in release function")
    Cc:
    Signed-off-by: Patrice Chotard
    Link: https://lore.kernel.org/r/20191004123606.17241-1-patrice.chotard@st.com
    Signed-off-by: Mark Brown
    Signed-off-by: Greg Kroah-Hartman

    Patrice Chotard