linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/5] ARM: dts: realtek: SB2 semaphores
@ 2019-12-02 22:05 Andreas Färber
  2019-12-02 22:05 ` [RFC 1/5] dt-bindings: hwlock: Add Realtek RTD1195 SB2 Andreas Färber
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Andreas Färber @ 2019-12-02 22:05 UTC (permalink / raw)
  To: linux-realtek-soc
  Cc: devicetree, Cheng-Yu Lee, linux-kernel, Rob Herring,
	Andreas Färber, linux-arm-kernel

Hello,

This patch series implements hardware semaphores found in SB2 bridge.

Downstream BSP code assigns the same first semaphore to both CRT and Iso nodes,
which seems inefficient in light of nine semaphore registers and is therefore
deferred in this initial RFC.

This series is based on my syscon series [1].

Latest experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next

Have a lot of fun!

Cheers,
Andreas

[1] https://patchwork.kernel.org/cover/11269453/

Cc: devicetree@vger.kernel.org
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Cheng-Yu Lee <cylee12@realtek.com>

Andreas Färber (5):
  dt-bindings: hwlock: Add Realtek RTD1195 SB2
  hwspinlock: Add Realtek RTD1195 SB2
  ARM: dts: rtd1195: Add SB2 sem nodes
  arm64: dts: realtek: rtd129x: Add SB2 sem nodes
  arm64: dts: realtek: rtd139x: Add SB2 sem nodes

 .../bindings/hwlock/realtek,rtd1195-sb2-sem.yaml   |  42 +++++++++
 arch/arm/boot/dts/rtd1195.dtsi                     |  14 +++
 arch/arm64/boot/dts/realtek/rtd129x.dtsi           |  14 +++
 arch/arm64/boot/dts/realtek/rtd139x.dtsi           |  14 +++
 drivers/hwspinlock/Kconfig                         |  11 +++
 drivers/hwspinlock/Makefile                        |   1 +
 drivers/hwspinlock/rtd1195_sb2_sem.c               | 101 +++++++++++++++++++++
 7 files changed, 197 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/realtek,rtd1195-sb2-sem.yaml
 create mode 100644 drivers/hwspinlock/rtd1195_sb2_sem.c

-- 
2.16.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC 1/5] dt-bindings: hwlock: Add Realtek RTD1195 SB2
  2019-12-02 22:05 [RFC 0/5] ARM: dts: realtek: SB2 semaphores Andreas Färber
@ 2019-12-02 22:05 ` Andreas Färber
  2019-12-13 23:40   ` Rob Herring
  2019-12-02 22:05 ` [RFC 2/5] hwspinlock: " Andreas Färber
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2019-12-02 22:05 UTC (permalink / raw)
  To: linux-realtek-soc
  Cc: Ohad Ben-Cohen, Mark Rutland, Cheng-Yu Lee, devicetree,
	linux-remoteproc, linux-kernel, Bjorn Andersson, Rob Herring,
	Andreas Färber, linux-arm-kernel

Define a binding for Realtek RTD1195 SoC's SB2 hardware semaphore.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 .../bindings/hwlock/realtek,rtd1195-sb2-sem.yaml   | 42 ++++++++++++++++++++++
 1 file changed, 42 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwlock/realtek,rtd1195-sb2-sem.yaml

diff --git a/Documentation/devicetree/bindings/hwlock/realtek,rtd1195-sb2-sem.yaml b/Documentation/devicetree/bindings/hwlock/realtek,rtd1195-sb2-sem.yaml
new file mode 100644
index 000000000000..8035af02c667
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwlock/realtek,rtd1195-sb2-sem.yaml
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: GPL-2.0-or-later OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwlock/realtek,rtd1195-sb2-sem.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Realtek RTD1195 SB2 hardware semaphore device tree binding
+
+maintainers:
+  - Andreas Färber <afaerber@suse.de>
+
+properties:
+  compatible:
+    const: realtek,rtd1195-sb2-sem
+
+  reg:
+    maxItems: 1
+
+  "#hwlock-cells":
+    enum: [ 0, 1 ]
+
+required:
+  - compatible
+  - reg
+  - "#hwlock-cells"
+
+additionalProperties: false
+
+examples:
+  - |
+    hwspinlock@9801a000 {
+      compatible = "realtek,rtd1195-sb2-sem";
+      reg = <0x9801a000 0x4>;
+      #hwlock-cells = <0>;
+    };
+  - |
+    hwspinlock@9801a620 {
+      compatible = "realtek,rtd1195-sb2-sem";
+      reg = <0x9801a620 0x20>;
+      #hwlock-cells = <1>;
+    };
+...
-- 
2.16.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC 2/5] hwspinlock: Add Realtek RTD1195 SB2
  2019-12-02 22:05 [RFC 0/5] ARM: dts: realtek: SB2 semaphores Andreas Färber
  2019-12-02 22:05 ` [RFC 1/5] dt-bindings: hwlock: Add Realtek RTD1195 SB2 Andreas Färber
@ 2019-12-02 22:05 ` Andreas Färber
  2019-12-03  8:46   ` Fabien DESSENNE
  2019-12-02 22:05 ` [RFC 3/5] ARM: dts: rtd1195: Add SB2 sem nodes Andreas Färber
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2019-12-02 22:05 UTC (permalink / raw)
  To: linux-realtek-soc
  Cc: Ohad Ben-Cohen, Cheng-Yu Lee, linux-remoteproc, linux-kernel,
	Bjorn Andersson, Andreas Färber, linux-arm-kernel

Implement a driver for hardware semaphores found in RTD1195 SoC.
It allows for both per-register instances (SB2_HD_SEM) as well as
contiguous register ranges (SB2_HD_SEM_NEW[0-7]).

While these registers are part of the SB2 syscon, this implementation
does not use syscon, to allow assigning one as SB2 syscon's hwlock.

