summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2007-07-31 17:43:18 +0000
committerimp <imp@FreeBSD.org>2007-07-31 17:43:18 +0000
commit4d0d4dac14197b82cd2999248f86e3614a9e1f93 (patch)
tree0e6666c9828bb5e140b76d42dbb8847c17d8d3b1 /sys
parent99641742c6c190c323b98343e5a497998807e7bf (diff)
downloadFreeBSD-src-4d0d4dac14197b82cd2999248f86e3614a9e1f93.zip
FreeBSD-src-4d0d4dac14197b82cd2999248f86e3614a9e1f93.tar.gz
Make USB work on the KB9202{,A,B} boards. This has been in p4 for about
7 months. You must have JP6 in the 1-2 position to supply power to the USB devices, but I've used uftdi, uplcom and umass successfully. If you have it in 2-3, then nothing will show up. Also, if you have the FQPA packaging for the AT91RM9200 (like the KN9202 boards have), you will get the following message uhub0: device problem (IOERROR), disabling port 2 due to a hardware erratum. It is safe to ignore as it is about pins that aren't brought out on the FQPA package and aren't proeprly terminated either. Alas, there's no register to read to tell the FQPA from the BGA versions. Submitted by: Daan Vreeken Approved by: re (kensmith)
Diffstat (limited to 'sys')
-rw-r--r--sys/arm/at91/at91rm92reg.h3
-rw-r--r--sys/arm/at91/kb920x_machdep.c4
-rw-r--r--sys/arm/at91/ohci_atmelarm.c32
3 files changed, 36 insertions, 3 deletions
diff --git a/sys/arm/at91/at91rm92reg.h b/sys/arm/at91/at91rm92reg.h
index b1b6758..6918149 100644
--- a/sys/arm/at91/at91rm92reg.h
+++ b/sys/arm/at91/at91rm92reg.h
@@ -336,7 +336,8 @@
#define AT91RM92_TC1C1_BASE 0xffa4040
#define AT91RM92_TC1C2_BASE 0xffa4080
-#define AT91RM92_OHCI_BASE 0x00300000
+#define AT91RM92_OHCI_BASE 0xdfe00000
+#define AT91RM92_OHCI_PA_BASE 0x00300000
#define AT91RM92_OHCI_SIZE 0x00100000
#define AT91C_MASTER_CLOCK 60000000
diff --git a/sys/arm/at91/kb920x_machdep.c b/sys/arm/at91/kb920x_machdep.c
index 8481b5d..d0e9d7b 100644
--- a/sys/arm/at91/kb920x_machdep.c
+++ b/sys/arm/at91/kb920x_machdep.c
@@ -165,14 +165,14 @@ static const struct pmap_devmap kb920x_devmap[] = {
* initialization is done. However, the AT91 resource allocation
* system doesn't know how to use pmap_mapdev() yet.
*/
-#if 0
+#if 1
{
/*
* Add the ohci controller, and anything else that might be
* on this chip select for a VA/PA mapping.
*/
AT91RM92_OHCI_BASE,
- AT91RM92_OHCI_BASE,
+ AT91RM92_OHCI_PA_BASE,
AT91RM92_OHCI_SIZE,
VM_PROT_READ|VM_PROT_WRITE,
PTE_NOCACHE,
diff --git a/sys/arm/at91/ohci_atmelarm.c b/sys/arm/at91/ohci_atmelarm.c
index e5bc1c8..139bfc2 100644
--- a/sys/arm/at91/ohci_atmelarm.c
+++ b/sys/arm/at91/ohci_atmelarm.c
@@ -28,7 +28,9 @@ __FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/module.h>
+#include <sys/mutex.h>
#include <sys/bus.h>
#include <sys/queue.h>
#include <machine/bus.h>
@@ -99,6 +101,30 @@ ohci_atmelarm_attach(device_t dev)
}
device_set_ivars(sc->sc_ohci.sc_bus.bdev, &sc->sc_ohci.sc_bus);
+ /* Allocate a parent dma tag for DMA maps */
+ err = bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0,
+ BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0,
+ NULL, NULL, &sc->sc_ohci.sc_bus.parent_dmatag);
+ if (err) {
+ device_printf(dev, "Could not allocate parent DMA tag (%d)\n",
+ err);
+ err = ENXIO;
+ goto error;
+ }
+
+ /* Allocate a dma tag for transfer buffers */
+ err = bus_dma_tag_create(sc->sc_ohci.sc_bus.parent_dmatag, 1, 0,
+ BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
+ BUS_SPACE_MAXSIZE_32BIT, USB_DMA_NSEG, BUS_SPACE_MAXSIZE_32BIT, 0,
+ busdma_lock_mutex, &Giant, &sc->sc_ohci.sc_bus.buffer_dmatag);
+ if (err) {
+ device_printf(dev, "Could not allocate transfer tag (%d)\n",
+ err);
+ err = ENXIO;
+ goto error;
+ }
+
err = bus_setup_intr(dev, sc->sc_ohci.irq_res, INTR_TYPE_BIO, NULL,
ohci_intr, sc, &sc->sc_ohci.ih);
if (err) {
@@ -158,6 +184,12 @@ ohci_atmelarm_detach(device_t dev)
bus_teardown_intr(dev, sc->sc_ohci.irq_res, sc->sc_ohci.ih);
sc->sc_ohci.ih = NULL;
}
+
+ if (sc->sc_ohci.sc_bus.parent_dmatag != NULL)
+ bus_dma_tag_destroy(sc->sc_ohci.sc_bus.parent_dmatag);
+ if (sc->sc_ohci.sc_bus.buffer_dmatag != NULL)
+ bus_dma_tag_destroy(sc->sc_ohci.sc_bus.buffer_dmatag);
+
if (sc->sc_ohci.sc_bus.bdev) {
device_delete_child(dev, sc->sc_ohci.sc_bus.bdev);
sc->sc_ohci.sc_bus.bdev = NULL;
OpenPOWER on IntegriCloud