Skip to contentSkip to conversation

Add support of STM32 hwspinlock

PATCH Superseded Benjamin Gaignard 4 participants 10 messages Nov 12, 2018 – Dec 3, 2018

Subsystems (3)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add support of STM32 hwspinlock

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

version 3:
- fix clock name in properties description.
- use postcore_initcall() instead of module_platform_driver()

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              | 156 +++++++++++++++++++++
 6 files changed, 202 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 v3 1/4 dt-bindings: hwlock: Document STM32 hwspinlock bindings

Add bindings for STM32 hardware spinlock device

---
version 3 :
- fix clock name in properties description
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..adf4f000ea3d
@@ -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 "hsem".
+- 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
maintainer
#2 lore raw

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

Quoted 3 lines · Benjamin Gaignard

Add bindings for STM32 hardware spinlock device

Linaro or ST? Please make the author email match.

Quoted 43 lines

---
version 3 :
- fix clock name in properties description
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..adf4f000ea3d
@@ -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 "hsem".
+- 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
#3 lore raw

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

Quoted 7 lines · Rob Herring
Quoted 3 lines · Benjamin Gaignard

Add bindings for STM32 hardware spinlock device

Linaro or ST? Please make the author email match.

Thanks for the review Rob and thanks for spotting this.

@Benjamin, please resend the driver and dt-binding with matching author and sob - or if you wrote this as ST and want to send it upstream as Linaro add your new sob after the ST one.

Regards,
Bjorn

Quoted 43 lines
Quoted 43 lines

---
version 3 :
- fix clock name in properties description
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..adf4f000ea3d
@@ -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 "hsem".
+- 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
maintainer Reviewed-by on v3 1/4
#4 lore raw

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

In reply to Benjamin Gaignard
Quoted 10 lines · Benjamin Gaignard

Add bindings for STM32 hardware spinlock device

---
version 3 :
- fix clock name in properties description
version 2 :
- change clock name from hwspinlock to hsem to be align with hardware documentation

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

PATCH v3 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 3 :
- use postcore_initcall() instead of module_platform_driver()

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 | 156 ++++++++++++++++++++++++++++++++++
 3 files changed, 166 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 +156 -0

156 lines not on this page · raw message

Signature · 1 line
2.15.0
#6 lore raw

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

In reply to Benjamin Gaignard

Declare hwspinlock device for stm32mp157 SoC

---
 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
#7 lore raw

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

In reply to Benjamin Gaignard
---
 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
#8 lore raw
In reply to Benjamin Gaignard

Hi Benjamin

Quoted 12 lines · Benjamin Gaignard

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

version 3:
- fix clock name in properties description.
- use postcore_initcall() instead of module_platform_driver()

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

Quoted 5 lines

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

DT patches applied on stm32-next.

Regards
Alex

Quoted 11 lines
  .../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              | 156 +++++++++++++++++++++
  6 files changed, 202 insertions(+)

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

#9 lore raw
In reply to Benjamin Gaignard

Hi Benjamin,

Quoted 25 lines · Benjamin Gaignard

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

version 3:
- fix clock name in properties description.
- use postcore_initcall() instead of module_platform_driver()

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              | 156 +++++++++++++++++++++
  6 files changed, 202 insertions(+)
Quoted 3 lines

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

There is a (strong) dependency between pinctrl and hsem.
As our pin controller is enabled by default, it's better to enable also
your hwspinlock device by default. It will avoid pin controller probe defer and a no stable behavior. So, I gonna remove DT patches from stm32-next. Those Dt patches will not be included in my 4.20 pull-request.

regards
Alex