Cc: Cheng-Yu Lee <cylee12@realtek.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 drivers/hwspinlock/Kconfig           |  11 ++++
 drivers/hwspinlock/Makefile          |   1 +
 drivers/hwspinlock/rtd1195_sb2_sem.c | 101 +++++++++++++++++++++++++++++++++++
 3 files changed, 113 insertions(+)
 create mode 100644 drivers/hwspinlock/rtd1195_sb2_sem.c

diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
index 37740e992cfa..9c26c436d399 100644
--- a/drivers/hwspinlock/Kconfig
+++ b/drivers/hwspinlock/Kconfig
@@ -28,6 +28,17 @@ config HWSPINLOCK_QCOM
 
 	  If unsure, say N.
 
+config HWSPINLOCK_RTD1195_SB2
+	tristate "Realtek RTD1195 SB2 Hardware Spinlock device"
+	depends on HWSPINLOCK
+	depends on ARCH_REALTEK || COMPILE_TEST
+	default ARCH_REALTEK
+	help
+	  Say y here to support the Realtek Hardware Semaphore functionality,
+	  found on the RTD1195 and later SoC families.
+
+	  If unsure, say N.
+
 config HWSPINLOCK_SIRF
 	tristate "SIRF Hardware Spinlock device"
 	depends on HWSPINLOCK
diff --git a/drivers/hwspinlock/Makefile b/drivers/hwspinlock/Makefile
index ed053e3f02be..d5bd59412468 100644
--- a/drivers/hwspinlock/Makefile
+++ b/drivers/hwspinlock/Makefile
@@ -6,6 +6,7 @@
 obj-$(CONFIG_HWSPINLOCK)		+= hwspinlock_core.o
 obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_QCOM)		+= qcom_hwspinlock.o
+obj-$(CONFIG_HWSPINLOCK_RTD1195_SB2)	+= rtd1195_sb2_sem.o
 obj-$(CONFIG_HWSPINLOCK_SIRF)		+= sirf_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_SPRD)		+= sprd_hwspinlock.o
 obj-$(CONFIG_HWSPINLOCK_STM32)		+= stm32_hwspinlock.o
diff --git a/drivers/hwspinlock/rtd1195_sb2_sem.c b/drivers/hwspinlock/rtd1195_sb2_sem.c
new file mode 100644
index 000000000000..ae925d057874
--- /dev/null
+++ b/drivers/hwspinlock/rtd1195_sb2_sem.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * RTD1195 SB2 hardware semaphore
+ *
+ * Copyright (c) 2019 Andreas Färber
+ */
+
+#include <linux/bitops.h>
+#include <linux/hwspinlock.h>
+#include <linux/idr.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+
+#include "hwspinlock_internal.h"
+
+struct rtd1195_sb2_sem {
+	struct platform_device *pdev;
+	void __iomem *base;
+	int base_id;
+	struct hwspinlock_device lockdev;
+};
+
+static DEFINE_IDR(rtd1195_sb2_sem_idr);
+
+static int rtd1195_sb2_sem_trylock(struct hwspinlock *lock)
+{
+	void __iomem *reg = (void __iomem *)lock->priv;
+
+	return readl_relaxed(reg) & BIT(0);
+}
+
+static void rtd1195_sb2_sem_unlock(struct hwspinlock *lock)
+{
+	void __iomem *reg = (void __iomem *)lock->priv;
+
+	writel_relaxed(0, reg);
+}
+
+static const struct hwspinlock_ops rtd1195_sb2_sem_hwspinlock_ops = {
+	.trylock	= rtd1195_sb2_sem_trylock,
+	.unlock		= rtd1195_sb2_sem_unlock,
+};
+
+static int rtd1195_sb2_sem_probe(struct platform_device *pdev)
+{
+	struct rtd1195_sb2_sem *sem;
+	struct hwspinlock *lock;
+	struct resource *res;
+	int i, num;
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -ENOMEM;
+
+	num = resource_size(res) / 4;
+
+	sem = devm_kzalloc(&pdev->dev, sizeof(*sem) + num * sizeof(*lock),
+			   GFP_KERNEL);
+	if (!sem)
+		return -ENOMEM;
+
+	sem->pdev = pdev;
+
+	sem->base = of_iomap(pdev->dev.of_node, 0);
+	if (!sem->base)
+		return -ENOMEM;
+
+	for (i = 0; i < num; i++) {
+		lock = &sem->lockdev.lock[i];
+		lock->priv = sem->base + i * 4;
+	}
+
+	platform_set_drvdata(pdev, sem);
+
+	sem->base_id = idr_alloc(&rtd1195_sb2_sem_idr, sem, 0, 0, GFP_KERNEL);
+
+	return devm_hwspin_lock_register(&pdev->dev, &sem->lockdev,
+		&rtd1195_sb2_sem_hwspinlock_ops, sem->base_id, num);
+}
+
+static const struct of_device_id rtd1195_sb2_sem_dt_ids[] = {
+	{ .compatible = "realtek,rtd1195-sb2-sem" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, rtd1195_sb2_sem_dt_ids);
+
+static struct platform_driver rtd1195_sb2_sem_platform_driver = {
+	.driver = {
+		.name = "rtd1195-sb2-sem",
+		.of_match_table = rtd1195_sb2_sem_dt_ids,
+	},
+	.probe = rtd1195_sb2_sem_probe,
+};
+module_platform_driver(rtd1195_sb2_sem_platform_driver);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Hardware spinlock driver for Realtek RTD1195 SB2");
+MODULE_AUTHOR("Andreas Färber <afaerber@suse.de>");
-- 
2.16.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC 3/5] ARM: dts: rtd1195: Add SB2 sem nodes
  2019-12-02 22:05 [RFC 0/5] ARM: dts: realtek: SB2 semaphores Andreas Färber
  2019-12-02 22:05 ` [RFC 1/5] dt-bindings: hwlock: Add Realtek RTD1195 SB2 Andreas Färber
  2019-12-02 22:05 ` [RFC 2/5] hwspinlock: " Andreas Färber
