From nobody@FreeBSD.org  Wed Dec 19 05:49:46 2001
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21])
	by hub.freebsd.org (Postfix) with ESMTP id C917337B417
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 19 Dec 2001 05:49:45 -0800 (PST)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.11.6/8.11.6) id fBJDnjb62094;
	Wed, 19 Dec 2001 05:49:45 -0800 (PST)
	(envelope-from nobody)
Message-Id: <200112191349.fBJDnjb62094@freefall.freebsd.org>
Date: Wed, 19 Dec 2001 05:49:45 -0800 (PST)
From: Thorsten Greiner <thorsten.greiner@consol.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Patch for USB (uhci)
X-Send-Pr-Version: www-1.0

>Number:         33004
>Category:       kern
>Synopsis:       Patch for USB (uhci)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-usb
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 19 05:50:02 PST 2001
>Closed-Date:    Mon Nov 15 02:19:23 GMT 2004
>Last-Modified:  Mon Nov 15 02:19:23 GMT 2004
>Originator:     Thorsten Greiner
>Release:        4.4-STABLE
>Organization:
>Environment:
FreeBSD tybalt 4.4-STABLE FreeBSD 4.4-STABLE #51: Wed Dec 19 10:57:03 CET 2001     thorsten@tybalt:/usr/src/sys/compile/TYBALT  i386
>Description:
Out of the box 4.4-STABLE will not activate the uhci usb controller on my ASUS L7300 laptop. This usb host controller is recognized as follows:

uhci0: <Intel 82443MX USB controller> port 0x1c00-0x1c1f at device 7.2 on pci0
pci_cfgintr_linked: linked (63) to hard-routed irq 11
pci_cfgintr: 0:7 INTD routed to irq 11
usb0: <Intel 82443MX USB controller> 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

The symptoms of the problem are timeouts during bus exploration:

Dec 18 10:34:38 tybalt /kernel: uhub0: device problem, disabling port 1 

>How-To-Repeat:
Probably difficult unless you have the same hardware...
>Fix:
Apply the following patch to /usr/src/sys/pci/uhci_pci.c:

--- uhci_pci.c_orig	Wed Dec 20 10:56:47 2001
+++ uhci_pci.c	Wed Dec 19 10:56:50 2001
@@ -182,6 +182,7 @@
 	uhci_softc_t *sc = device_get_softc(self);
 	int rid;
 	int err;
+	u_int32_t csr;
 
 	rid = PCI_UHCI_BASE_REG;
 	sc->io_res = bus_alloc_resource(self, SYS_RES_IOPORT, &rid,
@@ -275,6 +276,11 @@
 		uhci_pci_detach(self);
 		return ENXIO;
 	}
