hwspinlock updates for v5.3
This contains support for hardware spinlock TI K3 AM65x and J721E family of SoCs, support for using hwspinlocks from atomic context and better error reporting when dealing with hardware disabled in DeviceTree. -----BEGIN PGP SIGNATURE----- iQJPBAABCAA5FiEEBd4DzF816k8JZtUlCx85Pw2ZrcUFAl0uHkobHGJqb3JuLmFu ZGVyc3NvbkBsaW5hcm8ub3JnAAoJEAsfOT8Nma3Fm0MP/ibvaJ82nOKumQGrOjom CAI2U/nf1AWbm3Rhy+u3zVelKpd9iLKjsUj2fF42HBARZWXGfxEJUL7fH50Whp+n lGDgD5r1vE+wp4aqHycRZJEKWUnKTLA/2ddK9QUfljtvdItZJ1MBoKu/V3nhELZd wfK7vLVbeSIcK2ChVYFZtNhFRmRRN24K4RzcANzzxNrP7+xzqZuJEwmpKKibeMCN M/LI0XcE95s4+O3e5mcTOOtEyGqbsNrwOwQquYVOFBNbzKHN2HN/9dPAXHA4/K0y N8zseMeV52dTtaaK8tNLcY7XNJp8r326TN8N/ufmU8oO+KCj3cx1juBSeS4pze1m U4+vFS9B8aRdeB6a6+W4ZdJpJVSJvTKDJMSB2vbvXJAQfklrGlaHQRmv+OBoPVMj vUwWB10hJZMrONfGxN8KwG7wzFx7yIol2u2KmJcSfFVAJVVA/YBaulZDl6jkzyeB GDrgrGnd7iYGa2LhPVHZ/xwyCb0WsRQMXx2gkNegxwlF+nnfTrNMKUJ9eTps4WUn o80/khuegIzyieym9SB+f7BCRO1xC26FhcGuHrKJXK2Rfcf6LJv+b1B0Q+hwL8UQ 2DsImsH9VnWV7lIaXvbQh8Fsr361xuxJ2Lm3dszbtfEUuhLSyMuJvhyPO+FPSggZ C51xGa/x71EqBWvKh2YheJSo =Dz9r -----END PGP SIGNATURE----- Merge tag 'hwlock-v5.3' of git://github.com/andersson/remoteproc Pull hwspinlock updates from Bjorn Andersson: "This contains support for hardware spinlock TI K3 AM65x and J721E family of SoCs, support for using hwspinlocks from atomic context and better error reporting when dealing with hardware disabled in DeviceTree" * tag 'hwlock-v5.3' of git://github.com/andersson/remoteproc: hwspinlock: add the 'in_atomic' API hwspinlock: document the hwspinlock 'raw' API hwspinlock: stm32: implement the relax() ops hwspinlock: ignore disabled device hwspinlock/omap: Add a trace during probe hwspinlock/omap: Add support for TI K3 SoCs dt-bindings: hwlock: Update OMAP binding for TI K3 SoCs
This commit is contained in:
commit
57ab5f7402
7 changed files with 206 additions and 22 deletions
|
|
@ -14,9 +14,10 @@
|
|||
#include <linux/sched.h>
|
||||
|
||||
/* hwspinlock mode argument */
|
||||
#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
|
||||
#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
|
||||
#define HWLOCK_RAW 0x03
|
||||
#define HWLOCK_IRQSTATE 0x01 /* Disable interrupts, save state */
|
||||
#define HWLOCK_IRQ 0x02 /* Disable interrupts, don't save state */
|
||||
#define HWLOCK_RAW 0x03
|
||||
#define HWLOCK_IN_ATOMIC 0x04 /* Called while in atomic context */
|
||||
|
||||
struct device;
|
||||
struct device_node;
|
||||
|
|
@ -222,6 +223,23 @@ static inline int hwspin_trylock_raw(struct hwspinlock *hwlock)
|
|||
return __hwspin_trylock(hwlock, HWLOCK_RAW, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* hwspin_trylock_in_atomic() - attempt to lock a specific hwspinlock
|
||||
* @hwlock: an hwspinlock which we want to trylock
|
||||
*
|
||||
* This function attempts to lock an hwspinlock, and will immediately fail
|
||||
* if the hwspinlock is already taken.
|
||||
*
|
||||
* This function shall be called only from an atomic context.
|
||||
*
|
||||
* Returns 0 if we successfully locked the hwspinlock, -EBUSY if
|
||||
* the hwspinlock was already taken, and -EINVAL if @hwlock is invalid.
|
||||
*/
|
||||
static inline int hwspin_trylock_in_atomic(struct hwspinlock *hwlock)
|
||||
{
|
||||
return __hwspin_trylock(hwlock, HWLOCK_IN_ATOMIC, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* hwspin_trylock() - attempt to lock a specific hwspinlock
|
||||
* @hwlock: an hwspinlock which we want to trylock
|
||||
|
|
@ -312,6 +330,28 @@ int hwspin_lock_timeout_raw(struct hwspinlock *hwlock, unsigned int to)
|
|||
return __hwspin_lock_timeout(hwlock, to, HWLOCK_RAW, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* hwspin_lock_timeout_in_atomic() - lock an hwspinlock with timeout limit
|
||||
* @hwlock: the hwspinlock to be locked
|
||||
* @to: timeout value in msecs
|
||||
*
|
||||
* This function locks the underlying @hwlock. If the @hwlock
|
||||
* is already taken, the function will busy loop waiting for it to
|
||||
* be released, but give up when @timeout msecs have elapsed.
|
||||
*
|
||||
* This function shall be called only from an atomic context and the timeout
|
||||
* value shall not exceed a few msecs.
|
||||
*
|
||||
* Returns 0 when the @hwlock was successfully taken, and an appropriate
|
||||
* error code otherwise (most notably an -ETIMEDOUT if the @hwlock is still
|
||||
* busy after @timeout msecs). The function will never sleep.
|
||||
*/
|
||||
static inline
|
||||
int hwspin_lock_timeout_in_atomic(struct hwspinlock *hwlock, unsigned int to)
|
||||
{
|
||||
return __hwspin_lock_timeout(hwlock, to, HWLOCK_IN_ATOMIC, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* hwspin_lock_timeout() - lock an hwspinlock with timeout limit
|
||||
* @hwlock: the hwspinlock to be locked
|
||||
|
|
@ -386,6 +426,21 @@ static inline void hwspin_unlock_raw(struct hwspinlock *hwlock)
|
|||
__hwspin_unlock(hwlock, HWLOCK_RAW, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* hwspin_unlock_in_atomic() - unlock hwspinlock
|
||||
* @hwlock: a previously-acquired hwspinlock which we want to unlock
|
||||
*
|
||||
* This function will unlock a specific hwspinlock.
|
||||
*
|
||||
* @hwlock must be already locked (e.g. by hwspin_trylock()) before calling
|
||||
* this function: it is a bug to call unlock on a @hwlock that is already
|
||||
* unlocked.
|
||||
*/
|
||||
static inline void hwspin_unlock_in_atomic(struct hwspinlock *hwlock)
|
||||
{
|
||||
__hwspin_unlock(hwlock, HWLOCK_IN_ATOMIC, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* hwspin_unlock() - unlock hwspinlock
|
||||
* @hwlock: a previously-acquired hwspinlock which we want to unlock
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue