Date: Mon, 2 Jun 2008 09:45:33 GMT From: Andrew Turner <andrew@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 142745 for review Message-ID: <200806020945.m529jXAr018676@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=142745 Change 142745 by andrew@andrew_bender on 2008/06/02 09:45:32 First cut at implementing arm_get_next_irq, arm_mask_irq and arm_unmask_irq Affected files ... .. //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410.c#10 edit Differences ... ==== //depot/projects/arm/src/sys/arm/s3c2xx0/s3c2410.c#10 (text+ko) ==== @@ -332,15 +332,108 @@ int arm_get_next_irq(void) { + int irq; + + if ((irq = bus_space_read_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTOFFSET)) != 0) { + + /* Clear the pending bit */ + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, + INTCTL_SRCPND, (1 << irq)); + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, + INTCTL_INTPND, (1 << irq)); + + switch (irq) { + case S3C24X0_INT_ADCTC: + case S3C2410_INT_UART0: + case S3C2410_INT_UART1: + case S3C2410_INT_UART2: + /* Find the sub IRQ */ + 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); + if (irq == 0) + return (-1); + + irq = ffs(irq); + + /* Clear the sub irq pending bit */ + bus_space_write_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_SUBSRCPND, + (1 << irq)); + + return (S3C2410_SUBIRQ_MIN + irq); + } + + return (irq); + } return (-1); } void arm_mask_irq(uintptr_t irq) { + u_int32_t mask; + + if (irq < S3C2410_SUBIRQ_MIN) { + mask = bus_space_read_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK); + mask |= (1 << irq); + bus_space_write_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK, mask); + } else { + mask = bus_space_read_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); + mask |= (1 << (irq - S3C2410_SUBIRQ_MIN)); + bus_space_write_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); + } } void arm_unmask_irq(uintptr_t irq) { + u_int32_t mask; + + if (irq >= S3C2410_SUBIRQ_MIN) { + mask = bus_space_read_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); + mask &= ~(1 << (irq - S3C2410_SUBIRQ_MIN)); + bus_space_write_4(&s3c2xx0_bs_tag, + s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); + + /* Find the other irq to unmask */ + switch (irq) { + case S3C2410_INT_ADC: + case S3C2410_INT_TC: + irq = S3C24X0_INT_ADCTC; + break; + case S3C2410_INT_RXD0: + case S3C2410_INT_TXD0: + case S3C2410_INT_ERR0: + irq = S3C2410_INT_UART0; + break; + case S3C2410_INT_RXD1: + case S3C2410_INT_TXD1: + case S3C2410_INT_ERR1: + irq = S3C2410_INT_UART1; + break; + + case S3C2410_INT_RXD2: + case S3C2410_INT_TXD2: + case S3C2410_INT_ERR2: + irq = S3C2410_INT_UART2; + break; + default: + /* We don't know which other IRQ to unmask */ + return; + } + } + mask = bus_space_read_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, + INTCTL_INTMSK); + mask &= ~(1 << irq); + bus_space_write_4(&s3c2xx0_bs_tag, s3c2xx0_softc->sc_intctl_ioh, + INTCTL_INTMSK, mask); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806020945.m529jXAr018676>