hwspinlock updates for v5.20

This removes the need for representing the Qualcomm SFPB mutex using an
 intermediate syscon node and it clean up the pm_runtime_get_sync() usage
 in the OMAP hwspinlock driver.
 -----BEGIN PGP SIGNATURE-----
 
 iQJPBAABCAA5FiEEBd4DzF816k8JZtUlCx85Pw2ZrcUFAmLxM5YbHGJqb3JuLmFu
 ZGVyc3NvbkBsaW5hcm8ub3JnAAoJEAsfOT8Nma3FujcP/0eGIAjGCtNWaDNvT/pI
 dK/nVn06AaHdRa3VLN0JbWyHeeEilCsDlEdmNr+5IwEtii6JHL481KdbWj641VXX
 BMhenHGPg24cp1xFXQe5qs9Dgr1slN/jsuCbDcnluLwdbFI+saQqVpozFnPx83l5
 7sDSXGjmF3yDrwhm5idadQKGwr5M7FjxV/nENzQIrD/0uAeBtkIuzCm5VY2qcHZM
 /LcgAEne4N3+RJfDgtCQHf1nbdMIVyeoPHLnL1RdeBXPZ8AdKSwtX7fRPK/nQd7j
 4R5LZ3DgwtXa+7hz1RKx1N6RNLJ6wQm1Y9/01xvFlJY0nLYwilGUSIDOrtuCHnnS
 S1caIwutYMIL3QszOIvNBoeNebIeRYk86eNMKEyRGpWo09au5gh668Y4wdGMOabD
 Hw6VgiwVb8RJeb0xubyueTjTmplJcjbbkGfBrUR063EJ3E/XrmpwuQ/WeLrHvv5Y
 DS3HoBW/QL0I2Ts2pjNAmBYrRr84E8dGql7KVNWrWYnfS2V1JxFD6Xz+319s75w6
 Y+EAkBdEmZoD2i2p8cDLrRQf1dGLW6zbFGw6YYNHL5/CEYCV4jILtNDxgZk27Pws
 0w4P7gXNjttR/TRaHUevTslBtczlw9PR47wrygANmhgzqdRpZCC+FLkSRfeaHKSE
 /hHhG+WY1pxX+7ucccSh8L4W
 =qrVf
 -----END PGP SIGNATURE-----

Merge tag 'hwlock-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux

Pull hwspinlock updates from Bjorn Andersson:
 "This removes the need for representing the Qualcomm SFPB mutex using
  an intermediate syscon node and it clean up the pm_runtime_get_sync()
  usage in the OMAP hwspinlock driver"

* tag 'hwlock-v5.20' of git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux:
  hwspinlock: qcom: Add support for mmio usage to sfpb-mutex
  hwspinlock: using pm_runtime_resume_and_get instead of pm_runtime_get_sync
This commit is contained in:
Linus Torvalds 2022-08-08 10:27:51 -07:00
commit 3466f49dd0
2 changed files with 25 additions and 9 deletions

View File

@ -94,11 +94,9 @@ static int omap_hwspinlock_probe(struct platform_device *pdev)
* the module SYSSTATUS register
*/
pm_runtime_enable(&pdev->dev);
ret = pm_runtime_get_sync(&pdev->dev);
if (ret < 0) {
pm_runtime_put_noidle(&pdev->dev);
ret = pm_runtime_resume_and_get(&pdev->dev);
if (ret < 0)
goto runtime_err;
}
/* Determine number of locks */
i = readl(io_base + SYSSTATUS_OFFSET);

View File

@ -19,6 +19,11 @@
#define QCOM_MUTEX_APPS_PROC_ID 1
#define QCOM_MUTEX_NUM_LOCKS 32
struct qcom_hwspinlock_of_data {
u32 offset;
u32 stride;
};
static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
{
struct regmap_field *field = lock->priv;
@ -63,9 +68,20 @@ static const struct hwspinlock_ops qcom_hwspinlock_ops = {
.unlock = qcom_hwspinlock_unlock,
};
static const struct qcom_hwspinlock_of_data of_sfpb_mutex = {
.offset = 0x4,
.stride = 0x4,
};
/* All modern platform has offset 0 and stride of 4k */
static const struct qcom_hwspinlock_of_data of_tcsr_mutex = {
.offset = 0,
.stride = 0x1000,
};
static const struct of_device_id qcom_hwspinlock_of_match[] = {
{ .compatible = "qcom,sfpb-mutex" },
{ .compatible = "qcom,tcsr-mutex" },
{ .compatible = "qcom,sfpb-mutex", .data = &of_sfpb_mutex },
{ .compatible = "qcom,tcsr-mutex", .data = &of_tcsr_mutex },
{ }
};
MODULE_DEVICE_TABLE(of, qcom_hwspinlock_of_match);
@ -112,12 +128,14 @@ static const struct regmap_config tcsr_mutex_config = {
static struct regmap *qcom_hwspinlock_probe_mmio(struct platform_device *pdev,
u32 *offset, u32 *stride)
{
const struct qcom_hwspinlock_of_data *data;
struct device *dev = &pdev->dev;
void __iomem *base;
/* All modern platform has offset 0 and stride of 4k */
*offset = 0;
*stride = 0x1000;
data = of_device_get_match_data(dev);
*offset = data->offset;
*stride = data->stride;
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))