2022-07-07 10:31:30

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex

Allow sfpb-mutex to use mmio in addition to syscon.

Signed-off-by: Christian Marangi <[email protected]>
Reviewed-by: Bjorn Andersson <[email protected]>
---
drivers/hwspinlock/qcom_hwspinlock.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
index 364710966665..80ea45b3a815 100644
--- a/drivers/hwspinlock/qcom_hwspinlock.c
+++ b/drivers/hwspinlock/qcom_hwspinlock.c
@@ -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))
--
2.36.1


2022-07-07 10:43:24

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 3/3] ARM: dts: qcom: add missing smem compatible for ipq8064 dtsi

Add missing smem compatible and hwlocks phandle for ipq8064 dtsi
smem node.

Signed-off-by: Christian Marangi <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
---
arch/arm/boot/dts/qcom-ipq8064.dtsi | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi
index cd1b43e2cab4..ff1a2acb1d83 100644
--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -292,8 +292,11 @@ nss@40000000 {
};

smem: smem@41000000 {
+ compatible = "qcom,smem";
reg = <0x41000000 0x200000>;
no-map;
+
+ hwlocks = <&sfpb_mutex 3>;
};
};

--
2.36.1

2022-07-07 10:43:32

by Christian Marangi

[permalink] [raw]
Subject: [PATCH v2 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi

Add missing hwlock for ipq8064 dtsi provided by qcom,sfpb-mutex.

Signed-off-by: Christian Marangi <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
---
arch/arm/boot/dts/qcom-ipq8064.dtsi | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi
index 4b475d98343c..cd1b43e2cab4 100644
--- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
+++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
@@ -1224,4 +1224,11 @@ sdcc3: mmc@12180000 {
};
};
};
+
+ sfpb_mutex: hwlock@1200600 {
+ compatible = "qcom,sfpb-mutex";
+ reg = <0x01200600 0x100>;
+
+ #hwlock-cells = <1>;
+ };
};
--
2.36.1

2022-07-17 03:10:02

by Bjorn Andersson

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi

On Thu 07 Jul 05:20 CDT 2022, Christian Marangi wrote:

> Add missing hwlock for ipq8064 dtsi provided by qcom,sfpb-mutex.
>
> Signed-off-by: Christian Marangi <[email protected]>
> Acked-by: Krzysztof Kozlowski <[email protected]>
> ---
> arch/arm/boot/dts/qcom-ipq8064.dtsi | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi
> index 4b475d98343c..cd1b43e2cab4 100644
> --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
> +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
> @@ -1224,4 +1224,11 @@ sdcc3: mmc@12180000 {
> };
> };
> };
> +
> + sfpb_mutex: hwlock@1200600 {

This is an mmio device, so it should live under /soc, so I moved it
there while applying the patch.


But it would be nice if this file followed others and kept all nodes
sorted by address (or name if they don't have an address). Also if
addresses were padded to 8 digits, to make sorting easier.

I would much appreciate if you could find the time to prepare such a
patch.

Thank you,
Bjorn

> + compatible = "qcom,sfpb-mutex";
> + reg = <0x01200600 0x100>;
> +
> + #hwlock-cells = <1>;
> + };
> };
> --
> 2.36.1
>

2022-07-17 03:23:56

by Bjorn Andersson

[permalink] [raw]
Subject: Re: (subset) [PATCH v2 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex

On Thu, 7 Jul 2022 12:20:38 +0200, Christian Marangi wrote:
> Allow sfpb-mutex to use mmio in addition to syscon.
>
>

Applied, thanks!

[2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi
commit: fbe4be367b2169602f6a5949a20d2917b25714d4
[3/3] ARM: dts: qcom: add missing smem compatible for ipq8064 dtsi
commit: 4fefb5434c4b735daf913abaef12431405368031

Best regards,
--
Bjorn Andersson <[email protected]>

2022-07-17 09:43:25

by Christian Marangi

[permalink] [raw]
Subject: Re: [PATCH v2 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi

On Sat, Jul 16, 2022 at 10:04:39PM -0500, Bjorn Andersson wrote:
> On Thu 07 Jul 05:20 CDT 2022, Christian Marangi wrote:
>
> > Add missing hwlock for ipq8064 dtsi provided by qcom,sfpb-mutex.
> >
> > Signed-off-by: Christian Marangi <[email protected]>
> > Acked-by: Krzysztof Kozlowski <[email protected]>
> > ---
> > arch/arm/boot/dts/qcom-ipq8064.dtsi | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/qcom-ipq8064.dtsi b/arch/arm/boot/dts/qcom-ipq8064.dtsi
> > index 4b475d98343c..cd1b43e2cab4 100644
> > --- a/arch/arm/boot/dts/qcom-ipq8064.dtsi
> > +++ b/arch/arm/boot/dts/qcom-ipq8064.dtsi
> > @@ -1224,4 +1224,11 @@ sdcc3: mmc@12180000 {
> > };
> > };
> > };
> > +
> > + sfpb_mutex: hwlock@1200600 {
>
> This is an mmio device, so it should live under /soc, so I moved it
> there while applying the patch.
>
>
> But it would be nice if this file followed others and kept all nodes
> sorted by address (or name if they don't have an address). Also if
> addresses were padded to 8 digits, to make sorting easier.
>
> I would much appreciate if you could find the time to prepare such a
> patch.

That will take tons of changes, but yes will make a patch to reorder all
the nodes.

>
> > + compatible = "qcom,sfpb-mutex";
> > + reg = <0x01200600 0x100>;
> > +
> > + #hwlock-cells = <1>;
> > + };
> > };
> > --
> > 2.36.1
> >

--
Ansuel