Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Aug 2013 08:42:17 +0200
From:      Hans Petter Selasky <hps@bitfrost.no>
To:        "Lundberg, Johannes" <johannes@brilliantservice.co.jp>
Cc:        FreeBSD Current <freebsd-current@freebsd.org>, "freebsd-usb@freebsd.org" <freebsd-usb@freebsd.org>
Subject:   Re: xhci broken on 10-CURRENT and 2013 MacBook Air?
Message-ID:  <52203EC9.4060808@bitfrost.no>
In-Reply-To: <CAASDrVk4eWVLj0=VHygKk5iG9Zd0tSwNkqLX%2BLJjP=mD_LRrUw@mail.gmail.com>
References:  <CAASDrV=_8XDFZqcVP7aHdgEwxtMEDyNDQAyM5dgPmJ6=toOpow@mail.gmail.com> <CAASDrVmyduRKwsp5oURYuHX8G4hoODn0TftbC5MfV=3XhhocrA@mail.gmail.com> <521B9CD7.8010902@bitfrost.no> <CAASDrVk5xjptRPttbQA6b7Tg_Pgf005EqMQpUhv-jNje%2B352%2BA@mail.gmail.com> <521C6C26.7050207@bitfrost.no> <CAASDrVnJj4%2BkhHB-StW3JpVuCqZx7MBcmqA59_Ay-06Jgu5PnQ@mail.gmail.com> <CAASDrVk4eWVLj0=VHygKk5iG9Zd0tSwNkqLX%2BLJjP=mD_LRrUw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030709090608070304030300
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 08/30/13 08:09, Lundberg, Johannes wrote:
> What I got so far is this;
>
> USB driver from current stops after
> xhci0: 32 byte context size
>
> While driver from 9.1 continues to the next step which is
> usbus0 on xhci0
> xhci0: usbpf: Attached
> ...
>
> I can try adding some printf's in the code and see if I get some more..
>

Hi,

There are only a few commits to the xhci driver since 9.1 was releases, 
so this should be easy to figure out.

I'm doing a wild guess. Can you try the attached patch. It will ensure 
that any BIOS generated interrupts get cleared before we reset the 
controller.

--HPS


--------------030709090608070304030300
Content-Type: text/x-patch;
 name="xhci_irq.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="xhci_irq.diff"

=== sys/dev/usb/controller/xhci.c
==================================================================
--- sys/dev/usb/controller/xhci.c	(revision 254832)
+++ sys/dev/usb/controller/xhci.c	(local)
@@ -320,6 +320,12 @@
 		device_printf(sc->sc_bus.parent, "32 byte context size.\n");
 	}
 
+	temp = XREAD4(sc, oper, XHCI_USBSTS);
+	/* clear all pending interrupts */
+	XWRITE4(sc, oper, XHCI_USBSTS, temp);
+	/* clear and disable leftover interrupts */
+	XWRITE4(sc, runt, XHCI_IMAN(0), XHCI_IMAN_INTR_PEND);
+
 	/* Reset controller */
 	XWRITE4(sc, oper, XHCI_USBCMD, XHCI_CMD_HCRST);
 
@@ -385,10 +391,6 @@
 	sc->sc_exit_lat_max = XHCI_HCS3_U1_DEL(temp) +
 	    XHCI_HCS3_U2_DEL(temp) + 250 /* us */;
 
-	temp = XREAD4(sc, oper, XHCI_USBSTS);
-
-	/* clear interrupts */
-	XWRITE4(sc, oper, XHCI_USBSTS, temp);
 	/* disable all device notifications */
 	XWRITE4(sc, oper, XHCI_DNCTRL, 0);
 
@@ -462,11 +464,8 @@
 	XWRITE4(sc, runt, XHCI_ERSTBA_HI(0), (uint32_t)(addr >> 32));
 
 	/* Setup interrupter registers */
+	XWRITE4(sc, runt, XHCI_IMAN(0), XHCI_IMAN_INTR_ENA);
 
-	temp = XREAD4(sc, runt, XHCI_IMAN(0));
-	temp |= XHCI_IMAN_INTR_ENA;
-	XWRITE4(sc, runt, XHCI_IMAN(0), temp);
-
 	/* setup command ring control base address */
 	addr = buf_res.physaddr;
 	addr += (uintptr_t)&((struct xhci_hw_root *)0)->hwr_commands[0];

--------------030709090608070304030300--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?52203EC9.4060808>