Skip to contentSkip to conversation

drivers: hwspinlock: add CSR atlas7 implementation

PATCH In review Barry Song 4 participants 14 messages May 26, 2015 – Jun 12, 2015 8 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH v4 1/3 drivers: hwspinlock: add CSR atlas7 implementation

From: Wei Chen <[email protected]>

Add hwspinlock support for the CSR atlas7 SoC.

The Hardware Spinlock device on atlas7 provides hardware assistance for synchronization between the multiple processors in the system (dual Cortex-A7, CAN bus Cortex-M3 and audio DSP).

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>

---
-v4: fix the error handler for iomap;
fix a checkpatch issue;
thanks suman!

 drivers/hwspinlock/Kconfig           |  12 ++++
 drivers/hwspinlock/Makefile          |   1 +
 drivers/hwspinlock/sirf_hwspinlock.c | 136 +++++++++++++++++++++++++++++++++++
 3 files changed, 149 insertions(+)
 create mode 100644 drivers/hwspinlock/sirf_hwspinlock.c
drivers/hwspinlock/Kconfig +12 -0
index b5b4f52..73a4016 100644
@@ -30,6 +30,18 @@ config HWSPINLOCK_QCOM
 
 	  If unsure, say N.
 
+config HWSPINLOCK_SIRF
+	tristate "SIRF Hardware Spinlock device"
+	depends on ARCH_SIRF
+	select HWSPINLOCK
+	help
+	  Say y here to support the SIRF Hardware Spinlock device, which
+	  provides a synchronisation mechanism for the various processors
+	  on the SoC.
+
+	  It's safe to say n here if you're not interested in SIRF hardware
+	  spinlock or just want a bare minimum kernel.
+
 config HSEM_U8500
 	tristate "STE Hardware Semaphore functionality"
 	depends on ARCH_U8500
drivers/hwspinlock/Makefile +1 -0
index 68f95d9..6b59cb5a 100644
@@ -5,4 +5,5 @@
 obj-$(CONFIG_HWSPINLOCK)		+= hwspinlock_core.o
 obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_QCOM)		+= qcom_hwspinlock.o
+obj-$(CONFIG_HWSPINLOCK_SIRF)		+= sirf_hwspinlock.o
 obj-$(CONFIG_HSEM_U8500)		+= u8500_hsem.o
drivers/hwspinlock/sirf_hwspinlock.c new file +136 -0

136 lines not on this page · raw message

Signature · 6 lines
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#2 lore raw

PATCH v4 2/3 Documentation: dt: add the CSR atlas7 hwspinlock bindings document

In reply to a message not in the archive

From: Wei Chen <[email protected]>

The Hardware Spinlock device on atlas7 provides hardware assistance for synchronization between the multiple processors in the system (dual Cortex-A7, CAN bus Cortex-M3 and audio DSP).
This patch adds the DT bindings information for this hwspinlock module.

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>

---
-v4: add description for "#hwlock-cells"
thanks suman!

 .../devicetree/bindings/hwlock/sirf,hwspinlock.txt | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/sirf,hwspinlock.txt
Documentation/devicetree/bindings/hwlock/sirf,hwspinlock.txt new file +28 -0
new file mode 100644
index 0000000..9bb1240a6
@@ -0,0 +1,28 @@
+SIRF Hardware spinlock device Binding
+-----------------------------------------------
+
+Required properties :
+- compatible : shall contain only one of the following:
+	"sirf,hwspinlock"
+
+- reg : the register address of hwspinlock
+
+- #hwlock-cells : hwlock users only use the hwlock id to represent a specific
+	hwlock, so the number of cells should be <1> here.
+
+Please look at the generic hwlock binding for usage information for consumers,
+"Documentation/devicetree/bindings/hwlock/hwlock.txt"
+
+Example of hwlock provider:
+	hwlock {
+		compatible = "sirf,hwspinlock";
+		reg = <0x13240000 0x00010000>;
+		#hwlock-cells = <1>;
+	};
+
+Example of hwlock users:
+	node {
+		...
+		hwlocks = <&hwlock 2>;
+		...
+	};
Signature · 6 lines
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#6 lore raw

PATCH v3 3/3 ARM: dts: atlas7: use general dt-binding for hwspinlock

In reply to a message not in the archive

From: Wei Chen <[email protected]>

This patch moves to use generic dt-binding for hwspinlock providers and clients.
add #hwlock-cells for the provider and hwlocks for clients.

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>
---
 arch/arm/boot/dts/atlas7.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/atlas7.dtsi +3 -3
