* [PATCH v2 0/3] Adding brcmstb-hwspinlock support
@ 2025-10-01 18:16 Kamal Dasu
2025-10-01 18:16 ` [PATCH v2 1/3] dt-bindings: hwlock: " Kamal Dasu
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Kamal Dasu @ 2025-10-01 18:16 UTC (permalink / raw)
To: peng.fan, andersson, baolin.wang, robh, krzk+dt, conor+dt,
florian.fainelli
Cc: bcm-kernel-feedback-list, linux-remoteproc, devicetree,
linux-arm-kernel, linux-kernel, Kamal Dasu
This is a standalone patch for the hardware semaphore feature for
all brcmstb SoCs that have the same hardware semaphore registers
hence platform driver compatible uses:
'.compatible = "brcm,brcmstb-hwspinlock"'
The patch has been tested to work as builtin as well as a module.
v2 changes:
Adressed 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 unecessary platfrom_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 Intial patch :
url: https://github.com/intel-lab-lkp/linux/commits/Kamal-Dasu/dt-bindings-brcmstb-hwspinlock-support-for-hwspinlock/20250712-034624
base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link: https://lore.kernel.org/r/20250711154221.928164-4-kamal.dasu%40broadcom.com
patch subject: [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
.../hwlock/brcm,brcmstb-hwspinlock.yaml | 36 +++++++
MAINTAINERS | 8 ++
drivers/hwspinlock/Kconfig | 11 ++-
drivers/hwspinlock/Makefile | 1 +
drivers/hwspinlock/brcmstb_hwspinlock.c | 96 +++++++++++++++++++
5 files changed, 151 insertions(+), 1 deletion(-)
create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml
create mode 100644 drivers/hwspinlock/brcmstb_hwspinlock.c
--
2.34.1
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH v2 1/3] dt-bindings: hwlock: Adding brcmstb-hwspinlock support 2025-10-01 18:16 [PATCH v2 0/3] Adding brcmstb-hwspinlock support Kamal Dasu @ 2025-10-01 18:16 ` Kamal Dasu 2025-10-08 15:56 ` Rob Herring 2025-10-01 18:16 ` [PATCH v2 2/3] hwspinlock: brcmstb hardware semaphore support Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 3/3] MAINTAINERS: adding entry for BRCMSTB HWSPINLOCK driver Kamal Dasu 2 siblings, 1 reply; 8+ messages in thread From: Kamal Dasu @ 2025-10-01 18:16 UTC (permalink / raw) To: peng.fan, andersson, baolin.wang, robh, krzk+dt, conor+dt, florian.fainelli Cc: bcm-kernel-feedback-list, linux-remoteproc, devicetree, linux-arm-kernel, linux-kernel, Kamal Dasu Adding brcmstb-hwspinlock bindings. Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> --- .../hwlock/brcm,brcmstb-hwspinlock.yaml | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml diff --git a/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml new file mode 100644 index 000000000000..f45399b4fe0b --- /dev/null +++ b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml @@ -0,0 +1,36 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/hwlock/brcm,brcmstb-hwspinlock.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom settop Hardware Spinlock + +maintainers: + - Kamal Dasu <kamal.dasu@broadcom.com> + +properties: + compatible: + const: brcm,brcmstb-hwspinlock + + "#hwlock-cells": + const: 1 + + reg: + maxItems: 1 + +required: + - compatible + - reg + - "#hwlock-cells" + +additionalProperties: false + +examples: + - | + hwlock@8404038 { + compatible = "brcm,brcmstb-hwspinlock"; + reg = <0x8404038 0x40>; + #hwlock-cells = <1>; + }; + -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: hwlock: Adding brcmstb-hwspinlock support 2025-10-01 18:16 ` [PATCH v2 1/3] dt-bindings: hwlock: " Kamal Dasu @ 2025-10-08 15:56 ` Rob Herring 2025-10-08 16:39 ` Florian Fainelli 0 siblings, 1 reply; 8+ messages in thread From: Rob Herring @ 2025-10-08 15:56 UTC (permalink / raw) To: Kamal Dasu Cc: peng.fan, andersson, baolin.wang, krzk+dt, conor+dt, florian.fainelli, bcm-kernel-feedback-list, linux-remoteproc, devicetree, linux-arm-kernel, linux-kernel On Wed, Oct 01, 2025 at 02:16:39PM -0400, Kamal Dasu wrote: > Adding brcmstb-hwspinlock bindings. That's obvious from the diff. Tell us something about the h/w and convince me we don't need per SoC compatible which is standard practice. > > Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> > --- > .../hwlock/brcm,brcmstb-hwspinlock.yaml | 36 +++++++++++++++++++ > 1 file changed, 36 insertions(+) > create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml > > diff --git a/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml > new file mode 100644 > index 000000000000..f45399b4fe0b > --- /dev/null > +++ b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml > @@ -0,0 +1,36 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/hwlock/brcm,brcmstb-hwspinlock.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Broadcom settop Hardware Spinlock > + > +maintainers: > + - Kamal Dasu <kamal.dasu@broadcom.com> > + > +properties: > + compatible: > + const: brcm,brcmstb-hwspinlock hwspinlock is the name of the h/w block? Use the name of the h/w, not linux subsystem names. > + > + "#hwlock-cells": > + const: 1 > + > + reg: > + maxItems: 1 > + > +required: > + - compatible > + - reg > + - "#hwlock-cells" > + > +additionalProperties: false > + > +examples: > + - | > + hwlock@8404038 { > + compatible = "brcm,brcmstb-hwspinlock"; > + reg = <0x8404038 0x40>; h/w blocks rarely start at an offset like that. Is this part of some other h/w block? If so, then just add '#hwlock-cells' to *that* node. > + #hwlock-cells = <1>; > + }; > + > -- > 2.34.1 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: hwlock: Adding brcmstb-hwspinlock support 2025-10-08 15:56 ` Rob Herring @ 2025-10-08 16:39 ` Florian Fainelli 2025-10-09 0:40 ` Krzysztof Kozlowski 0 siblings, 1 reply; 8+ messages in thread From: Florian Fainelli @ 2025-10-08 16:39 UTC (permalink / raw) To: Rob Herring, Kamal Dasu Cc: peng.fan, andersson, baolin.wang, krzk+dt, conor+dt, bcm-kernel-feedback-list, linux-remoteproc, devicetree, linux-arm-kernel, linux-kernel On 10/8/2025 8:56 AM, Rob Herring wrote: > On Wed, Oct 01, 2025 at 02:16:39PM -0400, Kamal Dasu wrote: >> Adding brcmstb-hwspinlock bindings. > > That's obvious from the diff. Tell us something about the h/w and > convince me we don't need per SoC compatible which is standard practice. > >> >> Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> >> --- >> .../hwlock/brcm,brcmstb-hwspinlock.yaml | 36 +++++++++++++++++++ >> 1 file changed, 36 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml >> >> diff --git a/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml >> new file mode 100644 >> index 000000000000..f45399b4fe0b >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml >> @@ -0,0 +1,36 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/hwlock/brcm,brcmstb-hwspinlock.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Broadcom settop Hardware Spinlock >> + >> +maintainers: >> + - Kamal Dasu <kamal.dasu@broadcom.com> >> + >> +properties: >> + compatible: >> + const: brcm,brcmstb-hwspinlock > > hwspinlock is the name of the h/w block? Use the name of the h/w, not > linux subsystem names. > >> + >> + "#hwlock-cells": >> + const: 1 >> + >> + reg: >> + maxItems: 1 >> + >> +required: >> + - compatible >> + - reg >> + - "#hwlock-cells" >> + >> +additionalProperties: false >> + >> +examples: >> + - | >> + hwlock@8404038 { >> + compatible = "brcm,brcmstb-hwspinlock"; >> + reg = <0x8404038 0x40>; > > h/w blocks rarely start at an offset like that. Is this part of some > other h/w block? If so, then just add '#hwlock-cells' to *that* node. We've answered that in the previous review: The block is part of a "sundry" IP which has lots of controls that did not belong anywhere else, for better or for worse (pin/mux controls, SoC identification, drive strength, reset controls, and other misc bits). -- Florian ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: hwlock: Adding brcmstb-hwspinlock support 2025-10-08 16:39 ` Florian Fainelli @ 2025-10-09 0:40 ` Krzysztof Kozlowski 2025-10-09 15:40 ` Kamal Dasu 0 siblings, 1 reply; 8+ messages in thread From: Krzysztof Kozlowski @ 2025-10-09 0:40 UTC (permalink / raw) To: Florian Fainelli, Rob Herring, Kamal Dasu Cc: peng.fan, andersson, baolin.wang, krzk+dt, conor+dt, bcm-kernel-feedback-list, linux-remoteproc, devicetree, linux-arm-kernel, linux-kernel On 09/10/2025 01:39, Florian Fainelli wrote: > > > On 10/8/2025 8:56 AM, Rob Herring wrote: >> On Wed, Oct 01, 2025 at 02:16:39PM -0400, Kamal Dasu wrote: >>> Adding brcmstb-hwspinlock bindings. >> >> That's obvious from the diff. Tell us something about the h/w and >> convince me we don't need per SoC compatible which is standard practice. >> >>> >>> Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> >>> --- >>> .../hwlock/brcm,brcmstb-hwspinlock.yaml | 36 +++++++++++++++++++ >>> 1 file changed, 36 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml >>> >>> diff --git a/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml >>> new file mode 100644 >>> index 000000000000..f45399b4fe0b >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml >>> @@ -0,0 +1,36 @@ >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >>> +%YAML 1.2 >>> +--- >>> +$id: http://devicetree.org/schemas/hwlock/brcm,brcmstb-hwspinlock.yaml# >>> +$schema: http://devicetree.org/meta-schemas/core.yaml# >>> + >>> +title: Broadcom settop Hardware Spinlock >>> + >>> +maintainers: >>> + - Kamal Dasu <kamal.dasu@broadcom.com> >>> + >>> +properties: >>> + compatible: >>> + const: brcm,brcmstb-hwspinlock >> >> hwspinlock is the name of the h/w block? Use the name of the h/w, not >> linux subsystem names. >> >>> + >>> + "#hwlock-cells": >>> + const: 1 >>> + >>> + reg: >>> + maxItems: 1 >>> + >>> +required: >>> + - compatible >>> + - reg >>> + - "#hwlock-cells" >>> + >>> +additionalProperties: false >>> + >>> +examples: >>> + - | >>> + hwlock@8404038 { >>> + compatible = "brcm,brcmstb-hwspinlock"; >>> + reg = <0x8404038 0x40>; >> >> h/w blocks rarely start at an offset like that. Is this part of some >> other h/w block? If so, then just add '#hwlock-cells' to *that* node. > > We've answered that in the previous review: > > The block is part of a "sundry" IP which has lots of controls that did > not belong anywhere else, for better or for worse (pin/mux controls, SoC > identification, drive strength, reset controls, and other misc bits). And every time above explanation will not reach description or commit msg we will ask the same. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] dt-bindings: hwlock: Adding brcmstb-hwspinlock support 2025-10-09 0:40 ` Krzysztof Kozlowski @ 2025-10-09 15:40 ` Kamal Dasu 0 siblings, 0 replies; 8+ messages in thread From: Kamal Dasu @ 2025-10-09 15:40 UTC (permalink / raw) To: Krzysztof Kozlowski Cc: Florian Fainelli, Rob Herring, peng.fan, andersson, baolin.wang, krzk+dt, conor+dt, bcm-kernel-feedback-list, linux-remoteproc, devicetree, linux-arm-kernel, linux-kernel [-- Attachment #1: Type: text/plain, Size: 2798 bytes --] Ok I will send a v3 with the explanation in the commit message for both the patches. On Wed, Oct 8, 2025 at 8:40 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > On 09/10/2025 01:39, Florian Fainelli wrote: > > > > > > On 10/8/2025 8:56 AM, Rob Herring wrote: > >> On Wed, Oct 01, 2025 at 02:16:39PM -0400, Kamal Dasu wrote: > >>> Adding brcmstb-hwspinlock bindings. > >> > >> That's obvious from the diff. Tell us something about the h/w and > >> convince me we don't need per SoC compatible which is standard practice. > >> > >>> > >>> Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> > >>> --- > >>> .../hwlock/brcm,brcmstb-hwspinlock.yaml | 36 +++++++++++++++++++ > >>> 1 file changed, 36 insertions(+) > >>> create mode 100644 Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml > >>> > >>> diff --git a/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml > >>> new file mode 100644 > >>> index 000000000000..f45399b4fe0b > >>> --- /dev/null > >>> +++ b/Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml > >>> @@ -0,0 +1,36 @@ > >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > >>> +%YAML 1.2 > >>> +--- > >>> +$id: http://devicetree.org/schemas/hwlock/brcm,brcmstb-hwspinlock.yaml# > >>> +$schema: http://devicetree.org/meta-schemas/core.yaml# > >>> + > >>> +title: Broadcom settop Hardware Spinlock > >>> + > >>> +maintainers: > >>> + - Kamal Dasu <kamal.dasu@broadcom.com> > >>> + > >>> +properties: > >>> + compatible: > >>> + const: brcm,brcmstb-hwspinlock > >> > >> hwspinlock is the name of the h/w block? Use the name of the h/w, not > >> linux subsystem names. > >> > >>> + > >>> + "#hwlock-cells": > >>> + const: 1 > >>> + > >>> + reg: > >>> + maxItems: 1 > >>> + > >>> +required: > >>> + - compatible > >>> + - reg > >>> + - "#hwlock-cells" > >>> + > >>> +additionalProperties: false > >>> + > >>> +examples: > >>> + - | > >>> + hwlock@8404038 { > >>> + compatible = "brcm,brcmstb-hwspinlock"; > >>> + reg = <0x8404038 0x40>; > >> > >> h/w blocks rarely start at an offset like that. Is this part of some > >> other h/w block? If so, then just add '#hwlock-cells' to *that* node. > > > > We've answered that in the previous review: > > > > The block is part of a "sundry" IP which has lots of controls that did > > not belong anywhere else, for better or for worse (pin/mux controls, SoC > > identification, drive strength, reset controls, and other misc bits). > > > And every time above explanation will not reach description or commit > msg we will ask the same. > > > > Best regards, > Krzysztof [-- Attachment #2: S/MIME Cryptographic Signature --] [-- Type: application/pkcs7-signature, Size: 5461 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] hwspinlock: brcmstb hardware semaphore support 2025-10-01 18:16 [PATCH v2 0/3] Adding brcmstb-hwspinlock support Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 1/3] dt-bindings: hwlock: " Kamal Dasu @ 2025-10-01 18:16 ` Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 3/3] MAINTAINERS: adding entry for BRCMSTB HWSPINLOCK driver Kamal Dasu 2 siblings, 0 replies; 8+ messages in thread From: Kamal Dasu @ 2025-10-01 18:16 UTC (permalink / raw) To: peng.fan, andersson, baolin.wang, robh, krzk+dt, conor+dt, florian.fainelli Cc: bcm-kernel-feedback-list, linux-remoteproc, devicetree, linux-arm-kernel, linux-kernel, Kamal Dasu Added support for brmstb_hwspinlock driver that makes use of the hwspinlock framework. Driver uses SUN_TOP_CTRL_SEMAPHORE_[1:15] registers to implement the hardware semaphore. With this change other brcmstb drivers can use hwspin_trylock() and hwspin_unlock() apis and make use of this hwspinlock framework. Other driver dt nodes just need to use a reference to the &hwspinlock and the lock id they want to use. e.g. hwlocks = <&hwspinlock0 0>; Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> --- drivers/hwspinlock/Kconfig | 11 ++- drivers/hwspinlock/Makefile | 1 + drivers/hwspinlock/brcmstb_hwspinlock.c | 96 +++++++++++++++++++++++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 drivers/hwspinlock/brcmstb_hwspinlock.c diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig index 3874d15b0e9b..39797cadfd0b 100644 --- a/drivers/hwspinlock/Kconfig +++ b/drivers/hwspinlock/Kconfig @@ -8,6 +8,16 @@ menuconfig HWSPINLOCK if HWSPINLOCK +config HWSPINLOCK_BRCMSTB + tristate "Broadcom Setttop 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 @@ -62,5 +72,4 @@ config HSEM_U8500 SoC. If unsure, say N. - endif # HWSPINLOCK diff --git a/drivers/hwspinlock/Makefile b/drivers/hwspinlock/Makefile index a0f16c9aaa82..35f2d94d8ba2 100644 --- a/drivers/hwspinlock/Makefile +++ b/drivers/hwspinlock/Makefile @@ -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 diff --git a/drivers/hwspinlock/brcmstb_hwspinlock.c b/drivers/hwspinlock/brcmstb_hwspinlock.c new file mode 100644 index 000000000000..0b164c57192e --- /dev/null +++ b/drivers/hwspinlock/brcmstb_hwspinlock.c @@ -0,0 +1,96 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * brcmstb HWSEM driver + * + * Copyright (C) 2025 Broadcom + * + */ + +#include <linux/delay.h> +#include <linux/hwspinlock.h> +#include <linux/io.h> +#include <linux/mod_devicetable.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/slab.h> +#include <linux/spinlock.h> +#include "hwspinlock_internal.h" + +#define BRCMSTB_NUM_SEMAPHORES 16 +#define RESET_SEMAPHORE 0 + +#define HWSPINLOCK_VAL 'L' + +static int brcmstb_hwspinlock_trylock(struct hwspinlock *lock) +{ + void __iomem *lock_addr = (void __iomem *)lock->priv; + + writel(HWSPINLOCK_VAL, lock_addr); + + return (readl(lock_addr) == HWSPINLOCK_VAL); +} + +static void brcmstb_hwspinlock_unlock(struct hwspinlock *lock) +{ + void __iomem *lock_addr = (void __iomem *)lock->priv; + + /* release the lock by writing 0 to it */ + writel(RESET_SEMAPHORE, lock_addr); +} + +static void brcmstb_hwspinlock_relax(struct hwspinlock *lock) +{ + ndelay(50); +} + +static const struct hwspinlock_ops brcmstb_hwspinlock_ops = { + .trylock = brcmstb_hwspinlock_trylock, + .unlock = brcmstb_hwspinlock_unlock, + .relax = brcmstb_hwspinlock_relax, +}; + +static int brcmstb_hwspinlock_probe(struct platform_device *pdev) +{ + struct hwspinlock_device *bank; + struct hwspinlock *hwlock; + void __iomem *io_base; + int i, num_locks = BRCMSTB_NUM_SEMAPHORES; + + io_base = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(io_base)) { + dev_err(&pdev->dev, "semaphore iobase mapping error\n"); + return PTR_ERR(io_base); + } + + bank = devm_kzalloc(&pdev->dev, struct_size(bank, lock, num_locks), + GFP_KERNEL); + if (!bank) + return -ENOMEM; + + for (i = 0, hwlock = &bank->lock[0]; i < num_locks; i++, hwlock++) + hwlock->priv = (void __iomem *)(io_base + sizeof(u32) * i); + + return devm_hwspin_lock_register(&pdev->dev, bank, + &brcmstb_hwspinlock_ops, + 0, num_locks); +} + +static const struct of_device_id brcmstb_hwspinlock_ids[] = { + { .compatible = "brcm,brcmstb-hwspinlock", }, + { /* end */ }, +}; +MODULE_DEVICE_TABLE(of, brcmstb_hwspinlock_ids); + +static struct platform_driver brcmstb_hwspinlock_driver = { + .probe = brcmstb_hwspinlock_probe, + .driver = { + .name = "brcmstb_hwspinlock", + .of_match_table = brcmstb_hwspinlock_ids, + }, +}; + +module_platform_driver(brcmstb_hwspinlock_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Hardware Spinlock driver for brcmstb"); +MODULE_AUTHOR("Kamal Dasu <kdasu.dasu@broadcom.com>"); -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] MAINTAINERS: adding entry for BRCMSTB HWSPINLOCK driver 2025-10-01 18:16 [PATCH v2 0/3] Adding brcmstb-hwspinlock support Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 1/3] dt-bindings: hwlock: " Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 2/3] hwspinlock: brcmstb hardware semaphore support Kamal Dasu @ 2025-10-01 18:16 ` Kamal Dasu 2 siblings, 0 replies; 8+ messages in thread From: Kamal Dasu @ 2025-10-01 18:16 UTC (permalink / raw) To: peng.fan, andersson, baolin.wang, robh, krzk+dt, conor+dt, florian.fainelli Cc: bcm-kernel-feedback-list, linux-remoteproc, devicetree, linux-arm-kernel, linux-kernel, Kamal Dasu Signed-off-by: Kamal Dasu <kamal.dasu@broadcom.com> --- MAINTAINERS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 97d958c945e4..21b78f468169 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4972,6 +4972,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 <kamal.dasu@broadcom.com> +R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> +L: linux-remoteproc@vger.kernel.org +S: Supported +F: Documentation/devicetree/bindings/hwlock/brcm,brcmstb-hwspinlock.yaml +F: drivers/hwspinlock/brcmstb_hwspinlock.c + BROADCOM BRCMSTB I2C DRIVER M: Kamal Dasu <kamal.dasu@broadcom.com> R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> -- 2.34.1 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-10-09 15:41 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-01 18:16 [PATCH v2 0/3] Adding brcmstb-hwspinlock support Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 1/3] dt-bindings: hwlock: " Kamal Dasu 2025-10-08 15:56 ` Rob Herring 2025-10-08 16:39 ` Florian Fainelli 2025-10-09 0:40 ` Krzysztof Kozlowski 2025-10-09 15:40 ` Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 2/3] hwspinlock: brcmstb hardware semaphore support Kamal Dasu 2025-10-01 18:16 ` [PATCH v2 3/3] MAINTAINERS: adding entry for BRCMSTB HWSPINLOCK driver Kamal Dasu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).