diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2005-01-04 03:47:01 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2005-01-04 03:47:01 +0000 |
commit | cea5f0848d694d341141486d49ecd38b8df23906 (patch) | |
tree | 4e901a1c57d83942d24ed553963ffb142806083d /sys | |
parent | 6aa828eec10dfc8e0ad231b12cf7bfc3363d5dd6 (diff) |
USB support for C3000, much thanks to dlg@ for pxa2x0_ohci.c
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/arm/xscale/files.pxa2x0 | 10 | ||||
-rw-r--r-- | sys/arch/arm/xscale/pxa2x0_ohci.c | 145 | ||||
-rw-r--r-- | sys/arch/zaurus/conf/GENERIC | 42 | ||||
-rw-r--r-- | sys/arch/zaurus/conf/RAMDISK | 39 | ||||
-rw-r--r-- | sys/arch/zaurus/conf/files.zaurus | 22 |
5 files changed, 231 insertions, 27 deletions
diff --git a/sys/arch/arm/xscale/files.pxa2x0 b/sys/arch/arm/xscale/files.pxa2x0 index d7fff50047a..08f9ada7fa5 100644 --- a/sys/arch/arm/xscale/files.pxa2x0 +++ b/sys/arch/arm/xscale/files.pxa2x0 @@ -1,4 +1,4 @@ -# $OpenBSD: files.pxa2x0,v 1.3 2005/01/03 12:05:24 miod Exp $ +# $OpenBSD: files.pxa2x0,v 1.4 2005/01/04 03:47:00 drahn Exp $ # $NetBSD: files.pxa2x0,v 1.6 2004/05/01 19:09:14 thorpej Exp $ # # Configuration info for Intel PXA2[51]0 CPU support @@ -43,6 +43,10 @@ file arch/arm/xscale/pxa2x0_a4x_space.c pxauart | obio file arch/arm/xscale/pxa2x0_a4x_io.S pxauart | obio #defflag opt_com.h FFUARTCONSOLE STUARTCONSOLE BTUARTCONSOLE +# OHCI USB Controller +attach ohci at pxaip with pxaohci +file arch/arm/xscale/pxa2x0_ohci.c pxaohci + # LCD controller device lcd: wsemuldisplaydev, rasops16, rasops8, rasops4 file arch/arm/xscale/pxa2x0_lcd.c lcd needs-flag @@ -54,10 +58,6 @@ device pxapcic: pcmciabus attach pxapcic at pxaip file arch/arm/xscale/pxa2x0_pcic.c pxapcic -# onboard USB -attach ohci at pxaip with ohci_pxa -file arch/arm/xscale/pxa2x0_ohci.c ohci - # XXX this is a hack to use dev/pcmcia without fdc.c device fdc diff --git a/sys/arch/arm/xscale/pxa2x0_ohci.c b/sys/arch/arm/xscale/pxa2x0_ohci.c new file mode 100644 index 00000000000..ab6b115d111 --- /dev/null +++ b/sys/arch/arm/xscale/pxa2x0_ohci.c @@ -0,0 +1,145 @@ +/* $OpenBSD: pxa2x0_ohci.c,v 1.1 2005/01/04 03:47:00 drahn Exp $ */ + +/* + * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/cdefs.h> + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/device.h> +#include <sys/termios.h> + +#include <machine/intr.h> +#include <machine/bus.h> + +#include <arm/xscale/pxa2x0reg.h> +#include <arm/xscale/pxa2x0var.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> + +int pxaohci_match(struct device *, void *, void *); +void pxaohci_attach(struct device *, struct device *, void *); +int pxaohci_detach(device_ptr_t, int); + +struct pxaohci_softc { + ohci_softc_t sc; + void *sc_ih; + void *sc_ih1; + int sc_intr; +}; + +struct cfattach pxaohci_ca = { + sizeof (struct pxaohci_softc), pxaohci_match, pxaohci_attach, + pxaohci_detach, ohci_activate +}; + +int +pxaohci_match(struct device *parent, void *match, void *aux) +{ + struct pxaip_attach_args *pxa = aux; + + /* XXX if pxa revision != 270 return 0 */ + + if ((pxa->pxa_addr != PXA2X0_USBHC_BASE) || + (pxa->pxa_intr != PXA2X0_INT_USBH1)) + return (0); + + pxa->pxa_size = PXA2X0_USBHC_SIZE; /* XXX wtf? */ + + return (1); +} + +void +pxaohci_attach(struct device *parent, struct device *self, void *aux) +{ + struct pxaohci_softc *sc = (struct pxaohci_softc *)self; + struct pxaip_attach_args *pxa = aux; + usbd_status r; + + sc->sc.iot = pxa->pxa_iot; + sc->sc.sc_bus.dmatag = pxa->pxa_dmat; + sc->sc_intr = pxa->pxa_intr; + sc->sc_ih = NULL; + sc->sc_ih1 = NULL; + sc->sc.sc_size = 0; + + /* Map I/O space */ + if (bus_space_map(sc->sc.iot, pxa->pxa_addr, pxa->pxa_size, 0, + &sc->sc.ioh)) { + printf(": cannot map mem space\n"); + return; + } + sc->sc.sc_size = pxa->pxa_size; + + /* XXX copied from ohci_pci.c. needed? */ + bus_space_barrier(sc->sc.iot, sc->sc.ioh, 0, sc->sc.sc_size, + BUS_SPACE_BARRIER_READ|BUS_SPACE_BARRIER_WRITE); + /* 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); + + /* XXX splusb? */ + sc->sc_ih = pxa2x0_intr_establish(sc->sc_intr, IPL_USB, ohci_intr, sc, + sc->sc.sc_bus.bdev.dv_xname); + sc->sc_ih1 = pxa2x0_intr_establish(2, IPL_USB, ohci_intr, sc, + sc->sc.sc_bus.bdev.dv_xname); + + strlcpy(sc->sc.sc_vendor, "Vendor String", sizeof(sc->sc.sc_vendor)); + + 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); + sc->sc.sc_size = 0; + /* XXX disestablish */ + return; + } + /* XXX splx(s) usb? */ + + sc->sc.sc_child = config_found((void *) sc, &sc->sc.sc_bus, + usbctlprint); +} + +int +pxaohci_detach(device_ptr_t self, int flags) +{ + struct pxaohci_softc *sc = (struct pxaohci_softc *)self; + int rv; + + rv = ohci_detach(&sc->sc, flags); + if (rv) + return (rv); +#ifdef notdef + if (sc->sc_ih != NULL) { + /* XXX disestablish */ + sc->sc_ih = NULL; + } +#endif + if (sc->sc.sc_size) { + bus_space_unmap(sc->sc.iot, sc->sc.ioh, sc->sc.sc_size); + sc->sc.sc_size = 0; + } + + return (0); +} diff --git a/sys/arch/zaurus/conf/GENERIC b/sys/arch/zaurus/conf/GENERIC index 44a7d6d63b7..4c8ffbf9e4f 100644 --- a/sys/arch/zaurus/conf/GENERIC +++ b/sys/arch/zaurus/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.1 2004/12/31 00:04:35 drahn Exp $ +# $OpenBSD: GENERIC,v 1.2 2005/01/04 03:47:00 drahn Exp $ # # GENERIC machine description file # @@ -74,6 +74,37 @@ pxaip0 at mainbus? pxaintc0 at pxaip? # interrupt controller pxagpio0 at pxaip? # GPIO saost0 at pxaip? addr 0x40a00000 size 0x20 +ohci0 at pxaip? addr 0x4c000000 size 0x70 intr 3 +usb* at ohci? + +# USB bus support +usb* at ohci? flags 0x1 +uhub* at usb? +uhub* at uhub? + +uhidev* at uhub? +uhid* at uhidev? # USB Generic HID devices +ukbd* at uhidev? # USB HID Keyboard devices +wskbd* at ukbd? mux 1 +#ums* at uhub? # USB Mice +#wsmouse* at ums? mux 0 +#ulpt* at uhub? # USB Printer +aue* at uhub? # ADMtek AN986 Pegasus Ethernet +axe* at uhub? # ASIX Electronics AX88172 USB Ethernet +cue* at uhub? # CATC USB-EL1201A based Ethernet +kue* at uhub? # Kawasaki KL5KUSB101B based Ethernet +cdce* at uhub? # CDC Ethernet +upl* at uhub? # Prolific PL2301/PL2302 host-to-host +udav* at uhub? # Davicom DM9601 based Ethernet +url* at uhub? # Realtek RTL8150L based adapters +wi* at uhub? # WaveLAN IEEE 802.11DS +#uscanner* at uhub? # USB Scanner driver +#usscanner* at uhub? # USB SCSI scanners +#scsibus* at usscanner? +#uyap* at uhub? # Y@P firmware loader +#ugen* at uhub? # USB Generic driver +umass* at uhub? # USB Mass Storage devices +scsibus* at umass? # cotulla integrated 16550 UARTs options COM_PXA2X0 @@ -94,9 +125,12 @@ wi* at pcmcia? wdc* at pcmcia? # IDE hard drives -wd0 at wdc? flags 0x0000 -wd* at wdc? flags 0x0000 +wd0 at wdc? flags 0x0000 +wd* at wdc? flags 0x0000 +# PHY +rlphy* at mii? # RealTek 8139 internal PHYs +ukphy* at mii? # generic unknown PHYs # On-board device support obio0 at pxaip? intr 8 @@ -109,5 +143,5 @@ wsdisplay* at lcd? console ? options WSEMUL_VT100 # VT100 / VT220 emulation # Pseudo-Devices -#pseudo-device wsmux 2 # mouse & keyboard multiplexor +pseudo-device wsmux 2 # mouse & keyboard multiplexor pseudo-device crypto 1 diff --git a/sys/arch/zaurus/conf/RAMDISK b/sys/arch/zaurus/conf/RAMDISK index 4ce2d6f537f..422574a3834 100644 --- a/sys/arch/zaurus/conf/RAMDISK +++ b/sys/arch/zaurus/conf/RAMDISK @@ -1,4 +1,4 @@ -# $OpenBSD: RAMDISK,v 1.2 2004/12/31 00:40:52 drahn Exp $ +# $OpenBSD: RAMDISK,v 1.3 2005/01/04 03:47:00 drahn Exp $ # $NetBSD: GENERIC,v 1.27.4.1 2002/08/01 04:18:06 lukem Exp $ # # GENERIC machine description file @@ -82,6 +82,37 @@ pxaip0 at mainbus? pxaintc0 at pxaip? # interrupt controller pxagpio0 at pxaip? # GPIO saost0 at pxaip? addr 0x40a00000 size 0x20 +ohci0 at pxaip? addr 0x4c000000 size 0x70 intr 3 +usb* at ohci? + +# USB bus support +usb* at ohci? flags 0x1 +uhub* at usb? +uhub* at uhub? + +uhidev* at uhub? +uhid* at uhidev? # USB Generic HID devices +ukbd* at uhidev? # USB HID Keyboard devices +wskbd* at ukbd? mux 1 +#ums* at uhub? # USB Mice +#wsmouse* at ums? mux 0 +#ulpt* at uhub? # USB Printer +aue* at uhub? # ADMtek AN986 Pegasus Ethernet +axe* at uhub? # ASIX Electronics AX88172 USB Ethernet +cue* at uhub? # CATC USB-EL1201A based Ethernet +kue* at uhub? # Kawasaki KL5KUSB101B based Ethernet +cdce* at uhub? # CDC Ethernet +upl* at uhub? # Prolific PL2301/PL2302 host-to-host +udav* at uhub? # Davicom DM9601 based Ethernet +url* at uhub? # Realtek RTL8150L based adapters +wi* at uhub? # WaveLAN IEEE 802.11DS +#uscanner* at uhub? # USB Scanner driver +#usscanner* at uhub? # USB SCSI scanners +#scsibus* at usscanner? +#uyap* at uhub? # Y@P firmware loader +#ugen* at uhub? # USB Generic driver +umass* at uhub? # USB Mass Storage devices +scsibus* at umass? # cotulla integrated 16550 UARTs options COM_PXA2X0 @@ -105,6 +136,10 @@ wdc* at pcmcia? # IDE hard drives wd* at wdc? flags 0x0000 +# PHY +rlphy* at mii? # RealTek 8139 internal PHYs +ukphy* at mii? # generic unknown PHYs + # On-board device support obio0 at pxaip? intr 8 #sm0 at obio? addr 0x0c000000 intr 3 # on-board SMC 91C96 @@ -117,7 +152,7 @@ options WSEMUL_VT100 # VT100 / VT220 emulation # Pseudo-Devices -#pseudo-device wsmux 2 # mouse & keyboard multiplexor +pseudo-device wsmux 2 # mouse & keyboard multiplexor #pseudo-device crypto 1 pseudo-device loop 1 # network loopback pseudo-device bpfilter 1 # packet filter diff --git a/sys/arch/zaurus/conf/files.zaurus b/sys/arch/zaurus/conf/files.zaurus index 44fe3482280..4a99dc79137 100644 --- a/sys/arch/zaurus/conf/files.zaurus +++ b/sys/arch/zaurus/conf/files.zaurus @@ -1,4 +1,3 @@ -# $OpenBSD: files.zaurus,v 1.4 2005/01/02 19:43:07 drahn Exp $ # $NetBSD: files.pxaarm,v 1.17 2003/02/17 20:51:53 ichiro Exp $ # # First try for arm-specific configuration info @@ -60,21 +59,6 @@ file arch/arm/fpe-arm/armfpe.s armfpe # Machine-independent I2O drivers. include "dev/i2o/files.i2o" -# -# Include PCI config -# -include "dev/mii/files.mii" -include "dev/pci/files.pci" - -device pcib: isabus -attach pcib at pci -file arch/zaurus/pci/pcib.c pcib - -file arch/zaurus/pci/pciide_machdep.c pciide - -# Include USB stuff -include "dev/usb/files.usb" - # Include WSCONS stuff include "dev/wscons/files.wscons" include "dev/rasops/files.rasops" @@ -85,3 +69,9 @@ include "dev/pckbc/files.pckbc" # kludge, not present on zaurus, but needed for arm/conf.c device fcom: tty, bus_space_generic file arch/arm/footbridge/footbridge_com.c fcom needs-flag + +# Include USB stuff +include "dev/usb/files.usb" + +# Media Independent Interface (mii) +include "../../../dev/mii/files.mii" |