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
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
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
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
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
03 Nov, 2020
1 commit
-
The hardware spinlock devices are defined in the DT, there's no need for
init calls order, remove boilerplate code by using module_platform_driver.Reviewed-by: Baolin Wang
Signed-off-by: Chunyan Zhang
Link: https://lore.kernel.org/r/20201030034654.15775-3-zhang.lyra@gmail.com
Signed-off-by: Bjorn Andersson
26 Oct, 2020
1 commit
-
Remove redundant header files.
Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/1590991552-93643-1-git-send-email-baolin.wang@linux.alibaba.com
Signed-off-by: Bjorn Andersson
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
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
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 -
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
22 Jan, 2020
7 commits
-
Use devm_hwspin_lock_register() to register the hwlock controller instead of
unregistering the hwlock controller explicitly when removing the device.Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/8f94e67b5f9af20a93418a2fc9cc71b194f1285c.1578453662.git.baolin.wang7@gmail.com
Signed-off-by: Bjorn Andersson -
Since the hwspinlock core has changed the PM runtime to be optional, and
the SIRF hardware spinlock has no pm runtime requirement, thus remove
these redundant PM runtime functions.Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/c921e391aa2a652d8d6ae0e4041202cec9d917e7.1578453662.git.baolin.wang7@gmail.com
Signed-off-by: Bjorn Andersson -
Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together, which can simpify the code.Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/dfa043f317c609a6172468ac11598968dd751bce.1578453662.git.baolin.wang7@gmail.com
Signed-off-by: Bjorn Andersson -
Use devm_kzalloc() to allocate memory, which can simplify the error
handling.Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/c066ad704c1a5fd52c3002cac80ddd59b3901b01.1578453062.git.baolin.wang7@gmail.com
Signed-off-by: Bjorn Andersson -
Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together, which can simpify the code.
Meanwhile renaming the error label to make more sense after removing
iounmap().Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/6c09c5034a7e68fdfc22d2cb5daa375bccb33a66.1578453062.git.baolin.wang7@gmail.com
Signed-off-by: Bjorn Andersson -
Use devm_hwspin_lock_register() to register the hwlock controller instead of
unregistering the hwlock controller explicitly when removing the device.Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/d69ad8611a68b0cac3c927d19901f3c113c5435c.1578452735.git.baolin.wang7@gmail.com
Signed-off-by: Bjorn Andersson -
Since the hwspinlock core has changed the PM runtime to be optional, and
the Qualcomm hardware spinlock has no pm runtime requirement, thus remove
these redundant PM runtime functions.Signed-off-by: Baolin Wang
Link: https://lore.kernel.org/r/e0bb751feb7af709f92e52a07d0e8ebcf1ee44ff.1578452735.git.baolin.wang7@gmail.com
Signed-off-by: Bjorn Andersson
29 Dec, 2019
1 commit
-
Use devm_platform_ioremap_resource() to simplify code.
Signed-off-by: Yangtao Li
Link: https://lore.kernel.org/r/20191228191541.26999-1-tiny.windzz@gmail.com
Signed-off-by: Bjorn Andersson
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 -
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 -
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 -
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
05 Oct, 2019
7 commits
-
Use devm_hwspin_lock_register() to register the hwlock controller instead of
unregistering the hwlock controller explicitly when removing the device.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
Use devm_add_action_or_reset() for calls to clk_disable_unprepare(),
which can simplify the error handling.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
We must check the return value of clk_prepare_enable() to make sure the
hardware spinlock controller can be enabled successfully, otherwise we
should return error.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together, which can simpify the code.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
Use devm_hwspin_lock_register() to register the hwlock controller instead of
unregistering the hwlock controller explicitly when removing the device.Reviewed-by: Linus Walleij
Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
Use devm_kzalloc() to allocate memory.
Reviewed-by: Linus Walleij
Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
Use the new helper that wraps the calls to platform_get_resource()
and devm_ioremap_resource() together, which can simpify the code.Reviewed-by: Linus Walleij
Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson
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 -
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 -
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 -
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 -
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
04 Jan, 2019
1 commit
-
In case of error, the function devm_ioremap_resource() returns ERR_PTR()
and never returns NULL. The NULL test in the return value check should
be replaced with IS_ERR().Fixes: f24fcff1d267 ("hwspinlock: add STM32 hwspinlock device")
Acked-by: Benjamin Gaignard
Signed-off-by: Wei Yongjun
Signed-off-by: Bjorn Andersson
06 Dec, 2018
1 commit
-
This patch adds support of hardware semaphores for stm32mp1 SoC.
The hardware block provides 32 semaphores.Signed-off-by: Benjamin Gaignard
Signed-off-by: Benjamin Gaignard
Signed-off-by: Bjorn Andersson
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
27 Jun, 2018
2 commits
-
Fix one comment mistake with correct function names.
Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson -
This patch introduces devm_hwspin_lock_register() and devm_hwspin_lock_unregister()
interfaces to help to register or unregister one hardware spinlock controller, that
will help to simplify the cleanup code for hwspinlock drivers.Signed-off-by: Baolin Wang
Signed-off-by: Bjorn Andersson