28 May, 2021

1 commit

  • Adds the sun6i_hwspinlock driver for the hardware spinlock unit found in
    most of the sun6i compatible SoCs.

    This unit provides at least 32 spinlocks in hardware. The implementation
    supports 32, 64, 128 or 256 32bit registers. A lock can be taken by
    reading a register and released by writing a 0 to it. This driver
    supports all 4 spinlock setups, but for now only the first setup (32
    locks) seem to exist in available devices. This spinlock unit is shared
    between all ARM cores and the embedded companion core. All of them can
    take/release a lock with a single cycle operation. It can be used to
    sync access to devices shared by the ARM cores and the companion core.

    There are two ways to check if a lock is taken. The first way is to read
    a lock. If a 0 is returned, the lock was free and is taken now. If an 1
    is returned, the caller has to try again. Which means the lock is taken.
    The second way is to read a 32bit wide status register where every bit
    represents one of the 32 first locks. According to the datasheets this
    status register supports only the 32 first locks. This is the reason the
    first way (lock read/write) approach is used to be able to cover all 256
    locks in future devices. The driver also reports the amount of supported
    locks via debugfs.

    Reviewed-by: Samuel Holland
    Acked-by: Maxime Ripard
    Signed-off-by: Wilken Gottwalt
    Link: https://lore.kernel.org/r/bfd2b97307c2321b15c09683f4bd5e1fcc792f13.1615713499.git.wilken.gottwalt@posteo.net
    Signed-off-by: Bjorn Andersson

    Wilken Gottwalt
     

18 Mar, 2021

1 commit

  • The CSR SiRF prima2/atlas platforms are getting removed, so this driver
    is no longer needed.

    Cc: Barry Song
    Link: https://lore.kernel.org/linux-arm-kernel/20210120124812.2800027-1-arnd@kernel.org/T/
    Signed-off-by: Arnd Bergmann
    Link: https://lore.kernel.org/r/20210120132537.2285157-1-arnd@kernel.org
    Signed-off-by: Bjorn Andersson

    Arnd Bergmann
     

10 Feb, 2021

1 commit

  • The AM64x SoC contains a HwSpinlock IP instance in the MAIN domain,
    and is a minor variant of the IP on the current TI K3 SoCs such as
    AM64x, J721E or J7200 SoCs. The IP is not built with the K3 safety
    feature in hardware, and has slightly different integration into
    the overall SoC.

    Add the support for this IP through a new compatible.

    Signed-off-by: Suman Anna
    Link: https://lore.kernel.org/r/20210209172240.2305-3-s-anna@ti.com
    Signed-off-by: Bjorn Andersson

    Suman Anna
     

11 Dec, 2020

1 commit

  • Remove the the redundant 'of_match_ptr' macro to fix below warning
    when the CONFIG_OF is not selected.

    All warnings:
    drivers/hwspinlock/sirf_hwspinlock.c:87:34: warning: unused variable
    'sirf_hwpinlock_ids' [-Wunused-const-variable]

    Reported-by: kernel test robot
    Signed-off-by: Baolin Wang
    Link: https://lore.kernel.org/r/250d35cb489c3c4c066f7ce256d27f36712a1979.1591618255.git.baolin.wang7@gmail.com
    Signed-off-by: Bjorn Andersson

    Baolin Wang
     

18 Nov, 2020

1 commit

  • The macro function of_match_ptr() is NULL if CONFIG_OF is not set, in this
    case Clang compiler would complain the of_device_id variable is unused.

    Reviewed-by: Baolin Wang
    Reported-by: kernel test robot
    Fixes: d8c8bbbb1aba ("hwspinlock: sprd: Add hardware spinlock driver")
    Signed-off-by: Chunyan Zhang
    Link: https://lore.kernel.org/r/20201112070410.14810-1-zhang.lyra@gmail.com
    Signed-off-by: Bjorn Andersson

    Chunyan Zhang
     

03 Nov, 2020

1 commit


26 Oct, 2020

1 commit


14 Jul, 2020

1 commit

  • In modern Qualcomm platforms the mutex region of the TCSR is forked off
    into its own block, all with a offset of 0 and stride of 4096, and in
    some of these platforms no other registers in this region is accessed
    from Linux.

    So add support for directly memory mapping this register space, to avoid
    the need to represent this block using a syscon.

    Reviewed-by: Baolin Wang
    Reviewed-by: Vinod Koul
    Signed-off-by: Bjorn Andersson
    Link: https://lore.kernel.org/r/20200622075956.171058-4-bjorn.andersson@linaro.org
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

21 Jun, 2020

1 commit

  • Every hwspinlock driver is expected to depend on the
    hwspinlock core, so it's possible to simplify the
    Kconfig, factoring out the HWSPINLOCK dependency.

    Reviewed-by: Baolin Wang
    Signed-off-by: Ezequiel Garcia
    Link: https://lore.kernel.org/r/20200414220943.6203-1-ezequiel@collabora.com
    Signed-off-by: Bjorn Andersson

    Ezequiel Garcia
     

26 Mar, 2020