@ 2019-12-02 22:05 ` Andreas Färber
  2019-12-02 22:05 ` [RFC 4/5] arm64: dts: realtek: rtd129x: " Andreas Färber
  2019-12-02 22:05 ` [RFC 5/5] arm64: dts: realtek: rtd139x: " Andreas Färber
  4 siblings, 0 replies; 11+ messages in thread
From: Andreas Färber @ 2019-12-02 22:05 UTC (permalink / raw)
  To: linux-realtek-soc
  Cc: Mark Rutland, devicetree, Cheng-Yu Lee, linux-kernel,
	Rob Herring, Andreas Färber, linux-arm-kernel

Add DT nodes to SB2 for hardware semaphores on RTD1195 SoC.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 arch/arm/boot/dts/rtd1195.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/boot/dts/rtd1195.dtsi b/arch/arm/boot/dts/rtd1195.dtsi
index 21897210d9d0..6fd12a2d766e 100644
--- a/arch/arm/boot/dts/rtd1195.dtsi
+++ b/arch/arm/boot/dts/rtd1195.dtsi
@@ -215,3 +215,17 @@
 		status = "disabled";
 	};
 };
+
+&sb2 {
+	sb2_hd_sem: hwspinlock@0 {
+		compatible = "realtek,rtd1195-sb2-sem";
+		reg = <0x0 0x4>;
+		#hwlock-cells = <0>;
+	};
+
+	sb2_hd_sem_new: hwspinlock@620 {
+		compatible = "realtek,rtd1195-sb2-sem";
+		reg = <0x620 0x20>;
+		#hwlock-cells = <1>;
+	};
+};
-- 
2.16.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC 4/5] arm64: dts: realtek: rtd129x: Add SB2 sem nodes
  2019-12-02 22:05 [RFC 0/5] ARM: dts: realtek: SB2 semaphores Andreas Färber
                   ` (2 preceding siblings ...)
  2019-12-02 22:05 ` [RFC 3/5] ARM: dts: rtd1195: Add SB2 sem nodes Andreas Färber
@ 2019-12-02 22:05 ` Andreas Färber
  2019-12-02 22:05 ` [RFC 5/5] arm64: dts: realtek: rtd139x: " Andreas Färber
  4 siblings, 0 replies; 11+ messages in thread
From: Andreas Färber @ 2019-12-02 22:05 UTC (permalink / raw)
  To: linux-realtek-soc
  Cc: Mark Rutland, devicetree, Cheng-Yu Lee, linux-kernel,
	Rob Herring, Andreas Färber, linux-arm-kernel

Add DT nodes to SB2 for hardware sempaphores in RTD1295 SoC family.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 arch/arm64/boot/dts/realtek/rtd129x.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/realtek/rtd129x.dtsi b/arch/arm64/boot/dts/realtek/rtd129x.dtsi
index 39aefe66a794..93ab6fdd03d4 100644
--- a/arch/arm64/boot/dts/realtek/rtd129x.dtsi
+++ b/arch/arm64/boot/dts/realtek/rtd129x.dtsi
@@ -193,3 +193,17 @@
 		status = "disabled";
 	};
 };
+
+&sb2 {
+	sb2_hd_sem: hwspinlock@0 {
+		compatible = "realtek,rtd1195-sb2-sem";
+		reg = <0x0 0x4>;
+		#hwlock-cells = <0>;
+	};
+
+	sb2_hd_sem_new: hwspinlock@620 {
+		compatible = "realtek,rtd1195-sb2-sem";
+		reg = <0x620 0x20>;
+		#hwlock-cells = <1>;
+	};
+};
-- 
2.16.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [RFC 5/5] arm64: dts: realtek: rtd139x: Add SB2 sem nodes
  2019-12-02 22:05 [RFC 0/5] ARM: dts: realtek: SB2 semaphores Andreas Färber
                   ` (3 preceding siblings ...)
  2019-12-02 22:05 ` [RFC 4/5] arm64: dts: realtek: rtd129x: " Andreas Färber
@ 2019-12-02 22:05 ` Andreas Färber
  2019-12-02 23:12   ` Andreas Färber
  4 siblings, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2019-12-02 22:05 UTC (permalink / raw)
  To: linux-realtek-soc
  Cc: Mark Rutland, devicetree, Cheng-Yu Lee, linux-kernel,
	Rob Herring, Andreas Färber, linux-arm-kernel

Add DT nodes to SB2 for hardware semaphores in RTD1395 SoC family.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 arch/arm64/boot/dts/realtek/rtd139x.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm64/boot/dts/realtek/rtd139x.dtsi b/arch/arm64/boot/dts/realtek/rtd139x.dtsi
index a3c10ceeb586..586b05350274 100644
--- a/arch/arm64/boot/dts/realtek/rtd139x.dtsi
+++ b/arch/arm64/boot/dts/realtek/rtd139x.dtsi
@@ -191,3 +191,17 @@
 		status = "disabled";
 	};
 };
+
+&sb2 {
+	sb2_hd_sem: hwspinlock@0 {
+		compatible = "realtek,rtd1195-sb2-sem";
+		reg = <0x0 0x4>;
+		#hwlock-cells = <0>;
+	};
+
+	sb2_hd_sem_new: hwspinlock@620 {
+		compatible = "realtek,rtd1195-sb2-sem";
+		reg = <0x620 0x20>;
+		#hwlock-cells = <1>;
+	};
+};
-- 
2.16.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [RFC 5/5] arm64: dts: realtek: rtd139x: Add SB2 sem nodes
  2019-12-02 22:05 ` [RFC 5/5] arm64: dts: realtek: rtd139x: " Andreas Färber
