From owner-svn-src-head@freebsd.org Wed Jan 20 13:58:09 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F9F4A89A73; Wed, 20 Jan 2016 13:58:09 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C1F6A18F0; Wed, 20 Jan 2016 13:58:08 +0000 (UTC) (envelope-from zbb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0KDw7XN068852; Wed, 20 Jan 2016 13:58:07 GMT (envelope-from zbb@FreeBSD.org) Received: (from zbb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0KDw73L068851; Wed, 20 Jan 2016 13:58:07 GMT (envelope-from zbb@FreeBSD.org) Message-Id: <201601201358.u0KDw73L068851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: zbb set sender to zbb@FreeBSD.org using -f From: Zbigniew Bodek Date: Wed, 20 Jan 2016 13:58:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r294427 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jan 2016 13:58:09 -0000 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 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 |