Linux-remoteproc Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 0/4] hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon
@ 2020-06-22  7:59 Bjorn Andersson
  2020-06-22  7:59 ` [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML Bjorn Andersson
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Bjorn Andersson @ 2020-06-22  7:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Baolin Wang, Rob Herring
  Cc: linux-arm-msm, linux-remoteproc, devicetree, linux-kernel

In modern Qualcomm platforms the mutex region of the TCSR is forked off into
its own block, all with a offset of 0 and stride of 4096, and in some of these
platforms no other registers in this region is accessed from Linux. Update the
binding and the implementation to allow the TCSR mutex to be represented
without an intermediate syscon node.

Bjorn Andersson (4):
  dt-bindings: hwlock: qcom: Migrate binding to YAML
  dt-bindings: hwlock: qcom: Allow device on mmio bus
  hwspinlock: qcom: Allow mmio usage in addition to syscon
  arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon

 .../bindings/hwlock/qcom-hwspinlock.txt       | 39 -----------
 .../bindings/hwlock/qcom-hwspinlock.yaml      | 65 +++++++++++++++++
 arch/arm64/boot/dts/qcom/sm8250.dtsi          | 17 ++---
 drivers/hwspinlock/qcom_hwspinlock.c          | 70 ++++++++++++++-----
 4 files changed, 125 insertions(+), 66 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
 create mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml

-- 
2.26.2


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

* [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
  2020-06-22  7:59 [PATCH v2 0/4] hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon Bjorn Andersson
@ 2020-06-22  7:59 ` Bjorn Andersson
  2020-07-14  2:09   ` Rob Herring
  2020-07-21 15:13   ` Rob Herring
  2020-06-22  7:59 ` [PATCH v2 2/4] dt-bindings: hwlock: qcom: Allow device on mmio bus Bjorn Andersson
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 14+ messages in thread
From: Bjorn Andersson @ 2020-06-22  7:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Baolin Wang, Rob Herring
  Cc: linux-arm-msm, linux-remoteproc, devicetree, linux-kernel, Vinod Koul

Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.

Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v1:
- Actually remove the old binding doc

 .../bindings/hwlock/qcom-hwspinlock.txt       | 39 --------------
 .../bindings/hwlock/qcom-hwspinlock.yaml      | 51 +++++++++++++++++++
 2 files changed, 51 insertions(+), 39 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
 create mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml

diff --git a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
deleted file mode 100644
index 4563f524556b..000000000000
--- a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-Qualcomm Hardware Mutex Block:
-
-The hardware block provides mutexes utilized between different processors on
-the SoC as part of the communication protocol used by these processors.
-
-- compatible:
-	Usage: required
-	Value type: <string>
-	Definition: must be one of:
-		    "qcom,sfpb-mutex",
-		    "qcom,tcsr-mutex"
-
-- syscon:
-	Usage: required
-	Value type: <prop-encoded-array>
-	Definition: one cell containing:
-		    syscon phandle
-		    offset of the hwmutex block within the syscon
-		    stride of the hwmutex registers
-
-- #hwlock-cells:
-	Usage: required
-	Value type: <u32>
-	Definition: must be 1, the specified cell represent the lock id
-		    (hwlock standard property, see hwlock.txt)
-
-Example:
-
-	tcsr_mutex_block: syscon@fd484000 {
-		compatible = "syscon";
-		reg = <0xfd484000 0x2000>;
-	};
-
-	hwlock@fd484000 {
-		compatible = "qcom,tcsr-mutex";
-		syscon = <&tcsr_mutex_block 0 0x80>;
-
-		#hwlock-cells = <1>;
-	};
diff --git a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
new file mode 100644
index 000000000000..71e63b52edd5
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwlock/qcom-hwspinlock.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm Hardware Mutex Block
+
+maintainers:
+  - Bjorn Andersson <bjorn.andersson@linaro.org>
+
+description:
+  The hardware block provides mutexes utilized between different processors on
+  the SoC as part of the communication protocol used by these processors.
+
+properties:
+  compatible:
+    enum:
+      - qcom,sfpb-mutex
+      - qcom,tcsr-mutex
+
+  '#hwlock-cells':
+    const: 1
+
+  syscon:
+    $ref: "/schemas/types.yaml#/definitions/phandle-array"
+    description:
+      Should be a triple of phandle referencing the TCSR mutex syscon, offset
+      of first mutex within the syscon and stride between each mutex.
+
+required:
+  - compatible
+  - '#hwlock-cells'
+  - syscon
+
+additionalProperties: false
+
+examples:
+  - |
+        tcsr_mutex_block: syscon@fd484000 {
+                compatible = "syscon";
+                reg = <0xfd484000 0x2000>;
+        };
+
+        hwlock {
+                compatible = "qcom,tcsr-mutex";
+                syscon = <&tcsr_mutex_block 0 0x80>;
+
+                #hwlock-cells = <1>;
+        };
+...
-- 
2.26.2


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

* [PATCH v2 2/4] dt-bindings: hwlock: qcom: Allow device on mmio bus
  2020-06-22  7:59 [PATCH v2 0/4] hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon Bjorn Andersson
  2020-06-22  7:59 ` [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML Bjorn Andersson
@ 2020-06-22  7:59 ` Bjorn Andersson
  2020-07-14  2:10   ` Rob Herring
  2020-06-22  7:59 ` [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon Bjorn Andersson
  2020-06-22  7:59 ` [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon Bjorn Andersson
  3 siblings, 1 reply; 14+ messages in thread
From: Bjorn Andersson @ 2020-06-22  7:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Baolin Wang, Rob Herring
  Cc: linux-arm-msm, linux-remoteproc, devicetree, linux-kernel, Vinod Koul

In modern Qualcomm platforms the mutex region of the TCSR is forked off
into its own block, all with a offset of 0 and stride of 4096, and in
some of these platforms no other registers in this region is accessed
from Linux.

Update the binding to allow the hardware block to be described directly
on the mmio bus, in addition to allowing the existing syscon based
definition for backwards compatibility.

Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v1:
- None

 .../bindings/hwlock/qcom-hwspinlock.yaml         | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
index 71e63b52edd5..88f975837588 100644
--- a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
+++ b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
@@ -19,6 +19,9 @@ properties:
       - qcom,sfpb-mutex
       - qcom,tcsr-mutex
 
+  reg:
+    maxItems: 1
+
   '#hwlock-cells':
     const: 1
 
@@ -31,7 +34,12 @@ properties:
 required:
   - compatible
   - '#hwlock-cells'
-  - syscon
+
+oneOf:
+  - required:
+    - reg
+  - required:
+    - syscon
 
 additionalProperties: false
 
@@ -46,6 +54,12 @@ examples:
                 compatible = "qcom,tcsr-mutex";
                 syscon = <&tcsr_mutex_block 0 0x80>;
 
+                #hwlock-cells = <1>;
+        };
+  - |
+        tcsr_mutex: hwlock@1f40000 {
+                compatible = "qcom,tcsr-mutex";
+                reg = <0x01f40000 0x40000>;
                 #hwlock-cells = <1>;
         };
 ...
-- 
2.26.2


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

* [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon
  2020-06-22  7:59 [PATCH v2 0/4] hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon Bjorn Andersson
  2020-06-22  7:59 ` [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML Bjorn Andersson
  2020-06-22  7:59 ` [PATCH v2 2/4] dt-bindings: hwlock: qcom: Allow device on mmio bus Bjorn Andersson
@ 2020-06-22  7:59 ` Bjorn Andersson
  2020-07-14 16:04   ` Stephan Gerhold
  2020-06-22  7:59 ` [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon Bjorn Andersson
  3 siblings, 1 reply; 14+ messages in thread
From: Bjorn Andersson @ 2020-06-22  7:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Baolin Wang, Rob Herring
  Cc: linux-arm-msm, linux-remoteproc, devicetree, linux-kernel, Vinod Koul

In modern Qualcomm platforms the mutex region of the TCSR is forked off
into its own block, all with a offset of 0 and stride of 4096, and in
some of these platforms no other registers in this region is accessed
from Linux.

So add support for directly memory mapping this register space, to avoid
the need to represent this block using a syscon.

Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
---

Changes since v1:
- Use devm_platform_ioremap_resource()

 drivers/hwspinlock/qcom_hwspinlock.c | 70 +++++++++++++++++++++-------
 1 file changed, 54 insertions(+), 16 deletions(-)

diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
index f0da544b14d2..364710966665 100644
--- a/drivers/hwspinlock/qcom_hwspinlock.c
+++ b/drivers/hwspinlock/qcom_hwspinlock.c
@@ -70,41 +70,79 @@ static const struct of_device_id qcom_hwspinlock_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, qcom_hwspinlock_of_match);
 
-static int qcom_hwspinlock_probe(struct platform_device *pdev)
+static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
+						   u32 *base, u32 *stride)
 {
-	struct hwspinlock_device *bank;
 	struct device_node *syscon;
-	struct reg_field field;
 	struct regmap *regmap;
-	size_t array_size;
-	u32 stride;
-	u32 base;
 	int ret;
-	int i;
 
 	syscon = of_parse_phandle(pdev->dev.of_node, "syscon", 0);
-	if (!syscon) {
-		dev_err(&pdev->dev, "no syscon property\n");
-		return -ENODEV;
-	}
+	if (!syscon)
+		return ERR_PTR(-ENODEV);
 
 	regmap = syscon_node_to_regmap(syscon);
 	of_node_put(syscon);
 	if (IS_ERR(regmap))
-		return PTR_ERR(regmap);
+		return regmap;
 
-	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, &base);
+	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, base);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "no offset in syscon\n");
-		return -EINVAL;
+		return ERR_PTR(-EINVAL);
 	}
 
-	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 2, &stride);
+	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 2, stride);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "no stride syscon\n");
-		return -EINVAL;
+		return ERR_PTR(-EINVAL);
 	}
 
+	return regmap;
+}
+
+static const struct regmap_config tcsr_mutex_config = {
+	.reg_bits		= 32,
+	.reg_stride		= 4,
+	.val_bits		= 32,
+	.max_register		= 0x40000,
+	.fast_io		= true,
+};
+
+static struct regmap *qcom_hwspinlock_probe_mmio(struct platform_device *pdev,
+						 u32 *offset, u32 *stride)
+{
+	struct device *dev = &pdev->dev;
+	void __iomem *base;
+
+	/* All modern platform has offset 0 and stride of 4k */
+	*offset = 0;
+	*stride = 0x1000;
+
+	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);
+}
+
+static int qcom_hwspinlock_probe(struct platform_device *pdev)
+{
+	struct hwspinlock_device *bank;
+	struct reg_field field;
+	struct regmap *regmap;
+	size_t array_size;
+	u32 stride;
+	u32 base;
+	int i;
+
+	regmap = qcom_hwspinlock_probe_syscon(pdev, &base, &stride);
+	if (IS_ERR(regmap) && PTR_ERR(regmap) == -ENODEV)
+		regmap = qcom_hwspinlock_probe_mmio(pdev, &base, &stride);
+
+	if (IS_ERR(regmap))
+		return PTR_ERR(regmap);
+
 	array_size = QCOM_MUTEX_NUM_LOCKS * sizeof(struct hwspinlock);
 	bank = devm_kzalloc(&pdev->dev, sizeof(*bank) + array_size, GFP_KERNEL);
 	if (!bank)
-- 
2.26.2


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

* [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon
  2020-06-22  7:59 [PATCH v2 0/4] hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon Bjorn Andersson
                   ` (2 preceding siblings ...)
  2020-06-22  7:59 ` [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon Bjorn Andersson
@ 2020-06-22  7:59 ` Bjorn Andersson
  2020-07-15 19:36   ` Dmitry Baryshkov
  2020-07-16  2:59   ` Manivannan Sadhasivam
  3 siblings, 2 replies; 14+ messages in thread
From: Bjorn Andersson @ 2020-06-22  7:59 UTC (permalink / raw)
  To: Andy Gross, Bjorn Andersson, Ohad Ben-Cohen, Baolin Wang, Rob Herring
  Cc: linux-arm-msm, linux-remoteproc, devicetree, linux-kernel

Now that we don't need the intermediate syscon to represent the TCSR
mutexes, update the dts to describe the TCSR mutex directly under /soc.

The change also fixes the sort order of the nodes.

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

Changs since v1:
- Adjusted sort order of the nodes

 arch/arm64/boot/dts/qcom/sm8250.dtsi | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi
index 7050adba7995..67a1b6f3301b 100644
--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
@@ -144,12 +144,6 @@ scm: scm {
 		};
 	};
 
-	tcsr_mutex: hwlock {
-		compatible = "qcom,tcsr-mutex";
-		syscon = <&tcsr_mutex_regs 0 0x1000>;
-		#hwlock-cells = <1>;
-	};
-
 	memory@80000000 {
 		device_type = "memory";
 		/* We expect the bootloader to fill in the size */
@@ -376,6 +370,12 @@ ufs_mem_phy_lanes: lanes@1d87400 {
 			};
 		};
 
+		tcsr_mutex: hwlock@1f40000 {
+			compatible = "qcom,tcsr-mutex";
+			reg = <0x0 0x01f40000 0x0 0x40000>;
+			#hwlock-cells = <1>;
+		};
+
 		intc: interrupt-controller@17a00000 {
 			compatible = "arm,gic-v3";
 			#interrupt-cells = <3>;
@@ -486,11 +486,6 @@ rpmhpd_opp_turbo_l1: opp10 {
 			};
 		};
 
-		tcsr_mutex_regs: syscon@1f40000 {
-			compatible = "syscon";
-			reg = <0x0 0x01f40000 0x0 0x40000>;
-		};
-
 		timer@17c20000 {
 			#address-cells = <2>;
 			#size-cells = <2>;
-- 
2.26.2


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

* Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
  2020-06-22  7:59 ` [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML Bjorn Andersson
@ 2020-07-14  2:09   ` Rob Herring
  2020-07-21 15:13   ` Rob Herring
  1 sibling, 0 replies; 14+ messages in thread
From: Rob Herring @ 2020-07-14  2:09 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Baolin Wang, linux-arm-msm, Rob Herring, Vinod Koul,
	linux-kernel, Ohad Ben-Cohen, linux-remoteproc, devicetree,
	Andy Gross

On Mon, 22 Jun 2020 00:59:53 -0700, Bjorn Andersson wrote:
> Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
> 
> Reviewed-by: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> 
> Changes since v1:
> - Actually remove the old binding doc
> 
>  .../bindings/hwlock/qcom-hwspinlock.txt       | 39 --------------
>  .../bindings/hwlock/qcom-hwspinlock.yaml      | 51 +++++++++++++++++++
>  2 files changed, 51 insertions(+), 39 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
>  create mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 2/4] dt-bindings: hwlock: qcom: Allow device on mmio bus
  2020-06-22  7:59 ` [PATCH v2 2/4] dt-bindings: hwlock: qcom: Allow device on mmio bus Bjorn Andersson
@ 2020-07-14  2:10   ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2020-07-14  2:10 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: linux-remoteproc, linux-kernel, Ohad Ben-Cohen, Baolin Wang,
	Vinod Koul, devicetree, Andy Gross, Rob Herring, linux-arm-msm

On Mon, 22 Jun 2020 00:59:54 -0700, Bjorn Andersson wrote:
> In modern Qualcomm platforms the mutex region of the TCSR is forked off
> into its own block, all with a offset of 0 and stride of 4096, and in
> some of these platforms no other registers in this region is accessed
> from Linux.
> 
> Update the binding to allow the hardware block to be described directly
> on the mmio bus, in addition to allowing the existing syscon based
> definition for backwards compatibility.
> 
> Reviewed-by: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> 
> Changes since v1:
> - None
> 
>  .../bindings/hwlock/qcom-hwspinlock.yaml         | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 

Reviewed-by: Rob Herring <robh@kernel.org>

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

* Re: [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon
  2020-06-22  7:59 ` [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon Bjorn Andersson
@ 2020-07-14 16:04   ` Stephan Gerhold
  2020-07-14 16:33     ` Bjorn Andersson
  0 siblings, 1 reply; 14+ messages in thread
From: Stephan Gerhold @ 2020-07-14 16:04 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Ohad Ben-Cohen, Baolin Wang, Rob Herring,
	linux-arm-msm, linux-remoteproc, devicetree, linux-kernel,
	Vinod Koul

Hi Bjorn,

On Mon, Jun 22, 2020 at 12:59:55AM -0700, Bjorn Andersson wrote:
> In modern Qualcomm platforms the mutex region of the TCSR is forked off
> into its own block, all with a offset of 0 and stride of 4096, and in
> some of these platforms no other registers in this region is accessed
> from Linux.
> 
> So add support for directly memory mapping this register space, to avoid
> the need to represent this block using a syscon.
> 
> Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
> Reviewed-by: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
> 
> Changes since v1:
> - Use devm_platform_ioremap_resource()
> 
>  drivers/hwspinlock/qcom_hwspinlock.c | 70 +++++++++++++++++++++-------
>  1 file changed, 54 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
> index f0da544b14d2..364710966665 100644
> --- a/drivers/hwspinlock/qcom_hwspinlock.c
> +++ b/drivers/hwspinlock/qcom_hwspinlock.c
> @@ -70,41 +70,79 @@ static const struct of_device_id qcom_hwspinlock_of_match[] = {
>  };
>  MODULE_DEVICE_TABLE(of, qcom_hwspinlock_of_match);
>  
> -static int qcom_hwspinlock_probe(struct platform_device *pdev)
> +static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
> +						   u32 *base, u32 *stride)
>  {
> -	struct hwspinlock_device *bank;
>  	struct device_node *syscon;
> -	struct reg_field field;
>  	struct regmap *regmap;
> -	size_t array_size;
> -	u32 stride;
> -	u32 base;
>  	int ret;
> -	int i;
>  
>  	syscon = of_parse_phandle(pdev->dev.of_node, "syscon", 0);
> -	if (!syscon) {
> -		dev_err(&pdev->dev, "no syscon property\n");
> -		return -ENODEV;
> -	}
> +	if (!syscon)
> +		return ERR_PTR(-ENODEV);
>  
>  	regmap = syscon_node_to_regmap(syscon);
>  	of_node_put(syscon);
>  	if (IS_ERR(regmap))
> -		return PTR_ERR(regmap);
> +		return regmap;
>  
> -	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, &base);
> +	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, base);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "no offset in syscon\n");
> -		return -EINVAL;
> +		return ERR_PTR(-EINVAL);
>  	}
>  
> -	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 2, &stride);
> +	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 2, stride);
>  	if (ret < 0) {
>  		dev_err(&pdev->dev, "no stride syscon\n");
> -		return -EINVAL;
> +		return ERR_PTR(-EINVAL);
>  	}
>  
> +	return regmap;
> +}
> +
> +static const struct regmap_config tcsr_mutex_config = {
> +	.reg_bits		= 32,
> +	.reg_stride		= 4,
> +	.val_bits		= 32,
> +	.max_register		= 0x40000,

Where does the 0x40000 come from?

It seems like this driver has QCOM_MUTEX_NUM_LOCKS = 32 hardcoded.
With a stride of 4096 = 0x1000 you get 0x1000 * 32 = 0x20000.

This is also the reg size used in msm8996.dtsi and msm8916.dtsi for
example, while sdm845.dtsi and sm8250.dtsi specify 0x40000.
Are you not exposing all available locks on the newer SoCs?

I'm not sure how important max_register is... But I guess it should be
either correct for all SoCs or not specified at all (since it's
optional)?

(That is assuming the hwlock can be also used directly via MMIO on
 MSM8996 and MSM8916. It looks to me like it has its own register
 space there as well...)

Thanks,
Stephan

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

* Re: [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon
  2020-07-14 16:04   ` Stephan Gerhold
@ 2020-07-14 16:33     ` Bjorn Andersson
  0 siblings, 0 replies; 14+ messages in thread
From: Bjorn Andersson @ 2020-07-14 16:33 UTC (permalink / raw)
  To: Stephan Gerhold
  Cc: Andy Gross, Ohad Ben-Cohen, Baolin Wang, Rob Herring,
	linux-arm-msm, linux-remoteproc, devicetree, linux-kernel,
	Vinod Koul

On Tue 14 Jul 09:04 PDT 2020, Stephan Gerhold wrote:

> Hi Bjorn,
> 
> On Mon, Jun 22, 2020 at 12:59:55AM -0700, Bjorn Andersson wrote:
> > In modern Qualcomm platforms the mutex region of the TCSR is forked off
> > into its own block, all with a offset of 0 and stride of 4096, and in
> > some of these platforms no other registers in this region is accessed
> > from Linux.
> > 
> > So add support for directly memory mapping this register space, to avoid
> > the need to represent this block using a syscon.
> > 
> > Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
> > Reviewed-by: Vinod Koul <vkoul@kernel.org>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> > 
> > Changes since v1:
> > - Use devm_platform_ioremap_resource()
> > 
> >  drivers/hwspinlock/qcom_hwspinlock.c | 70 +++++++++++++++++++++-------
> >  1 file changed, 54 insertions(+), 16 deletions(-)
> > 
> > diff --git a/drivers/hwspinlock/qcom_hwspinlock.c b/drivers/hwspinlock/qcom_hwspinlock.c
> > index f0da544b14d2..364710966665 100644
> > --- a/drivers/hwspinlock/qcom_hwspinlock.c
> > +++ b/drivers/hwspinlock/qcom_hwspinlock.c
> > @@ -70,41 +70,79 @@ static const struct of_device_id qcom_hwspinlock_of_match[] = {
> >  };
> >  MODULE_DEVICE_TABLE(of, qcom_hwspinlock_of_match);
> >  
> > -static int qcom_hwspinlock_probe(struct platform_device *pdev)
> > +static struct regmap *qcom_hwspinlock_probe_syscon(struct platform_device *pdev,
> > +						   u32 *base, u32 *stride)
> >  {
> > -	struct hwspinlock_device *bank;
> >  	struct device_node *syscon;
> > -	struct reg_field field;
> >  	struct regmap *regmap;
> > -	size_t array_size;
> > -	u32 stride;
> > -	u32 base;
> >  	int ret;
> > -	int i;
> >  
> >  	syscon = of_parse_phandle(pdev->dev.of_node, "syscon", 0);
> > -	if (!syscon) {
> > -		dev_err(&pdev->dev, "no syscon property\n");
> > -		return -ENODEV;
> > -	}
> > +	if (!syscon)
> > +		return ERR_PTR(-ENODEV);
> >  
> >  	regmap = syscon_node_to_regmap(syscon);
> >  	of_node_put(syscon);
> >  	if (IS_ERR(regmap))
> > -		return PTR_ERR(regmap);
> > +		return regmap;
> >  
> > -	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, &base);
> > +	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 1, base);
> >  	if (ret < 0) {
> >  		dev_err(&pdev->dev, "no offset in syscon\n");
> > -		return -EINVAL;
> > +		return ERR_PTR(-EINVAL);
> >  	}
> >  
> > -	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 2, &stride);
> > +	ret = of_property_read_u32_index(pdev->dev.of_node, "syscon", 2, stride);
> >  	if (ret < 0) {
> >  		dev_err(&pdev->dev, "no stride syscon\n");
> > -		return -EINVAL;
> > +		return ERR_PTR(-EINVAL);
> >  	}
> >  
> > +	return regmap;
> > +}
> > +
> > +static const struct regmap_config tcsr_mutex_config = {
> > +	.reg_bits		= 32,
> > +	.reg_stride		= 4,
> > +	.val_bits		= 32,
> > +	.max_register		= 0x40000,
> 
> Where does the 0x40000 come from?
> 

I presumably copied it off the dts I was looking (sm8250) as I wrote
this, but...

> It seems like this driver has QCOM_MUTEX_NUM_LOCKS = 32 hardcoded.
> With a stride of 4096 = 0x1000 you get 0x1000 * 32 = 0x20000.
> 
> This is also the reg size used in msm8996.dtsi and msm8916.dtsi for
> example, while sdm845.dtsi and sm8250.dtsi specify 0x40000.
> Are you not exposing all available locks on the newer SoCs?
> 
> I'm not sure how important max_register is... But I guess it should be
> either correct for all SoCs or not specified at all (since it's
> optional)?
> 

...you're right. I think it should be omitted.

> (That is assuming the hwlock can be also used directly via MMIO on
>  MSM8996 and MSM8916. It looks to me like it has its own register
>  space there as well...)
> 

If used on e.g. MSM8996 we still need to make sure the syscon is there,
so that the modem subsystem halt registers is available to the mpss
remoteproc. But specifying compatible as "qcom,tcsr-mutex", "syscon";
would use the new scheme and still would allow that access.


I merged patch 1-3 yesterday, so it would have to be an incremental
patch. I've put it on my todo list, but if you write up a patch I'd be
happy to merge it :)

Thanks,
Bjorn

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

* Re: [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon
  2020-06-22  7:59 ` [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon Bjorn Andersson
@ 2020-07-15 19:36   ` Dmitry Baryshkov
  2020-07-16  2:59   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 14+ messages in thread
From: Dmitry Baryshkov @ 2020-07-15 19:36 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Ohad Ben-Cohen, Baolin Wang, Rob Herring,
	open list:DRM DRIVER FOR MSM ADRENO GPU, linux-remoteproc,
	open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	open list

On Mon, 22 Jun 2020 at 11:00, Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> Now that we don't need the intermediate syscon to represent the TCSR
> mutexes, update the dts to describe the TCSR mutex directly under /soc.
>
> The change also fixes the sort order of the nodes.
>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>


-- 
With best wishes
Dmitry

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

* Re: [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon
  2020-06-22  7:59 ` [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon Bjorn Andersson
  2020-07-15 19:36   ` Dmitry Baryshkov
@ 2020-07-16  2:59   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 14+ messages in thread
From: Manivannan Sadhasivam @ 2020-07-16  2:59 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Ohad Ben-Cohen, Baolin Wang, Rob Herring,
	linux-arm-msm, linux-remoteproc, devicetree, linux-kernel

On Mon, Jun 22, 2020 at 12:59:56AM -0700, Bjorn Andersson wrote:
> Now that we don't need the intermediate syscon to represent the TCSR
> mutexes, update the dts to describe the TCSR mutex directly under /soc.
> 
> The change also fixes the sort order of the nodes.
> 
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
> 
> Changs since v1:
> - Adjusted sort order of the nodes
> 
>  arch/arm64/boot/dts/qcom/sm8250.dtsi | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi
> index 7050adba7995..67a1b6f3301b 100644
> --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
> +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
> @@ -144,12 +144,6 @@ scm: scm {
>  		};
>  	};
>  
> -	tcsr_mutex: hwlock {
> -		compatible = "qcom,tcsr-mutex";
> -		syscon = <&tcsr_mutex_regs 0 0x1000>;
> -		#hwlock-cells = <1>;
> -	};
> -
>  	memory@80000000 {
>  		device_type = "memory";
>  		/* We expect the bootloader to fill in the size */
> @@ -376,6 +370,12 @@ ufs_mem_phy_lanes: lanes@1d87400 {
>  			};
>  		};
>  
> +		tcsr_mutex: hwlock@1f40000 {
> +			compatible = "qcom,tcsr-mutex";
> +			reg = <0x0 0x01f40000 0x0 0x40000>;
> +			#hwlock-cells = <1>;
> +		};
> +
>  		intc: interrupt-controller@17a00000 {
>  			compatible = "arm,gic-v3";
>  			#interrupt-cells = <3>;
> @@ -486,11 +486,6 @@ rpmhpd_opp_turbo_l1: opp10 {
>  			};
>  		};
>  
> -		tcsr_mutex_regs: syscon@1f40000 {
> -			compatible = "syscon";
> -			reg = <0x0 0x01f40000 0x0 0x40000>;
> -		};
> -
>  		timer@17c20000 {
>  			#address-cells = <2>;
>  			#size-cells = <2>;
> -- 
> 2.26.2
> 

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

* Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
  2020-06-22  7:59 ` [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML Bjorn Andersson
  2020-07-14  2:09   ` Rob Herring
@ 2020-07-21 15:13   ` Rob Herring
  2020-07-22  4:46     ` Bjorn Andersson
  1 sibling, 1 reply; 14+ messages in thread
From: Rob Herring @ 2020-07-21 15:13 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM, devicetree,
	linux-kernel, Vinod Koul

On Mon, Jun 22, 2020 at 1:59 AM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
>
> Reviewed-by: Vinod Koul <vkoul@kernel.org>
> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> ---
>
> Changes since v1:
> - Actually remove the old binding doc
>
>  .../bindings/hwlock/qcom-hwspinlock.txt       | 39 --------------
>  .../bindings/hwlock/qcom-hwspinlock.yaml      | 51 +++++++++++++++++++
>  2 files changed, 51 insertions(+), 39 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
>  create mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml

[...]

> diff --git a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> new file mode 100644
> index 000000000000..71e63b52edd5
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> @@ -0,0 +1,51 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwlock/qcom-hwspinlock.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Qualcomm Hardware Mutex Block
> +
> +maintainers:
> +  - Bjorn Andersson <bjorn.andersson@linaro.org>
> +
> +description:
> +  The hardware block provides mutexes utilized between different processors on
> +  the SoC as part of the communication protocol used by these processors.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - qcom,sfpb-mutex
> +      - qcom,tcsr-mutex
> +
> +  '#hwlock-cells':
> +    const: 1
> +
> +  syscon:
> +    $ref: "/schemas/types.yaml#/definitions/phandle-array"
> +    description:
> +      Should be a triple of phandle referencing the TCSR mutex syscon, offset
> +      of first mutex within the syscon and stride between each mutex.
> +
> +required:
> +  - compatible
> +  - '#hwlock-cells'
> +  - syscon
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +        tcsr_mutex_block: syscon@fd484000 {
> +                compatible = "syscon";

'syscon' alone now generates warnings. Can you drop this node or add a
specific compatible.

> +                reg = <0xfd484000 0x2000>;
> +        };
> +
> +        hwlock {
> +                compatible = "qcom,tcsr-mutex";
> +                syscon = <&tcsr_mutex_block 0 0x80>;
> +
> +                #hwlock-cells = <1>;
> +        };
> +...
> --
> 2.26.2
>

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

* Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
  2020-07-21 15:13   ` Rob Herring
@ 2020-07-22  4:46     ` Bjorn Andersson
  2020-07-22 14:42       ` Rob Herring
  0 siblings, 1 reply; 14+ messages in thread
From: Bjorn Andersson @ 2020-07-22  4:46 UTC (permalink / raw)
  To: Rob Herring
  Cc: Andy Gross, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM, devicetree,
	linux-kernel, Vinod Koul

On Tue 21 Jul 08:13 PDT 2020, Rob Herring wrote:

> On Mon, Jun 22, 2020 at 1:59 AM Bjorn Andersson
> <bjorn.andersson@linaro.org> wrote:
> >
> > Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
> >
> > Reviewed-by: Vinod Koul <vkoul@kernel.org>
> > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > ---
> >
> > Changes since v1:
> > - Actually remove the old binding doc
> >
> >  .../bindings/hwlock/qcom-hwspinlock.txt       | 39 --------------
> >  .../bindings/hwlock/qcom-hwspinlock.yaml      | 51 +++++++++++++++++++
> >  2 files changed, 51 insertions(+), 39 deletions(-)
> >  delete mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
> >  create mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> 
> [...]
> 
> > diff --git a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> > new file mode 100644
> > index 000000000000..71e63b52edd5
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> > @@ -0,0 +1,51 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/hwlock/qcom-hwspinlock.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Qualcomm Hardware Mutex Block
> > +
> > +maintainers:
> > +  - Bjorn Andersson <bjorn.andersson@linaro.org>
> > +
> > +description:
> > +  The hardware block provides mutexes utilized between different processors on
> > +  the SoC as part of the communication protocol used by these processors.
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - qcom,sfpb-mutex
> > +      - qcom,tcsr-mutex
> > +
> > +  '#hwlock-cells':
> > +    const: 1
> > +
> > +  syscon:
> > +    $ref: "/schemas/types.yaml#/definitions/phandle-array"
> > +    description:
> > +      Should be a triple of phandle referencing the TCSR mutex syscon, offset
> > +      of first mutex within the syscon and stride between each mutex.
> > +
> > +required:
> > +  - compatible
> > +  - '#hwlock-cells'
> > +  - syscon
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +        tcsr_mutex_block: syscon@fd484000 {
> > +                compatible = "syscon";
> 
> 'syscon' alone now generates warnings. Can you drop this node or add a
> specific compatible.
> 

In the binding examples or in the dts files as well?

The hardware block here is named "TCSR_MUTEX", so the natural compatible
to add here would be "qcom,tcsr-mutex", but that already has a meaning -
and the syscon node here doesn't carry all required properties...


Should we perhaps just remove the split model (syscon and
qcom,tcsr-mutex as different nodes) from the example and dts files?
(While maintaining backwards compatibility in the binding and driver)

For the platforms where we have other drivers that needs to poke in this
syscon it seems to work fine to say:
	compatible = "qcom,tcsr-mutex", "syscon";

Regards,
Bjorn

> > +                reg = <0xfd484000 0x2000>;
> > +        };
> > +
> > +        hwlock {
> > +                compatible = "qcom,tcsr-mutex";
> > +                syscon = <&tcsr_mutex_block 0 0x80>;
> > +
> > +                #hwlock-cells = <1>;
> > +        };
> > +...
> > --
> > 2.26.2
> >

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

* Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
  2020-07-22  4:46     ` Bjorn Andersson
@ 2020-07-22 14:42       ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2020-07-22 14:42 UTC (permalink / raw)
  To: Bjorn Andersson
  Cc: Andy Gross, Ohad Ben-Cohen, Baolin Wang, linux-arm-msm,
	open list:REMOTE PROCESSOR (REMOTEPROC) SUBSYSTEM, devicetree,
	linux-kernel, Vinod Koul

On Tue, Jul 21, 2020 at 10:48 PM Bjorn Andersson
<bjorn.andersson@linaro.org> wrote:
>
> On Tue 21 Jul 08:13 PDT 2020, Rob Herring wrote:
>
> > On Mon, Jun 22, 2020 at 1:59 AM Bjorn Andersson
> > <bjorn.andersson@linaro.org> wrote:
> > >
> > > Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
> > >
> > > Reviewed-by: Vinod Koul <vkoul@kernel.org>
> > > Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
> > > ---
> > >
> > > Changes since v1:
> > > - Actually remove the old binding doc
> > >
> > >  .../bindings/hwlock/qcom-hwspinlock.txt       | 39 --------------
> > >  .../bindings/hwlock/qcom-hwspinlock.yaml      | 51 +++++++++++++++++++
> > >  2 files changed, 51 insertions(+), 39 deletions(-)
> > >  delete mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt
> > >  create mode 100644 Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> >
> > [...]
> >
> > > diff --git a/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> > > new file mode 100644
> > > index 000000000000..71e63b52edd5
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml
> > > @@ -0,0 +1,51 @@
> > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/hwlock/qcom-hwspinlock.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Qualcomm Hardware Mutex Block
> > > +
> > > +maintainers:
> > > +  - Bjorn Andersson <bjorn.andersson@linaro.org>
> > > +
> > > +description:
> > > +  The hardware block provides mutexes utilized between different processors on
> > > +  the SoC as part of the communication protocol used by these processors.
> > > +
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - qcom,sfpb-mutex
> > > +      - qcom,tcsr-mutex
> > > +
> > > +  '#hwlock-cells':
> > > +    const: 1
> > > +
> > > +  syscon:
> > > +    $ref: "/schemas/types.yaml#/definitions/phandle-array"
> > > +    description:
> > > +      Should be a triple of phandle referencing the TCSR mutex syscon, offset
> > > +      of first mutex within the syscon and stride between each mutex.
> > > +
> > > +required:
> > > +  - compatible
> > > +  - '#hwlock-cells'
> > > +  - syscon
> > > +
> > > +additionalProperties: false
> > > +
> > > +examples:
> > > +  - |
> > > +        tcsr_mutex_block: syscon@fd484000 {
> > > +                compatible = "syscon";
> >
> > 'syscon' alone now generates warnings. Can you drop this node or add a
> > specific compatible.
> >
>
> In the binding examples or in the dts files as well?

Both, but only the examples need to be warning free at this point. So
just dropping the node in the example is enough and you can solve this
for dts files later if you wish.

> The hardware block here is named "TCSR_MUTEX", so the natural compatible
> to add here would be "qcom,tcsr-mutex", but that already has a meaning -
> and the syscon node here doesn't carry all required properties...

So you have 2 nodes pointing to the same h/w? Also a no-no...

> Should we perhaps just remove the split model (syscon and
> qcom,tcsr-mutex as different nodes) from the example and dts files?
> (While maintaining backwards compatibility in the binding and driver)
>
> For the platforms where we have other drivers that needs to poke in this
> syscon it seems to work fine to say:
>         compatible = "qcom,tcsr-mutex", "syscon";

Yes. 'syscon' just means automagically create a regmap.

Rob

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

end of thread, back to index

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22  7:59 [PATCH v2 0/4] hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon Bjorn Andersson
2020-06-22  7:59 ` [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML Bjorn Andersson
2020-07-14  2:09   ` Rob Herring
2020-07-21 15:13   ` Rob Herring
2020-07-22  4:46     ` Bjorn Andersson
2020-07-22 14:42       ` Rob Herring
2020-06-22  7:59 ` [PATCH v2 2/4] dt-bindings: hwlock: qcom: Allow device on mmio bus Bjorn Andersson
2020-07-14  2:10   ` Rob Herring
2020-06-22  7:59 ` [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon Bjorn Andersson
2020-07-14 16:04   ` Stephan Gerhold
2020-07-14 16:33     ` Bjorn Andersson
2020-06-22  7:59 ` [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon Bjorn Andersson
2020-07-15 19:36   ` Dmitry Baryshkov
2020-07-16  2:59   ` Manivannan Sadhasivam

Linux-remoteproc Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-remoteproc/0 linux-remoteproc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-remoteproc linux-remoteproc/ https://lore.kernel.org/linux-remoteproc \
		linux-remoteproc@vger.kernel.org
	public-inbox-index linux-remoteproc

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-remoteproc


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git