@ 2019-12-02 23:12   ` Andreas Färber
  0 siblings, 0 replies; 11+ messages in thread
From: Andreas Färber @ 2019-12-02 23:12 UTC (permalink / raw)
  To: linux-realtek-soc, Cheng-Yu Lee, James Tai
  Cc: Mark Rutland, devicetree, Rob Herring, linux-kernel, linux-arm-kernel

Am 02.12.19 um 23:05 schrieb Andreas Färber:
> Add DT nodes to SB2 for hardware semaphores in RTD1395 SoC family.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  arch/arm64/boot/dts/realtek/rtd139x.dtsi | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/realtek/rtd139x.dtsi b/arch/arm64/boot/dts/realtek/rtd139x.dtsi
> index a3c10ceeb586..586b05350274 100644
> --- a/arch/arm64/boot/dts/realtek/rtd139x.dtsi
> +++ b/arch/arm64/boot/dts/realtek/rtd139x.dtsi
> @@ -191,3 +191,17 @@
>  		status = "disabled";
>  	};
>  };
> +
> +&sb2 {
> +	sb2_hd_sem: hwspinlock@0 {
> +		compatible = "realtek,rtd1195-sb2-sem";
> +		reg = <0x0 0x4>;
> +		#hwlock-cells = <0>;
> +	};
> +
> +	sb2_hd_sem_new: hwspinlock@620 {
> +		compatible = "realtek,rtd1195-sb2-sem";
> +		reg = <0x620 0x20>;
> +		#hwlock-cells = <1>;
> +	};

Forgot to mention: These last 8 registers (0x20) are a guess, untested.
@Realtek: Can someone please check whether RTD1395 has the same nine sem
registers as RTD1295?

Similarly, this series is lacking a patch for RTD1619 because - same as
for RTD1295/RTD1395 - BSP DT only shows the first one (cf. coverletter).
Same issue for RTD1319 while at it.

Thanks,
Andreas

> +};

-- 
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 2/5] hwspinlock: Add Realtek RTD1195 SB2
  2019-12-02 22:05 ` [RFC 2/5] hwspinlock: " Andreas Färber
@ 2019-12-03  8:46   ` Fabien DESSENNE
  2019-12-03  8:58     ` Andreas Färber
  0 siblings, 1 reply; 11+ messages in thread
From: Fabien DESSENNE @ 2019-12-03  8:46 UTC (permalink / raw)
  To: Andreas Färber, linux-realtek-soc
  Cc: Ohad Ben-Cohen, Cheng-Yu Lee, linux-remoteproc, linux-kernel,
	Bjorn Andersson, linux-arm-kernel

Hi Andreas


Few comments below.

BR

Fabien


