svn commit: r294427 - head/sys/dev/usb/controller

Zbigniew Bodek zbb at FreeBSD.org
Wed Jan 20 13:58:09 UTC 2016


Author: zbb
Date: Wed Jan 20 13:58:07 2016
New Revision: 294427
URL: https://svnweb.freebsd.org/changeset/base/294427

Log:
  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 at semihalf.com>
  Differential revision:  https://reviews.freebsd.org/D4369

Modified:
  head/sys/dev/usb/controller/ehci_mv.c

Modified: head/sys/dev/usb/controller/ehci_mv.c
==============================================================================
--- head/sys/dev/usb/controller/ehci_mv.c	Wed Jan 20 13:55:51 2016	(r294426)
+++ head/sys/dev/usb/controller/ehci_mv.c	Wed Jan 20 13:58:07 2016	(r294427)
@@ -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 |


More information about the svn-src-head mailing list