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)
This commit is contained in:
Warner Losh 2007-07-31 17:43:18 +00:00
parent 6308183c5d
commit 3f0fd37320
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=171673
3 changed files with 36 additions and 3 deletions

View File

@ -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

View File

@ -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,

View File

@ -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;