Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 31 Jan 2010 10:32:37 GMT
From:      Rafal Jaworowski <raj@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 174002 for review
Message-ID:  <201001311032.o0VAWbeK033956@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/chv.cgi?CH=174002

Change 174002 by raj@raj_fdt on 2010/01/31 10:32:29

	Fix handling interrupts in FDT/simplebus environment.
	
	We are now fully set to run ARM drivers using IRQ resources.

Affected files ...

.. //depot/projects/fdt/sys/dev/fdt/fdt_arm.c#2 edit
.. //depot/projects/fdt/sys/dev/fdt/fdtbus.c#4 edit
.. //depot/projects/fdt/sys/dev/fdt/simplebus.c#5 edit

Differences ...

==== //depot/projects/fdt/sys/dev/fdt/fdt_arm.c#2 (text+ko) ====

@@ -56,32 +56,8 @@
 		return (ENXIO);
 
 	*interrupt = fdt32_to_cpu(intr[0]);
-
-	switch (fdt32_to_cpu(intr[1])) {
-	case 0:
-		/* L to H edge */
-		*trig = INTR_TRIGGER_EDGE;
-		*pol = INTR_POLARITY_HIGH;
-		break;
-	case 1:
-		/* Active L level */
-		*trig = INTR_TRIGGER_LEVEL;
-		*pol = INTR_POLARITY_LOW;
-		break;
-	case 2:
-		/* Active H level */
-		*trig = INTR_TRIGGER_LEVEL;
-		*pol = INTR_POLARITY_HIGH;
-		break;
-	case 3:
-		/* H to L edge */
-		*trig = INTR_TRIGGER_EDGE;
-		*pol = INTR_POLARITY_LOW;
-		break;
-	default:
-		*trig = INTR_TRIGGER_CONFORM;
-		*pol = INTR_POLARITY_CONFORM;
-	}
+	*trig = INTR_TRIGGER_CONFORM;
+	*pol = INTR_POLARITY_CONFORM;
 
 	return (0);
 }

==== //depot/projects/fdt/sys/dev/fdt/fdtbus.c#4 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009 The FreeBSD Foundation
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by Semihalf under sponsorship from
@@ -435,7 +435,10 @@
 	err = powerpc_setup_intr(device_get_nameunit(child),
 	    rman_get_start(res), filter, ihand, arg, flags, cookiep);
 #elif defined(__arm__)
-	/* TODO */
+	arm_setup_irqhandler(device_get_nameunit(child),
+	    filter, ihand, arg, rman_get_start(res), flags, cookiep);
+	arm_unmask_irq(rman_get_start(res));
+	err = 0;
 #endif
 
 	return (err);

==== //depot/projects/fdt/sys/dev/fdt/simplebus.c#5 (text+ko) ====

@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2009 The FreeBSD Foundation
+ * Copyright (c) 2009-2010 The FreeBSD Foundation
  * All rights reserved.
  *
  * This software was developed by Semihalf under sponsorship from
@@ -368,7 +368,7 @@
 	struct simplebus_devinfo *di;
 	enum intr_trigger trig;
 	enum intr_polarity pol;
-	int irq, rid, err;
+	int irq, rid;
 
 	if (res == NULL)
 		panic("simplebus_setup_intr: NULL irq resource!");
@@ -392,14 +392,12 @@
 	debugf("intr config: irq = %d, trig = %d, pol = %d\n", irq, trig, pol);
 
 #if defined(__powerpc__)
+	int err;
+
 	err = powerpc_config_intr(irq, trig, pol);
-#elif defined(__arm__)
-	arm_setup_irqhandler(device_get_nameunit(child), filter, ihand, arg,
-	    irq, flags, cookiep);
-	return (0);
-#endif
 	if (err)
 		return (err);
+#endif
 
 	return (bus_generic_setup_intr(bus, child, res, flags, filter, ihand,
 	    arg, cookiep));



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001311032.o0VAWbeK033956>