diff options
author | zbb <zbb@FreeBSD.org> | 2016-01-20 13:58:07 +0000 |
---|---|---|
committer | zbb <zbb@FreeBSD.org> | 2016-01-20 13:58:07 +0000 |
commit | 47e34b464bd0457734bbe2002d708ec6f71700dc (patch) | |
tree | 374d04371ef948a904edf61631f4af6bc7b4dde8 /sys/dev/usb | |
parent | 182c23f7f549e3e0235a58d736ac2a6dcdff419c (diff) | |
download | FreeBSD-src-47e34b464bd0457734bbe2002d708ec6f71700dc.zip FreeBSD-src-47e34b464bd0457734bbe2002d708ec6f71700dc.tar.gz |
Improve attachment of the ehci_mv driver
Driver was modified to ensure it attaches properly to "marvell,orion-ehci"
node, which doesn't have error interrupt line defined. Neccessary
ofw_compat_data struct was added and probe procedure was altered.
Reviewed by: andrew, ian
Obtained from: Semihalf
Sponsored by: Stormshield
Submitted by: Bartosz Szczepanek <bsz@semihalf.com>
Differential revision: https://reviews.freebsd.org/D4369
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/controller/ehci_mv.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/sys/dev/usb/controller/ehci_mv.c b/sys/dev/usb/controller/ehci_mv.c index 8053102..f06a830 100644 --- a/sys/dev/usb/controller/ehci_mv.c +++ b/sys/dev/usb/controller/ehci_mv.c @@ -99,6 +99,12 @@ static void *ih_err; #define MV_USB_HOST_OVERFLOW (1 << 2) #define MV_USB_DEVICE_UNDERFLOW (1 << 3) +static struct ofw_compat_data compat_data[] = { + {"mrvl,usb-ehci", true}, + {"marvell,orion-ehci", true}, + {NULL, false} +}; + static int mv_ehci_probe(device_t self) { @@ -106,7 +112,7 @@ mv_ehci_probe(device_t self) if (!ofw_bus_status_okay(self)) return (ENXIO); - if (!ofw_bus_is_compatible(self, "mrvl,usb-ehci")) + if (!ofw_bus_search_compatible(self, compat_data)->ocd_data) return (ENXIO); device_set_desc(self, EHCI_HC_DEVSTR); @@ -156,12 +162,15 @@ mv_ehci_attach(device_t self) device_get_name(self)); rid = 0; - irq_err = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, - RF_SHAREABLE | RF_ACTIVE); - if (irq_err == NULL) { - device_printf(self, "Could not allocate error irq\n"); - mv_ehci_detach(self); - return (ENXIO); + if (!ofw_bus_is_compatible(self, "marvell,orion-ehci")) { + irq_err = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (irq_err == NULL) { + device_printf(self, "Could not allocate error irq\n"); + mv_ehci_detach(self); + return (ENXIO); + } + rid = 1; } /* @@ -169,7 +178,6 @@ mv_ehci_attach(device_t self) * sure to use the correct rid for the main one (controller interrupt) * -- refer to DTS for the right resource number to use here. */ - rid = 1; sc->sc_irq_res = bus_alloc_resource_any(self, SYS_RES_IRQ, &rid, RF_SHAREABLE | RF_ACTIVE); if (sc->sc_irq_res == NULL) { @@ -187,12 +195,14 @@ mv_ehci_attach(device_t self) sprintf(sc->sc_vendor, "Marvell"); - err = bus_setup_intr(self, irq_err, INTR_TYPE_BIO, - err_intr, NULL, sc, &ih_err); - if (err) { - device_printf(self, "Could not setup error irq, %d\n", err); - ih_err = NULL; - goto error; + if (!ofw_bus_is_compatible(self, "marvell,orion-ehci")) { + err = bus_setup_intr(self, irq_err, INTR_TYPE_BIO, + err_intr, NULL, sc, &ih_err); + if (err) { + device_printf(self, "Could not setup error irq, %d\n", err); + ih_err = NULL; + goto error; + } } EWRITE4(sc, USB_BRIDGE_INTR_MASK, MV_USB_ADDR_DECODE_ERR | |