diff mbox series

[1/2] sh73a0 CMT1 device exposed via UIO

Message ID 161632672360.9191.17012441985597645272.sendpatchset@octo (mailing list archive)
State RFC
Delegated to: Geert Uytterhoeven
Headers show
Series sh73a0 CMT1 test setup using UIO | expand

Commit Message

Magnus Damm March 21, 2021, 11:38 a.m. UTC
From: Magnus Damm <damm+renesas@opensource.se>

Modify the kernel slightly to expose CMT1 via UIO and print some
IRQ-related messages from UIO for debugging purpose.

Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm/boot/dts/sh73a0.dtsi |    2 +-
 drivers/uio/uio.c             |    3 ++-
 drivers/uio/uio_pdrv_genirq.c |   10 ++++++++--
 3 files changed, 11 insertions(+), 4 deletions(-)

Comments

Geert Uytterhoeven March 21, 2021, 2:06 p.m. UTC | #1
Hi Magnus,

On Sun, Mar 21, 2021 at 1:12 PM Magnus Damm <damm@opensource.se> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Modify the kernel slightly to expose CMT1 via UIO and print some
> IRQ-related messages from UIO for debugging purpose.
>
> Not-Yet-Signed-off-by: Magnus Damm <damm+renesas@opensource.se>

Thanks for your patch!

> --- 0001/arch/arm/boot/dts/sh73a0.dtsi
> +++ work/arch/arm/boot/dts/sh73a0.dtsi  2021-03-21 18:15:44.683760186 +0900
> @@ -99,7 +99,7 @@
>         };
>
>         cmt1: timer@e6138000 {
> -               compatible = "renesas,sh73a0-cmt1";
> +               compatible = "uio_pdrv_genirq";

DT describes hardware, not software policy, so please drop this part.

> --- 0001/drivers/uio/uio_pdrv_genirq.c
> +++ work/drivers/uio/uio_pdrv_genirq.c  2021-03-21 18:15:03.120757568 +0900
> @@ -276,7 +282,7 @@ static const struct dev_pm_ops uio_pdrv_
>
>  #ifdef CONFIG_OF
>  static struct of_device_id uio_of_genirq_match[] = {
> -       { /* This is filled with module_parm */ },
> +       { .compatible = "uio_pdrv_genirq", },

The comment you removed tells you how to use this driver ;-)
Alternative, please use driver_override and bind in sysfs.

>         { /* Sentinel */ },
>  };
>  MODULE_DEVICE_TABLE(of, uio_of_genirq_match);

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

--- 0001/arch/arm/boot/dts/sh73a0.dtsi
+++ work/arch/arm/boot/dts/sh73a0.dtsi	2021-03-21 18:15:44.683760186 +0900
@@ -99,7 +99,7 @@ 
 	};
 
 	cmt1: timer@e6138000 {
-		compatible = "renesas,sh73a0-cmt1";
+		compatible = "uio_pdrv_genirq";
 		reg = <0xe6138000 0x200>;
 		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&mstp3_clks SH73A0_CLK_CMT1>;
--- 0001/drivers/uio/uio.c
+++ work/drivers/uio/uio.c	2021-03-21 18:14:34.880755790 +0900
@@ -11,7 +11,7 @@ 
  *
  * Base Functions
  */
-
+#define DEBUG
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/poll.h>
@@ -975,6 +975,7 @@  int __uio_register_device(struct module
 		 * FDs at the time of unregister and therefore may not be
 		 * freed until they are released.
 		 */
+		pr_debug("uio request_irq %lu\n", info->irq);
 		ret = request_irq(info->irq, uio_interrupt,
 				  info->irq_flags, info->name, idev);
 		if (ret) {
--- 0001/drivers/uio/uio_pdrv_genirq.c
+++ work/drivers/uio/uio_pdrv_genirq.c	2021-03-21 18:15:03.120757568 +0900
@@ -10,7 +10,7 @@ 
  * Copyright (C) 2008 by Digi International Inc.
  * All rights reserved.
  */
-
+#define DEBUG
 #include <linux/platform_device.h>
 #include <linux/uio_driver.h>
 #include <linux/spinlock.h>
@@ -66,6 +66,8 @@  static irqreturn_t uio_pdrv_genirq_handl
 	 * remember the state so we can allow user space to enable it later.
 	 */
 
+	pr_debug("irqhandler %d\n", irq);
+
 	spin_lock(&priv->lock);
 	if (!__test_and_set_bit(UIO_IRQ_DISABLED, &priv->flags))
 		disable_irq_nosync(irq);
@@ -87,6 +89,8 @@  static int uio_pdrv_genirq_irqcontrol(st
 	 * with irq handler on SMP systems.
 	 */
 
+	pr_debug("irqcontrol %d\n", irq_on);
+	
 	spin_lock_irqsave(&priv->lock, flags);
 	if (irq_on) {
 		if (__test_and_clear_bit(UIO_IRQ_DISABLED, &priv->flags))
@@ -172,6 +176,8 @@  static int uio_pdrv_genirq_probe(struct
 		}
 	}
 
+	pr_debug("uio irq %lu\n", uioinfo->irq);
+	
 	if (uioinfo->irq) {
 		struct irq_data *irq_data = irq_get_irq_data(uioinfo->irq);
 
@@ -276,7 +282,7 @@  static const struct dev_pm_ops uio_pdrv_
 
 #ifdef CONFIG_OF
 static struct of_device_id uio_of_genirq_match[] = {
-	{ /* This is filled with module_parm */ },
+	{ .compatible = "uio_pdrv_genirq", },
 	{ /* Sentinel */ },
 };
 MODULE_DEVICE_TABLE(of, uio_of_genirq_match);