PERFORCE change 144218 for review

Andrew Turner andrew at FreeBSD.org
Fri Jun 27 23:58:40 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=144218

Change 144218 by andrew at andrew_bender on 2008/06/27 23:58:03

	Add support for allocating sub-irq's rather than the requested irq. This allows us to allocate the UART sub-irq's by asking for the main uart irq

Affected files ...

.. //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410.c#13 edit

Differences ...

==== //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410.c#13 (text+ko) ====

@@ -119,14 +119,16 @@
         struct resource *ires,  int flags, driver_filter_t *filt,
 	driver_intr_t *intr, void *arg, void **cookiep)
 {
-	int error;
+	int error, irq;
 
 	error = BUS_SETUP_INTR(device_get_parent(dev), child, ires, flags, filt,
 	    intr, arg, cookiep);
 	if (error != 0)
 		return (error);
 
-	arm_unmask_irq(rman_get_start(ires));
+	for (irq = rman_get_start(ires); irq <= rman_get_end(ires); irq++) {
+		arm_unmask_irq(irq);
+	}
 	return (0);
 }
 
@@ -154,6 +156,35 @@
 			count = ulmax(count, rle->count);
 			end = ulmax(rle->end, start + count - 1);
 		}
+		/*
+		 * When allocating an irq with children irq's really
+		 * allocate the children as it is those we are interested
+		 * in receiving, not the parent.
+		 */
+		if (type == SYS_RES_IRQ && start == end) {
+			switch (start) {
+			case S3C24X0_INT_ADCTC:
+				start = S3C2410_INT_TC;
+				end = S3C2410_INT_ADC;
+				break;
+			case S3C2410_INT_UART0:
+				start = S3C2410_INT_RXD0;
+				end = S3C2410_INT_ERR0;
+				break;
+			case S3C2410_INT_UART1:
+				start = S3C2410_INT_RXD1;
+				end = S3C2410_INT_ERR1;
+				break;
+			case S3C2410_INT_UART2:
+				start = S3C2410_INT_RXD2;
+				end = S3C2410_INT_ERR2;
+				break;
+			default:
+				break;
+			}
+			if (start != end)
+				count = end - start + 1;
+		}
 	}
 
 	switch (type) {
@@ -264,7 +295,7 @@
 
 	/* Add the uart and set it's irq */
 	child = s3c2410_add_child(dev, 0, "uart", 0);
-	bus_set_resource(child, SYS_RES_IRQ, 0, S3C2410_INT_TXD0, 1);
+	bus_set_resource(child, SYS_RES_IRQ, 0, S3C2410_INT_UART0, 1);
 
 	bus_generic_probe(dev);
 	bus_generic_attach(dev);
@@ -349,8 +380,8 @@
 			irq = 0x7ff;
 			irq &= bus_space_read_4(&s3c2xx0_bs_tag,
 			    s3c2xx0_softc->sc_intctl_ioh, INTCTL_SUBSRCPND);
-			irq &= bus_space_read_4(&s3c2xx0_bs_tag,
-			    s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK);
+			irq &= ~(bus_space_read_4(&s3c2xx0_bs_tag,
+			    s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK));
 			if (irq == 0)
 				return (-1);
 


More information about the p4-projects mailing list