From owner-freebsd-bugs@FreeBSD.ORG Sun Jun 22 04:37:09 2003 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 82FA837B401; Sun, 22 Jun 2003 04:37:09 -0700 (PDT) Received: from atnsmtp92.24on.cc (ATNSMTP92.24on.cc [213.225.2.183]) by mx1.FreeBSD.org (Postfix) with ESMTP id ECE8743FB1; Sun, 22 Jun 2003 04:37:07 -0700 (PDT) (envelope-from tilman@arved.de) Received: from 21322530218.direct.eti.at ([213.225.30.218]) by atnsmtp92.24on.cc with Microsoft SMTPSVC(5.5.1877.447.44); Sun, 22 Jun 2003 13:37:16 +0200 Received: from sauna.arved.de (sauna.arved.de [192.168.2.4]) h5MBawol033683; Sun, 22 Jun 2003 13:36:58 +0200 (CEST) (envelope-from tilman@arved.de) Received: from sauna.arved.de (sauna.arved.de [127.0.0.1]) by sauna.arved.de (8.12.9/8.12.9) with ESMTP id h5MBawe0034346; Sun, 22 Jun 2003 13:36:58 +0200 (CEST) (envelope-from tilman@sauna.arved.de) Received: by sauna.arved.de (8.12.9/8.12.9/Submit) id h5MBavEN034345; Sun, 22 Jun 2003 13:36:57 +0200 (CEST) From: Tilman Linneweh Organization: FreeBSD.org To: freebsd-gnats-submit@FreeBSD.org, thorsten.greiner@consol.de Date: Sun, 22 Jun 2003 13:36:57 +0200 User-Agent: KMail/1.5.2 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200306221336.57346.arved@FreeBSD.org> cc: joe@FreeBSD.org cc: FreeBSD-bugs@FreeBSD.org Subject: Re: kern/33004: Patch for USB (uhci) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Jun 2003 11:37:09 -0000 Hi, [ Joe, I am CCing you, since you have done most of the USB stuff in CURRENT ] Today I upgraded my Notebook to 5.1, and this patch is still necessary to get USB working. Relevant parts of dmesg with patch: uhci0: port 0x1c00-0x1c1f irq 11 at device 7.2 on pci0 usb0: on uhci0 usb0: USB revision 1.0 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered ums0: Cypress Sem Cypress USB Mouse, rev 1.00/4.9c, addr 2, iclass 3/1 ums0: 3 buttons and Z dir. without patch: uhci0: port 0x1c00-0x1c1f irq 11 at device 7.2 on pci0 usb0: on uhci0 usb0: USB revision 1.0 uhub0: Intel UHCI root hub, class 9/0, rev 1.00/1.00, addr 1 uhub0: 2 ports with 2 removable, self powered uhub0: device problem, disabling port 1 Some things changed since Thorsten submitted the patch, so here is a diff relative to CURRENT. Since PCI_COMMAND_STATUS_REG has been removed in CURRENT, I defined it, but probably PCIR_COMMAND should be used, but neither am I a PCI hacker nor did I found any documentation about the purpose of this defines. regards tilman Index: uhci_pci.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/uhci_pci.c,v retrieving revision 1.47 diff -u -r1.47 uhci_pci.c --- uhci_pci.c 12 Jun 2003 05:29:15 -0000 1.47 +++ uhci_pci.c 22 Jun 2003 11:17:58 -0000 @@ -138,7 +138,7 @@ static const char *uhci_device_generic = "UHCI (generic) USB controller"; #define PCI_UHCI_BASE_REG 0x20 - +#define PCI_COMMAND_STATUS_REG 0x04 static int uhci_pci_attach(device_t self); static int uhci_pci_detach(device_t self); @@ -164,8 +164,13 @@ uhci_pci_resume(device_t self) { uhci_softc_t *sc = device_get_softc(self); + u_int32_t csr; uhci_power(PWR_RESUME, sc); + /* Enable the device. */ + csr = pci_read_config(self, PCI_COMMAND_STATUS_REG, 4); + pci_write_config(self, PCI_COMMAND_STATUS_REG, + csr | PCIM_CMD_BUSMASTEREN, 4); bus_generic_resume(self); return 0; @@ -244,6 +249,7 @@ uhci_softc_t *sc = device_get_softc(self); int rid; int err; + u_int32_t csr; pci_enable_busmaster(self); @@ -304,6 +310,11 @@ sc->sc_bus.usbrev = USBREV_UNKNOWN; break; } + + /* Enable the device. */ + csr = pci_read_config(self, PCI_COMMAND_STATUS_REG, 4); + pci_write_config(self, PCI_COMMAND_STATUS_REG, + csr | PCIM_CMD_BUSMASTEREN, 4); err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_BIO, (driver_intr_t *) uhci_intr, sc, &sc->ih);