2 commits

  • The current codebase makes use of the zero-length array language
    extension to the C90 standard, but the preferred mechanism to declare
    variable-length types such as these ones is a flexible array member[1][2],
    introduced in C99:

    struct foo {
    int stuff;
    struct boo array[];
    };

    By making use of the mechanism above, we will get a compiler warning
    in case the flexible array does not occur last in the structure, which
    will help us prevent some kind of undefined behavior bugs from being
    inadvertently introduced[3] to the codebase from now on.

    Also, notice that, dynamic memory allocations won't be affected by
    this change:

    "Flexible array members have incomplete type, and so the sizeof operator
    may not be applied. As a quirk of the original implementation of
    zero-length arrays, sizeof evaluates to zero."[1]

    This issue was found with the help of Coccinelle.

    [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
    [2] https://github.com/KSPP/linux/issues/21
    [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

    Reviewed-by: Baolin Wang
    Signed-off-by: Gustavo A. R. Silva
    Link: https://lore.kernel.org/r/20200319213839.GA10669@embeddedor.com
    Signed-off-by: Bjorn Andersson

    Gustavo A. R. Silva
     
  • Allow drivers to be built with COMPILE_TEST.

    Signed-off-by: Baolin Wang
    Link: https://lore.kernel.org/r/5a95c3de07ef020a4e2f2776fa5adb00637ee387.1581324976.git.baolin.wang7@gmail.com
    Signed-off-by: Bjorn Andersson

    Baolin Wang
     

22 Jan, 2020

7 commits


29 Dec, 2019

1 commit


09 Nov, 2019

4 commits

  • Since the hwspinlock core has changed the PM runtime to be optional, thus
    remove the redundant PM runtime implementation in the u8500 HWSEM driver.

    Reviewed-by: Linus Walleij
    Signed-off-by: Baolin Wang
    Signed-off-by: Bjorn Andersson

    Baolin Wang
     
  • Since the hwspinlock core has changed the PM runtime to be optional, thus
    remove the redundant PM runtime implementation in the Spreadtrum hwlock
    driver.

    Signed-off-by: Baolin Wang
    Signed-off-by: Bjorn Andersson

    Baolin Wang
     
  • Now some hwspinlock controllers did not have the requirement to implement
    the PM runtime, but drivers must enable the PM runtime to comply with the
    hwspinlock core.

    Thus we can change the PM runtime support to be optional by validating
    the -EACCES error number which means the PM runtime is not enabled, and
    removing the return value validating of pm_runtime_put(). So that we
    can remove some redundant PM runtime code in drivers.

    Signed-off-by: Baolin Wang
    Signed-off-by: Bjorn Andersson

    Baolin Wang
     
  • The original code use BUG_ON() to validate the parameters when locking
    or unlocking one hardware lock, but we should not crash the whole kernel
    though the hwlock parameters are incorrect, instead we can return
    the error number for users and give some warning.

    Signed-off-by: Baolin Wang
    Signed-off-by: Bjorn Andersson

    Baolin Wang
     

05 Oct, 2019

7 commits


30 Jun, 2019

5 commits

  • Add the 'in_atomic' mode which can be called from an atomic context.
    This mode relies on the existing 'raw' mode (no lock, no preemption/irq
    disabling) with the difference that the timeout is not based on jiffies
    (jiffies won't increase when irq are disabled) but handled with
    busy-waiting udelay() calls.

    Signed-off-by: Fabien Dessenne
    Signed-off-by: Bjorn Andersson

    Fabien Dessenne
     
  • Implement this optional ops, called by hwspinlock core while spinning on
    a lock, between two successive invocations of trylock().

    Reviewed-by: Benjamin Gaignard
    Signed-off-by: Fabien Dessenne
    Signed-off-by: Bjorn Andersson

    Fabien Dessenne
     
  • Do not wait for hwspinlock device registration if it is not available
    for use.

    Acked-by: Suman Anna
    Signed-off-by: Fabien Dessenne
    Signed-off-by: Bjorn Andersson

    Fabien Dessenne
     
  • Add a debug level trace statement in the OMAP HwSpinlock driver
    probe function to print the number of hwlocks on a successful
    registration.

    Signed-off-by: Suman Anna
    Signed-off-by: Bjorn Andersson

    Suman Anna
     
  • A HwSpinlock IP is also present on the newer TI K3 AM65x and J721E
    family of SoCs within the Main NavSS sub-module. Reuse the existing
    OMAP Hwspinlock driver to extend the support for this IP on K3 AM65x
    SoCs as well. The IP has slightly different bit-fields in the
    SYSCONFIG and SYSSTATUS registers.

    Signed-off-by: Suman Anna
    Signed-off-by: Bjorn Andersson

    Suman Anna
     

04 Jan, 2019

1 commit


06 Dec, 2018

1 commit


31 Jul, 2018

1 commit

  • The commit 4f1acd758b08 ("hwspinlock: Add devm_xxx() APIs to request/free
    hwlock") introduces one bug, that will return one error pointer if failed
    to request one hwlock, but we expect NULL pointer on error for consumers.
    This patch will fix this issue.

    Reported-by: Dan Carpenter
    Signed-off-by: Baolin Wang
    Signed-off-by: Bjorn Andersson

    Baolin Wang
     

27 Jun, 2018

2 commits