hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon
Subsystems (4)
v2 cover hwspinlock: qcom: Allow dropping the intermediate TCSR mutex syscon
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
Signature · 1 line
2.26.2
PATCH v2 1/4 dt-bindings: hwlock: qcom: Migrate binding to YAML
Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
---
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
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.txt deleted +0 -39
@@ -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>; - };
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +51 -0
51 lines not on this page · raw message
Signature · 1 line
2.26.2
Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
Quoted 6 lines · Bjorn Andersson
Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
Reviewed-by Vinod Koul <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>---
Quoted 9 lines
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
Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
In reply to Bjorn AnderssonQuoted 15 lines · Bjorn Andersson
Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
Reviewed-by Vinod Koul <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>---
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
[...]
Quoted 37 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +31
-0@@ -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 <[email protected]> + +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:
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml line 41
Quoted 10 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +10
-0+ - 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.
Quoted 13 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +10
-1+ reg = <0xfd484000 0x2000>; + }; + + hwlock { + compatible = "qcom,tcsr-mutex"; + syscon = <&tcsr_mutex_block 0 0x80>; + + #hwlock-cells = <1>; + }; +... --2.26.2
Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
Quoted 62 lines · Rob Herring
Quoted 15 lines · Bjorn Andersson
Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
Reviewed-by Vinod Koul <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>---
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[...]
Quoted 42 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +36
-0@@ -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 <[email protected]> + +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
Quoted 9 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml line 41
Quoted 5 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +5
-0+ +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
Quoted 13 lines
Quoted 13 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +10
-1+ reg = <0xfd484000 0x2000>; + }; + + hwlock { + compatible = "qcom,tcsr-mutex"; + syscon = <&tcsr_mutex_block 0 0x80>; + + #hwlock-cells = <1>; + }; +... --2.26.2
Re: [PATCH v2 1/4] dt-bindings: hwlock: qcom: Migrate binding to YAML
Quoted 75 lines · Bjorn Andersson
Quoted 62 lines · Rob Herring
Quoted 15 lines · Bjorn Andersson
Migrate the Qualcomm TCSR mutex binding to YAML to allow validation.
Reviewed-by Vinod Koul <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>---
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[...]
Quoted 42 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +36
-0@@ -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 <[email protected]> + +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: falseQuoted 9 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml line 41
Quoted 5 lines
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml new file +5
-0+ +examples: + - | + tcsr_mutex_block: syscon@fd484000 { + compatible = "syscon";'syscon' alone now generates warnings. Can you drop this node or add a specific compatible.
Quoted 1 line
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.
Quoted 3 lines
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...
Quoted 7 lines
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
PATCH v2 2/4 dt-bindings: hwlock: qcom: Allow device on mmio bus
In reply to Bjorn AnderssonIn 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.
---
Changes since v1:
- None
.../bindings/hwlock/qcom-hwspinlock.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/hwlock/qcom-hwspinlock.yaml +15 -1
@@ -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>; }; ...
Signature · 1 line
2.26.2
Re: [PATCH v2 2/4] dt-bindings: hwlock: qcom: Allow device on mmio bus
Quoted 11 lines · Bjorn Andersson
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 <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>
Quoted 8 lines
---
Changes since v1:
- None.../bindings/hwlock/qcom-hwspinlock.yaml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
PATCH v2 3/4 hwspinlock: qcom: Allow mmio usage in addition to syscon
In reply to Bjorn AnderssonIn 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.
---
Changes since v1:
- Use devm_platform_ioremap_resource()
drivers/hwspinlock/qcom_hwspinlock.c | 70 +++++++++++++++++++++------- 1 file changed, 54 insertions(+), 16 deletions(-)
drivers/hwspinlock/qcom_hwspinlock.c +54 -16
@@ -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)
Signature · 1 line
2.26.2
Re: [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon
Hi Bjorn,
Quoted 69 lines · Bjorn Andersson
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 <[email protected]>Reviewed-by Vinod Koul <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>---
Changes since v1:
- Usedevm_platform_ioremap_resource()drivers/hwspinlock/qcom_hwspinlock.c | 70 +++++++++++++++++++++------- 1 file changed, 54 insertions(+), 16 deletions(-)drivers/hwspinlock/qcom_hwspinlock.c +9
-16@@ -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 );
drivers/hwspinlock/qcom_hwspinlock.c static const struct of_device_id qcom_hwspinlock_of_match[] = { · line 108
Quoted 10 lines
drivers/hwspinlock/qcom_hwspinlock.c +8
-0} +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
Re: [PATCH v2 3/4] hwspinlock: qcom: Allow mmio usage in addition to syscon
Quoted 74 lines · Stephan Gerhold
Hi Bjorn,
Quoted 71 lines · Bjorn Andersson
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 <[email protected]>Reviewed-by Vinod Koul <[email protected]>Signed-off-by Bjorn Andersson <[email protected]>---
Changes since v1:
- Usedevm_platform_ioremap_resource()drivers/hwspinlock/qcom_hwspinlock.c | 70 +++++++++++++++++++++------- 1 file changed, 54 insertions(+), 16 deletions(-)drivers/hwspinlock/qcom_hwspinlock.c +9
-16@@ -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 ); }
Quoted 11 lines
drivers/hwspinlock/qcom_hwspinlock.c static const struct of_device_id qcom_hwspinlock_of_match[] = { · line 108
Quoted 8 lines
drivers/hwspinlock/qcom_hwspinlock.c +8
-0+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
0x40000come from?
I presumably copied it off the dts I was looking (sm8250) as I wrote this, but...
Quoted 11 lines
It seems like this driver has
QCOM_MUTEX_NUM_LOCKS= 32 hardcoded. With a stride of 4096 =0x1000you get0x1000* 32 =0x20000.This is also the reg size used in
msm8996.dtsiandmsm8916.dtsifor example, whilesdm845.dtsiandsm8250.dtsispecify0x40000. Are you not exposing all available locks on the newer SoCs?I'm not sure how important
max_registeris... 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.
Quoted 4 lines
(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
PATCH v2 4/4 arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon
In reply to Bjorn AnderssonNow 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.
---
Changs since v1:
- Adjusted sort order of the nodes
arch/arm64/boot/dts/qcom/sm8250.dtsi | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
arch/arm64/boot/dts/qcom/sm8250.dtsi +6 -11
@@ -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>;
Signature · 1 line
2.26.2
Re: [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon
Quoted 7 lines · Bjorn Andersson
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 <[email protected]>
Signature · 2 lines
With best wishes Dmitry
Re: [PATCH v2 4/4] arm64: dts: qcom: sm8250: Drop tcsr_mutex syscon
In reply to Bjorn AnderssonQuoted 6 lines · Bjorn Andersson
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 <[email protected]>
Thanks,
Mani
Quoted 53 lines
---
Changs since v1:
- Adjusted sort order of the nodesarch/arm64/boot/dts/qcom/sm8250.dtsi | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)arch/arm64/boot/dts/qcom/sm8250.dtsi +6
-11@@ -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>;Signature · 1 line
2.26.2