Skip to contentSkip to conversation

Add support of STM32 hwspinlock

PATCH In review Benjamin Gaignard 4 participants 11 messages Nov 14, 2018 – Dec 6, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Add support of STM32 hwspinlock

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

version 4:
- add Linaro SoB

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 v4 1/4 dt-bindings: hwlock: Document STM32 hwspinlock bindings

From: Benjamin Gaignard <[email protected]>

Add bindings for STM32 hardware spinlock device

---
version 4:
- add Linaro SoB

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

PATCH v4 2/4 hwspinlock: add STM32 hwspinlock device

In reply to Benjamin Gaignard

From: Benjamin Gaignard <[email protected]>

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

---
version 4:
- add Linaro SoB

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

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

In reply to Benjamin Gaignard

From: Benjamin Gaignard <[email protected]>

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

Re: [PATCH v4 3/4] ARM: dts: stm32: Add hwspinlock node for stm32mp157 SoC

I love your patch! Yet something to improve:

Hi Benjamin,

I love your patch! Yet something to improve:

[auto build test ERROR on stm32/stm32-next]
[cannot apply to v4.20-rc2 next-20181116]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Benjamin-Gaignard/Add-support-of-STM32-hwspinlock/20181115-204402
base:   https://git.kernel.org/pub/scm/linux/kernel/git/atorgue/stm32.git stm32-next
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 7.2.0-11) 7.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=arm

All errors (new ones prefixed by >>):

arch/arm/boot/dts/stm32mp157c-ed1.dtb: ERROR (duplicate_node_names): /soc/hwspinlock at 4c000000: Duplicate node name

>> ERROR: Input tree has errors, aborting (use -f to force output)
--
   arch/arm/boot/dts/stm32mp157c-ev1.dtb: ERROR (duplicate_node_names): /soc/hwspinlock at 4c000000: Duplicate node name
>> ERROR: Input tree has errors, aborting (use -f to force output)

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 67811 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20181116/03be4ccd/attachment-0001.gz>

#5 lore raw

Re: [PATCH v4 3/4] ARM: dts: stm32: Add hwspinlock node for stm32mp157 SoC

In reply to Benjamin Gaignard
Quoted 4 lines · Benjamin Gaignard

From: Benjamin Gaignard <[email protected]>

Declare hwspinlock device for stm32mp157 SoC

I abandon this patch and I will send a one that fixes the issues.

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

2.15.0

Signature · 7 lines
Benjamin Gaignard

Graphic Study Group

Linaro.org │ Open source software for ARM SoCs

Follow Linaro: Facebook | Twitter | Blog
#6 lore raw

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

In reply to Benjamin Gaignard

From: Benjamin Gaignard <[email protected]>

---
 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
#7 lore raw
In reply to Benjamin Gaignard
Quoted 5 lines · Benjamin Gaignard

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

version 4:
- add Linaro SoB

Gentle ping on this series

Regards,
Benjamin

Quoted 29 lines

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

--
2.15.0

#8 lore raw
Quoted 10 lines · Benjamin Gaignard
Quoted 5 lines · Benjamin Gaignard

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

version 4:
- add Linaro SoB

Gentle ping on this series

Maybe you want to fix the 0-day error and resend.

Does adding the hwlock to the interrupt controller depend on this series?

Rob

#9 lore raw
In reply to Benjamin Gaignard
Quoted 10 lines · Benjamin Gaignard
Quoted 5 lines · Benjamin Gaignard

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

version 4:
- add Linaro SoB

Gentle ping on this series

Sorry about that Benjamin, I was convinced that I picked your patches already. Applied first two patches to hwspinlock tree.

I expect the dts update to go through the ST tree, and I guess the complaint from 0day tells us they already are?

Regards,
Bjorn

#10 lore raw
Quoted 8 lines · Bjorn Andersson
Quoted 5 lines · Benjamin Gaignard
Quoted 3 lines · Benjamin Gaignard

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

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

version 4:
- add Linaro SoB

Gentle ping on this series

Sorry about that Benjamin, I was convinced that I picked your patches already. Applied first two patches to hwspinlock tree.

Thanks.

Quoted 3 lines

I expect the dts update to go through the ST tree, and I guess the complaint from 0day tells us they already are?

Yes I will send fixed dts patches for stm32 tree

Quoted 3 lines

Regards,
Bjorn