On 02/12/2019 11:05 PM, Andreas Färber wrote:
> Implement a driver for hardware semaphores found in RTD1195 SoC.
> It allows for both per-register instances (SB2_HD_SEM) as well as
> contiguous register ranges (SB2_HD_SEM_NEW[0-7]).
>
> While these registers are part of the SB2 syscon, this implementation
> does not use syscon, to allow assigning one as SB2 syscon's hwlock.
>
> Cc: Cheng-Yu Lee <cylee12@realtek.com>
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>   drivers/hwspinlock/Kconfig           |  11 ++++
>   drivers/hwspinlock/Makefile          |   1 +
>   drivers/hwspinlock/rtd1195_sb2_sem.c | 101 +++++++++++++++++++++++++++++++++++
>   3 files changed, 113 insertions(+)
>   create mode 100644 drivers/hwspinlock/rtd1195_sb2_sem.c
>
> diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
> index 37740e992cfa..9c26c436d399 100644
> --- a/drivers/hwspinlock/Kconfig
> +++ b/drivers/hwspinlock/Kconfig
> @@ -28,6 +28,17 @@ config HWSPINLOCK_QCOM
>   
>   	  If unsure, say N.
>   
> +config HWSPINLOCK_RTD1195_SB2
> +	tristate "Realtek RTD1195 SB2 Hardware Spinlock device"
> +	depends on HWSPINLOCK
> +	depends on ARCH_REALTEK || COMPILE_TEST
> +	default ARCH_REALTEK
> +	help
> +	  Say y here to support the Realtek Hardware Semaphore functionality,
> +	  found on the RTD1195 and later SoC families.
> +
> +	  If unsure, say N.
> +
>   config HWSPINLOCK_SIRF
>   	tristate "SIRF Hardware Spinlock device"
>   	depends on HWSPINLOCK
> diff --git a/drivers/hwspinlock/Makefile b/drivers/hwspinlock/Makefile
> index ed053e3f02be..d5bd59412468 100644
> --- a/drivers/hwspinlock/Makefile
> +++ b/drivers/hwspinlock/Makefile
> @@ -6,6 +6,7 @@
>   obj-$(CONFIG_HWSPINLOCK)		+= hwspinlock_core.o
>   obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
>   obj-$(CONFIG_HWSPINLOCK_QCOM)		+= qcom_hwspinlock.o
> +obj-$(CONFIG_HWSPINLOCK_RTD1195_SB2)	+= rtd1195_sb2_sem.o
>   obj-$(CONFIG_HWSPINLOCK_SIRF)		+= sirf_hwspinlock.o
>   obj-$(CONFIG_HWSPINLOCK_SPRD)		+= sprd_hwspinlock.o
>   obj-$(CONFIG_HWSPINLOCK_STM32)		+= stm32_hwspinlock.o
> diff --git a/drivers/hwspinlock/rtd1195_sb2_sem.c b/drivers/hwspinlock/rtd1195_sb2_sem.c
> new file mode 100644
> index 000000000000..ae925d057874
> --- /dev/null
> +++ b/drivers/hwspinlock/rtd1195_sb2_sem.c
> @@ -0,0 +1,101 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * RTD1195 SB2 hardware semaphore
> + *
> + * Copyright (c) 2019 Andreas Färber
> + */
> +
> +#include <linux/bitops.h>
> +#include <linux/hwspinlock.h>
> +#include <linux/idr.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_address.h>
> +#include <linux/platform_device.h>
> +
> +#include "hwspinlock_internal.h"
> +
> +struct rtd1195_sb2_sem {
> +	struct platform_device *pdev;
> +	void __iomem *base;
> +	int base_id;
The pdev, base and base_id members of this struct are set in .probe() 
but never read anywhere: you may remove them and keep only lockdev
> +	struct hwspinlock_device lockdev;
> +};
> +
> +static DEFINE_IDR(rtd1195_sb2_sem_idr);
> +
> +static int rtd1195_sb2_sem_trylock(struct hwspinlock *lock)
> +{
> +	void __iomem *reg = (void __iomem *)lock->priv;
> +
> +	return readl_relaxed(reg) & BIT(0);
> +}
> +
> +static void rtd1195_sb2_sem_unlock(struct hwspinlock *lock)
> +{
> +	void __iomem *reg = (void __iomem *)lock->priv;
> +
> +	writel_relaxed(0, reg);
> +}
> +
> +static const struct hwspinlock_ops rtd1195_sb2_sem_hwspinlock_ops = {
> +	.trylock	= rtd1195_sb2_sem_trylock,
> +	.unlock		= rtd1195_sb2_sem_unlock,
> +};
> +
> +static int rtd1195_sb2_sem_probe(struct platform_device *pdev)
> +{
> +	struct rtd1195_sb2_sem *sem;
> +	struct hwspinlock *lock;
> +	struct resource *res;
> +	int i, num;
> +
> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +	if (!res)
> +		return -ENOMEM;
> +
> +	num = resource_size(res) / 4;
> +
> +	sem = devm_kzalloc(&pdev->dev, sizeof(*sem) + num * sizeof(*lock),
> +			   GFP_KERNEL);
> +	if (!sem)
> +		return -ENOMEM;
> +
> +	sem->pdev = pdev;
> +
> +	sem->base = of_iomap(pdev->dev.of_node, 0);
You may use devm_ioremap_resource() here.
> +	if (!sem->base)
> +		return -ENOMEM;
> +
> +	for (i = 0; i < num; i++) {
> +		lock = &sem->lockdev.lock[i];
> +		lock->priv = sem->base + i * 4;
> +	}
> +
> +	platform_set_drvdata(pdev, sem);
> +
> +	sem->base_id = idr_alloc(&rtd1195_sb2_sem_idr, sem, 0, 0, GFP_KERNEL);
> +
> +	return devm_hwspin_lock_register(&pdev->dev, &sem->lockdev,
> +		&rtd1195_sb2_sem_hwspinlock_ops, sem->base_id, num);
> +}
> +
> +static const struct of_device_id rtd1195_sb2_sem_dt_ids[] = {
> +	{ .compatible = "realtek,rtd1195-sb2-sem" },
> +	{ }
> +};
> +MODULE_DEVICE_TABLE(of, rtd1195_sb2_sem_dt_ids);
> +
> +static struct platform_driver rtd1195_sb2_sem_platform_driver = {
> +	.driver = {
> +		.name = "rtd1195-sb2-sem",
> +		.of_match_table = rtd1195_sb2_sem_dt_ids,
> +	},
> +	.probe = rtd1195_sb2_sem_probe,
> +};
> +module_platform_driver(rtd1195_sb2_sem_platform_driver);
> +
> +MODULE_LICENSE("GPL");
> +MODULE_DESCRIPTION("Hardware spinlock driver for Realtek RTD1195 SB2");
> +MODULE_AUTHOR("Andreas Färber <afaerber@suse.de>");
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 2/5] hwspinlock: Add Realtek RTD1195 SB2
  2019-12-03  8:46   ` Fabien DESSENNE
@ 2019-12-03  8:58     ` Andreas Färber
  2019-12-03  9:50       ` Fabien DESSENNE
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Färber @ 2019-12-03  8:58 UTC (permalink / raw)
  To: Fabien DESSENNE
  Cc: Ohad Ben-Cohen, Cheng-Yu Lee, linux-realtek-soc,
	linux-remoteproc, linux-kernel, Bjorn Andersson,
	linux-arm-kernel

Hi Fabien,

Am 03.12.19 um 09:46 schrieb Fabien DESSENNE:
> On 02/12/2019 11:05 PM, Andreas Färber wrote:
>> Implement a driver for hardware semaphores found in RTD1195 SoC.
>> It allows for both per-register instances (SB2_HD_SEM) as well as
>> contiguous register ranges (SB2_HD_SEM_NEW[0-7]).
>>
>> While these registers are part of the SB2 syscon, this implementation
>> does not use syscon, to allow assigning one as SB2 syscon's hwlock.
>>
>> Cc: Cheng-Yu Lee <cylee12@realtek.com>
>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>> ---
>>   drivers/hwspinlock/Kconfig           |  11 ++++
>>   drivers/hwspinlock/Makefile          |   1 +
>>   drivers/hwspinlock/rtd1195_sb2_sem.c | 101 +++++++++++++++++++++++++++++++++++
>>   3 files changed, 113 insertions(+)
>>   create mode 100644 drivers/hwspinlock/rtd1195_sb2_sem.c
>>
>> diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
>> index 37740e992cfa..9c26c436d399 100644
>> --- a/drivers/hwspinlock/Kconfig
>> +++ b/drivers/hwspinlock/Kconfig
>> @@ -28,6 +28,17 @@ config HWSPINLOCK_QCOM
>>   
>>   	  If unsure, say N.
>>   
>> +config HWSPINLOCK_RTD1195_SB2
>> +	tristate "Realtek RTD1195 SB2 Hardware Spinlock device"
>> +	depends on HWSPINLOCK
>> +	depends on ARCH_REALTEK || COMPILE_TEST
>> +	default ARCH_REALTEK
>> +	help
>> +	  Say y here to support the Realtek Hardware Semaphore functionality,
>> +	  found on the RTD1195 and later SoC families.
>> +
>> +	  If unsure, say N.
>> +
>>   config HWSPINLOCK_SIRF
>>   	tristate "SIRF Hardware Spinlock device"
>>   	depends on HWSPINLOCK
>> diff --git a/drivers/hwspinlock/Makefile b/drivers/hwspinlock/Makefile
>> index ed053e3f02be..d5bd59412468 100644
>> --- a/drivers/hwspinlock/Makefile
>> +++ b/drivers/hwspinlock/Makefile
>> @@ -6,6 +6,7 @@
>>   obj-$(CONFIG_HWSPINLOCK)		+= hwspinlock_core.o
>>   obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
>>   obj-$(CONFIG_HWSPINLOCK_QCOM)		+= qcom_hwspinlock.o
>> +obj-$(CONFIG_HWSPINLOCK_RTD1195_SB2)	+= rtd1195_sb2_sem.o
>>   obj-$(CONFIG_HWSPINLOCK_SIRF)		+= sirf_hwspinlock.o
>>   obj-$(CONFIG_HWSPINLOCK_SPRD)		+= sprd_hwspinlock.o
>>   obj-$(CONFIG_HWSPINLOCK_STM32)		+= stm32_hwspinlock.o
>> diff --git a/drivers/hwspinlock/rtd1195_sb2_sem.c b/drivers/hwspinlock/rtd1195_sb2_sem.c
>> new file mode 100644
>> index 000000000000..ae925d057874
>> --- /dev/null
>> +++ b/drivers/hwspinlock/rtd1195_sb2_sem.c
>> @@ -0,0 +1,101 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +/*
>> + * RTD1195 SB2 hardware semaphore
>> + *
>> + * Copyright (c) 2019 Andreas Färber
>> + */
>> +
>> +#include <linux/bitops.h>
>> +#include <linux/hwspinlock.h>
>> +#include <linux/idr.h>
>> +#include <linux/io.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>> +#include <linux/of_address.h>
>> +#include <linux/platform_device.h>
>> +
>> +#include "hwspinlock_internal.h"
>> +
>> +struct rtd1195_sb2_sem {
>> +	struct platform_device *pdev;
>> +	void __iomem *base;
>> +	int base_id;
> The pdev, base and base_id members of this struct are set in .probe() 
> but never read anywhere: you may remove them and keep only lockdev

Hmm, this module driver is still missing a remove hook that might need
them. I was originally planning to pass this struct as priv to the
initial locks, but that didn't work out for more than one lock.

Also, have you ever had the case where an hwspinlock driver were using a
syscon instead of __iomem pointer, and potentially be used as hwlock for
that same syscon? I assumed that would cause circular probing problems,
but I didn't actually test it and considered it a bad design idea? If it
is supported, a regmap would be the alternative to base above.

>> +	struct hwspinlock_device lockdev;
>> +};
>> +
>> +static DEFINE_IDR(rtd1195_sb2_sem_idr);
>> +
>> +static int rtd1195_sb2_sem_trylock(struct hwspinlock *lock)
>> +{
>> +	void __iomem *reg = (void __iomem *)lock->priv;
>> +
>> +	return readl_relaxed(reg) & BIT(0);
>> +}
>> +
>> +static void rtd1195_sb2_sem_unlock(struct hwspinlock *lock)
>> +{
>> +	void __iomem *reg = (void __iomem *)lock->priv;
>> +
>> +	writel_relaxed(0, reg);
>> +}
>> +
>> +static const struct hwspinlock_ops rtd1195_sb2_sem_hwspinlock_ops = {
>> +	.trylock	= rtd1195_sb2_sem_trylock,
>> +	.unlock		= rtd1195_sb2_sem_unlock,
>> +};
>> +
>> +static int rtd1195_sb2_sem_probe(struct platform_device *pdev)
>> +{
>> +	struct rtd1195_sb2_sem *sem;
>> +	struct hwspinlock *lock;
>> +	struct resource *res;
>> +	int i, num;
>> +
>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> +	if (!res)
>> +		return -ENOMEM;
>> +
>> +	num = resource_size(res) / 4;
>> +
>> +	sem = devm_kzalloc(&pdev->dev, sizeof(*sem) + num * sizeof(*lock),
>> +			   GFP_KERNEL);
>> +	if (!sem)
>> +		return -ENOMEM;
>> +
>> +	sem->pdev = pdev;
>> +
>> +	sem->base = of_iomap(pdev->dev.of_node, 0);
> You may use devm_ioremap_resource() here.

Wouldn't that also reserve this memory and thus cause conflicts?

I have another unposted driver on the same syscon (reason for basing
this on the syscon series [1]), which currently overlaps it - to be
updated to syscon.

Thanks for initial review,
Andreas

[1] https://patchwork.kernel.org/cover/11269971/

>> +	if (!sem->base)
>> +		return -ENOMEM;
>> +
>> +	for (i = 0; i < num; i++) {
>> +		lock = &sem->lockdev.lock[i];
>> +		lock->priv = sem->base + i * 4;
>> +	}
>> +
>> +	platform_set_drvdata(pdev, sem);
>> +
>> +	sem->base_id = idr_alloc(&rtd1195_sb2_sem_idr, sem, 0, 0, GFP_KERNEL);
>> +
>> +	return devm_hwspin_lock_register(&pdev->dev, &sem->lockdev,
>> +		&rtd1195_sb2_sem_hwspinlock_ops, sem->base_id, num);
>> +}
>> +
>> +static const struct of_device_id rtd1195_sb2_sem_dt_ids[] = {
>> +	{ .compatible = "realtek,rtd1195-sb2-sem" },
>> +	{ }
>> +};
>> +MODULE_DEVICE_TABLE(of, rtd1195_sb2_sem_dt_ids);
>> +
>> +static struct platform_driver rtd1195_sb2_sem_platform_driver = {
>> +	.driver = {
>> +		.name = "rtd1195-sb2-sem",
>> +		.of_match_table = rtd1195_sb2_sem_dt_ids,
>> +	},
>> +	.probe = rtd1195_sb2_sem_probe,
>> +};
>> +module_platform_driver(rtd1195_sb2_sem_platform_driver);
>> +
>> +MODULE_LICENSE("GPL");
>> +MODULE_DESCRIPTION("Hardware spinlock driver for Realtek RTD1195 SB2");
>> +MODULE_AUTHOR("Andreas Färber <afaerber@suse.de>");


-- 
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer
HRB 36809 (AG Nürnberg)

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 2/5] hwspinlock: Add Realtek RTD1195 SB2
  2019-12-03  8:58     ` Andreas Färber
