Skip to contentSkip to conversation

Add support of STM32 hwspinlock

PATCH Superseded Benjamin Gaignard 3 participants 7 messages Nov 8, 2018 – Nov 12, 2018

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add support of STM32 hwspinlock

This serie adds the support of the hardware semaphore block for stm32mp1 SoC.

version 2:
- fix comments done by Bjorn about clock naming, license terms in header, alphabetic ordering in Makefile and Kconfig and remove function
- Do not push test module in this version while waiting for feedbacks about it

Benjamin Gaignard (4):
dt-bindings: hwlock: Document STM32 hwspinlock bindings
hwspinlock: add STM32 hwspinlock device
ARM: dts: stm32: Add hwspinlock node for stm32mp157 SoC
ARM: dts: stm32: enable hwspinlock on stm32mp157c-ed1

 .../bindings/hwlock/st,stm32-hwspinlock.txt        |  23 ++++
 arch/arm/boot/dts/stm32mp157c-ed1.dts              |   4 +
 arch/arm/boot/dts/stm32mp157c.dtsi                 |   9 ++
 drivers/hwspinlock/Kconfig                         |   9 ++
 drivers/hwspinlock/Makefile                        |   1 +
 drivers/hwspinlock/stm32_hwspinlock.c              | 144 +++++++++++++++++++++
 6 files changed, 190 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt
 create mode 100644 drivers/hwspinlock/stm32_hwspinlock.c
Signature · 1 line
2.15.0
#1 lore raw

PATCH v2 1/4 dt-bindings: hwlock: Document STM32 hwspinlock bindings

Add bindings for STM32 hardware spinlock device

---
version 2 :
- change clock name from hwspinlock to hsem to be align with hardware documentation

 .../bindings/hwlock/st,stm32-hwspinlock.txt        | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt
Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt new file +23 -0
new file mode 100644
index 000000000000..6e933b218574
@@ -0,0 +1,23 @@
+STM32 Hardware Spinlock Device Binding
+-------------------------------------
+
+Required properties :
+- compatible : should be "st,stm32-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.
+- clock-names : Must contain "hwspinlock".
+- clocks : Must contain a phandle entry for the clock in clock-names, see the
+	common clock bindings.
+
+Please look at the generic hwlock binding for usage information for consumers,
+"Documentation/devicetree/bindings/hwlock/hwlock.txt"
+
+Example of hwlock provider:
+	hwspinlock at 4c000000 {
+		compatible = "st,stm32-hwspinlock";
+		#hwlock-cells = <1>;
+		reg = <0x4c000000 0x400>;
+		clocks = <&rcc HSEM>;
+		clock-names = "hsem";
+	};
Signature · 1 line
2.15.0
#2 lore raw

Re: [PATCH v2 1/4] dt-bindings: hwlock: Document STM32 hwspinlock bindings

Hi Benjamin

Quoted 18 lines · Benjamin Gaignard

Add bindings for STM32 hardware spinlock device

---
version 2 :
- change clock name from hwspinlock to hsem to be align with hardware documentation

  .../bindings/hwlock/st,stm32-hwspinlock.txt        | 23 ++++++++++++++++++++++
  1 file changed, 23 insertions(+)

create mode 100644 Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt

Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt new file +0 -0
new file mode 100644
index 000000000000..6e933b218574

Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt line 9

Quoted 9 lines
Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt new file +9 -0
@@ -0,0 +1,23 @@
+STM32 Hardware Spinlock Device Binding
+-------------------------------------
+
+Required properties :
+- compatible : should be "st,stm32-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.
+- clock-names : Must contain "hwspinlock".

"hwspinlock" --> "hsem" ?

Quoted 15 lines
Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt new file +14 -0
+- clocks : Must contain a phandle entry for the clock in clock-names, see the
+	common clock bindings.
+
+Please look at the generic hwlock binding for usage information for consumers,
+"Documentation/devicetree/bindings/hwlock/hwlock.txt"
+
+Example of hwlock provider:
+	hwspinlock at 4c000000 {
+		compatible = "st,stm32-hwspinlock";
+		#hwlock-cells = <1>;
+		reg = <0x4c000000 0x400>;
+		clocks = <&rcc HSEM>;
+		clock-names = "hsem";
+	};
maintainer
#3 lore raw

