diff options
author | Dale Rahn <drahn@cvs.openbsd.org> | 2010-06-07 16:34:21 +0000 |
---|---|---|
committer | Dale Rahn <drahn@cvs.openbsd.org> | 2010-06-07 16:34:21 +0000 |
commit | 104f94dd4b97509289ed863c89b58daf794e9a24 (patch) | |
tree | 45d6df2c1c07c7deafcf2f80cfb12320bbf17ef6 /sys/arch/zaurus | |
parent | b68c74a8c5478357c68cc5bac072bea1271134fc (diff) |
Break pxaudc into xscale and MD pieces so that palm and zaurus can correctly
share the driver with different GPIOs/IRQs Diff from marex via jasper.
Diffstat (limited to 'sys/arch/zaurus')
-rw-r--r-- | sys/arch/zaurus/conf/files.zaurus | 8 | ||||
-rw-r--r-- | sys/arch/zaurus/dev/zaurus_udc.c | 97 | ||||
-rw-r--r-- | sys/arch/zaurus/include/machine_reg.h | 8 |
3 files changed, 106 insertions, 7 deletions
diff --git a/sys/arch/zaurus/conf/files.zaurus b/sys/arch/zaurus/conf/files.zaurus index af286daee18..52c5e3bcdfa 100644 --- a/sys/arch/zaurus/conf/files.zaurus +++ b/sys/arch/zaurus/conf/files.zaurus @@ -1,4 +1,4 @@ -# $OpenBSD: files.zaurus,v 1.25 2007/06/08 22:57:43 jasper Exp $ +# $OpenBSD: files.zaurus,v 1.26 2010/06/07 16:34:20 drahn Exp $ # # First try for arm-specific configuration info # @@ -18,8 +18,8 @@ file arch/zaurus/zaurus/zaurus_machdep.c # # Machine-independent SCSI drivers # -include "../../../scsi/files.scsi" -include "../../../dev/atapiscsi/files.atapiscsi" +include "scsi/files.scsi" +include "dev/atapiscsi/files.atapiscsi" # CPU support and integrated peripherals include "arch/arm/xscale/files.pxa2x0" @@ -102,6 +102,8 @@ include "dev/pckbc/files.pckbc" # Include USB stuff include "dev/usb/files.usb" +attach pxaudc at pxaip with pxaudc_zaurus +file arch/zaurus/dev/zaurus_udc.c pxaudc_zaurus # Bluetooth include "dev/bluetooth/files.bluetooth" diff --git a/sys/arch/zaurus/dev/zaurus_udc.c b/sys/arch/zaurus/dev/zaurus_udc.c new file mode 100644 index 00000000000..11f0ed234a3 --- /dev/null +++ b/sys/arch/zaurus/dev/zaurus_udc.c @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2009 Marek Vasut <marex@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. + */ + +/* Attachment driver for pxaudc(4) on Zaurus */ + +#include <sys/param.h> +#include <sys/device.h> +#include <sys/systm.h> +#include <sys/timeout.h> + +#include <dev/sdmmc/sdmmcreg.h> +#include <machine/machine_reg.h> +#include <machine/zaurus_var.h> + +#include <dev/usb/usb.h> +#include <dev/usb/usbdi.h> +#include <dev/usb/usbdivar.h> +#include <dev/usb/usbf.h> +#include <dev/usb/usbfvar.h> + +#include <arch/arm/xscale/pxa2x0_gpio.h> +#include <arch/arm/xscale/pxa27x_udc.h> + +int zaurus_udc_match(struct device *, void *, void *); +void zaurus_udc_attach(struct device *, struct device *, void *); +int zaurus_udc_detach(struct device *, int); +int zaurus_udc_is_host(void); + +struct cfattach pxaudc_zaurus_ca = { + sizeof(struct pxaudc_softc), + zaurus_udc_match, + zaurus_udc_attach, + zaurus_udc_detach, +}; + +int +zaurus_udc_match(struct device *parent, void *match, void *aux) +{ + return pxaudc_match(); +} + +int +zaurus_udc_is_host(void) +{ + return !(pxa2x0_gpio_get_bit(GPIO_USB_DETECT) || + pxa2x0_gpio_get_bit(GPIO_USB_DEVICE)); +} + +void +zaurus_udc_attach(struct device *parent, struct device *self, void *aux) +{ + struct pxaudc_softc *sc = (struct pxaudc_softc *)self; + + + sc->sc_gpio_detect = GPIO_USB_DETECT; + sc->sc_gpio_pullup = GPIO_USB_PULLUP; + sc->sc_gpio_pullup_inv = 0; + sc->sc_is_host = zaurus_udc_is_host; + + /* Platform specific GPIO configuration */ + pxa2x0_gpio_set_function(GPIO_USB_DETECT, GPIO_IN); + pxa2x0_gpio_set_function(GPIO_USB_DEVICE, GPIO_IN); + pxa2x0_gpio_set_function(GPIO_USB_PULLUP, GPIO_OUT); + + pxa2x0_gpio_set_function(45, GPIO_OUT); + pxa2x0_gpio_set_function(40, GPIO_OUT); + pxa2x0_gpio_set_function(39, GPIO_IN); + pxa2x0_gpio_set_function(38, GPIO_IN); + pxa2x0_gpio_set_function(37, GPIO_OUT); + pxa2x0_gpio_set_function(36, GPIO_IN); + pxa2x0_gpio_set_function(34, GPIO_IN); + pxa2x0_gpio_set_function(89, GPIO_OUT); + pxa2x0_gpio_set_function(120, GPIO_OUT); + + pxaudc_attach(sc, aux); +} + +int +zaurus_udc_detach(struct device *self, int flags) +{ + struct pxaudc_softc *sc = (struct pxaudc_softc *)self; + + return pxaudc_detach(sc, flags); +} diff --git a/sys/arch/zaurus/include/machine_reg.h b/sys/arch/zaurus/include/machine_reg.h index d790b02e7ff..9d38fb6c77d 100644 --- a/sys/arch/zaurus/include/machine_reg.h +++ b/sys/arch/zaurus/include/machine_reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: machine_reg.h,v 1.2 2009/09/03 21:40:29 marex Exp $ */ +/* $OpenBSD: machine_reg.h,v 1.3 2010/06/07 16:34:20 drahn Exp $ */ /* $NetBSD: lubbock_reg.h,v 1.1 2003/06/18 10:51:15 bsh Exp $ */ /* @@ -75,9 +75,9 @@ #define C3000_RC_IRQ_PIN 13 /* remote control */ #define C3000_CF0_IRQ_PIN 94 #define C3000_CF1_IRQ_PIN 93 -#define PXA_USB_DEVICE_PIN 35 /* indicate connection type */ -#define PXA_USB_CONNECT_PIN 41 /* connection interrupt */ -#define PXA_USB_PULLUP_PIN 45 /* show/hide device presence */ +#define GPIO_USB_DEVICE 35 /* indicate connection type */ +#define GPIO_USB_DETECT 41 /* connection interrupt */ +#define GPIO_USB_PULLUP 45 /* show/hide device presence */ #define GPIO_HP_IN_C3000 116 /* headphone jack */ #define GPIO_MMC_DETECT 9 /* card detect */ |