From patchwork Sat Feb 15 00:12:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 11383637 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B867D13A4 for ; Sat, 15 Feb 2020 00:13:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86802207FF for ; Sat, 15 Feb 2020 00:13:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hpoAqGYS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86802207FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2l5U-0001EZ-PL for patchwork-qemu-devel@patchwork.kernel.org; Fri, 14 Feb 2020 19:13:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53541) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2l4r-0008CA-Ok for qemu-devel@nongnu.org; Fri, 14 Feb 2020 19:12:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2l4q-00038v-Eo for qemu-devel@nongnu.org; Fri, 14 Feb 2020 19:12:57 -0500 Received: from mail-pg1-x544.google.com ([2607:f8b0:4864:20::544]:46019) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2l4o-00032V-90; Fri, 14 Feb 2020 19:12:54 -0500 Received: by mail-pg1-x544.google.com with SMTP id b9so5594978pgk.12; Fri, 14 Feb 2020 16:12:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=lzWIP4VkwCYbcbIQG5CcKiRH3f3/MB+GZnEQK5D3umo=; b=hpoAqGYSAUvA47AEU/PM62h20f007z+dJx852KaAatQxwRGPsEi6rjW+/zXnNlrwp0 L+N2Wj9uH9B2ZHtZZXSiWFsEP4b7q7GOb1UfJ9DfVXjqGVOvDyF8BrHs7DrDAJrUalq8 oCJFGSEqxOHMyLZsNVSXDoCQa6Du46ryFFA+cJKUqiIgKkmScQwZlODFTbfhyTLT/BC1 xrNFTqK+DT9T6W5siA6qSj2rJCHqiNnI7T4GlBqOWjR+nOhHzGOBmXvvhE/QcuB34n/l GRhF67HwKSjB27TCfjWAO5WlTG4sSoZAmd9Sm3u4fEnB4ab/oUw97O/NHnMVwceIyBb+ /2AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=lzWIP4VkwCYbcbIQG5CcKiRH3f3/MB+GZnEQK5D3umo=; b=o/qisdEqNcM0ycahQoWA9yfyX2ysigpbBuUhsY3eSBMda3WaJtfJ8kC+GLnGhg7zwe FGPk0bpvPY2EO6gvpn8FDi/2a6OAuI3UankbvCA1+RU6wT3QE61TifFT3exyQ+rqFEEi dRylFjvwdjxbnCRvxTHPUi6tUhkO2oZ/nrjHK1oIClfy1zzV+F+VNH+rVUDQVtJcWBiF Au6opNULviCkqnc/oOiDgQzSimX8TA4xDAW0kmeoIziVMYJpYaa66uWN4aawfoKOQGY9 IpsxBBcB1xFIdHpTon+4Z1jxS3GI4CD83fIdPRmQLDz8sA7KYCtA9yW5J+Rb9ED97Zu3 fA6g== X-Gm-Message-State: APjAAAUqVA097wWKYDIAejGWLgRKzhmXT70uvp39kD3k69lQW7DS7nAg 9am29auQL22pz8gtcKm6MnY= X-Google-Smtp-Source: APXvYqxIEo02tNg08eQujp+12a4xWk1R/Cx2WaQTGOM1ydJ3rlVx6pJB6JcdWVJNxB8TrBLxzW2d2A== X-Received: by 2002:a62:1a16:: with SMTP id a22mr5966524pfa.34.1581725573453; Fri, 14 Feb 2020 16:12:53 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id v5sm8317720pgc.11.2020.02.14.16.12.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Feb 2020 16:12:52 -0800 (PST) From: Guenter Roeck To: Peter Maydell , Gerd Hoffmann Subject: [PATCH v2 1/3] hw: usb: hcd-ohci: Move OHCISysBusState and TYPE_SYSBUS_OHCI to include file Date: Fri, 14 Feb 2020 16:12:46 -0800 Message-Id: <20200215001248.2642-2-linux@roeck-us.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200215001248.2642-1-linux@roeck-us.net> References: <20200215001248.2642-1-linux@roeck-us.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::544 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Beniamino Galvani , qemu-arm@nongnu.org, qemu-devel@nongnu.org, Guenter Roeck Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" We need to be able to use OHCISysBusState outside hcd-ohci.c, so move it to its include file. Signed-off-by: Guenter Roeck --- v2: no changes hw/usb/hcd-ohci.c | 15 --------------- hw/usb/hcd-ohci.h | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/hw/usb/hcd-ohci.c b/hw/usb/hcd-ohci.c index 8a94bd004a..1e6e85e86a 100644 --- a/hw/usb/hcd-ohci.c +++ b/hw/usb/hcd-ohci.c @@ -1870,21 +1870,6 @@ void ohci_sysbus_die(struct OHCIState *ohci) ohci_bus_stop(ohci); } -#define TYPE_SYSBUS_OHCI "sysbus-ohci" -#define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj), TYPE_SYSBUS_OHCI) - -typedef struct { - /*< private >*/ - SysBusDevice parent_obj; - /*< public >*/ - - OHCIState ohci; - char *masterbus; - uint32_t num_ports; - uint32_t firstport; - dma_addr_t dma_offset; -} OHCISysBusState; - static void ohci_realize_pxa(DeviceState *dev, Error **errp) { OHCISysBusState *s = SYSBUS_OHCI(dev); diff --git a/hw/usb/hcd-ohci.h b/hw/usb/hcd-ohci.h index 16e3f1e13a..5c8819aedf 100644 --- a/hw/usb/hcd-ohci.h +++ b/hw/usb/hcd-ohci.h @@ -22,6 +22,7 @@ #define HCD_OHCI_H #include "sysemu/dma.h" +#include "hw/usb.h" /* Number of Downstream Ports on the root hub: */ #define OHCI_MAX_PORTS 15 @@ -90,6 +91,21 @@ typedef struct OHCIState { void (*ohci_die)(struct OHCIState *ohci); } OHCIState; +#define TYPE_SYSBUS_OHCI "sysbus-ohci" +#define SYSBUS_OHCI(obj) OBJECT_CHECK(OHCISysBusState, (obj), TYPE_SYSBUS_OHCI) + +typedef struct { + /*< private >*/ + SysBusDevice parent_obj; + /*< public >*/ + + OHCIState ohci; + char *masterbus; + uint32_t num_ports; + uint32_t firstport; + dma_addr_t dma_offset; +} OHCISysBusState; + extern const VMStateDescription vmstate_ohci_state; void usb_ohci_init(OHCIState *ohci, DeviceState *dev, uint32_t num_ports, From patchwork Sat Feb 15 00:12:47 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 11383639 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED94B186E for ; Sat, 15 Feb 2020 00:13:37 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C4FBB207FF for ; Sat, 15 Feb 2020 00:13:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FcIxJxJb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C4FBB207FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46892 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2l5U-0001Ed-VR for patchwork-qemu-devel@patchwork.kernel.org; Fri, 14 Feb 2020 19:13:36 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53561) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2l4t-0008FP-2D for qemu-devel@nongnu.org; Fri, 14 Feb 2020 19:12:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2l4s-0003BT-5G for qemu-devel@nongnu.org; Fri, 14 Feb 2020 19:12:59 -0500 Received: from mail-pg1-x543.google.com ([2607:f8b0:4864:20::543]:34372) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2l4q-00036K-8G; Fri, 14 Feb 2020 19:12:56 -0500 Received: by mail-pg1-x543.google.com with SMTP id j4so5746063pgi.1; Fri, 14 Feb 2020 16:12:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hbeVP/BW+IaFARdpXG4HDpnB43Wxr9sq7+fPSUPZvsM=; b=FcIxJxJbxQ80ZNP3JZjFhtw0vGua8ZGcSIWcBBllDo2ahg2vwRfrxqE6CU6jlo5ISR naPkleDMMnZ2agi8xrwGx8k8InWJQi2DOnX+fsFiZxIx/jbhqZJz6UAML7IXOykyh/ni 5B2UPozbvWZNH1YZYEBi3SiziMCGbW+nl9n2uRWtCKYtWQ/Ws76YSP4WU5i/fzpt+1pU D7CHlPOFM97yd07sZaSYc4vW7xbFiCOwdxWKf7+e3FxruQHzWFUWfVUZ5GYn7bvhYgbf 2AnxsbNGhm9ojPNIsOvJF/dm7XUGIYcSX0HdVjjWg/3SnGBbwuZi6sqeFipjmoYJaojf xeZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=hbeVP/BW+IaFARdpXG4HDpnB43Wxr9sq7+fPSUPZvsM=; b=I8zb/5UvLMR4O+nRgZyYHSkp0ahL1zrDM9TqeyM9vmrCeQfSY0NItzuV16Wp1zykY3 atbBL+GgaMjNdzCYiHtwzzy9ESQ/SF81FGIEQcBkjb71Wio/CNqVmjovC/pPoZi60Nff vcJbeU0VIyh7AgtxUf4Und+uZNB0bSD0PdsZ/yJQ0dcjp2uoA3VeYhMtr9kjuldUtylJ gMJ4Pm6OSDzVFWGAb91hU5ceIO/zgzkfrfWHrLi7peW+CNjqpGy+mc1KoaWsYjXKpJLl L4jCV/YNf3JuPpZKxM0r+ZUxqDqfMgz+mqudg+eUGJ+BjeT6RnZd5XmYs5+93UhmhboB RgkQ== X-Gm-Message-State: APjAAAUNHA95buxKkt7uS4/jfwviyploUNWAws874Z5cQ4pdmeCL7zlF bpkzpmKtI7JhmMLmA2y9O3k= X-Google-Smtp-Source: APXvYqyBldKLT1Pm6J6WzLd5PAbioQ0hGgJHYVWZ/kXoX0PMAv2KwB6r5eOx2oGy2LKKXApz4P7/5Q== X-Received: by 2002:aa7:8809:: with SMTP id c9mr5802564pfo.238.1581725575362; Fri, 14 Feb 2020 16:12:55 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id c184sm8431141pfa.39.2020.02.14.16.12.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Feb 2020 16:12:54 -0800 (PST) From: Guenter Roeck To: Peter Maydell , Gerd Hoffmann Subject: [PATCH v2 2/3] hcd-ehci: Introduce "companion-enable" sysbus property Date: Fri, 14 Feb 2020 16:12:47 -0800 Message-Id: <20200215001248.2642-3-linux@roeck-us.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200215001248.2642-1-linux@roeck-us.net> References: <20200215001248.2642-1-linux@roeck-us.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::543 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Beniamino Galvani , qemu-arm@nongnu.org, qemu-devel@nongnu.org, Guenter Roeck Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" We'll use this property in a follow-up patch to insantiate an EHCI bus with companion support. Signed-off-by: Guenter Roeck --- v2: Added patch hw/usb/hcd-ehci-sysbus.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c index b5a014f968..014ad3d552 100644 --- a/hw/usb/hcd-ehci-sysbus.c +++ b/hw/usb/hcd-ehci-sysbus.c @@ -33,6 +33,8 @@ static const VMStateDescription vmstate_ehci_sysbus = { static Property ehci_sysbus_properties[] = { DEFINE_PROP_UINT32("maxframes", EHCISysBusState, ehci.maxframes, 128), + DEFINE_PROP_BOOL("companion-enable", EHCISysBusState, ehci.companion_enable, + false), DEFINE_PROP_END_OF_LIST(), }; From patchwork Sat Feb 15 00:12:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guenter Roeck X-Patchwork-Id: 11383643 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A31D13A4 for ; Sat, 15 Feb 2020 00:14:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5093C207FF for ; Sat, 15 Feb 2020 00:14:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="erjIupE2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5093C207FF Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:46914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2l6i-0003as-IE for patchwork-qemu-devel@patchwork.kernel.org; Fri, 14 Feb 2020 19:14:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53581) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2l4v-0008O0-TN for qemu-devel@nongnu.org; Fri, 14 Feb 2020 19:13:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2l4u-0003Fz-GR for qemu-devel@nongnu.org; Fri, 14 Feb 2020 19:13:01 -0500 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]:40659) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2l4r-000394-Oz; Fri, 14 Feb 2020 19:12:57 -0500 Received: by mail-pg1-x542.google.com with SMTP id z7so5730382pgk.7; Fri, 14 Feb 2020 16:12:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=JXT2z9qJxKdTjfJEwn9Dgtbq3jsFOHBma8z40zcFGTA=; b=erjIupE2hrkCVfbJAUzkJA3r/6EXPdw5gdrXcpF/7dgS0/HyyXih9EVrtz5hX+59Kh wirhOtGjH3fF+KkY2lKTj2fO0mQ6LXoI14YgCyn+fxA2UpD/upsVZ4fM53CrccSnLc4a YMUA/1OKKn2+irPElLOGTnJEexceZGxkxDtTC7bqBGncKAEsDVQGj2FdWFTyen3VwgAW GiMnG1yW7t0xjbG3ZlRGRg1XUpznbE+QOAI/i6pMSx5tU/q5Yuzw8o98Y0z9bT4IYmrd E6UjrT86fQWcefXYN/L62fuPSoRjqfoEuI2li5fevEM91EUyVGKD82PTdOlOAHwAKn+7 p6Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=JXT2z9qJxKdTjfJEwn9Dgtbq3jsFOHBma8z40zcFGTA=; b=dabIFZb73JFlHinBi2+nyTa7uN1qmvCyNlt9M+0YSvjKkIbmUAnkOXc+SBlb6IIp9T sCsrEUeAa+Y+xHBBOo8Y/lFrYwKHqe76UkCx5facdNFZvev1moZRFecqbb9BeNodDK/P 85zd9aFK6orsVuSsUmj4tmF+EubkG1nFaKN+ZRTXMNC5Lzfy40vqeMtNMhbJtBAY7voB gMw/8Wazz+Np1h8ghblFhEuGP5xLcpWw/tinpXTKfzyCqlxVuu5tMHQ8w2Wxga3gIcsy rRP0z9fbKfflUTyBktteI1usKFIYzRZGK0CtcvCkagZURmyHbQvrtMa0/m9du6ht8XYx kbCw== X-Gm-Message-State: APjAAAXH3yVtIvvAvz8ojd/bFa1VioannjioZISXHCiSpeeXAc3RviUe BOy3CbrlJ7AHnU+HHs9YhVw= X-Google-Smtp-Source: APXvYqzPkLvbrpNcyLc7DFblcKPUwGSe+b/HB6QsxQsavfmSNiHQTAuOOUtwDOMss9gFlIyqeLVRPg== X-Received: by 2002:a63:9919:: with SMTP id d25mr5997971pge.22.1581725576805; Fri, 14 Feb 2020 16:12:56 -0800 (PST) Received: from localhost ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id g24sm8305601pfk.92.2020.02.14.16.12.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 14 Feb 2020 16:12:56 -0800 (PST) From: Guenter Roeck To: Peter Maydell , Gerd Hoffmann Subject: [PATCH v2 3/3] arm: allwinner: Wire up USB ports Date: Fri, 14 Feb 2020 16:12:48 -0800 Message-Id: <20200215001248.2642-4-linux@roeck-us.net> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200215001248.2642-1-linux@roeck-us.net> References: <20200215001248.2642-1-linux@roeck-us.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::542 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Beniamino Galvani , qemu-arm@nongnu.org, qemu-devel@nongnu.org, Guenter Roeck Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" Instantiate EHCI and OHCI controllers on Allwinner A10. OHCI ports are modeled as companions of the respective EHCI ports. With this patch applied, USB controllers are discovered and instantiated when booting the cubieboard machine with a recent Linux kernel. ehci-platform 1c14000.usb: EHCI Host Controller ehci-platform 1c14000.usb: new USB bus registered, assigned bus number 1 ehci-platform 1c14000.usb: irq 26, io mem 0x01c14000 ehci-platform 1c14000.usb: USB 2.0 started, EHCI 1.00 ehci-platform 1c1c000.usb: EHCI Host Controller ehci-platform 1c1c000.usb: new USB bus registered, assigned bus number 2 ehci-platform 1c1c000.usb: irq 31, io mem 0x01c1c000 ehci-platform 1c1c000.usb: USB 2.0 started, EHCI 1.00 ohci-platform 1c14400.usb: Generic Platform OHCI controller ohci-platform 1c14400.usb: new USB bus registered, assigned bus number 3 ohci-platform 1c14400.usb: irq 27, io mem 0x01c14400 ohci-platform 1c1c400.usb: Generic Platform OHCI controller ohci-platform 1c1c400.usb: new USB bus registered, assigned bus number 4 ohci-platform 1c1c400.usb: irq 32, io mem 0x01c1c400 usb 2-1: new high-speed USB device number 2 using ehci-platform usb-storage 2-1:1.0: USB Mass Storage device detected scsi host1: usb-storage 2-1:1.0 usb 3-1: new full-speed USB device number 2 using ohci-platform input: QEMU QEMU USB Mouse as /devices/platform/soc/1c14400.usb/usb3/3-1/3-1:1.0/0003:0627:0001.0001/input/input0 Signed-off-by: Guenter Roeck --- v2: Instantiate EHCI and OHCI in a single patch Use define instead of ARRAY_SIZE to get the number of USB ports Instantiate OHCI in companion mode Use &error_fatal to handle error conditions hw/arm/allwinner-a10.c | 43 ++++++++++++++++++++++++++++++++++ include/hw/arm/allwinner-a10.h | 6 +++++ 2 files changed, 49 insertions(+) diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c index 45cd8d2db5..57275c92f5 100644 --- a/hw/arm/allwinner-a10.c +++ b/hw/arm/allwinner-a10.c @@ -24,12 +24,16 @@ #include "hw/arm/allwinner-a10.h" #include "hw/misc/unimp.h" #include "sysemu/sysemu.h" +#include "hw/boards.h" +#include "hw/usb/hcd-ohci.h" #define AW_A10_CCM_REG_BASE 0x01c20000 #define AW_A10_PIC_REG_BASE 0x01c20400 #define AW_A10_PIT_REG_BASE 0x01c20c00 #define AW_A10_UART0_REG_BASE 0x01c28000 #define AW_A10_EMAC_BASE 0x01c0b000 +#define AW_A10_EHCI_BASE 0x01c14000 +#define AW_A10_OHCI_BASE 0x01c14400 #define AW_A10_SATA_BASE 0x01c18000 static void aw_a10_init(Object *obj) @@ -53,6 +57,17 @@ static void aw_a10_init(Object *obj) sysbus_init_child_obj(obj, "sata", &s->sata, sizeof(s->sata), TYPE_ALLWINNER_AHCI); + + if (machine_usb(current_machine)) { + int i; + + for (i = 0; i < AW_A10_NUM_USB; i++) { + sysbus_init_child_obj(obj, "ehci[*]", OBJECT(&s->ehci[i]), + sizeof(s->ehci[i]), TYPE_PLATFORM_EHCI); + sysbus_init_child_obj(obj, "ohci[*]", OBJECT(&s->ohci[i]), + sizeof(s->ohci[i]), TYPE_SYSBUS_OHCI); + } + } } static void aw_a10_realize(DeviceState *dev, Error **errp) @@ -133,6 +148,34 @@ static void aw_a10_realize(DeviceState *dev, Error **errp) serial_mm_init(get_system_memory(), AW_A10_UART0_REG_BASE, 2, qdev_get_gpio_in(dev, 1), 115200, serial_hd(0), DEVICE_NATIVE_ENDIAN); + + if (machine_usb(current_machine)) { + int i; + + for (i = 0; i < AW_A10_NUM_USB; i++) { + char bus[16]; + + sprintf(bus, "usb-bus.%d", i); + + object_property_set_bool(OBJECT(&s->ehci[i]), true, + "companion-enable", &error_fatal); + object_property_set_bool(OBJECT(&s->ehci[i]), true, "realized", + &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0, + AW_A10_EHCI_BASE + i * 0x8000); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0, + qdev_get_gpio_in(dev, 39 + i)); + + object_property_set_str(OBJECT(&s->ohci[i]), bus, "masterbus", + &error_fatal); + object_property_set_bool(OBJECT(&s->ohci[i]), true, "realized", + &error_fatal); + sysbus_mmio_map(SYS_BUS_DEVICE(&s->ohci[i]), 0, + AW_A10_OHCI_BASE + i * 0x8000); + sysbus_connect_irq(SYS_BUS_DEVICE(&s->ohci[i]), 0, + qdev_get_gpio_in(dev, 64 + i)); + } + } } static void aw_a10_class_init(ObjectClass *oc, void *data) diff --git a/include/hw/arm/allwinner-a10.h b/include/hw/arm/allwinner-a10.h index 0007a927bb..12ca731cb2 100644 --- a/include/hw/arm/allwinner-a10.h +++ b/include/hw/arm/allwinner-a10.h @@ -9,11 +9,15 @@ #include "hw/intc/allwinner-a10-pic.h" #include "hw/net/allwinner_emac.h" #include "hw/ide/ahci.h" +#include "hw/usb/hcd-ohci.h" +#include "hw/usb/hcd-ehci.h" #include "target/arm/cpu.h" #define AW_A10_SDRAM_BASE 0x40000000 +#define AW_A10_NUM_USB 2 + #define TYPE_AW_A10 "allwinner-a10" #define AW_A10(obj) OBJECT_CHECK(AwA10State, (obj), TYPE_AW_A10) @@ -29,6 +33,8 @@ typedef struct AwA10State { AwEmacState emac; AllwinnerAHCIState sata; MemoryRegion sram_a; + EHCISysBusState ehci[AW_A10_NUM_USB]; + OHCISysBusState ohci[AW_A10_NUM_USB]; } AwA10State; #endif