30 Dec, 2020

1 commit

  • [ Upstream commit 88e1419b5ee30cc50e0c4d5265bdee1ba04af539 ]

    pm_runtime_get_sync will increment pm usage counter even it
    failed. Forgetting to pm_runtime_put_noidle will result in
    reference leak in two callers(stm32_qspi_exec_op and
    stm32_qspi_setup), so we should fix it.

    Fixes: 9d282c17b023a ("spi: stm32-qspi: Add pm_runtime support")
    Signed-off-by: Zhang Qilong
    Reviewed-by: Patrice Chotard
    Link: https://lore.kernel.org/r/20201106015357.141235-1-zhangqilong3@huawei.com
    Signed-off-by: Mark Brown
    Signed-off-by: Sasha Levin

    Zhang Qilong
     

17 Jun, 2020

1 commit

  • In case of -EPROBE_DEFER, stm32_qspi_release() was called
    in any case which unregistered driver from pm_runtime framework
    even if it has not been registered yet to it. This leads to:

    stm32-qspi 58003000.spi: can't setup spi0.0, status -13
    spi_master spi0: spi_device register error /soc/spi@58003000/mx66l51235l@0
    spi_master spi0: Failed to create SPI device for /soc/spi@58003000/mx66l51235l@0
    stm32-qspi 58003000.spi: can't setup spi0.1, status -13
    spi_master spi0: spi_device register error /soc/spi@58003000/mx66l51235l@1
    spi_master spi0: Failed to create SPI device for /soc/spi@58003000/mx66l51235l@1

    On v5.7 kernel,this issue was not "visible", qspi driver was probed
    successfully.

    Fixes: 9d282c17b023 ("spi: stm32-qspi: Add pm_runtime support")

    Signed-off-by: Patrice Chotard
    Link: https://lore.kernel.org/r/20200616113035.4514-1-patrice.chotard@st.com
    Signed-off-by: Mark Brown

    Patrice Chotard
     

30 Apr, 2020

1 commit

  • Issue detected by unbinding/binding the stm32 qspi driver as following:

    root@stm32mp2:~# echo 40430000.spi > /sys/bus/platform/drivers/stm32-qspi/404300
    00.spi/driver/unbind
    root@stm32mp2:~# echo 40430000.spi > /sys/bus/platform/drivers/stm32-qspi/bind
    [ 969.864021] stm32-qspi 40430000.spi: Unbalanced pm_runtime_enable!
    [ 970.225161] spi-nor spi0.0: mx66u51235f (65536 Kbytes)
    [ 970.935721] spi-nor spi0.1: mx66u51235f (65536 Kbytes)

    Fixes: 9d282c17b023 ("spi: stm32-qspi: Add pm_runtime support")

    Signed-off-by: Patrice Chotard
    Link: https://lore.kernel.org/r/20200429102625.25974-1-patrice.chotard@st.com
    Signed-off-by: Mark Brown

    Patrice Chotard
     

17 Apr, 2020

1 commit

  • By default, STM32_AUTOSUSPEND_DELAY is set to -1 which has for
    effect to prevent runtime suspends.
    Runtime suspends can be activated by setting autosuspend_delay_ms using
    sysfs entry :
    echo {delay_in_ms} > /sys/devices/platform/soc/58003000.spi/power/autosusp
    end_delay_ms)

    Signed-off-by: Christophe Kerello
    Signed-off-by: Patrice Chotard
    Signed-off-by: Benjamin Gaignard
    Link: https://lore.kernel.org/r/20200417121241.6473-1-patrice.chotard@st.com
    Signed-off-by: Mark Brown

    Patrice Chotard
     

11 Feb, 2020

2 commits


16 Dec, 2019

1 commit


05 Oct, 2019

1 commit

  • 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

    Patrice Chotard
     

02 Aug, 2019

1 commit

  • We don't need dev_err() messages when platform_get_irq() fails now that
    platform_get_irq() prints an error message itself when something goes
    wrong. Let's remove these prints with a simple semantic patch.

    //
    @@
    expression ret;
    struct platform_device *E;
    @@

    ret =
    (
    platform_get_irq(E, ...)
    |
    platform_get_irq_byname(E, ...)
    );

    if ( \( ret < 0 \| ret

    While we're here, remove braces on if statements that only have one
    statement (manually).

    Cc: Mark Brown
    Cc: linux-spi@vger.kernel.org
    Cc: Greg Kroah-Hartman
    Signed-off-by: Stephen Boyd
    Link: https://lore.kernel.org/r/20190730181557.90391-42-swboyd@chromium.org
    Signed-off-by: Mark Brown

    Stephen Boyd
     

05 Jul, 2019

1 commit


28 Jun, 2019

1 commit


25 Jun, 2019

1 commit

  • On STM32 F4/F7/H7 SoCs, FTHRES is a 5 bits field in QSPI_CR register,
    but for STM32MP1 SoCs, FTHRES is a 4 bits field long. CR_FTHRES_MASK
    definition is not correct.

    As for all these SoCs, FTHRES field is set to 3, FIELD_PREP() macro
    is used with a constant as second parameter which make its usage useless.

    CR_FTHRES_MASK and FIELD_PREP() can be removed.

    Signed-off-by: Patrice Chotard
    Signed-off-by: Mark Brown

    Patrice Chotard
     

02 May, 2019

1 commit


26 Mar, 2019

2 commits


21 Mar, 2019

1 commit


16 Mar, 2019

2 commits


19 Oct, 2018

1 commit

  • The qspi controller is a specialized communication interface
    targeting single, dual or quad SPI Flash memories (NOR/NAND).

    It can operate in any of the following modes:
    -indirect mode: all the operations are performed using the quadspi
    registers
    -read memory-mapped mode: the external Flash memory is mapped to the
    microcontroller address space and is seen by the system as if it was
    an internal memory

    tested on:
    -NOR: mx66l51235l
    -NAND: MT29F2G01ABAGD

    Signed-off-by: Ludovic Barre
    Signed-off-by: Mark Brown

    Ludovic Barre