PATCH v2 1/4 dt-bindings: hwlock: Document STM32 hwspinlock bindings

In reply to Benjamin Gaignard
Quoted 12 lines · Benjamin Gaignard

Add bindings for STM32 hardware spinlock device

---
version 2 :
- change clock name from hwspinlock to hsem to be align with hardware documentation

 .../bindings/hwlock/st,stm32-hwspinlock.txt        | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/st,stm32-hwspinlock.txt
#4 lore raw

PATCH v2 2/4 hwspinlock: add STM32 hwspinlock device

In reply to Benjamin Gaignard

This patch adds support of hardware semaphores for stm32mp1 SoC. The hardware block provides 32 semaphores.

---
version 2 :
- change clock name from hwspinlock to hsem to be align with hardware documentation
- remove useless licence terms from header
- fix alphabetic order issues
- do not abort remove function if hwspin_lock_unregister() failed

 drivers/hwspinlock/Kconfig            |   9 +++
 drivers/hwspinlock/Makefile           |   1 +
 drivers/hwspinlock/stm32_hwspinlock.c | 144 ++++++++++++++++++++++++++++++++++
 3 files changed, 154 insertions(+)
 create mode 100644 drivers/hwspinlock/stm32_hwspinlock.c
drivers/hwspinlock/Kconfig +9 -0
index e895d29500ee..7869c67e5b6b 100644
@@ -49,6 +49,15 @@ config HWSPINLOCK_SPRD
 
 	  If unsure, say N.
 
+config HWSPINLOCK_STM32
+	tristate "STM32 Hardware Spinlock device"
+	depends on MACH_STM32MP157
+	depends on HWSPINLOCK
+	help
+	  Say y here to support the STM32 Hardware Spinlock device.
+
+	  If unsure, say N.
+
 config HSEM_U8500
 	tristate "STE Hardware Semaphore functionality"
 	depends on HWSPINLOCK
drivers/hwspinlock/Makefile +1 -0
index b87c01a506a4..ed053e3f02be 100644
@@ -8,4 +8,5 @@ obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_QCOM)		+= qcom_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_SIRF)		+= sirf_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_SPRD)		+= sprd_hwspinlock.o
+obj-$(CONFIG_HWSPINLOCK_STM32)		+= stm32_hwspinlock.o
 obj-$(CONFIG_HSEM_U8500)		+= u8500_hsem.o
drivers/hwspinlock/stm32_hwspinlock.c new file +144 -0

144 lines not on this page · raw message

Signature · 1 line
2.15.0
#5 lore raw

PATCH v2 3/4 ARM: dts: stm32: Add hwspinlock node for stm32mp157 SoC

In reply to Benjamin Gaignard

Declare hwspinlock device for stm32mp157 SoC

---
version 2 :
- change clock name from hwspinlock to hsem to be align with hardware documentation

 arch/arm/boot/dts/stm32mp157c.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)
arch/arm/boot/dts/stm32mp157c.dtsi +9 -0
index 185541a5b69f..98f824d8b0f0 100644
@@ -803,6 +803,15 @@
 			status = "disabled";
 		};
 
+		hsem: hwspinlock at 4c000000 {
+			compatible = "st,stm32-hwspinlock";
+			#hwlock-cells = <1>;
+			reg = <0x4c000000 0x400>;
+			clocks = <&rcc HSEM>;
+			clock-names = "hwsem";
+			status = "disabled";
+		};
+
 		rcc: rcc at 50000000 {
 			compatible = "st,stm32mp1-rcc", "syscon";
 			reg = <0x50000000 0x1000>;
Signature · 1 line
2.15.0
#6 lore raw

PATCH v2 4/4 ARM: dts: stm32: enable hwspinlock on stm32mp157c-ed1

In reply to Benjamin Gaignard

Activate hwspinlock for stm32mp157c-ed1

---
 arch/arm/boot/dts/stm32mp157c-ed1.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/stm32mp157c-ed1.dts +4 -0
index f77bea49c079..158a337b3129 100644
@@ -94,3 +94,7 @@
 	vdda1v1-supply = <&reg11>;
 	vdda1v8-supply = <&reg18>;
 };
+
+&hsem {
+	status = "okay";
+};
Signature · 1 line
2.15.0