Skip to contentSkip to conversation

Adding brcmstb-hwspinlock support

PATCH In review Kamal Dasu 2 participants 7 messages Apr 27 – Aug 13

Subsystems (3)
lore
Share & tools
lore

Kamal Dasu

author
#0 lore raw

v7 cover Adding brcmstb-hwspinlock support

This series adds hardware semaphore support for Broadcom set-top SoCs via the generic hwspinlock framework.

The semaphore registers live in the sundry block; the DT binding describes only the semaphore register range. The compatible is brcm,bcm7038-sun-top-ctrl-semaphore (BCM7038 is where this block first appeared on set-top chips).

The driver has been tested built-in and as a module.

v7 changes :
- Rebase: Whole series rebased onto Linux 7.1-rc1 (254f49634ee1) so it applies cleanly on current upstream.
- Reviewed-by tag (PATCH 1/3, dt-bindings): Krzysztof Kozlowski's

v6 changes:
Addressed review comments from Krzysztof Kozlowski:
- Renamed DT binding YAML file from "brcm,brcmstb-hwspinlock.yaml" to "brcm,bcm7038-sun-top-ctrl-semaphore.yaml" to match the compatible string
- Updated $id in the YAML to match the new filename
- Updated MAINTAINERS F: entry to match the new filename

v5 changes:
Addressed review comments from Krzysztof Kozlowski:
- Changed compatible to "brcm,bcm7038-sun-top-ctrl-semaphore" using the SoC where the semaphore hardware was first introduced, following the brcm,bcm7038-l1-intc convention

v4 changes:
Addressed review comments from Krzysztof Kozlowski and Rob Herring:
- Renamed compatible from "brcm,brcmstb-hwspinlock" to "brcm,brcmstb-sun-top-ctrl-semaphore" to use the hardware name
- Added description block to the DT binding YAML explaining what the semaphore registers are and their relationship to the sundry block
- Fixed typo in Kconfig "Setttop" -> "Settop"
- Fixed email typo in MODULE_AUTHOR

v3 changes:
Added detailed explanation in the all commit messages as per review comments
- Added description of 'sundry' ip block that the hardware semaphore belongs to
- Added reasoning for using common compatible string

v2 changes:
Addressed following review comments:
- fixed ordering of obj brcmstb_hwspinlock.o in Makefile
- fixed ordering of 'config HWSPINLOCK_BRCMSTB' block in Kconfig
- Renamed BRCMSTB_MAX_SEMAPHORES to BRCMSTB_NUM_SEMAPHORES
- Removed unnecessary platform_set_drvdata(pdev, bank);

Also addressing duplicate PATCH 1/3 sent in error as part of v1 change.

v1 changes:
based on fixes made to Initial patch:

[PATCH 2/4] hwspinlock: brcmstb hardware semaphore support

All the review comments and build warning have been fixed.

Kamal Dasu (3):
dt-bindings: hwlock: Adding brcmstb-hwspinlock support
hwspinlock: brcmstb hardware semaphore support
MAINTAINERS: adding entry for BRCMSTB HWSPINLOCK driver

 .../brcm,bcm7038-sun-top-ctrl-semaphore.yaml  | 44 +++++++++
 MAINTAINERS                                   |  8 ++
 drivers/hwspinlock/Kconfig                    | 10 ++
 drivers/hwspinlock/Makefile                   |  1 +
 drivers/hwspinlock/brcmstb_hwspinlock.c       | 96 +++++++++++++++++++
 5 files changed, 159 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,bcm7038-sun-top-ctrl-semaphore.yaml
 create mode 100644 drivers/hwspinlock/brcmstb_hwspinlock.c
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v7 1/3 dt-bindings: hwlock: Adding brcmstb-hwspinlock support

The Broadcom settop SoCs have hardware semaphores as part of the "sundry" IP block which has other controls that do not belong anywhere else e.g. pin/mux controls, SoC identification, drive strength, reset controls, and other misc bits are part of this block.

Adding brcmstb-hwspinlock bindings which allows the hwspinlock driver to iomap only the 16 hardware semaphore registers that are part of all settop SoCs. The semaphore registers are based on the BCM7038 SoC where they were first introduced in settop chips.