@ 2019-12-03  9:50       ` Fabien DESSENNE
  0 siblings, 0 replies; 11+ messages in thread
From: Fabien DESSENNE @ 2019-12-03  9:50 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Ohad Ben-Cohen, Cheng-Yu Lee, linux-realtek-soc,
	linux-remoteproc, linux-kernel, Bjorn Andersson,
	linux-arm-kernel

Hi Andreas


On 03/12/2019 9:58 AM, Andreas Färber wrote:
> Hi Fabien,
>
> Am 03.12.19 um 09:46 schrieb Fabien DESSENNE:
>> On 02/12/2019 11:05 PM, Andreas Färber wrote:
>>> Implement a driver for hardware semaphores found in RTD1195 SoC.
>>> It allows for both per-register instances (SB2_HD_SEM) as well as
>>> contiguous register ranges (SB2_HD_SEM_NEW[0-7]).
>>>
>>> While these registers are part of the SB2 syscon, this implementation
>>> does not use syscon, to allow assigning one as SB2 syscon's hwlock.
>>>
>>> Cc: Cheng-Yu Lee <cylee12@realtek.com>
>>> Signed-off-by: Andreas Färber <afaerber@suse.de>
>>> ---
>>>    drivers/hwspinlock/Kconfig           |  11 ++++
>>>    drivers/hwspinlock/Makefile          |   1 +
>>>    drivers/hwspinlock/rtd1195_sb2_sem.c | 101 +++++++++++++++++++++++++++++++++++
>>>    3 files changed, 113 insertions(+)
>>>    create mode 100644 drivers/hwspinlock/rtd1195_sb2_sem.c
>>>
>>> diff --git a/drivers/hwspinlock/Kconfig b/drivers/hwspinlock/Kconfig
>>> index 37740e992cfa..9c26c436d399 100644
>>> --- a/drivers/hwspinlock/Kconfig
>>> +++ b/drivers/hwspinlock/Kconfig
>>> @@ -28,6 +28,17 @@ config HWSPINLOCK_QCOM
>>>    
>>>    	  If unsure, say N.
>>>    
>>> +config HWSPINLOCK_RTD1195_SB2
>>> +	tristate "Realtek RTD1195 SB2 Hardware Spinlock device"
>>> +	depends on HWSPINLOCK
>>> +	depends on ARCH_REALTEK || COMPILE_TEST
>>> +	default ARCH_REALTEK
>>> +	help
>>> +	  Say y here to support the Realtek Hardware Semaphore functionality,
>>> +	  found on the RTD1195 and later SoC families.
>>> +
>>> +	  If unsure, say N.
>>> +
>>>    config HWSPINLOCK_SIRF
>>>    	tristate "SIRF Hardware Spinlock device"
>>>    	depends on HWSPINLOCK
>>> diff --git a/drivers/hwspinlock/Makefile b/drivers/hwspinlock/Makefile
>>> index ed053e3f02be..d5bd59412468 100644
>>> --- a/drivers/hwspinlock/Makefile
>>> +++ b/drivers/hwspinlock/Makefile
>>> @@ -6,6 +6,7 @@
>>>    obj-$(CONFIG_HWSPINLOCK)		+= hwspinlock_core.o
>>>    obj-$(CONFIG_HWSPINLOCK_OMAP)		+= omap_hwspinlock.o
>>>    obj-$(CONFIG_HWSPINLOCK_QCOM)		+= qcom_hwspinlock.o
>>> +obj-$(CONFIG_HWSPINLOCK_RTD1195_SB2)	+= rtd1195_sb2_sem.o
>>>    obj-$(CONFIG_HWSPINLOCK_SIRF)		+= sirf_hwspinlock.o
>>>    obj-$(CONFIG_HWSPINLOCK_SPRD)		+= sprd_hwspinlock.o
>>>    obj-$(CONFIG_HWSPINLOCK_STM32)		+= stm32_hwspinlock.o
>>> diff --git a/drivers/hwspinlock/rtd1195_sb2_sem.c b/drivers/hwspinlock/rtd1195_sb2_sem.c
>>> new file mode 100644
>>> index 000000000000..ae925d057874
>>> --- /dev/null
>>> +++ b/drivers/hwspinlock/rtd1195_sb2_sem.c
>>> @@ -0,0 +1,101 @@
>>> +// SPDX-License-Identifier: GPL-2.0-or-later
>>> +/*
>>> + * RTD1195 SB2 hardware semaphore
>>> + *
>>> + * Copyright (c) 2019 Andreas Färber
>>> + */
>>> +
>>> +#include <linux/bitops.h>
>>> +#include <linux/hwspinlock.h>
>>> +#include <linux/idr.h>
>>> +#include <linux/io.h>
>>> +#include <linux/module.h>
>>> +#include <linux/of.h>
>>> +#include <linux/of_address.h>
>>> +#include <linux/platform_device.h>
>>> +
>>> +#include "hwspinlock_internal.h"
>>> +
>>> +struct rtd1195_sb2_sem {
>>> +	struct platform_device *pdev;
>>> +	void __iomem *base;
>>> +	int base_id;
>> The pdev, base and base_id members of this struct are set in .probe()
>> but never read anywhere: you may remove them and keep only lockdev
> Hmm, this module driver is still missing a remove hook that might need
> them. I was originally planning to pass this struct as priv to the
> initial locks, but that didn't work out for more than one lock.


I do not think that you need to read these parameters back in .remove().

In top of that, if you use devm_xxx() everywhere in .probe(), then 
.remove() would probably be empty. Apart maybe a call to idr_remove() or 
idr_destroy().


>
> Also, have you ever had the case where an hwspinlock driver were using a
> syscon instead of __iomem pointer, and potentially be used as hwlock for
> that same syscon? I assumed that would cause circular probing problems,
> but I didn't actually test it and considered it a bad design idea? If it
> is supported, a regmap would be the alternative to base above.


I do not have any experience on this particular point. But note that 
"syscon" drivers can declare an  'hwlocks' property it their DT node. In 
that case, every call to syscon is protected by the hwlock (see [1]). 
You shall take care of this too.

[1] https://lore.kernel.org/patchwork/patch/872812/


>
>>> +	struct hwspinlock_device lockdev;
>>> +};
>>> +
>>> +static DEFINE_IDR(rtd1195_sb2_sem_idr);
>>> +
>>> +static int rtd1195_sb2_sem_trylock(struct hwspinlock *lock)
>>> +{
>>> +	void __iomem *reg = (void __iomem *)lock->priv;
>>> +
>>> +	return readl_relaxed(reg) & BIT(0);
>>> +}
>>> +
>>> +static void rtd1195_sb2_sem_unlock(struct hwspinlock *lock)
>>> +{
>>> +	void __iomem *reg = (void __iomem *)lock->priv;
>>> +
>>> +	writel_relaxed(0, reg);
>>> +}
>>> +
>>> +static const struct hwspinlock_ops rtd1195_sb2_sem_hwspinlock_ops = {
>>> +	.trylock	= rtd1195_sb2_sem_trylock,
>>> +	.unlock		= rtd1195_sb2_sem_unlock,
>>> +};
>>> +
>>> +static int rtd1195_sb2_sem_probe(struct platform_device *pdev)
>>> +{
>>> +	struct rtd1195_sb2_sem *sem;
>>> +	struct hwspinlock *lock;
>>> +	struct resource *res;
>>> +	int i, num;
>>> +
>>> +	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +	if (!res)
>>> +		return -ENOMEM;
>>> +
>>> +	num = resource_size(res) / 4;
>>> +
>>> +	sem = devm_kzalloc(&pdev->dev, sizeof(*sem) + num * sizeof(*lock),
>>> +			   GFP_KERNEL);
>>> +	if (!sem)
>>> +		return -ENOMEM;
>>> +
>>> +	sem->pdev = pdev;
>>> +
>>> +	sem->base = of_iomap(pdev->dev.of_node, 0);
>> You may use devm_ioremap_resource() here.
> Wouldn't that also reserve this memory and thus cause conflicts?


My suggestion consists in using the devm_ version. I do not think that 
it can cause any trouble.


>
> I have another unposted driver on the same syscon (reason for basing
> this on the syscon series [1]), which currently overlaps it - to be
> updated to syscon.
>
> Thanks for initial review,
> Andreas
>
> [1] https://patchwork.kernel.org/cover/11269971/
>
>>> +	if (!sem->base)
>>> +		return -ENOMEM;
>>> +
>>> +	for (i = 0; i < num; i++) {
>>> +		lock = &sem->lockdev.lock[i];
>>> +		lock->priv = sem->base + i * 4;
>>> +	}
>>> +
>>> +	platform_set_drvdata(pdev, sem);
>>> +
>>> +	sem->base_id = idr_alloc(&rtd1195_sb2_sem_idr, sem, 0, 0, GFP_KERNEL);
>>> +
>>> +	return devm_hwspin_lock_register(&pdev->dev, &sem->lockdev,
>>> +		&rtd1195_sb2_sem_hwspinlock_ops, sem->base_id, num);
>>> +}
>>> +
>>> +static const struct of_device_id rtd1195_sb2_sem_dt_ids[] = {
>>> +	{ .compatible = "realtek,rtd1195-sb2-sem" },
>>> +	{ }
>>> +};
>>> +MODULE_DEVICE_TABLE(of, rtd1195_sb2_sem_dt_ids);
>>> +
>>> +static struct platform_driver rtd1195_sb2_sem_platform_driver = {
>>> +	.driver = {
>>> +		.name = "rtd1195-sb2-sem",
>>> +		.of_match_table = rtd1195_sb2_sem_dt_ids,
>>> +	},
>>> +	.probe = rtd1195_sb2_sem_probe,
>>> +};
>>> +module_platform_driver(rtd1195_sb2_sem_platform_driver);
>>> +
>>> +MODULE_LICENSE("GPL");
>>> +MODULE_DESCRIPTION("Hardware spinlock driver for Realtek RTD1195 SB2");
>>> +MODULE_AUTHOR("Andreas Färber <afaerber@suse.de>");
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [RFC 1/5] dt-bindings: hwlock: Add Realtek RTD1195 SB2
  2019-12-02 22:05 ` [RFC 1/5] dt-bindings: hwlock: Add Realtek RTD1195 SB2 Andreas Färber
