diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-09-12 21:40:46 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-09-12 21:40:46 +0000 |
commit | 213513e37724f408e88187a601bb11d89e4ffb95 (patch) | |
tree | 42a75381ea7172c48b3f4900d5255c4713ab844b | |
parent | dd25a7e9d354e3b96572c0944f27017ae0b4cd23 (diff) |
Compensate for the fact the the FDT uses a different offset for the registers
than the hardcoded ones we used before. Replace a few magic numbers with
#defines while I'm there. Based on suggestions from dms@.
-rw-r--r-- | sys/arch/socppc/dev/ehci_obio.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/arch/socppc/dev/ehci_obio.c b/sys/arch/socppc/dev/ehci_obio.c index b127650daec..097dc5a9cf8 100644 --- a/sys/arch/socppc/dev/ehci_obio.c +++ b/sys/arch/socppc/dev/ehci_obio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci_obio.c,v 1.2 2009/09/06 20:09:34 kettenis Exp $ */ +/* $OpenBSD: ehci_obio.c,v 1.3 2009/09/12 21:40:45 kettenis Exp $ */ /* * Copyright (c) 2008 Mark Kettenis @@ -36,6 +36,12 @@ #include <dev/pci/pcidevs.h> +#define USB_EHCI_OFFSET 0x00100 +#define USB_SNOOP1 0x00400 - USB_EHCI_OFFSET +#define USB_SNOOP_2GB 0x1e000000 +#define USB_CONTROL 0x00500 - USB_EHCI_OFFSET +#define USB_CONTROL_USB_EN 0x04000000 + int ehci_obio_match(struct device *, void *, void *); void ehci_obio_attach(struct device *, struct device *, void *); @@ -86,8 +92,9 @@ ehci_obio_attach(struct device *parent, struct device *self, void *aux) int s; sc->iot = oa->oa_iot; - sc->sc_size = 1024; - if (bus_space_map(sc->iot, oa->oa_offset, sc->sc_size, 0, &sc->ioh)) { + sc->sc_size = 1028; + if (bus_space_map(sc->iot, oa->oa_offset + USB_EHCI_OFFSET, + sc->sc_size, 0, &sc->ioh)) { printf(": can't map registers\n"); return; } @@ -97,8 +104,8 @@ ehci_obio_attach(struct device *parent, struct device *self, void *aux) sc->sc_bus.dmatag = &ehci_bus_dma_tag; - bus_space_write_4(sc->iot, sc->ioh, 0x400, 0x04000000); - bus_space_write_4(sc->iot, sc->ioh, 0x300, 0x1e000000); + bus_space_write_4(sc->iot, sc->ioh, USB_CONTROL, USB_CONTROL_USB_EN); + bus_space_write_4(sc->iot, sc->ioh, USB_SNOOP1, USB_SNOOP_2GB); s = splhardusb(); sc->sc_offs = EREAD1(sc, EHCI_CAPLENGTH); |