---
 .../brcm,bcm7038-sun-top-ctrl-semaphore.yaml  | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,bcm7038-sun-top-ctrl-semaphore.yaml
Documentation/devicetree/bindings/hwlock/brcm,bcm7038-sun-top-ctrl-semaphore.yaml new file +44 -0
new file mode 100644
index 000000000000..552f334256b5
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwlock/brcm,bcm7038-sun-top-ctrl-semaphore.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom Settop Sundry Block Hardware Semaphore
+
+description:
+  Broadcom settop SoCs contain 16 hardware semaphore registers
+  (SEMAPHORE_0 through SEMAPHORE_15) that provide hardware-arbitrated
+  mutual exclusion between drivers running on the SoC.
+
+  The semaphore registers belong to the sundry hardware block. The
+  node describes the semaphore register range carved out of the larger
+  sundry block address space.
+
+maintainers:
+  - Kamal Dasu <[email protected]>
+
+properties:
+  compatible:
+    const: brcm,bcm7038-sun-top-ctrl-semaphore
+
+  "#hwlock-cells":
+    const: 1
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - "#hwlock-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    hwlock@404038 {
+        compatible = "brcm,bcm7038-sun-top-ctrl-semaphore";
+        reg = <0x404038 0x40>;
+        #hwlock-cells = <1>;
+    };
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v7 2/3 hwspinlock: brcmstb hardware semaphore support

In reply to Kamal Dasu

Broadcom settop SoCs have common 16 hardware semaphore registers that can be used as part of the kernel hardware spinlock framework. The hardware semaphores are part of the 'sundry' ip block that also has controls like pin/mux controls, SoC identification, drive strength, reset controls, and other misc bits.

Adding support for brcmstb_hwspinlock that only maps sundry block registers SUN_TOP_CTRL_SEMAPHORE_[0:15] to implement the hardware spinlock operations. Change allows other Broadcom settop drivers to call hwspin_trylock() and hwspin_unlock() interfaces to make use of hwspinlock framework. Other driver dt nodes just need to provide a reference to the &hwspinlock and lock id to make use of a particular hardware lock.
e.g. hwlocks = <&hwspinlock0 0>;

---
 drivers/hwspinlock/Kconfig              | 10 +++
 drivers/hwspinlock/Makefile             |  1 +
 drivers/hwspinlock/brcmstb_hwspinlock.c | 96 +++++++++++++++++++++++++
 3 files changed, 107 insertions(+)
 create mode 100644 drivers/hwspinlock/brcmstb_hwspinlock.c
drivers/hwspinlock/Kconfig +10 -0
index d84e00084ee2..3a81a6785e45 100644
@@ -8,6 +8,16 @@ menuconfig HWSPINLOCK
 
 if HWSPINLOCK
 
+config HWSPINLOCK_BRCMSTB
+	tristate "Broadcom Settop Hardware Semaphore functionality"
+	depends on ARCH_BRCMSTB || COMPILE_TEST
+	help
+	  Broadcom settop hwspinlock driver.
+	  Say y here to support the Broadcom Hardware Semaphore functionality, which
+	  provides a synchronisation mechanism on the SoC.
+
+	  If unsure, say N.
+
 config HWSPINLOCK_OMAP
 	tristate "OMAP Hardware Spinlock device"
 	depends on ARCH_OMAP4 || SOC_OMAP5 || SOC_DRA7XX || SOC_AM33XX || SOC_AM43XX || ARCH_K3 || COMPILE_TEST
drivers/hwspinlock/Makefile +1 -0
index 3a740805949d..379443987b94 100644
@@ -4,6 +4,7 @@
 #
 
 obj-$(CONFIG_HWSPINLOCK)		+= hwspinlock_core.o
+obj-$(CONFIG_HWSPINLOCK_BRCMSTB)	+= brcmstb_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_QCOM)		+= qcom_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_SPRD)		+= sprd_hwspinlock.o
drivers/hwspinlock/brcmstb_hwspinlock.c new file +96 -0

