diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2010-02-26 14:53:12 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2010-02-26 14:53:12 +0000 |
commit | 1c3b3d3329579fe9b81dc27e9b44b07cafe69d99 (patch) | |
tree | 4e593b7a5d86d482c26d6fcf88872173a4694682 /sys | |
parent | 0bc174e8b54efbce9bfee9b571da4a729be3bfb3 (diff) |
Subdevice interrupt dispatcher for voyager(4) and ohci@voyager device, only
allowed to match on old gdium artwork, as newer artwork have nothing
connected to the usb pins, and this causes the empty bus probe to stall the
boot a few seconds.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/loongson/conf/GENERIC | 4 | ||||
-rw-r--r-- | sys/arch/loongson/conf/RAMDISK | 3 | ||||
-rw-r--r-- | sys/arch/loongson/conf/files.loongson | 6 | ||||
-rw-r--r-- | sys/arch/loongson/dev/ohci_voyager.c | 188 | ||||
-rw-r--r-- | sys/arch/loongson/dev/smfb.c | 4 | ||||
-rw-r--r-- | sys/arch/loongson/dev/voyager.c | 179 | ||||
-rw-r--r-- | sys/arch/loongson/dev/voyagerreg.h | 95 | ||||
-rw-r--r-- | sys/arch/loongson/dev/voyagervar.h | 7 |
8 files changed, 457 insertions, 29 deletions
diff --git a/sys/arch/loongson/conf/GENERIC b/sys/arch/loongson/conf/GENERIC index 2876a9b4d37..b9ed254b97f 100644 --- a/sys/arch/loongson/conf/GENERIC +++ b/sys/arch/loongson/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.14 2010/02/24 22:16:18 miod Exp $ +# $OpenBSD: GENERIC,v 1.15 2010/02/26 14:53:11 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -62,7 +62,7 @@ stsec0 at iic0 # ST7 Embedded Controller lmtemp0 at iic0 # National Semiconductor LM75 mfokclock0 at iic0 # M41T8x todclock #iic* at voyager? -#ohci* at voyager? +ohci* at voyager? smfb* at voyager? wsdisplay* at smfb? diff --git a/sys/arch/loongson/conf/RAMDISK b/sys/arch/loongson/conf/RAMDISK index 02eaff0c8e4..4645e275491 100644 --- a/sys/arch/loongson/conf/RAMDISK +++ b/sys/arch/loongson/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.8 2010/02/19 00:21:43 miod Exp $ +# $OpenBSD: RAMDISK,v 1.9 2010/02/26 14:53:11 miod Exp $ # # For further information on compiling OpenBSD kernels, see the config(8) # man page. @@ -68,6 +68,7 @@ gdiumiic0 at gpio0 offset 6 mask 0x81 # pins 6 and 13 gdiumiic0 at gpio0 offset 46 mask 0x03 # pins 46 and 47 iic0 at gdiumiic0 mfokclock0 at iic0 # M41T8x todclock +ohci* at voyager? smfb* at voyager? wsdisplay* at smfb? diff --git a/sys/arch/loongson/conf/files.loongson b/sys/arch/loongson/conf/files.loongson index 6cdb10f0ce7..a5099a90154 100644 --- a/sys/arch/loongson/conf/files.loongson +++ b/sys/arch/loongson/conf/files.loongson @@ -1,4 +1,4 @@ -# $OpenBSD: files.loongson,v 1.6 2010/02/24 22:16:18 miod Exp $ +# $OpenBSD: files.loongson,v 1.7 2010/02/26 14:53:11 miod Exp $ # Standard stanzas config(8) can't run without maxpartitions 16 @@ -98,6 +98,10 @@ device mfokclock attach mfokclock at i2c file arch/loongson/dev/m41t8xclock.c mfokclock +# SM502 OHCI +attach ohci at voyager with ohci_voyager +file arch/loongson/dev/ohci_voyager.c ohci_voyager + # Silicon Motion SM502/SM712 frame buffer device smfb: wsemuldisplaydev, rasops16 attach smfb at pci with smfb_pci diff --git a/sys/arch/loongson/dev/ohci_voyager.c b/sys/arch/loongson/dev/ohci_voyager.c new file mode 100644 index 00000000000..ca37ca57503 --- /dev/null +++ b/sys/arch/loongson/dev/ohci_voyager.c @@ -0,0 +1,188 @@ +/* $OpenBSD: ohci_voyager.c,v 1.1 2010/02/26 14:53:11 miod Exp $ */ +/* OpenBSD: ohci_pci.c,v 1.33 2008/06/26 05:42:17 ray Exp */ +/* $NetBSD: ohci_pci.c,v 1.23 2002/10/02 16:51:47 thorpej Exp $ */ + +/* + * Copyright (c) 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Lennart Augustsson (lennart@augustsson.net) at + * Carlstedt Research & Technology. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * USB Open Host Controller driver. + * + * OHCI spec: http://www.intel.com/design/usb/ohci11d.pdf + * USB spec: http://www.teleport.com/cgi-bin/mailmerge.cgi/~usb/cgiform.tpl + */ + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> +#include <sys/device.h> +#include <sys/proc.h> +#include <sys/queue.h> + +#include <machine/bus.h> + +#include <dev/pci/pcivar.h> + +#include <loongson/dev/voyagerreg.h> +#include <loongson/dev/voyagervar.h> + +#include <dev/usb/usb.h> +#include <dev/usb/usbdi.h> +#include <dev/usb/usbdivar.h> +#include <dev/usb/usb_mem.h> + +#include <dev/usb/ohcireg.h> +#include <dev/usb/ohcivar.h> + +extern int gdium_revision; + +int ohci_voyager_match(struct device *, void *, void *); +void ohci_voyager_attach(struct device *, struct device *, void *); +void ohci_voyager_attach_deferred(struct device *); + +struct ohci_voyager_softc { + ohci_softc_t sc; + void *sc_ih; +}; + +struct cfattach ohci_voyager_ca = { + sizeof(struct ohci_voyager_softc), + ohci_voyager_match, ohci_voyager_attach, NULL, ohci_activate +}; + +int +ohci_voyager_match(struct device *parent, void *vcf, void *aux) +{ + struct voyager_attach_args *vaa = (struct voyager_attach_args *)aux; + struct cfdata *cf = (struct cfdata *)vcf; + + return gdium_revision == 0 && + strcmp(vaa->vaa_name, cf->cf_driver->cd_name) == 0; +} + +void +ohci_voyager_attach(struct device *parent, struct device *self, void *aux) +{ + struct ohci_voyager_softc *sc = (struct ohci_voyager_softc *)self; + struct voyager_attach_args *vaa = (struct voyager_attach_args *)aux; + struct pci_attach_args *pa = vaa->vaa_pa; + int s; + const char *vendor; + char *devname = sc->sc.sc_bus.bdev.dv_xname; + + /* Map I/O registers */ + sc->sc.sc_size = VOYAGER_OHCI_SIZE; + sc->sc.iot = vaa->vaa_mmiot; + if (bus_space_subregion(vaa->vaa_mmiot, vaa->vaa_mmioh, + VOYAGER_OHCI_BASE, VOYAGER_OHCI_SIZE, &sc->sc.ioh) != 0) { + printf(": can't map mem space\n"); + return; + } + + /* Record what interrupts were enabled by SMM/BIOS. */ + sc->sc.sc_intre = bus_space_read_4(sc->sc.iot, sc->sc.ioh, + OHCI_INTERRUPT_ENABLE); + + /* Disable interrupts, so we don't get any spurious ones. */ + bus_space_write_4(sc->sc.iot, sc->sc.ioh, OHCI_INTERRUPT_DISABLE, + OHCI_MIE); + + sc->sc.sc_bus.dmatag = pa->pa_dmat; + + bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size, + BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE); + bus_space_write_4(sc->sc.iot, sc->sc.ioh, + OHCI_INTERRUPT_DISABLE, OHCI_MIE); + + s = splusb(); + /* establish the interrupt. */ + sc->sc_ih = voyager_intr_establish(parent, VOYAGER_INTR_USB_HOST, + IPL_USB, ohci_intr, sc, devname); + if (sc->sc_ih == NULL) { + printf(": couldn't establish interrupt\n"); + splx(s); + return; + } + printf(": %s", voyager_intr_string(sc->sc_ih)); + + /* Figure out vendor for root hub descriptor. */ + vendor = pci_findvendor(pa->pa_id); + sc->sc.sc_id_vendor = PCI_VENDOR(pa->pa_id); + if (vendor) + strlcpy(sc->sc.sc_vendor, vendor, sizeof (sc->sc.sc_vendor)); + else + snprintf(sc->sc.sc_vendor, sizeof (sc->sc.sc_vendor), + "vendor 0x%04x", PCI_VENDOR(pa->pa_id)); + + /* Display revision and perform legacy emulation handover. */ + if (ohci_checkrev(&sc->sc) != USBD_NORMAL_COMPLETION || + ohci_handover(&sc->sc) != USBD_NORMAL_COMPLETION) { + splx(s); + return; + } + + /* Ignore interrupts for now */ + sc->sc.sc_dying = 1; + + config_defer(self, ohci_voyager_attach_deferred); + + splx(s); +} + +void +ohci_voyager_attach_deferred(struct device *self) +{ + struct ohci_voyager_softc *sc = (struct ohci_voyager_softc *)self; + usbd_status r; + int s; + + s = splusb(); + + sc->sc.sc_dying = 0; + + r = ohci_init(&sc->sc); + if (r != USBD_NORMAL_COMPLETION) { + printf("%s: init failed, error=%d\n", + sc->sc.sc_bus.bdev.dv_xname, r); + bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size); + splx(s); + return; + } + + sc->sc.sc_powerhook = powerhook_establish(ohci_power, &sc->sc); + if (sc->sc.sc_powerhook == NULL) + printf("%s: unable to establish powerhook\n", + sc->sc.sc_bus.bdev.dv_xname); + + splx(s); + + /* Attach usb device. */ + sc->sc.sc_child = config_found((void *)sc, &sc->sc.sc_bus, usbctlprint); +} diff --git a/sys/arch/loongson/dev/smfb.c b/sys/arch/loongson/dev/smfb.c index 7bb9ace4430..47496d92747 100644 --- a/sys/arch/loongson/dev/smfb.c +++ b/sys/arch/loongson/dev/smfb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smfb.c,v 1.5 2010/02/18 22:45:28 miod Exp $ */ +/* $OpenBSD: smfb.c,v 1.6 2010/02/26 14:53:11 miod Exp $ */ /* * Copyright (c) 2009, 2010 Miodrag Vallat. @@ -523,7 +523,7 @@ smfb_wait(struct smfb *fb) while (i-- != 0) { if (fb->is5xx) { reg = REG_READ(fb, VOYAGER_SYSTEM_CONTROL); - if ((reg & (VSC_FIFO_EMPTY | VSC_STATUS_BUSY)) == + if ((reg & (VSC_FIFO_EMPTY | VSC_2DENGINE_BUSY)) == VSC_FIFO_EMPTY) return 0; } else { diff --git a/sys/arch/loongson/dev/voyager.c b/sys/arch/loongson/dev/voyager.c index f470e968f4a..40aa6f2c0a8 100644 --- a/sys/arch/loongson/dev/voyager.c +++ b/sys/arch/loongson/dev/voyager.c @@ -1,4 +1,4 @@ -/* $OpenBSD: voyager.c,v 1.2 2010/02/24 22:14:54 miod Exp $ */ +/* $OpenBSD: voyager.c,v 1.3 2010/02/26 14:53:11 miod Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -27,6 +27,7 @@ #include <machine/bus.h> #include <machine/cpu.h> +#include <machine/intr.h> #include <dev/gpio/gpiovar.h> @@ -34,6 +35,7 @@ #include <dev/pci/pcivar.h> #include <dev/pci/pcidevs.h> +#include <loongson/dev/bonito_irq.h> /* for BONITO_NINTS */ #include <loongson/dev/voyagerreg.h> #include <loongson/dev/voyagervar.h> @@ -49,7 +51,10 @@ struct voyager_softc { bus_size_t sc_mmiosize; struct gpio_chipset_tag sc_gpio_tag; - gpio_pin_t sc_gpio_pins[VOYAGER_NGPIO]; + gpio_pin_t sc_gpio_pins[32 + 32]; + + void *sc_ih; + struct intrhand *sc_intr[32]; }; int voyager_match(struct device *, void *, void *); @@ -64,6 +69,7 @@ struct cfdriver voyager_cd = { }; void voyager_attach_gpio(struct voyager_softc *); +int voyager_intr(void *); int voyager_print(void *, const char *); int voyager_search(struct device *, void *, void *); @@ -88,23 +94,54 @@ voyager_attach(struct device *parent, struct device *self, void *aux) { struct voyager_softc *sc = (struct voyager_softc *)self; struct pci_attach_args *pa = (struct pci_attach_args *)aux; + pci_intr_handle_t ih; + const char *intrstr; + + printf(": "); + + /* + * Map registers. + */ if (pci_mapreg_map(pa, PCI_MAPREG_START, PCI_MAPREG_TYPE_MEM, BUS_SPACE_MAP_LINEAR, &sc->sc_fbt, &sc->sc_fbh, NULL, &sc->sc_fbsize, 0) != 0) { - printf(": can't map frame buffer\n"); + printf("can't map frame buffer\n"); return; } if (pci_mapreg_map(pa, PCI_MAPREG_START + 0x04, PCI_MAPREG_TYPE_MEM, BUS_SPACE_MAP_LINEAR, &sc->sc_mmiot, &sc->sc_mmioh, NULL, &sc->sc_mmiosize, 0) != 0) { - printf(": can't map mmio\n"); - bus_space_unmap(sc->sc_fbt, sc->sc_fbh, sc->sc_fbsize); - return; + printf("can't map mmio\n"); + goto fail1; } - printf("\n"); + /* + * Setup interrut handling. + */ + + bus_space_write_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_RAW_ICR, + 0xffffffff); + bus_space_write_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_IMR, 0); + (void)bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_IMR); + + if (pci_intr_map(pa, &ih) != 0) { + printf("can't map interrupt\n"); + goto fail2; + } + intrstr = pci_intr_string(pa->pa_pc, ih); + sc->sc_ih = pci_intr_establish(pa->pa_pc, ih, IPL_TTY, voyager_intr, + sc, self->dv_xname); + if (sc->sc_ih == NULL) { + printf("can't establish interrupt"); + if (intrstr != NULL) + printf(" at %s", intrstr); + printf("\n"); + goto fail2; + } + + printf("%s\n", intrstr); /* * Attach GPIO devices. @@ -115,6 +152,12 @@ voyager_attach(struct device *parent, struct device *self, void *aux) * Attach child devices. */ config_search(voyager_search, self, pa); + + return; +fail2: + bus_space_unmap(sc->sc_mmiot, sc->sc_mmioh, sc->sc_mmiosize); +fail1: + bus_space_unmap(sc->sc_fbt, sc->sc_fbh, sc->sc_fbsize); } int @@ -158,6 +201,89 @@ voyager_search(struct device *parent, void *vcf, void *args) } /* + * Interrupt disatcher + */ + +int +voyager_intr(void *vsc) +{ + struct voyager_softc *sc = (struct voyager_softc *)vsc; + uint32_t isr, imr, mask, bitno; + struct intrhand *ih; + + isr = bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_ISR); + imr = bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_IMR); + + isr &= imr; + if (isr == 0) + return 0; + + for (bitno = 0, mask = 1 << 0; isr != 0; bitno++, mask <<= 1) { + if ((isr & mask) == 0) + continue; + isr ^= mask; + for (ih = sc->sc_intr[bitno]; ih != NULL; ih = ih->ih_next) { + if ((*ih->ih_fun)(ih->ih_arg) != 0) + ih->ih_count.ec_count++; + } + } + + return 1; +} + +void * +voyager_intr_establish(void *cookie, int irq, int level, int (*fun)(void *), + void *arg, const char *name) +{ + struct voyager_softc *sc = (struct voyager_softc *)cookie; + struct intrhand *prevh, *nh; + uint32_t imr; + +#ifdef DIAGNOSTIC + if (irq < 0 || irq >= nitems(sc->sc_intr)) + return NULL; +#endif + + nh = (struct intrhand *)malloc(sizeof *nh, M_DEVBUF, M_NOWAIT | M_ZERO); + if (nh == NULL) + return NULL; + + nh->ih_fun = fun; + nh->ih_arg = arg; + nh->ih_level = level; + nh->ih_irq = irq + BONITO_NINTS; + evcount_attach(&nh->ih_count, name, (void *)&nh->ih_irq, &evcount_intr); + + if (sc->sc_intr[irq] == NULL) + sc->sc_intr[irq] = nh; + else { + /* insert at tail */ + for (prevh = sc->sc_intr[irq]; prevh->ih_next != NULL; + prevh = prevh->ih_next) ; + prevh->ih_next = nh; + } + + /* enable interrupt source */ + imr = bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_IMR); + imr |= 1 << irq; + bus_space_write_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_IMR, imr); + (void)bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, VOYAGER_IMR); + + return nh; +} + +const char * +voyager_intr_string(void *vih) +{ + struct intrhand *ih = (struct intrhand *)vih; + static char intrstr[1 + 32]; + + snprintf(intrstr, sizeof intrstr, "voyager irq %d", + ih->ih_irq - BONITO_NINTS); + return intrstr; +} + +/* * GPIO support code */ @@ -241,22 +367,49 @@ voyager_attach_gpio(struct voyager_softc *sc) { struct gpiobus_attach_args gba; int pin; + uint32_t control, value; bcopy(&voyager_gpio_tag, &sc->sc_gpio_tag, sizeof voyager_gpio_tag); sc->sc_gpio_tag.gp_cookie = sc; - for (pin = 0; pin < VOYAGER_NGPIO; pin++) { + control = bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, + VOYAGER_GPIOL_CONTROL); + value = bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, + VOYAGER_GPIO_DATA_LOW); + for (pin = 0; pin < 32; pin++) { + sc->sc_gpio_pins[pin].pin_num = pin; + if ((control & 1) == 0) { + sc->sc_gpio_pins[pin].pin_caps = + GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + sc->sc_gpio_pins[pin].pin_state = value & 1; + } else { + /* disable control of taken over pins */ + sc->sc_gpio_pins[pin].pin_caps = 0; + sc->sc_gpio_pins[pin].pin_state = 0; + } + } + + control = bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, + VOYAGER_GPIOH_CONTROL); + value = bus_space_read_4(sc->sc_mmiot, sc->sc_mmioh, + VOYAGER_GPIO_DATA_HIGH); + for (pin = 32 + 0; pin < 32 + 32; pin++) { sc->sc_gpio_pins[pin].pin_num = pin; - sc->sc_gpio_pins[pin].pin_caps = - GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; - sc->sc_gpio_pins[pin].pin_state = - voyager_gpio_pin_read(sc, pin); + if ((control & 1) == 0) { + sc->sc_gpio_pins[pin].pin_caps = + GPIO_PIN_INPUT | GPIO_PIN_OUTPUT; + sc->sc_gpio_pins[pin].pin_state = value & 1; + } else { + /* disable control of taken over pins */ + sc->sc_gpio_pins[pin].pin_caps = 0; + sc->sc_gpio_pins[pin].pin_state = 0; + } } gba.gba_name = "gpio"; gba.gba_gc = &sc->sc_gpio_tag; gba.gba_pins = sc->sc_gpio_pins; - gba.gba_npins = VOYAGER_NGPIO; + gba.gba_npins = nitems(sc->sc_gpio_pins); config_found(&sc->sc_dev, &gba, voyager_print); } diff --git a/sys/arch/loongson/dev/voyagerreg.h b/sys/arch/loongson/dev/voyagerreg.h index 4a56a51d88c..364635639bd 100644 --- a/sys/arch/loongson/dev/voyagerreg.h +++ b/sys/arch/loongson/dev/voyagerreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: voyagerreg.h,v 1.1 2010/02/18 22:45:28 miod Exp $ */ +/* $OpenBSD: voyagerreg.h,v 1.2 2010/02/26 14:53:11 miod Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -20,19 +20,96 @@ * Silicon Motion SM501/SM502 registers */ -#define SM5XX_MMIO_BASE 0x00000000 +#define SM5XX_MMIO_BASE 0x000000 -#define VOYAGER_SYSTEM_CONTROL 0x00 +#define VOYAGER_SYSTEM_CONTROL 0x000000 +#define VSC_DPMS_VSYNC_DISABLE 0x80000000 +#define VSC_DPMS_HSYNC_DISABLE 0x40000000 +#define VSC_COLOR_CONVERSION_BUSY 0x10000000 #define VSC_FIFO_EMPTY 0x00100000 -#define VSC_STATUS_BUSY 0x00080000 +#define VSC_2DENGINE_BUSY 0x00080000 +#define VSC_2DENGINE_ABORT 0x00003000 /* not a typo */ +#define VOYAGER_MISC_CONTROL 0x000004 +#define VOYAGER_GPIOL_CONTROL 0x000008 +#define VOYAGER_GPIOH_CONTROL 0x00000c +#define VOYAGER_DRAM_CONTROL 0x000010 +#define VOYAGER_ARB_CONTROL 0x000014 + +#define VOYAGER_COMMANDLIST_CONTROL 0x000018 +#define VOYAGER_COMMANDLIST_CONDITION 0x00001c +#define VOYAGER_COMMANDLIST_RETURN 0x000020 +#define VOYAGER_COMMANDLIST_STATUS 0x000024 + +#define VOYAGER_RAW_ISR 0x000028 +#define VOYAGER_RAWINTR_ZV1 6 +#define VOYAGER_RAWINTR_USB_PLUGIN 5 +#define VOYAGER_RAWINTR_ZV0 4 +#define VOYAGER_RAWINTR_CRT_VSYNC 3 +#define VOYAGER_RAWINTR_USB_SLAVE 2 +#define VOYAGER_RAWINTR_PANEL_VSYNC 1 +#define VOYAGER_RAWINTR_COMMAND_INTERPRETER 0 +#define VOYAGER_RAW_ICR 0x000028 +#define VOYAGER_ISR 0x00002c +#define VOYAGER_INTR_USB_PLUGIN 31 +#define VOYAGER_INTR_GPIO54 30 +#define VOYAGER_INTR_GPIO53 29 +#define VOYAGER_INTR_GPIO52 28 +#define VOYAGER_INTR_GPIO51 27 +#define VOYAGER_INTR_GPIO50 26 +#define VOYAGER_INTR_GPIO49 25 +#define VOYAGER_INTR_GPIO48 24 +#define VOYAGER_INTR_I2C 23 +#define VOYAGER_INTR_PWM 22 +#define VOYAGER_INTR_DMA 20 +#define VOYAGER_INTR_PCI 19 +#define VOYAGER_INTR_I2S 18 +#define VOYAGER_INTR_AC97 17 +#define VOYAGER_INTR_USB_SLAVE 16 +#define VOYAGER_INTR_UART1 13 +#define VOYAGER_INTR_UART0 12 +#define VOYAGER_INTR_CRT_VSYNC 11 +#define VOYAGER_INTR_8051 10 +#define VOYAGER_INTR_SSP1 9 +#define VOYAGER_INTR_SSP0 8 +#define VOYAGER_INTR_USB_HOST 6 +#define VOYAGER_INTR_ZV1 4 +#define VOYAGER_INTR_2DENGINE 3 +#define VOYAGER_INTR_ZV0 2 +#define VOYAGER_INTR_PANEL_VSYNC 1 +#define VOYAGER_INTR_COMMAND_INTERPRETER 0 +#define VOYAGER_IMR 0x000030 +#define VOYAGER_DEBUG 0x000034 + +#define VOYAGER_PM_CURRENT_GATE 0x000038 +#define VOYAGER_PM_CURRENT_CLOCK 0x00003c +#define VOYAGER_PM_MODE0_GATE 0x000040 +#define VOYAGER_PM_MODE0_CLOCK 0x000044 +#define VOYAGER_PM_MODE1_GATE 0x000048 +#define VOYAGER_PM_MODE1_CLOCK 0x00004c +#define VOYAGER_PM_SLEEP_GATE 0x000050 +#define VOYAGER_PM_CONTROL 0x000054 + +#define VOYAGER_MASTER_PCI_BASE 0x000058 +#define VOYAGER_ENDIAN_CONTROL 0x00005c +#define VOYAGER_DEVICE_ID 0x000060 +#define VOYAGER_PLL_COUNT 0x000064 +#define VOYAGER_MISC 0x000068 +#define VOYAGER_SDRAM_CLOCK 0x00006c +#define VOYAGER_NON_CACHE_ADDRESS 0x000070 +#define VOYAGER_PLL_CONTROL 0x000074 /* * GPIO */ -#define VOYAGER_NGPIO (32 + 32) +#define VOYAGER_GPIO_DATA_LOW 0x010000 +#define VOYAGER_GPIO_DATA_HIGH 0x010004 +#define VOYAGER_GPIO_DIR_LOW 0x010008 +#define VOYAGER_GPIO_DIR_HIGH 0x01000c + +/* + * OHCI + */ -#define VOYAGER_GPIO_DATA_LOW 0x00010000 -#define VOYAGER_GPIO_DATA_HIGH 0x00010004 -#define VOYAGER_GPIO_DIR_LOW 0x00010008 -#define VOYAGER_GPIO_DIR_HIGH 0x0001000c +#define VOYAGER_OHCI_BASE 0x040000 +#define VOYAGER_OHCI_SIZE 0x020000 diff --git a/sys/arch/loongson/dev/voyagervar.h b/sys/arch/loongson/dev/voyagervar.h index 6e4e38f43ec..d2bd3f1cb89 100644 --- a/sys/arch/loongson/dev/voyagervar.h +++ b/sys/arch/loongson/dev/voyagervar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: voyagervar.h,v 1.1 2010/02/18 22:45:28 miod Exp $ */ +/* $OpenBSD: voyagervar.h,v 1.2 2010/02/26 14:53:11 miod Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -25,3 +25,8 @@ struct voyager_attach_args { bus_space_tag_t vaa_mmiot; bus_space_handle_t vaa_mmioh; }; + +void *voyager_intr_establish(void *, int, int, int (*)(void *), void *, + const char *); +const char * + voyager_intr_string(void *); |