From patchwork Tue Oct 30 14:26:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 195518 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id D16A52C008C for ; Wed, 31 Oct 2012 02:26:34 +1100 (EST) Received: from localhost ([::1]:48238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTCnP-0002e6-Pk for incoming@patchwork.ozlabs.org; Tue, 30 Oct 2012 10:27:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:58403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTCma-0000od-CB for qemu-devel@nongnu.org; Tue, 30 Oct 2012 10:27:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TTCmR-0005Ix-FG for qemu-devel@nongnu.org; Tue, 30 Oct 2012 10:27:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36558) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TTCmR-0005IU-78 for qemu-devel@nongnu.org; Tue, 30 Oct 2012 10:26:59 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9UEQwwR027366 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 30 Oct 2012 10:26:58 -0400 Received: from rincewind.home.kraxel.org (ovpn-116-24.ams2.redhat.com [10.36.116.24]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q9UEQvB6025391; Tue, 30 Oct 2012 10:26:58 -0400 Received: by rincewind.home.kraxel.org (Postfix, from userid 500) id 5C72D41AB3; Tue, 30 Oct 2012 15:26:55 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 30 Oct 2012 15:26:38 +0100 Message-Id: <1351607214-4007-7-git-send-email-kraxel@redhat.com> In-Reply-To: <1351607214-4007-1-git-send-email-kraxel@redhat.com> References: <1351607214-4007-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 06/22] xhci: set pls in xhci_port_update & xhci_port_reset X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Set the port link state to the correct values in xhci_port_update and xhci_port_reset functions. Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 26 ++++++++++++++++++++++++-- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index 1db803c..84d1b26 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2365,33 +2365,55 @@ static void xhci_port_notify(XHCIPort *port, uint32_t bits) static void xhci_port_update(XHCIPort *port, int is_detach) { + uint32_t pls = PLS_RX_DETECT; + port->portsc = PORTSC_PP; if (!is_detach && xhci_port_have_device(port)) { port->portsc |= PORTSC_CCS; switch (port->uport->dev->speed) { case USB_SPEED_LOW: port->portsc |= PORTSC_SPEED_LOW; + pls = PLS_POLLING; break; case USB_SPEED_FULL: port->portsc |= PORTSC_SPEED_FULL; + pls = PLS_POLLING; break; case USB_SPEED_HIGH: port->portsc |= PORTSC_SPEED_HIGH; + pls = PLS_POLLING; break; case USB_SPEED_SUPER: port->portsc |= PORTSC_SPEED_SUPER; + port->portsc |= PORTSC_PED; + pls = PLS_U0; break; } } - + set_field(&port->portsc, pls, PORTSC_PLS); xhci_port_notify(port, PORTSC_CSC); } static void xhci_port_reset(XHCIPort *port) { DPRINTF("xhci: port %d reset\n", port); + if (!xhci_port_have_device(port)) { + return; + } + usb_device_reset(port->uport->dev); - port->portsc |= PORTSC_PRC | PORTSC_PED; + + switch (port->uport->dev->speed) { + case USB_SPEED_LOW: + case USB_SPEED_FULL: + case USB_SPEED_HIGH: + set_field(&port->portsc, PLS_U0, PORTSC_PLS); + port->portsc |= PORTSC_PED; + break; + } + + port->portsc &= ~PORTSC_PR; + xhci_port_notify(port, PORTSC_PRC); } static void xhci_reset(DeviceState *dev)