@ 2019-12-13 23:40   ` Rob Herring
  0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2019-12-13 23:40 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Ohad Ben-Cohen, Mark Rutland, Cheng-Yu Lee, linux-realtek-soc,
	linux-remoteproc, linux-kernel, Bjorn Andersson, devicetree,
	Andreas Färber, linux-arm-kernel

On Mon,  2 Dec 2019 23:05:31 +0100, =?UTF-8?q?Andreas=20F=C3=A4rber?= wrote:
> Define a binding for Realtek RTD1195 SoC's SB2 hardware semaphore.
> 
> Signed-off-by: Andreas Färber <afaerber@suse.de>
> ---
>  .../bindings/hwlock/realtek,rtd1195-sb2-sem.yaml   | 42 ++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwlock/realtek,rtd1195-sb2-sem.yaml
> 

Reviewed-by: Rob Herring <robh@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-12-13 23:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-02 22:05 [RFC 0/5] ARM: dts: realtek: SB2 semaphores Andreas Färber
2019-12-02 22:05 ` [RFC 1/5] dt-bindings: hwlock: Add Realtek RTD1195 SB2 Andreas Färber
2019-12-13 23:40   ` Rob Herring
2019-12-02 22:05 ` [RFC 2/5] hwspinlock: " Andreas Färber
2019-12-03  8:46   ` Fabien DESSENNE
2019-12-03  8:58     ` Andreas Färber
2019-12-03  9:50       ` Fabien DESSENNE
2019-12-02 22:05 ` [RFC 3/5] ARM: dts: rtd1195: Add SB2 sem nodes Andreas Färber
2019-12-02 22:05 ` [RFC 4/5] arm64: dts: realtek: rtd129x: " Andreas Färber
2019-12-02 22:05 ` [RFC 5/5] arm64: dts: realtek: rtd139x: " Andreas Färber
2019-12-02 23:12   ` Andreas Färber

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).