faa9044d3381694b5d8d561fa8f4c251ed0ebc97
[openwrt/staging/blogic.git] /
1 From 23316be8a9d450f33a21f1efe7d89570becbec58 Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sun, 16 Jul 2023 04:28:04 +0200
4 Subject: [PATCH] hwspinlock: qcom: add missing regmap config for SFPB MMIO
5 implementation
6
7 Commit 5d4753f741d8 ("hwspinlock: qcom: add support for MMIO on older
8 SoCs") introduced and made regmap_config mandatory in the of_data struct
9 but didn't add the regmap_config for sfpb based devices.
10
11 SFPB based devices can both use the legacy syscon way to probe or the
12 new MMIO way and currently device that use the MMIO way are broken as
13 they lack the definition of the now required regmap_config and always
14 return -EINVAL (and indirectly makes fail probing everything that
15 depends on it, smem, nandc with smem-parser...)
16
17 Fix this by correctly adding the missing regmap_config and restore
18 function of hwspinlock on SFPB based devices with MMIO implementation.
19
20 Cc: stable@vger.kernel.org
21 Fixes: 5d4753f741d8 ("hwspinlock: qcom: add support for MMIO on older SoCs")
22 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
23 Link: https://lore.kernel.org/r/20230716022804.21239-1-ansuelsmth@gmail.com
24 Signed-off-by: Bjorn Andersson <andersson@kernel.org>
25 ---
26 drivers/hwspinlock/qcom_hwspinlock.c | 9 +++++++++
27 1 file changed, 9 insertions(+)
28
29 --- a/drivers/hwspinlock/qcom_hwspinlock.c
30 +++ b/drivers/hwspinlock/qcom_hwspinlock.c
31 @@ -69,9 +69,18 @@ static const struct hwspinlock_ops qcom_
32 .unlock = qcom_hwspinlock_unlock,
33 };
34
35 +static const struct regmap_config sfpb_mutex_config = {
36 + .reg_bits = 32,
37 + .reg_stride = 4,
38 + .val_bits = 32,
39 + .max_register = 0x100,
40 + .fast_io = true,
41 +};
42 +
43 static const struct qcom_hwspinlock_of_data of_sfpb_mutex = {
44 .offset = 0x4,
45 .stride = 0x4,
46 + .regmap_config = &sfpb_mutex_config,
47 };
48
49 static const struct regmap_config tcsr_msm8226_mutex_config = {