96 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v7 3/3 MAINTAINERS: adding entry for BRCMSTB HWSPINLOCK driver

In reply to Kamal Dasu

Adding myself to the maintainers list for the hwspinlock driver on broadcom settop platforms.

---
 MAINTAINERS | 8 ++++++++
 1 file changed, 8 insertions(+)
MAINTAINERS +8 -0
index 2fb1c75afd16..4f3dfc6a090c 100644
@@ -5244,6 +5244,14 @@ S:	Supported
 F:	Documentation/devicetree/bindings/gpio/brcm,brcmstb-gpio.yaml
 F:	drivers/gpio/gpio-brcmstb.c
 
+BROADCOM BRCMSTB HWSPINLOCK DRIVER
+M:	Kamal Dasu <[email protected]>
+R:	Broadcom internal kernel review list <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	Documentation/devicetree/bindings/hwlock/brcm,bcm7038-sun-top-ctrl-semaphore.yaml
+F:	drivers/hwspinlock/brcmstb_hwspinlock.c
+
 BROADCOM BRCMSTB I2C DRIVER
 M:	Kamal Dasu <[email protected]>
 R:	Broadcom internal kernel review list <[email protected]>
Signature · 1 line
2.34.1
maintainer
#4 lore raw
In reply to Kamal Dasu

Hi Bjorn, Baolin,

Quoted 9 lines · Kamal Dasu

This series adds hardware semaphore support for Broadcom set-top SoCs via the generic hwspinlock framework.

The semaphore registers live in the sundry block; the DT binding describes only the semaphore register range. The compatible is brcm,bcm7038-sun-top-ctrl-semaphore (BCM7038 is where this block first appeared on set-top chips).

The driver has been tested built-in and as a module.

Is there anything else you would want to see being done differently here or is this ready for being merged into your tree?

Thanks!

Signature · 1 line
Florian
author
#5 lore raw
Quoted 12 lines · Florian Fainelli

Hi Bjorn, Baolin,

Quoted 8 lines · Kamal Dasu

This series adds hardware semaphore support for Broadcom set-top SoCs via the generic hwspinlock framework.

The semaphore registers live in the sundry block; the DT binding describes only the semaphore register range. The compatible is brcm,bcm7038-sun-top-ctrl-semaphore (BCM7038 is where this block first appeared on set-top chips).

Quoted 9 lines
Quoted 1 line

The driver has been tested built-in and as a module.

Is there anything else you would want to see being done differently here or is this ready for being merged into your tree?

Thanks!
--
Florian

Florian,

Since there hasn't been a response from the hwspinlock maintainers to your ping from May, and given that:

Krzysztof reviewed the DT bindings (Reviewed-by),
The series is self-contained under Broadcom STB platform code and has no core framework changes,

Could you please take this series through your Broadcom SoC tree for the next merge window?

Thanks,
Kamal

maintainer
#6 lore raw
Quoted 29 lines · Kamal Dasu
Quoted 12 lines · Florian Fainelli

Hi Bjorn, Baolin,

Quoted 8 lines · Kamal Dasu

This series adds hardware semaphore support for Broadcom set-top SoCs via the generic hwspinlock framework.

The semaphore registers live in the sundry block; the DT binding describes only the semaphore register range. The compatible is brcm,bcm7038-sun-top-ctrl-semaphore (BCM7038 is where this block first appeared on set-top chips).

Quoted 9 lines
Quoted 1 line

The driver has been tested built-in and as a module.

Is there anything else you would want to see being done differently here or is this ready for being merged into your tree?

Thanks!
--
Florian

Florian,

Since there hasn't been a response from the hwspinlock maintainers to your ping from May, and given that:

Quoted 6 lines

Krzysztof reviewed the DT bindings (Reviewed-by),
The series is self-contained under Broadcom STB platform code and has no core framework changes,

Could you please take this series through your Broadcom SoC tree for the next merge window?

I want to give Bjorn and Baolin a chance to respond, but would otherwise have to seek help from the ARM SoCs maintainers in order to get these patches moving forward.

Signature · 1 line
Florian