index a753178..66d3f0e 100644
@@ -84,17 +84,17 @@
 			#address-cells = <1>;
 			#size-cells = <1>;
 
-			hwspinlock {
+			hwlock: hwspinlock {
 				compatible = "sirf,hwspinlock";
 				reg = <0x13240000 0x00010000>;
-
-				num-spinlocks = <30>;
+				#hwlock-cells = <1>;
 			};
 
 			ns_m3_rproc@0 {
 				compatible = "sirf,ns2m30-rproc";
 				reg = <0x13240000 0x00010000>;
 				interrupts = <0 123 0>;
+				hwlocks = <&hwlock 0>, <&hwlock 1>;
 			};
 
 			ns_m3_rproc@1 {
Signature · 6 lines
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Reviewed-by
#18 lore raw
In reply to a message not in the archive
Quoted 4 lines · Barry Song

From: Wei Chen <[email protected]>

Add hwspinlock support for the CSR atlas7 SoC.

Quoted 8 lines

The Hardware Spinlock device on atlas7 provides hardware assistance for synchronization between the multiple processors in the system (dual Cortex-A7, CAN bus Cortex-M3 and audio DSP).

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>

regards
Suman

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#4 lore raw

Re: [PATCH v4 2/3] Documentation: dt: add the CSR atlas7 hwspinlock bindings document

In reply to a message not in the archive
Quoted 8 lines · Barry Song

From: Wei Chen <[email protected]>

The Hardware Spinlock device on atlas7 provides hardware assistance for synchronization between the multiple processors in the system (dual Cortex-A7, CAN bus Cortex-M3 and audio DSP).
This patch adds the DT bindings information for this hwspinlock module.

Quoted 5 lines
Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>

---

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#19 lore raw
In reply to a message not in the archive
Quoted 10 lines · Barry Song

From: Wei Chen <[email protected]>

Add hwspinlock support for the CSR atlas7 SoC.

The Hardware Spinlock device on atlas7 provides hardware assistance for synchronization between the multiple processors in the system (dual Cortex-A7, CAN bus Cortex-M3 and audio DSP).

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>
Quoted 3 lines

---

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by
#5 lore raw

Re: [PATCH v4 2/3] Documentation: dt: add the CSR atlas7 hwspinlock bindings document

In reply to a message not in the archive

On Tue, May 26, 2015 at 1:28 AM, Barry Song <[email protected]> wrote:
[..]

Quoted 1 line
Documentation/devicetree/bindings/hwlock/sirf,hwspinlock.txt +0 -0

[..]

Documentation/devicetree/bindings/hwlock/sirf,hwspinlock.txt

Quoted 3 lines

+- #hwlock-cells : hwlock users only use the hwlock id to represent a specific

Documentation/devicetree/bindings/hwlock/sirf,hwspinlock.txt +2 -0
+       hwlock, so the number of cells should be <1> here.
+

Jfyi, you could have gotten away with:

#hwlock-cells: must be 1

Quoted 2 lines

+Please look at the generic hwlock binding for usage information for consumers, +"Documentation/devicetree/bindings/hwlock/hwlock.txt"

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#8 lore raw

Re: [PATCH v3 3/3] ARM: dts: atlas7: use general dt-binding for hwspinlock

In reply to a message not in the archive

Barry,

Quoted 19 lines · Barry Song

From: Wei Chen <[email protected]>

This patch moves to use generic dt-binding for hwspinlock providers and clients.
add #hwlock-cells for the provider and hwlocks for clients.

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>
---
 arch/arm/boot/dts/atlas7.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/atlas7.dtsi +0 -0
index a753178..66d3f0e 100644

arch/arm/boot/dts/atlas7.dtsi line 89

Quoted 7 lines
arch/arm/boot/dts/atlas7.dtsi +1 -1
@@ -84,17 +84,17 @@
 			#address-cells = <1>;
 			#size-cells = <1>;
 
-			hwspinlock {
+			hwlock: hwspinlock {
 				compatible = "sirf,hwspinlock";
 				reg = <0x13240000 0x00010000>;

An unrelated question here, why the reg is same for all the child nodes of the parent ipc node? If this is partitioned properly, then the driver can be simplified a bit by using platform_get_resource and devm_ioremap_resource?

arch/arm/boot/dts/atlas7.dtsi line 97

Quoted 10 lines
arch/arm/boot/dts/atlas7.dtsi +2 -2
-
-				num-spinlocks = <30>;
+				#hwlock-cells = <1>;
 			};
 
 			ns_m3_rproc@0 {
 				compatible = "sirf,ns2m30-rproc";
 				reg = <0x13240000 0x00010000>;
 				interrupts = <0 123 0>;
+				hwlocks = <&hwlock 0>, <&hwlock 1>;

Does this need to be added for the other nodes like ns_m3_rproc@1 as well?

regards
Suman

arch/arm/boot/dts/atlas7.dtsi line 100

Quoted 4 lines
arch/arm/boot/dts/atlas7.dtsi +0 -0
 			};
 
 			ns_m3_rproc@1 {

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#10 lore raw

Re: [PATCH v3 3/3] ARM: dts: atlas7: use general dt-binding for hwspinlock

In reply to a message not in the archive

On Thu, May 28, 2015 at 2:30 PM, Suman Anna <[email protected]> wrote:
[..]

Quoted 7 lines
Quoted 1 line
                              reg = <0x13240000 0x00010000>;

An unrelated question here, why the reg is same for all the child nodes of the parent ipc node? If this is partitioned properly, then the driver can be simplified a bit by using platform_get_resource and devm_ioremap_resource?

Good catch Suman, I missed that.

Barry, if these blocks represents various functionalities of the same hw block then you should consider moving them to be part of a simple-mfd.

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#12 lore raw

Re: [PATCH v3 3/3] ARM: dts: atlas7: use general dt-binding for hwspinlock

In reply to a message not in the archive

2015-05-29 23:50 GMT+08:00 Bjorn Andersson <bjorn-UYDU3/[email protected]>:

Quoted 10 lines · Suman Anna

[..]

Quoted 7 lines
Quoted 1 line
                              reg = <0x13240000 0x00010000>;

An unrelated question here, why the reg is same for all the child nodes of the parent ipc node? If this is partitioned properly, then the driver can be simplified a bit by using platform_get_resource and devm_ioremap_resource?

Quoted 5 lines

Good catch Suman, I missed that.

Barry, if these blocks represents various functionalities of the same hw block then you should consider moving them to be part of a simple-mfd.

the hwspinlock and the IPC, which works for kicking interrupts between multiple cores in the SoC, are in one bus node but there is no overlapping register.
hwspinlock:
begin from 0x13240000 + 0x400
IPC:
begin from 0x13240000, and end at begin from 0x13240000 + 0x400 - 0x4 ?

so i guess we can refine the dts memory region to avoid MFD?

Quoted 3 lines

Regards,
Bjorn

-barry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#15 lore raw

Re: [PATCH v3 3/3] ARM: dts: atlas7: use general dt-binding for hwspinlock

In reply to a message not in the archive

2015-05-29 5:30 GMT+08:00 Suman Anna <[email protected]>:

Quoted 40 lines

Barry,

Quoted 19 lines · Barry Song

From: Wei Chen <[email protected]>

This patch moves to use generic dt-binding for hwspinlock providers and clients.
add #hwlock-cells for the provider and hwlocks for clients.

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>
---
 arch/arm/boot/dts/atlas7.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/atlas7.dtsi +0 -0
index a753178..66d3f0e 100644

arch/arm/boot/dts/atlas7.dtsi line 89

Quoted 7 lines
arch/arm/boot/dts/atlas7.dtsi +1 -1
@@ -84,17 +84,17 @@
                      #address-cells = <1>;
                      #size-cells = <1>;
 
-                     hwspinlock {
+                     hwlock: hwspinlock {
                              compatible = "sirf,hwspinlock";
                              reg = <0x13240000 0x00010000>;

An unrelated question here, why the reg is same for all the child nodes of the parent ipc node? If this is partitioned properly, then the driver can be simplified a bit by using platform_get_resource and devm_ioremap_resource?

Quoted 5 lines
arch/arm/boot/dts/atlas7.dtsi +1 -2
-
-                             num-spinlocks = <30>;
+                             #hwlock-cells = <1>;
                      };
 
Quoted 7 lines

arch/arm/boot/dts/atlas7.dtsi line 97

Quoted 5 lines
arch/arm/boot/dts/atlas7.dtsi +1 -0
                      ns_m3_rproc@0 {
                              compatible = "sirf,ns2m30-rproc";
                              reg = <0x13240000 0x00010000>;
                              interrupts = <0 123 0>;
+                             hwlocks = <&hwlock 0>, <&hwlock 1>;

Does this need to be added for the other nodes like ns_m3_rproc@1 as well?

now the hwlock-cells are only added for the nodes who are really using it. other users have not used it.

Quoted 9 lines

regards
Suman

Quoted 4 lines
arch/arm/boot/dts/atlas7.dtsi +0 -0
                      };
 
                      ns_m3_rproc@1 {

-barry
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#17 lore raw

Re: [PATCH v3 3/3] ARM: dts: atlas7: use general dt-binding for hwspinlock

In reply to a message not in the archive
Quoted 47 lines · Barry Song

2015-05-29 5:30 GMT+08:00 Suman Anna <[email protected]>:

Quoted 46 lines

Barry,

Quoted 19 lines · Barry Song

From: Wei Chen <[email protected]>

This patch moves to use generic dt-binding for hwspinlock providers and clients.
add #hwlock-cells for the provider and hwlocks for clients.

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>
---
 arch/arm/boot/dts/atlas7.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/atlas7.dtsi +0 -0
index a753178..66d3f0e 100644

arch/arm/boot/dts/atlas7.dtsi line 89

Quoted 7 lines
arch/arm/boot/dts/atlas7.dtsi +1 -1
@@ -84,17 +84,17 @@
                      #address-cells = <1>;
                      #size-cells = <1>;
 
-                     hwspinlock {
+                     hwlock: hwspinlock {
                              compatible = "sirf,hwspinlock";
                              reg = <0x13240000 0x00010000>;

An unrelated question here, why the reg is same for all the child nodes of the parent ipc node? If this is partitioned properly, then the driver can be simplified a bit by using platform_get_resource and devm_ioremap_resource?

Quoted 10 lines
arch/arm/boot/dts/atlas7.dtsi +2 -2
-
-                             num-spinlocks = <30>;
+                             #hwlock-cells = <1>;
                      };
 
                      ns_m3_rproc@0 {
                              compatible = "sirf,ns2m30-rproc";
                              reg = <0x13240000 0x00010000>;
                              interrupts = <0 123 0>;
+                             hwlocks = <&hwlock 0>, <&hwlock 1>;
Quoted 4 lines
Quoted 1 line

Does this need to be added for the other nodes like ns_m3_rproc@1 as well?

now the hwlock-cells are only added for the nodes who are really using it. other users have not used it.

OK, may be split it out then and add these in a subsequent patch with proper usage description.

regards
Suman

Quoted 5 lines
Quoted 5 lines

regards
Suman

Quoted 8 lines
Quoted 5 lines

arch/arm/boot/dts/atlas7.dtsi line 100

Quoted 4 lines
arch/arm/boot/dts/atlas7.dtsi +0 -0
                      };
 
                      ns_m3_rproc@1 {

-barry

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#14 lore raw

Re: [PATCH v3 3/3] ARM: dts: atlas7: use general dt-binding for hwspinlock

In reply to a message not in the archive
Quoted 25 lines · Barry Song

2015-05-29 23:50 GMT+08:00 Bjorn Andersson <bjorn-UYDU3/[email protected]>:

Quoted 10 lines · Suman Anna

[..]

Quoted 7 lines
Quoted 1 line
                              reg = <0x13240000 0x00010000>;

An unrelated question here, why the reg is same for all the child nodes of the parent ipc node? If this is partitioned properly, then the driver can be simplified a bit by using platform_get_resource and devm_ioremap_resource?

Quoted 5 lines

Good catch Suman, I missed that.

Barry, if these blocks represents various functionalities of the same hw block then you should consider moving them to be part of a simple-mfd.

the hwspinlock and the IPC, which works for kicking interrupts between multiple cores in the SoC, are in one bus node but there is no overlapping register.
hwspinlock:
begin from 0x13240000 + 0x400
IPC:
begin from 0x13240000, and end at begin from 0x13240000 + 0x400 - 0x4 ?

Quoted 1 line

so i guess we can refine the dts memory region to avoid MFD?

Yeah, that should be fine from the hwspinlock perspective, all its registers are self-contained.

regards
Suman
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#21 lore raw
In reply to a message not in the archive
Quoted 5 lines · Barry Song
Quoted 4 lines

From: Wei Chen <[email protected]>

Add hwspinlock support for the CSR atlas7 SoC.

Quoted 8 lines
Quoted 6 lines

The Hardware Spinlock device on atlas7 provides hardware assistance for synchronization between the multiple processors in the system (dual Cortex-A7, CAN bus Cortex-M3 and audio DSP).

Cc Suman Anna <[email protected]>
Cc Bjorn Andersson <bjorn-UYDU3/[email protected]>

Applied first two patches. Thanks Suman and Bjorn for making the time to review them!
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html