s3c24x0.c (210458) | s3c24x0.c (236990) |
---|---|
1/* $NetBSD: s3c2410.c,v 1.4 2003/08/27 03:46:05 bsh Exp $ */ 2 3/* 4 * Copyright (c) 2003 Genetec corporation. All rights reserved. 5 * Written by Hiroyuki Bessho for Genetec corporation. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> | 1/* $NetBSD: s3c2410.c,v 1.4 2003/08/27 03:46:05 bsh Exp $ */ 2 3/* 4 * Copyright (c) 2003 Genetec corporation. All rights reserved. 5 * Written by Hiroyuki Bessho for Genetec corporation. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 16 unchanged lines hidden (view full) --- 25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 29 * POSSIBILITY OF SUCH DAMAGE. 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/arm/s3c2xx0/s3c24x0.c 210458 2010-07-24 23:41:09Z andrew $"); | 33__FBSDID("$FreeBSD: head/sys/arm/s3c2xx0/s3c24x0.c 236990 2012-06-13 04:59:00Z imp $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/reboot.h> 39#include <sys/malloc.h> 40#include <sys/module.h> 41#include <sys/bus.h> --- 236 unchanged lines hidden (view full) --- 278 value = bus_space_read_4(s3c2xx0_softc->sc_iot, 279 s3c2xx0_softc->sc_gpio_ioh, reg); 280 value &= ~(7 << offset); 281 value |= mask << offset; 282 bus_space_write_4(s3c2xx0_softc->sc_iot, 283 s3c2xx0_softc->sc_gpio_ioh, reg, value); 284 285 return (0); | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/reboot.h> 39#include <sys/malloc.h> 40#include <sys/module.h> 41#include <sys/bus.h> --- 236 unchanged lines hidden (view full) --- 278 value = bus_space_read_4(s3c2xx0_softc->sc_iot, 279 s3c2xx0_softc->sc_gpio_ioh, reg); 280 value &= ~(7 << offset); 281 value |= mask << offset; 282 bus_space_write_4(s3c2xx0_softc->sc_iot, 283 s3c2xx0_softc->sc_gpio_ioh, reg, value); 284 285 return (0); |
286} | 286} |
287 288static struct resource * 289s3c24x0_alloc_resource(device_t bus, device_t child, int type, int *rid, 290 u_long start, u_long end, u_long count, u_int flags) 291{ 292 struct resource_list_entry *rle; 293 struct s3c2xx0_ivar *ivar = device_get_ivars(child); 294 struct resource_list *rl = &ivar->resources; --- 56 unchanged lines hidden (view full) --- 351 352 rman_set_bustag(res, &s3c2xx0_bs_tag); 353 rman_set_bushandle(res, start); 354 if (flags & RF_ACTIVE) { 355 if (bus_activate_resource(child, type, *rid, res)) { 356 rman_release_resource(res); 357 return (NULL); 358 } | 287 288static struct resource * 289s3c24x0_alloc_resource(device_t bus, device_t child, int type, int *rid, 290 u_long start, u_long end, u_long count, u_int flags) 291{ 292 struct resource_list_entry *rle; 293 struct s3c2xx0_ivar *ivar = device_get_ivars(child); 294 struct resource_list *rl = &ivar->resources; --- 56 unchanged lines hidden (view full) --- 351 352 rman_set_bustag(res, &s3c2xx0_bs_tag); 353 rman_set_bushandle(res, start); 354 if (flags & RF_ACTIVE) { 355 if (bus_activate_resource(child, type, *rid, res)) { 356 rman_release_resource(res); 357 return (NULL); 358 } |
359 } | 359 } |
360 break; 361 } 362 363 if (res != NULL) { 364 rman_set_rid(res, *rid); 365 if (rle != NULL) { 366 rle->res = res; 367 rle->start = rman_get_start(res); --- 378 unchanged lines hidden (view full) --- 746 if (irq >= S3C24X0_INT_EXT(0) && irq <= S3C24X0_INT_EXT(3)) { 747 /* External interrupt 0..3 are directly mapped to irq 0..3 */ 748 irq -= S3C24X0_EXTIRQ_MIN; 749 } 750 if (irq < S3C24X0_SUBIRQ_MIN) { 751 mask = bus_space_read_4(&s3c2xx0_bs_tag, 752 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK); 753 mask |= (1 << irq); | 360 break; 361 } 362 363 if (res != NULL) { 364 rman_set_rid(res, *rid); 365 if (rle != NULL) { 366 rle->res = res; 367 rle->start = rman_get_start(res); --- 378 unchanged lines hidden (view full) --- 746 if (irq >= S3C24X0_INT_EXT(0) && irq <= S3C24X0_INT_EXT(3)) { 747 /* External interrupt 0..3 are directly mapped to irq 0..3 */ 748 irq -= S3C24X0_EXTIRQ_MIN; 749 } 750 if (irq < S3C24X0_SUBIRQ_MIN) { 751 mask = bus_space_read_4(&s3c2xx0_bs_tag, 752 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK); 753 mask |= (1 << irq); |
754 bus_space_write_4(&s3c2xx0_bs_tag, | 754 bus_space_write_4(&s3c2xx0_bs_tag, |
755 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK, mask); 756 } else if (irq < S3C24X0_EXTIRQ_MIN) { 757 mask = bus_space_read_4(&s3c2xx0_bs_tag, 758 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); 759 mask |= (1 << (irq - S3C24X0_SUBIRQ_MIN)); | 755 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK, mask); 756 } else if (irq < S3C24X0_EXTIRQ_MIN) { 757 mask = bus_space_read_4(&s3c2xx0_bs_tag, 758 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); 759 mask |= (1 << (irq - S3C24X0_SUBIRQ_MIN)); |
760 bus_space_write_4(&s3c2xx0_bs_tag, | 760 bus_space_write_4(&s3c2xx0_bs_tag, |
761 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); 762 } else { 763 mask = bus_space_read_4(&s3c2xx0_bs_tag, 764 s3c2xx0_softc->sc_gpio_ioh, GPIO_EINTMASK); 765 mask |= (1 << (irq - S3C24X0_EXTIRQ_MIN)); | 761 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); 762 } else { 763 mask = bus_space_read_4(&s3c2xx0_bs_tag, 764 s3c2xx0_softc->sc_gpio_ioh, GPIO_EINTMASK); 765 mask |= (1 << (irq - S3C24X0_EXTIRQ_MIN)); |
766 bus_space_write_4(&s3c2xx0_bs_tag, | 766 bus_space_write_4(&s3c2xx0_bs_tag, |
767 s3c2xx0_softc->sc_intctl_ioh, GPIO_EINTMASK, mask); 768 } 769} 770 771void 772arm_unmask_irq(uintptr_t irq) 773{ 774 u_int32_t mask; --- 7 unchanged lines hidden (view full) --- 782 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK); 783 mask &= ~(1 << irq); 784 bus_space_write_4(&s3c2xx0_bs_tag, 785 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK, mask); 786 } else if (irq < S3C24X0_EXTIRQ_MIN) { 787 mask = bus_space_read_4(&s3c2xx0_bs_tag, 788 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); 789 mask &= ~(1 << (irq - S3C24X0_SUBIRQ_MIN)); | 767 s3c2xx0_softc->sc_intctl_ioh, GPIO_EINTMASK, mask); 768 } 769} 770 771void 772arm_unmask_irq(uintptr_t irq) 773{ 774 u_int32_t mask; --- 7 unchanged lines hidden (view full) --- 782 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK); 783 mask &= ~(1 << irq); 784 bus_space_write_4(&s3c2xx0_bs_tag, 785 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTMSK, mask); 786 } else if (irq < S3C24X0_EXTIRQ_MIN) { 787 mask = bus_space_read_4(&s3c2xx0_bs_tag, 788 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK); 789 mask &= ~(1 << (irq - S3C24X0_SUBIRQ_MIN)); |
790 bus_space_write_4(&s3c2xx0_bs_tag, | 790 bus_space_write_4(&s3c2xx0_bs_tag, |
791 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); 792 } else { 793 mask = bus_space_read_4(&s3c2xx0_bs_tag, 794 s3c2xx0_softc->sc_gpio_ioh, GPIO_EINTMASK); 795 mask &= ~(1 << (irq - S3C24X0_EXTIRQ_MIN)); | 791 s3c2xx0_softc->sc_intctl_ioh, INTCTL_INTSUBMSK, mask); 792 } else { 793 mask = bus_space_read_4(&s3c2xx0_bs_tag, 794 s3c2xx0_softc->sc_gpio_ioh, GPIO_EINTMASK); 795 mask &= ~(1 << (irq - S3C24X0_EXTIRQ_MIN)); |
796 bus_space_write_4(&s3c2xx0_bs_tag, | 796 bus_space_write_4(&s3c2xx0_bs_tag, |
797 s3c2xx0_softc->sc_intctl_ioh, GPIO_EINTMASK, mask); 798 } 799} | 797 s3c2xx0_softc->sc_intctl_ioh, GPIO_EINTMASK, mask); 798 } 799} |