All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex
@ 2022-07-07  1:30 Christian Marangi
  2022-07-07  1:30 ` [PATCH 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi Christian Marangi
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Christian Marangi @ 2022-07-07  1:30 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	devicetree, linux-kernel, linux-remoteproc
  Cc: Christian Marangi

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

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 drivers/hwspinlock/qcom_hwspinlock.c | 32 ++++++++++++++++++++++------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
index 364710966665..23c913095bd0 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);
@@ -101,7 +117,7 @@ static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
 	return regmap;
 }
 
-static const struct regmap_config tcsr_mutex_config = {
+static const struct regmap_config qcom_hwspinlock_mmio_config = {
 	.reg_bits		= 32,
 	.reg_stride		= 4,
 	.val_bits		= 32,
@@ -112,18 +128,20 @@ 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))
 		return ERR_CAST(base);
 
-	return devm_regmap_init_mmio(dev, base, &tcsr_mutex_config);
+	return devm_regmap_init_mmio(dev, base, &qcom_hwspinlock_mmio_config);
 }
 
 static int qcom_hwspinlock_probe(struct platform_device *pdev)
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi
  2022-07-07  1:30 [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Christian Marangi
@ 2022-07-07  1:30 ` Christian Marangi
  2022-07-07  6:58   ` Krzysztof Kozlowski
  2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem compatible " Christian Marangi
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Christian Marangi @ 2022-07-07  1:30 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	devicetree, linux-kernel, linux-remoteproc
  Cc: Christian Marangi

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

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] ARM: dts: qcom: add missing smem compatible for ipq8064 dtsi
  2022-07-07  1:30 [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Christian Marangi
  2022-07-07  1:30 ` [PATCH 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi Christian Marangi
@ 2022-07-07  1:30 ` Christian Marangi
  2022-07-07  6:59   ` Krzysztof Kozlowski
  2022-07-07  6:59   ` Krzysztof Kozlowski
  2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem node " Christian Marangi
                   ` (2 subsequent siblings)
  4 siblings, 2 replies; 12+ messages in thread
From: Christian Marangi @ 2022-07-07  1:30 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	devicetree, linux-kernel, linux-remoteproc
  Cc: Christian Marangi

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

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/3] ARM: dts: qcom: add missing smem node for ipq8064 dtsi
  2022-07-07  1:30 [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Christian Marangi
  2022-07-07  1:30 ` [PATCH 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi Christian Marangi
  2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem compatible " Christian Marangi
@ 2022-07-07  1:30 ` Christian Marangi
  2022-07-07  1:32   ` Christian Marangi
  2022-07-07  2:53 ` [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Bjorn Andersson
  2022-07-07 11:00 ` Baolin Wang
  4 siblings, 1 reply; 12+ messages in thread
From: Christian Marangi @ 2022-07-07  1:30 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	devicetree, linux-kernel, linux-remoteproc
  Cc: Christian Marangi

Add missing smem node for ipq8064 dtsi.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] ARM: dts: qcom: add missing smem node for ipq8064 dtsi
  2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem node " Christian Marangi
@ 2022-07-07  1:32   ` Christian Marangi
  0 siblings, 0 replies; 12+ messages in thread
From: Christian Marangi @ 2022-07-07  1:32 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	devicetree, linux-kernel, linux-remoteproc

On Thu, Jul 07, 2022 at 03:30:17AM +0200, Christian Marangi wrote:
> Add missing smem node for ipq8064 dtsi.
> 

Slipped while fixing commit description... pls ignore.

-- 
	Ansuel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex
  2022-07-07  1:30 [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Christian Marangi
                   ` (2 preceding siblings ...)
  2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem node " Christian Marangi
@ 2022-07-07  2:53 ` Bjorn Andersson
  2022-07-07 10:14   ` Christian Marangi
  2022-07-07 11:00 ` Baolin Wang
  4 siblings, 1 reply; 12+ messages in thread
From: Bjorn Andersson @ 2022-07-07  2:53 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Ohad Ben-Cohen, Baolin Wang, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On Wed 06 Jul 20:30 CDT 2022, Christian Marangi wrote:

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

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  drivers/hwspinlock/qcom_hwspinlock.c | 32 ++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
> index 364710966665..23c913095bd0 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);
> @@ -101,7 +117,7 @@ static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
>  	return regmap;
>  }
>  
> -static const struct regmap_config tcsr_mutex_config = {
> +static const struct regmap_config qcom_hwspinlock_mmio_config = {

Any objections against me skipping this rename when applying the patch?
Just to keep the patch to the point?

Regards,
Bjorn

>  	.reg_bits		= 32,
>  	.reg_stride		= 4,
>  	.val_bits		= 32,
> @@ -112,18 +128,20 @@ 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))
>  		return ERR_CAST(base);
>  
> -	return devm_regmap_init_mmio(dev, base, &tcsr_mutex_config);
> +	return devm_regmap_init_mmio(dev, base, &qcom_hwspinlock_mmio_config);
>  }
>  
>  static int qcom_hwspinlock_probe(struct platform_device *pdev)
> -- 
> 2.36.1
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi
  2022-07-07  1:30 ` [PATCH 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi Christian Marangi
@ 2022-07-07  6:58   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2022-07-07  6:58 UTC (permalink / raw)
  To: Christian Marangi, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Rob Herring, Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc

On 07/07/2022 03:30, Christian Marangi wrote:
> Add missing hwlock for ipq8064 dtsi provided by qcom,sfpb-mutex.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] ARM: dts: qcom: add missing smem compatible for ipq8064 dtsi
  2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem compatible " Christian Marangi
@ 2022-07-07  6:59   ` Krzysztof Kozlowski
  2022-07-07  6:59   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2022-07-07  6:59 UTC (permalink / raw)
  To: Christian Marangi, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Rob Herring, Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc

On 07/07/2022 03:30, Christian Marangi wrote:
> Add missing smem compatible and hwlocks binding for ipq8064 dtsi
> smem node.
> 
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/3] ARM: dts: qcom: add missing smem compatible for ipq8064 dtsi
  2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem compatible " Christian Marangi
  2022-07-07  6:59   ` Krzysztof Kozlowski
@ 2022-07-07  6:59   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 12+ messages in thread
From: Krzysztof Kozlowski @ 2022-07-07  6:59 UTC (permalink / raw)
  To: Christian Marangi, Andy Gross, Bjorn Andersson, Konrad Dybcio,
	Rob Herring, Krzysztof Kozlowski, Ohad Ben-Cohen, Baolin Wang,
	linux-arm-msm, devicetree, linux-kernel, linux-remoteproc

On 07/07/2022 03:30, Christian Marangi wrote:
> Add missing smem compatible and hwlocks binding for ipq8064 dtsi

s/binding/phandle/


Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex
  2022-07-07  2:53 ` [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Bjorn Andersson
@ 2022-07-07 10:14   ` Christian Marangi
  0 siblings, 0 replies; 12+ messages in thread
From: Christian Marangi @ 2022-07-07 10:14 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
	Ohad Ben-Cohen, Baolin Wang, linux-arm-msm, devicetree,
	linux-kernel, linux-remoteproc

On Wed, Jul 06, 2022 at 09:53:45PM -0500, Bjorn Andersson wrote:
> On Wed 06 Jul 20:30 CDT 2022, Christian Marangi wrote:
> 
> > Allow sfpb-mutex to use mmio in addition to syscon.
> > 
> 
> Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> 
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> >  drivers/hwspinlock/qcom_hwspinlock.c | 32 ++++++++++++++++++++++------
> >  1 file changed, 25 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
> > index 364710966665..23c913095bd0 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);
> > @@ -101,7 +117,7 @@ static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
> >  	return regmap;
> >  }
> >  
> > -static const struct regmap_config tcsr_mutex_config = {
> > +static const struct regmap_config qcom_hwspinlock_mmio_config = {
> 
> Any objections against me skipping this rename when applying the patch?
> Just to keep the patch to the point?
> 
> Regards,
> Bjorn
>

I will send v2 with the name reverted and another fix. 

> >  	.reg_bits		= 32,
> >  	.reg_stride		= 4,
> >  	.val_bits		= 32,
> > @@ -112,18 +128,20 @@ 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))
> >  		return ERR_CAST(base);
> >  
> > -	return devm_regmap_init_mmio(dev, base, &tcsr_mutex_config);
> > +	return devm_regmap_init_mmio(dev, base, &qcom_hwspinlock_mmio_config);
> >  }
> >  
> >  static int qcom_hwspinlock_probe(struct platform_device *pdev)
> > -- 
> > 2.36.1
> > 

-- 
	Ansuel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex
  2022-07-07  1:30 [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Christian Marangi
                   ` (3 preceding siblings ...)
  2022-07-07  2:53 ` [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Bjorn Andersson
@ 2022-07-07 11:00 ` Baolin Wang
  2022-07-07 11:07   ` Christian Marangi
  4 siblings, 1 reply; 12+ messages in thread
From: Baolin Wang @ 2022-07-07 11:00 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Ohad Ben-Cohen, linux-arm-msm,
	Devicetree List, LKML, linux-remoteproc

On Thu, Jul 7, 2022 at 9:30 AM Christian Marangi <ansuelsmth@gmail.com> wrote:
>
> Allow sfpb-mutex to use mmio in addition to syscon.
>
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> ---
>  drivers/hwspinlock/qcom_hwspinlock.c | 32 ++++++++++++++++++++++------
>  1 file changed, 25 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
> index 364710966665..23c913095bd0 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);
> @@ -101,7 +117,7 @@ static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
>         return regmap;
>  }
>
> -static const struct regmap_config tcsr_mutex_config = {
> +static const struct regmap_config qcom_hwspinlock_mmio_config = {
>         .reg_bits               = 32,
>         .reg_stride             = 4,
>         .val_bits               = 32,
> @@ -112,18 +128,20 @@ 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);

Nit: better to validate the return value though this is a rare case.

if (!data)
         return -ENODEV;

Otherwise LGTM.

Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>

-- 
Baolin Wang

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex
  2022-07-07 11:00 ` Baolin Wang
@ 2022-07-07 11:07   ` Christian Marangi
  0 siblings, 0 replies; 12+ messages in thread
From: Christian Marangi @ 2022-07-07 11:07 UTC (permalink / raw)
  To: Baolin Wang
  Cc: Andy Gross, Bjorn Andersson, Konrad Dybcio, Rob Herring,
	Krzysztof Kozlowski, Ohad Ben-Cohen, linux-arm-msm,
	Devicetree List, LKML, linux-remoteproc

On Thu, Jul 07, 2022 at 07:00:15PM +0800, Baolin Wang wrote:
> On Thu, Jul 7, 2022 at 9:30 AM Christian Marangi <ansuelsmth@gmail.com> wrote:
> >
> > Allow sfpb-mutex to use mmio in addition to syscon.
> >
> > Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> > ---
> >  drivers/hwspinlock/qcom_hwspinlock.c | 32 ++++++++++++++++++++++------
> >  1 file changed, 25 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
> > index 364710966665..23c913095bd0 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);
> > @@ -101,7 +117,7 @@ static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
> >         return regmap;
> >  }
> >
> > -static const struct regmap_config tcsr_mutex_config = {
> > +static const struct regmap_config qcom_hwspinlock_mmio_config = {
> >         .reg_bits               = 32,
> >         .reg_stride             = 4,
> >         .val_bits               = 32,
> > @@ -112,18 +128,20 @@ 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);
> 
> Nit: better to validate the return value though this is a rare case.
> 
> if (!data)
>          return -ENODEV;
> 

Wonder if that can actually happen?

Looking at of_device_get_match_data() it can only return the data or
NULL if the match data is not defined but considering it should ALWAYS
be defined (or the driver can't work). But yhea should be a value to
check.

-- 
	Ansuel

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-07-07 11:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07  1:30 [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Christian Marangi
2022-07-07  1:30 ` [PATCH 2/3] ARM: dts: qcom: add missing hwlock for ipq8064 dtsi Christian Marangi
2022-07-07  6:58   ` Krzysztof Kozlowski
2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem compatible " Christian Marangi
2022-07-07  6:59   ` Krzysztof Kozlowski
2022-07-07  6:59   ` Krzysztof Kozlowski
2022-07-07  1:30 ` [PATCH 3/3] ARM: dts: qcom: add missing smem node " Christian Marangi
2022-07-07  1:32   ` Christian Marangi
2022-07-07  2:53 ` [PATCH 1/3] hwspinlock: qcom: Add support for mmio usage to sfpb-mutex Bjorn Andersson
2022-07-07 10:14   ` Christian Marangi
2022-07-07 11:00 ` Baolin Wang
2022-07-07 11:07   ` Christian Marangi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.