+
+	/* 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);
 
 	/* Set the PIRQD enable bit and switch off all the others. We don't
 	 * want legacy support to interfere with us
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Sun Dec 30 06:01:08 PST 2001 
Responsible-Changed-Why:  
Over to the USB maintainer. 

http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33004 

From: Gerhard Sittig <Gerhard.Sittig@gmx.net>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/33004: Patch for USB (uhci)
Date: Wed, 13 Feb 2002 21:51:52 +0100

 [ it's about http://www.FreeBSD.org/cgi/query-pr.cgi?pr=33004 ]
 
 Here is what I experienced on my system.  It's a noname notebook
 with an SiS630 chipset.
 
 $ uname -a
 FreeBSD 4.4-STABLE #0: Sat Dec  1 00:06:24 CET 2001
 root@mops.gsinet.sittig.org:/usr/obj/usr/src/sys/MOPS
 
 $ dmesg
 [ ... ]
 ohci0: <SiS 5571 USB controller> mem 0xe8001000-0xe8001fff irq 5 at device 1.2 on pci0
 usb0: OHCI version 1.0, legacy support
 usb0: <SiS 5571 USB controller> on ohci0
 usb0: USB revision 1.0
 uhub0: SiS OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
 uhub0: 3 ports with 3 removable, self powered
 [ ... ]
 
 
 An out of the box FreeBSD system shows the following message
 soon after an USB device gets plugged in:
 
   uhub0: device problem, disabling port 1
 
 This happens on any of the two plugs.  It's a pity I don't have
 too much devices, but I tried several Logitech mice (with and
 without wires, optical and mechanical), none of them worked.  At
 first I suspected the wireless and the inside lit devices to
 suck too much current.  But even the regular cable mouse with
 mechanical ball sensors refused to work on this machine.  While
 all of them worked flawlessly at a desktop system (Asus A7V,
 FreeBSD 4.3-STABLE).
 
 
 "Inspired" by Th. Greiner's patch I applied the below diff to
 the ohci.c source.  Suddenly I get an El Cheapo(TM) mouse to
 work like it should have done right from the start. :)
 
   ums0: Cypress Sem Cypress USB Mouse, rev 1.00/4.7b, addr 2, iclass 3/1
   ums0: 3 buttons
   ...
   ums0: at uhub0 port 1 (addr 2) disconnected
   ums0: detached
   unable to open /dev/ums0: Device not configured
 
 I guess now it's time for me to get back to trying out all
 the devices I tried before but returned since I actually only
 wanted an external mouse with more than the two buttons the
 Synaptics touchpad has.  I never cared enough that they worked
 at the desktop to keep them. :>
 
 Now here is the diff:
 
 diff -u -w -b -r1.16.2.3 ohci_pci.c
 --- ohci_pci.c  2001/08/15 17:03:08     1.16.2.3
 +++ ohci_pci.c  2002/01/13 14:03:04
 @@ -153,6 +153,7 @@
         ohci_softc_t *sc = device_get_softc(self);
         int err;
         int rid;
 +       u_int32_t csr;
  
         /* XXX where does it say so in the spec? */
         sc->sc_bus.usbrev = USBREV_1_0;
 @@ -229,6 +230,11 @@
                 ohci_pci_detach(self);
                 return ENXIO;
         }
 + 
 +       /* 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 = ohci_init(sc);
         if (!err)
 
 Not at all am I aquainted enough with USB's internals and
 kernel hacking in general to judge if this is appropriate or
 if it even does harm to other devices.  It's merely doing at
 the ohci initialisation stage what worked for Thorsten for
 uhci.  But I felt you would like to know about this (kind of)
 success story ...
 
 
 virtually yours   82D1 9B9C 01DC 4FB4 D7B4  61BE 3F49 4F77 72DE DA76
 Gerhard Sittig   true | mail -s "get gpg key" Gerhard.Sittig@gmx.net
 -- 
      If you don't understand or are scared by any of the above
              ask your parents or an adult to help you.

From: Thorsten Greiner <Thorsten.Greiner@consol.de>
To: freebsd-gnats-submit@FreeBSD.org, thorsten.greiner@consol.de
Cc:  
Subject: Re: kern/33004: Patch for USB (uhci)
Date: Fri, 22 Feb 2002 10:25:18 +0100

 --------------Boundary-00=_6UGXJK9FOSXL9BKRE2K9
 Content-Type: text/plain;
   charset="iso-8859-15"
 Content-Transfer-Encoding: 8bit
 
 Daniel O' Connor (oconnor@gsoft.com.au) writes to me:
 > I modified it to set the bus master bit in resume as well - I've
 > attached what I have.
 
 I have attached his patch.
 
 Regards
 
 	-Thorsten
 --------------Boundary-00=_6UGXJK9FOSXL9BKRE2K9
 Content-Type: text/x-diff;
   charset="iso-8859-15";
   name="usb2.patch"
 Content-Transfer-Encoding: base64
 Content-Disposition: attachment; filename="usb2.patch"
 
 SW5kZXg6IHVoY2lfcGNpLmMKPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PT09PT09PQpSQ1MgZmlsZTogL3Vzci9DVlMtUmVwb3NpdG9y
 eS9zcmMvc3lzL3BjaS91aGNpX3BjaS5jLHYKcmV0cmlldmluZyByZXZpc2lvbiAxLjI2LjIuNApk
 aWZmIC11IC1yMS4yNi4yLjQgdWhjaV9wY2kuYwotLS0gdWhjaV9wY2kuYwkxNSBBdWcgMjAwMSAx
 NzowMzowOCAtMDAwMAkxLjI2LjIuNAorKysgdWhjaV9wY2kuYwkyMiBGZWIgMj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gfCBQQ0lNX0NNRF9CVVNNQVNURVJF
 TiwgNCk7CiAKIAkvKiBTZXQgdGhlIFBJUlFEIGVuYWJsZSBiaXQgYW5kIHN3aXRjaCBvZmYgYWxs
 IHRoZSBvdGhlcnMuIFdlIGRvbid0CiAJICogd2FudCBsZWdhY3kgc3VwcG9ydCB0byBpbnRlcmZl
 cmUgd2l0aCB1cwo=
 
 --------------Boundary-00=_6UGXJK9FOSXL9BKRE2K9--

From: Tilman Linneweh <arved@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, thorsten.greiner@consol.de
Cc: joe@FreeBSD.org, FreeBSD-bugs@FreeBSD.org
Subject: Re: kern/33004: Patch for USB (uhci)
Date: Sun, 22 Jun 2003 13:36:57 +0200

 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: <Intel 82443MX USB controller> port 0x1c00-0x1c1f irq 11 at device 7.2 
 on pci0
 usb0: <Intel 82443MX USB controller> 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: <Intel 82443MX USB controller> port 0x1c00-0x1c1f irq 11 at device 7.2 
 on pci0
 usb0: <Intel 82443MX USB controller> 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);
State-Changed-From-To: open->feedback 
State-Changed-By: linimon 
State-Changed-When: Fri Aug 27 22:32:15 GMT 2004 
State-Changed-Why:  
Is this still a problem with recent versions of FreeBSD? 


Responsible-Changed-From-To: n_hibma->freebsd-bugs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Fri Aug 27 22:32:15 GMT 2004 
Responsible-Changed-Why:  
With permission of assignee, reset assignment. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33004 
Responsible-Changed-From-To: freebsd-bugs->joe 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sat Aug 28 07:28:14 GMT 2004 
Responsible-Changed-Why:  
Reassignment suggested by previous assignee. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33004 
Responsible-Changed-From-To: joe->freebsd-usb 
Responsible-Changed-By: joe 
Responsible-Changed-When: Wed Nov 10 11:03:32 GMT 2004 
Responsible-Changed-Why:  
Hand this over to the usb mailling list. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33004 

From: Anish Mistry <mistry.7@osu.edu>
To: thorsten.greiner@consol.de, arved@FreeBSD.org
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: kern/33004: Patch for USB (uhci)
Date: Wed, 10 Nov 2004 21:25:10 -0500

 --nextPart1286423.gMFVCtl4Lo
 Content-Type: text/plain;
   charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 Does this problem persist with 5.3-RELEASE, 5-STABLE, or 6-CURRENT?
 
 =2D-=20
 Anish Mistry
 
 --nextPart1286423.gMFVCtl4Lo
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (FreeBSD)
 
 iD8DBQBBks2HxqA5ziudZT0RAtMnAJwLOOhpJ7/69bQiyL+Bijvn6zBvQQCgowTr
 ImLX8Kj6ET7s6mQ4lI/6J1w=
 =Oy4g
 -----END PGP SIGNATURE-----
 
 --nextPart1286423.gMFVCtl4Lo--

From: Tilman Linneweh <arved@FreeBSD.org>
To: Anish Mistry <mistry.7@osu.edu>
Cc: thorsten.greiner@consol.de, FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: kern/33004: Patch for USB (uhci)
Date: Thu, 11 Nov 2004 09:29:41 +0100

 * Anish Mistry [2004-11-11 03:27]:
 > Does this problem persist with 5.3-RELEASE, 5-STABLE, or 6-CURRENT?
 
 Sorry, my old Laptop dropped on the floor shortly before 5.2-RELEASE.
 At that time the patch was still necessary.

From: Anish Mistry <mistry.7@osu.edu>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: kern/33004: Patch for USB (uhci)
Date: Sun, 14 Nov 2004 21:12:35 -0500

 --nextPart2770488.l6p9IYFflt
 Content-Type: text/plain;
   charset="iso-8859-1"
 Content-Transfer-Encoding: quoted-printable
 Content-Disposition: inline
 
 On Sunday 14 November 2004 06:18 am, you wrote:
 > * Anish Mistry <mistry.7@osu.edu> [2004-11-11 08:10]:
 > > Does this problem persist with 5.3-RELEASE, 5-STABLE, or 6-CURRENT?
 >
 > Just tested the 5-STABLE branch: the patch is no longer necessary,
 > USB works 'out of the box'.
 >
 > Best regards
 >
 >         -Thorsten
 This PR can be closed now.
 
 =2D-=20
 Anish Mistry
 
 --nextPart2770488.l6p9IYFflt
 Content-Type: application/pgp-signature
 
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.2.6 (FreeBSD)
 
 iD8DBQBBmBCexqA5ziudZT0RAm7cAKDCRSVrGdAQ64nNj4KrvnWjCxjRQACg0W8j
 N0w4QkreATOXTmSMzY/vd2o=
 =tdeE
 -----END PGP SIGNATURE-----
 
 --nextPart2770488.l6p9IYFflt--
State-Changed-From-To: feedback->closed 
State-Changed-By: iedowse 
State-Changed-When: Mon Nov 15 02:18:12 GMT 2004 
State-Changed-Why:  

Submitter confirms that the patch is no longer necessary. Thanks! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=33004 
>Unformatted:
