From patchwork Fri May 18 11:15:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 916207 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="NQ6J2nzC"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40nQbB27FZz9rxs for ; Fri, 18 May 2018 21:16:06 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 16BAEC21FCA; Fri, 18 May 2018 11:15:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 5A483C21F92; Fri, 18 May 2018 11:15:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 32A28C21F4F; Fri, 18 May 2018 11:15:13 +0000 (UTC) Received: from mail-wr0-f195.google.com (mail-wr0-f195.google.com [209.85.128.195]) by lists.denx.de (Postfix) with ESMTPS id 817C1C21EAE for ; Fri, 18 May 2018 11:15:12 +0000 (UTC) Received: by mail-wr0-f195.google.com with SMTP id t16-v6so5624065wrm.9 for ; Fri, 18 May 2018 04:15:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=EBLAK7UyDgbRfMLtgyMxvQJSNx/9nuIUgPK/aGkk3zk=; b=NQ6J2nzCAQ7Xqqyj62CkNN+qzYQ/8XvthwMvbZKgn/8mwosN8wmZtXC/lTJwapwmRd gCZF3FZFN7dkC4eafsvI8pYXA0MgZo7FXORHGIvwBM7gOrEv+03GgbazShsgWtEJtzWR MB/8jSexgX8MmEppRp6BT+tQUf9L9nP2a+MefODRr29Z8hCS8Hi/82S6NKq4yMrUtb/P +lRfHgnS+3bIhRpGU8BTkZ1Pavdh1+eKBSpaqe1QoM0sKHV+99TbxXpeMppVb+RQQ3dO G1cAgsro0bix4H3aLRZuDAYQTzkPiDJxu8PKDOmhHHDiUz1fyC9iImLFC9Dt4oUis4r6 TQhQ== 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:in-reply-to:references; bh=EBLAK7UyDgbRfMLtgyMxvQJSNx/9nuIUgPK/aGkk3zk=; b=tqlJVmpdw0kEypWxBIGWmmISs3e+nyBUOO8P2vSqQDn5uQXpFnPR4VvUIBCDYsb9Xq WwuyNQ2CU5BzkAgoxmbGedoEeRIAUOR5p41FrhBuTzcXOND2VZ3hte/jNmHQQcBOGJS1 BURqweLOdjYk3FNqqGQgrEbVf+Kkru0NClW2llxWE1MQEUdj58gtjPQIMCSgEwFifh7Z qYX+N8uj6SH7BnDE/tJKID9M5FE7lkr/ltlplAxQOLcnGMz483zMbO5ojjSRm4z4QWKg J0DIYAbCZye0KriarOReFuUx4XODDxO5EkicZOD1U2UryZd8Wj7XBwjyEoi9UYKb7mV4 p6PA== X-Gm-Message-State: ALKqPwezVkH6kOqEfFzQT9ciFpFuAfOI3EuAkLPh5qdaoYs7P+ku7hxD INYHTLbjVy+aO+0P3ufQQBC2GQ== X-Google-Smtp-Source: AB8JxZqAUb3OagrKt+dE34PoSbK/MFhJseHiNBELBb/HNV1U7HwNGLsuS7GFvhJkdjdpWlexZe7V7A== X-Received: by 2002:adf:988c:: with SMTP id w12-v6mr7039828wrb.215.1526642112197; Fri, 18 May 2018 04:15:12 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id v12-v6sm6150201wrm.68.2018.05.18.04.15.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 18 May 2018 04:15:11 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Fri, 18 May 2018 13:15:04 +0200 Message-Id: <40b4dfd4b061159bbe3c98385981a3ccb10b35c1.1526642103.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Cc: Mugunthan V N Subject: [U-Boot] [PATCH v2 1/6] usb: dwc3: Add dwc3_init/remove with DM_USB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Mugunthan V N The patch is preparing dwc3 core for enabling DM_USB with peripheral driver with using driver model support. The driver will be bound by the DWC3 wrapper driver based on the dr_mode device tree entry. Signed-off-by: Mugunthan V N (Remove dwc3-omap changes) Signed-off-by: Michal Simek --- Changes in v2: - Retype dwc->dev in gadget.c to avoid compilation warning - Guard udevice with __UBOOT__ - Move ifdef in core.c to avoid compilation issues for some platforms (for example edison) Origin series here: https://patchwork.ozlabs.org/patch/775108/ - Fix labels as was asked in previous review. --- drivers/usb/dwc3/core.c | 55 +++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 6 +++++ drivers/usb/dwc3/gadget.c | 2 +- 3 files changed, 62 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index dbdad22d1134..1ab5cee60969 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -788,3 +788,58 @@ MODULE_ALIAS("platform:dwc3"); MODULE_AUTHOR("Felipe Balbi "); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver"); + +#ifdef CONFIG_DM_USB + +int dwc3_init(struct dwc3 *dwc) +{ + int ret; + + dwc3_cache_hwparams(dwc); + + ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE); + if (ret) { + dev_err(dwc->dev, "failed to allocate event buffers\n"); + return -ENOMEM; + } + + ret = dwc3_core_init(dwc); + if (ret) { + dev_err(dev, "failed to initialize core\n"); + goto core_fail; + } + + ret = dwc3_event_buffers_setup(dwc); + if (ret) { + dev_err(dwc->dev, "failed to setup event buffers\n"); + goto event_fail; + } + + ret = dwc3_core_init_mode(dwc); + if (ret) + goto mode_fail; + + return 0; + +mode_fail: + dwc3_event_buffers_cleanup(dwc); + +event_fail: + dwc3_core_exit(dwc); + +core_fail: + dwc3_free_event_buffers(dwc); + + return ret; +} + +void dwc3_remove(struct dwc3 *dwc) +{ + dwc3_core_exit_mode(dwc); + dwc3_event_buffers_cleanup(dwc); + dwc3_free_event_buffers(dwc); + dwc3_core_exit(dwc); + kfree(dwc->mem); +} + +#endif diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index cbe9850a0bda..58fe91dc5131 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -712,7 +712,11 @@ struct dwc3 { /* device lock */ spinlock_t lock; +#if defined(__UBOOT__) && defined(CONFIG_DM_USB) + struct udevice *dev; +#else struct device *dev; +#endif struct platform_device *xhci; struct resource xhci_resources[DWC3_XHCI_RESOURCES_NUM]; @@ -987,6 +991,8 @@ struct dwc3_gadget_ep_cmd_params { /* prototypes */ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc); +int dwc3_init(struct dwc3 *dwc); +void dwc3_remove(struct dwc3 *dwc); #ifdef CONFIG_USB_DWC3_HOST int dwc3_host_init(struct dwc3 *dwc); diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index d45fae044c4a..e340cb268fcd 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2609,7 +2609,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) if (ret) goto err4; - ret = usb_add_gadget_udc(dwc->dev, &dwc->gadget); + ret = usb_add_gadget_udc((struct device *)dwc->dev, &dwc->gadget); if (ret) { dev_err(dwc->dev, "failed to register udc\n"); goto err4; From patchwork Fri May 18 11:15:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 916211 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="O7FK/Sw3"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40nQhM3PS3z9rxs for ; Fri, 18 May 2018 21:20:35 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 36905C21EBE; Fri, 18 May 2018 11:20:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3A0E8C21FB6; Fri, 18 May 2018 11:15:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6F4BAC21F99; Fri, 18 May 2018 11:15:18 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by lists.denx.de (Postfix) with ESMTPS id EA194C21F38 for ; Fri, 18 May 2018 11:15:13 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id y15-v6so8790699wrg.11 for ; Fri, 18 May 2018 04:15:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=oyxQwGrXqI6ktc+GUW25/jBGRF0+r/5Yf45rfmAIaEA=; b=O7FK/Sw3Ko8uL6ilVQYX1QHUzZexUPJFIctS1eDbVXFC4NchVqsr5fcbpoG8p15YAc fUUe/f8nxfsSCj9SKBQcvNGq/JYCPM/XrWOoWxEaZPJ45GXTKa1Db1H3TVKfaUjYMxLj 1iT27yZsCz9RjUoy29tu/0FMdDNkOHJ/IP5QuPkT/mUV1n5bfuRbErK8Qw9xQ35Qmy7b x3JlcwDre+ZGY1dAelyGrnbo5p80rLy3OdtLX2NHqgQleNzQTksqpbf+QeyVskFHIuL4 n4lvtdE19bQcRqyNgkSW6zK/5yd1e4O5tZPulr29ap7GtpK4734sc0pDx3olex4r3+EP 6V0A== 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:in-reply-to:references; bh=oyxQwGrXqI6ktc+GUW25/jBGRF0+r/5Yf45rfmAIaEA=; b=M9NZZKWOAcG0PFaKiLV0VvyHcrSvBoBHUYO7lFMkGSIk7obe6PgYtJivtYH9P9KQHx E1Nv2MKxUHZSPci71SGjX12idYtFJMf40Y5JkyJAfKs3xUvHy5+hrMjLDgHBFzirzxJy 1c0uUhdn+dzBqZd8CIKREx4MR57E3vU/f2r1ufw5ComDJtpdg0NHXgJW1CMGnef0l56I o3fa07kv7XEXzyE0GejH6TpmJz4snyPuCKHcBC0ysBcHXF9l2XUaHW3LojCH2eCEMQmG gdyLS41+fuQdrZfJWiY08xIbqIlaOqswhgRJJd6vLGrD3imZFZ7LmiOKbboglf7guMR6 dQkA== X-Gm-Message-State: ALKqPwdkkanQVzQxIpWVfrK8CL+uBw+PdWR+AbXuuDzTr/0sUmoSZTXo A/IeKXYZ85KKarW5XCiEHX2xlg== X-Google-Smtp-Source: AB8JxZor1IdhBh1gmjb3PUjN6cyq6t3eordDVt9m/0k70DdY6Vmi9KkHthurHEgME5NMUxnNMglomw== X-Received: by 2002:adf:c3d0:: with SMTP id d16-v6mr1586739wrg.68.1526642113654; Fri, 18 May 2018 04:15:13 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id m64-v6sm11651178wmb.12.2018.05.18.04.15.12 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 18 May 2018 04:15:13 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Fri, 18 May 2018 13:15:05 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Cc: Mugunthan V N Subject: [U-Boot] [PATCH v2 2/6] usb: common: add support to get maximum speed from dt X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Mugunthan V N Add support to get maximum speed from dt so that usb drivers makes use of it for DT parsing. Signed-off-by: Mugunthan V N Signed-off-by: Michal Simek (rebase and fix errors) Reviewed-by: Simon Glass --- Changes in v2: None drivers/usb/common/common.c | 29 +++++++++++++++++++++++++++++ include/linux/usb/otg.h | 9 +++++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c index 17a0ab23ff53..a55def5aba67 100644 --- a/drivers/usb/common/common.c +++ b/drivers/usb/common/common.c @@ -9,6 +9,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -37,3 +38,31 @@ enum usb_dr_mode usb_get_dr_mode(int node) return USB_DR_MODE_UNKNOWN; } + +static const char *const speed_names[] = { + [USB_SPEED_UNKNOWN] = "UNKNOWN", + [USB_SPEED_LOW] = "low-speed", + [USB_SPEED_FULL] = "full-speed", + [USB_SPEED_HIGH] = "high-speed", + [USB_SPEED_WIRELESS] = "wireless", + [USB_SPEED_SUPER] = "super-speed", +}; + +enum usb_device_speed usb_get_maximum_speed(int node) +{ + const void *fdt = gd->fdt_blob; + const char *max_speed; + int i; + + max_speed = fdt_getprop(fdt, node, "maximum-speed", NULL); + if (!max_speed) { + pr_err("usb maximum-speed not found\n"); + return USB_SPEED_UNKNOWN; + } + + for (i = 0; i < ARRAY_SIZE(speed_names); i++) + if (!strcmp(max_speed, speed_names[i])) + return i; + + return USB_SPEED_UNKNOWN; +} diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index 0b273d8e2e8a..d2604c5cafba 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h @@ -25,4 +25,13 @@ enum usb_dr_mode { */ enum usb_dr_mode usb_get_dr_mode(int node); +/** + * usb_get_maximum_speed() - Get maximum speed for given device + * @node: Node offset to the given device + * + * The function gets phy interface string from property 'maximum-speed', + * and returns the correspondig enum usb_device_speed + */ +enum usb_device_speed usb_get_maximum_speed(int node); + #endif /* __LINUX_USB_OTG_H */ From patchwork Fri May 18 11:15:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 916212 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="HxhKaap5"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40nQj12W4Yz9rxs for ; Fri, 18 May 2018 21:21:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B4E51C21F3B; Fri, 18 May 2018 11:19:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 7DD96C21FB1; Fri, 18 May 2018 11:15:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 36E31C21F71; Fri, 18 May 2018 11:15:19 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id 84411C21F62 for ; Fri, 18 May 2018 11:15:15 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id a8-v6so13456859wmg.5 for ; Fri, 18 May 2018 04:15:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=g7Kzd4GX4DY1t3mzmPAOwPlItO0AWM6nY9BwJJftdo0=; b=HxhKaap52iCqXWsz1zbe12XIfanAU3BzBCTlAWfjkNjoPpI7mSUDJ9h3uDOWGOkNp5 h1inlW+/VDzLOkG8a7IAtV4YeTDaC+v8dBcO5w89j+2VgWpfRCKmaV752MnyRZgqN8Du mPOun9cZMy+jTJCipLvvzCrz+aS6t+kNIzvZYBuvdwWG6S87Q0L2nZymj4C/FAwDu+4Y B9DVqgRsmpkXeQcfnh8RXJm6JQXDMCYhcuYKptHFGW9PA9GoahHHEKV1yekYo0JUJ8BN pHN6WDOzdDQ9q+ZlNQLl/RUkCkM0NpaEoBJ1rpxHx/QqRJUiz5ni1MwG3+vrgs36ws2S jKIg== 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:in-reply-to:references; bh=g7Kzd4GX4DY1t3mzmPAOwPlItO0AWM6nY9BwJJftdo0=; b=PbOyXQRrNrRvkZuBTcqjWVWXxT/VqEs9sRmeer2mrqI5dgJMiPC5rR5pDReZ8ENLem 3zoSI54Wl1WdkDx4R/5w02La2Auz0tNlhPqOWW5IvJFxgfACLC26yLNDhHiAirdZXpcw NGSPhjV0cquZEPTH1PFfT4tZozWpPdxfP4vl1kERUfrlUxebXuBs97HKy2vGDo4sLm23 zVmCt8vfgPnvhxBCK9RZxZatHSoUM64nZ4maHp6EMuSc8ExZkVrMwuMWYVg2KdrJcFij 1jRqpl+EvCfNy5pYXc0b2aU9LTxk/klAr4+E96z58/sFts0zC9Pemk+xLDkNQHVdVoG7 uFIA== X-Gm-Message-State: ALKqPwemC87kSAiXhn1bQqAVTnA9eUHa1zvVRGwYobw+BVSywsUwozMs +rj/U2ps8Qj8tZhL1qFiKHhnXQ== X-Google-Smtp-Source: AB8JxZrKlRKqKGpnGbs2a7LMnQLQaO6OGYGTYtEGPKihbGw+lzeYKX9+5UKhxMjxpaLmvGHhOYwemA== X-Received: by 2002:a1c:6b57:: with SMTP id g84-v6mr4011875wmc.127.1526642115147; Fri, 18 May 2018 04:15:15 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id b16-v6sm7056469wrm.89.2018.05.18.04.15.14 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 18 May 2018 04:15:14 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Fri, 18 May 2018 13:15:06 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Subject: [U-Boot] [PATCH v2 3/6] usb: dwc3: Add generic DWC3 glue logic driver X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" By enabling BLK by default this is the next driver which needs to get support for DM_USB. Adding generic DWC3 glue logic which only parse nodes and read device mode. Based on it probe proper host/peripheral DWC3 drivers for it. Signed-off-by: Michal Simek --- Changes in v2: - Change style to avoid correct but not nice indentation by using char *driver variable (suggested by Marek) drivers/usb/dwc3/Kconfig | 6 ++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-generic.c | 157 ++++++++++++++++++++++++++++++++ 3 files changed, 164 insertions(+) create mode 100644 drivers/usb/dwc3/dwc3-generic.c diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index ae7fc1c6304d..943b7630eba4 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -37,6 +37,12 @@ config USB_DWC3_OMAP Say 'Y' here if you have one such device +config USB_DWC3_GENERIC + bool "Xilinx ZynqMP and similar Platforms" + depends on DM_USB && USB_DWC3 + help + Some platforms can reuse this DWC3 generic implementation. + config USB_DWC3_UNIPHIER bool "DesignWare USB3 Host Support on UniPhier Platforms" depends on ARCH_UNIPHIER && USB_XHCI_DWC3 diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile index cd18b8d9ec02..60b5515a67da 100644 --- a/drivers/usb/dwc3/Makefile +++ b/drivers/usb/dwc3/Makefile @@ -7,6 +7,7 @@ dwc3-y := core.o obj-$(CONFIG_USB_DWC3_GADGET) += gadget.o ep0.o obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o +obj-$(CONFIG_USB_DWC3_GENERIC) += dwc3-generic.o obj-$(CONFIG_USB_DWC3_UNIPHIER) += dwc3-uniphier.o obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o obj-$(CONFIG_USB_DWC3_PHY_SAMSUNG) += samsung_usb_phy.o diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c new file mode 100644 index 000000000000..ca63eac3d98e --- /dev/null +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -0,0 +1,157 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Generic DWC3 Glue layer + * + * Copyright (C) 2016 - 2018 Xilinx, Inc. + * + * Based on dwc3-omap.c. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "core.h" +#include "gadget.h" +#include "linux-compat.h" + +DECLARE_GLOBAL_DATA_PTR; + +int usb_gadget_handle_interrupts(int index) +{ + struct dwc3 *priv; + struct udevice *dev; + int ret; + + ret = uclass_first_device(UCLASS_USB_DEV_GENERIC, &dev); + if (!dev || ret) { + pr_err("No USB device found\n"); + return -ENODEV; + } + + priv = dev_get_priv(dev); + + dwc3_gadget_uboot_handle_interrupt(priv); + + return 0; +} + +static int dwc3_generic_peripheral_probe(struct udevice *dev) +{ + struct dwc3 *priv = dev_get_priv(dev); + + return dwc3_init(priv); +} + +static int dwc3_generic_peripheral_remove(struct udevice *dev) +{ + struct dwc3 *priv = dev_get_priv(dev); + + dwc3_remove(priv); + + return 0; +} + +static int dwc3_generic_peripheral_ofdata_to_platdata(struct udevice *dev) +{ + struct dwc3 *priv = dev_get_priv(dev); + int node = dev_of_offset(dev); + + priv->regs = (void *)devfdt_get_addr(dev); + priv->regs += DWC3_GLOBALS_REGS_START; + + priv->maximum_speed = usb_get_maximum_speed(node); + if (priv->maximum_speed == USB_SPEED_UNKNOWN) { + pr_err("Invalid usb maximum speed\n"); + return -ENODEV; + } + + priv->dr_mode = usb_get_dr_mode(node); + if (priv->dr_mode == USB_DR_MODE_UNKNOWN) { + pr_err("Invalid usb mode setup\n"); + return -ENODEV; + } + + return 0; +} + +static int dwc3_generic_peripheral_bind(struct udevice *dev) +{ + return device_probe(dev); +} + +U_BOOT_DRIVER(dwc3_generic_peripheral) = { + .name = "dwc3-generic-peripheral", + .id = UCLASS_USB_DEV_GENERIC, + .ofdata_to_platdata = dwc3_generic_peripheral_ofdata_to_platdata, + .probe = dwc3_generic_peripheral_probe, + .remove = dwc3_generic_peripheral_remove, + .bind = dwc3_generic_peripheral_bind, + .platdata_auto_alloc_size = sizeof(struct usb_platdata), + .priv_auto_alloc_size = sizeof(struct dwc3), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; + +static int dwc3_generic_bind(struct udevice *parent) +{ + const void *fdt = gd->fdt_blob; + int node; + int ret; + + for (node = fdt_first_subnode(fdt, dev_of_offset(parent)); node > 0; + node = fdt_next_subnode(fdt, node)) { + const char *name = fdt_get_name(fdt, node, NULL); + enum usb_dr_mode dr_mode; + struct udevice *dev; + const char *driver; + + debug("%s: subnode name: %s\n", __func__, name); + if (strncmp(name, "dwc3@", 4)) + continue; + + dr_mode = usb_get_dr_mode(node); + + switch (dr_mode) { + case USB_DR_MODE_PERIPHERAL: + case USB_DR_MODE_OTG: + debug("%s: dr_mode: OTG or Peripheral\n", __func__); + driver = "dwc3-generic-peripheral"; + break; + case USB_DR_MODE_HOST: + debug("%s: dr_mode: HOST\n", __func__); + driver = "dwc3-generic-host"; + break; + default: + debug("%s: unsupported dr_mode\n", __func__); + return -ENODEV; + }; + + ret = device_bind_driver_to_node(parent, driver, name, + offset_to_ofnode(node), &dev); + if (ret) { + debug("%s: not able to bind usb device mode\n", + __func__); + return ret; + } + } + + return 0; +} + +static const struct udevice_id dwc3_generic_ids[] = { + { .compatible = "xlnx,zynqmp-dwc3" }, + { } +}; + +U_BOOT_DRIVER(dwc3_generic_wrapper) = { + .name = "dwc3-generic-wrapper", + .id = UCLASS_MISC, + .of_match = dwc3_generic_ids, + .bind = dwc3_generic_bind, +}; From patchwork Fri May 18 11:15:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 916209 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="Aos0KTbI"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40nQg94nqHz9s2k for ; Fri, 18 May 2018 21:19:33 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 72607C21F3B; Fri, 18 May 2018 11:19:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id A8644C21FA0; Fri, 18 May 2018 11:15:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1B8B5C21F99; Fri, 18 May 2018 11:15:20 +0000 (UTC) Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by lists.denx.de (Postfix) with ESMTPS id 04A42C21F95 for ; Fri, 18 May 2018 11:15:17 +0000 (UTC) Received: by mail-wm0-f65.google.com with SMTP id f6-v6so13473447wmc.4 for ; Fri, 18 May 2018 04:15:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=wauma+3jClqwCpNiQbRtbWy1gwQoPvXDiTTRFgPhN2Q=; b=Aos0KTbIjofAatAkRrtRiJNWYYGA6YXxbbKR92HbHdoeP0+M3LFplIEy9nNQntecHY sfuSPrDJdTXuWftpK2cfnBeZX76Ua2xTgnUCmk8Ffe3+3/dXeh4hTpHmjU3Dy+J+/Fl5 njuPc4fzm15byptDZlJsfn7vEaq5xvpeZGnMgLacKb2nVeponfiCIGVBHfkUCNcBk+i+ SufZjkqo802WGv0HTp2g+ctwGMBddjsIi110g2eGj5deNDuT6yUtT2HesZxqEmPSv6WN QldFO4pu9evmZ/3qpQZnN32DpHCU+lbi/ngtjOd0m35pscG4HfHEBqWktP92mKnKpc0g F6Gg== 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:in-reply-to:references; bh=wauma+3jClqwCpNiQbRtbWy1gwQoPvXDiTTRFgPhN2Q=; b=VNaJzV8oZIMoBq2BaKuBz29pSUGF+T5KIC7blPlEbPIcU8Cmk2KUlv0NsVUuTnooQ3 FQ4UWydgbOKVSFjJOUYMiwxwmAIMBMvnXv9/taDqRdaFjpNAZ2uUBIsuJMPAgOuZXosS hhXCpXP1DjV2d8ZtvcY3wIM58ho6SkTsKzYhMdwwO8XK6nquKDM2I+P0qg8/zEDtzkLN /N0SsaGdqOXiSQpNeWeTbIp6pmlwXRZ8xltHUlrAQ3dv8egU22pfHxgiTLmoX4Mj1bj7 dtVT+g1FVmukNP6PtnumJuCshH9ngLVZAt6pxWtYJUIAUzrq9y6p59dBYLUAgQLST9AR 7M/w== X-Gm-Message-State: ALKqPwdtTHFgCKJgbiCNPjSnjnpSo46yMQ6FdDfCrg+me+0FHKFyIIRP 7OldnrcKTyELP61B+eQY6QmyD+G/ X-Google-Smtp-Source: AB8JxZouiNb+RGwIBZEfk21rJaDNyJ1ouCXtC2xa329lpA9VYv5ZCnTgTl3f+ygUr3Gm29hUlm+Pvw== X-Received: by 2002:a1c:6952:: with SMTP id e79-v6mr4576916wmc.76.1526642116696; Fri, 18 May 2018 04:15:16 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id x65-v6sm11936085wme.31.2018.05.18.04.15.15 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 18 May 2018 04:15:16 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Fri, 18 May 2018 13:15:07 +0200 Message-Id: <66738f3858015b377d2f36a1c32142766a19b3c0.1526642103.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Subject: [U-Boot] [PATCH v2 4/6] usb: xhci: zynqmp: Add support for DM_USB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The patch is adding support for DM_USB for xhci driver. Signed-off-by: Michal Simek --- Changes in v2: None drivers/usb/host/xhci-zynqmp.c | 69 ++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/drivers/usb/host/xhci-zynqmp.c b/drivers/usb/host/xhci-zynqmp.c index b1ade582aef6..526a42a9a58a 100644 --- a/drivers/usb/host/xhci-zynqmp.c +++ b/drivers/usb/host/xhci-zynqmp.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -54,13 +55,23 @@ #define USBOTGSS_IRQ_SET_1_DMADISABLECLR_EN BIT(17) struct zynqmp_xhci { +#ifdef CONFIG_DM_USB + struct usb_platdata usb_plat; +#endif + struct xhci_ctrl ctrl; struct xhci_hccr *hcd; struct dwc3 *dwc3_reg; }; +#ifdef CONFIG_DM_USB +struct zynqmp_xhci_platdata { + fdt_addr_t hcd_base; +}; +#else static struct zynqmp_xhci zynqmp_xhci; unsigned long ctr_addr[] = CONFIG_ZYNQMP_XHCI_LIST; +#endif static int zynqmp_xhci_core_init(struct zynqmp_xhci *zynqmp_xhci) { @@ -78,6 +89,7 @@ static int zynqmp_xhci_core_init(struct zynqmp_xhci *zynqmp_xhci) return ret; } +#ifndef CONFIG_DM_USB int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor) { struct zynqmp_xhci *ctx = &zynqmp_xhci; @@ -111,6 +123,7 @@ int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor) return ret; } +#endif void xhci_hcd_stop(int index) { @@ -121,3 +134,59 @@ void xhci_hcd_stop(int index) return; } + +#ifdef CONFIG_DM_USB +static int xhci_usb_probe(struct udevice *dev) +{ + struct zynqmp_xhci_platdata *plat = dev_get_platdata(dev); + struct zynqmp_xhci *ctx = dev_get_priv(dev); + struct xhci_hcor *hcor; + int ret; + + ctx->hcd = (struct xhci_hccr *)plat->hcd_base; + ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) + DWC3_REG_OFFSET); + + ret = zynqmp_xhci_core_init(ctx); + if (ret) { + puts("XHCI: failed to initialize controller\n"); + return -EINVAL; + } + + hcor = (struct xhci_hcor *)((ulong)ctx->hcd + + HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase))); + + return xhci_register(dev, ctx->hcd, hcor); +} + +static int xhci_usb_remove(struct udevice *dev) +{ + return xhci_deregister(dev); +} + +static int xhci_usb_ofdata_to_platdata(struct udevice *dev) +{ + struct zynqmp_xhci_platdata *plat = dev_get_platdata(dev); + const void *blob = gd->fdt_blob; + + /* Get the base address for XHCI controller from the device node */ + plat->hcd_base = fdtdec_get_addr(blob, dev_of_offset(dev), "reg"); + if (plat->hcd_base == FDT_ADDR_T_NONE) { + debug("Can't get the XHCI register base address\n"); + return -ENXIO; + } + + return 0; +} + +U_BOOT_DRIVER(dwc3_generic_host) = { + .name = "dwc3-generic-host", + .id = UCLASS_USB, + .ofdata_to_platdata = xhci_usb_ofdata_to_platdata, + .probe = xhci_usb_probe, + .remove = xhci_usb_remove, + .ops = &xhci_usb_ops, + .platdata_auto_alloc_size = sizeof(struct zynqmp_xhci_platdata), + .priv_auto_alloc_size = sizeof(struct zynqmp_xhci), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; +#endif From patchwork Fri May 18 11:15:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 916215 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="HSPYzUqz"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40nQkh4bVtz9rxs for ; Fri, 18 May 2018 21:22:36 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6E4ECC21F9E; Fri, 18 May 2018 11:20:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0E1C3C21F4E; Fri, 18 May 2018 11:15:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6590DC21FC9; Fri, 18 May 2018 11:15:29 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by lists.denx.de (Postfix) with ESMTPS id A542FC21EBB for ; Fri, 18 May 2018 11:15:18 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id x9-v6so5936498wrl.13 for ; Fri, 18 May 2018 04:15:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=M2JmBYajxSUeTyKrqfBwLsdtBXJa2a3EC9eZd9X167M=; b=HSPYzUqz4R2rx7PXzlQVIfBfRqx5Rbp3szbqvfrvQqSTzfUaiEJ0ufH+ksqbde/gOo sSPWac3Jhq0ohyk3KQr764OPtwoAgTfK/62mYpSGdq+V6JkgaUjHnia32JoTvMMcMr/B wJaFGtGX1Y1PUDDlE2L/v1RB+r+XM+P96ShjZ8GWQAQ493ALYyXEUdxXEvNg23cHfRjd ZxvAAOTY5McxwvxXiWrZt6w/zgDJ1p5AeFn52/xVU34IWnl4hdUq3Klrrw0mX7rYwq6u L9pk2fSRhXjKI011mQPHZW5viOIIFiSKB+017wzH2BfHlpSUoJpXjEf2Tm2gs11rSjfZ cABw== 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:in-reply-to:references; bh=M2JmBYajxSUeTyKrqfBwLsdtBXJa2a3EC9eZd9X167M=; b=kv1KMLe8l8Eq7SscN4va8GTLiAAZkGAujHv/jSyjBhzyAgwy4yDEgCxAGW2H+5YlWU CBziUdBDZF7RUc+giRseqmORBjmC5hzB1JHWvKePMgxZHsG6ChJvR4cu+gxf4fFL0W+I aYzLV/9T0J6Uqgr1rWhJfKHuo3yUyvVlEEXqro56jrWYIylmeKu0tvDlMhR+H8rbVjFN wsDiFqbfHoXRcJgo2Qd7fZwbL/dR+MB70km7/KAwNemoKBWL3vGp0cNr32JtDxcRCXRE BmpnpkkBzPST+85SWRrJzurG92Q36pAUaASVYrKtQpUjZGPQjeXyQyNyuYSJDXabFxUc SVgg== X-Gm-Message-State: ALKqPweVwZ56nfJLAdFjxpoLCr/zMen6Ndm+e3do5SaQKekmXgvlUSNy njV7/fJ0LQwxk5RYmzRBA+gROmKW X-Google-Smtp-Source: AB8JxZp8Ra1w/qQuztVs1oWbe000DAjPsrvNWOPNbvoGRgNBBS9uLDLPbOpW9OczPX6Y6W+gdLek0w== X-Received: by 2002:adf:9003:: with SMTP id h3-v6mr6745644wrh.188.1526642118251; Fri, 18 May 2018 04:15:18 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id 19-v6sm8027811wrz.7.2018.05.18.04.15.17 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 18 May 2018 04:15:17 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Fri, 18 May 2018 13:15:08 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Subject: [U-Boot] [PATCH v2 5/6] arm64: zynqmp: Use DWC3 generic driver and DM_USB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Remove harcoded XHCI lists and detect mode, speed based on DT. Signed-off-by: Michal Simek Serial-changes: 2 - Remove also XHCI macros from hardware.h - Remove additional new line in zcu106 --- Changes in v2: None arch/arm/include/asm/arch-zynqmp/hardware.h | 3 -- board/xilinx/zynqmp/zynqmp.c | 46 ------------------- .../xilinx_zynqmp_zc1751_xm015_dc1_defconfig | 1 + .../xilinx_zynqmp_zc1751_xm016_dc2_defconfig | 1 + .../xilinx_zynqmp_zc1751_xm017_dc3_defconfig | 1 + configs/xilinx_zynqmp_zcu100_revC_defconfig | 1 + configs/xilinx_zynqmp_zcu102_rev1_0_defconfig | 1 + configs/xilinx_zynqmp_zcu102_revA_defconfig | 1 + configs/xilinx_zynqmp_zcu102_revB_defconfig | 1 + configs/xilinx_zynqmp_zcu104_revA_defconfig | 1 + configs/xilinx_zynqmp_zcu104_revC_defconfig | 1 + configs/xilinx_zynqmp_zcu106_revA_defconfig | 1 + configs/xilinx_zynqmp_zcu111_revA_defconfig | 1 + .../configs/xilinx_zynqmp_zc1751_xm015_dc1.h | 1 - .../configs/xilinx_zynqmp_zc1751_xm016_dc2.h | 2 - .../configs/xilinx_zynqmp_zc1751_xm017_dc3.h | 3 -- include/configs/xilinx_zynqmp_zcu100.h | 3 -- include/configs/xilinx_zynqmp_zcu102.h | 2 - include/configs/xilinx_zynqmp_zcu104.h | 2 - include/configs/xilinx_zynqmp_zcu106.h | 2 - include/configs/xilinx_zynqmp_zcu111.h | 2 - 21 files changed, 11 insertions(+), 66 deletions(-) diff --git a/arch/arm/include/asm/arch-zynqmp/hardware.h b/arch/arm/include/asm/arch-zynqmp/hardware.h index dfd6097b4beb..acc68251be94 100644 --- a/arch/arm/include/asm/arch-zynqmp/hardware.h +++ b/arch/arm/include/asm/arch-zynqmp/hardware.h @@ -17,9 +17,6 @@ #define ARASAN_NAND_BASEADDR 0xFF100000 -#define ZYNQMP_USB0_XHCI_BASEADDR 0xFE200000 -#define ZYNQMP_USB1_XHCI_BASEADDR 0xFE300000 - #define ZYNQMP_TCM_BASE_ADDR 0xFFE00000 #define ZYNQMP_TCM_SIZE 0x40000 diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 57c0d93aa1bc..e41fec32df31 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -548,49 +548,3 @@ int checkboard(void) puts("Board: Xilinx ZynqMP\n"); return 0; } - -#ifdef CONFIG_USB_DWC3 -static struct dwc3_device dwc3_device_data0 = { - .maximum_speed = USB_SPEED_HIGH, - .base = ZYNQMP_USB0_XHCI_BASEADDR, - .dr_mode = USB_DR_MODE_PERIPHERAL, - .index = 0, -}; - -static struct dwc3_device dwc3_device_data1 = { - .maximum_speed = USB_SPEED_HIGH, - .base = ZYNQMP_USB1_XHCI_BASEADDR, - .dr_mode = USB_DR_MODE_PERIPHERAL, - .index = 1, -}; - -int usb_gadget_handle_interrupts(int index) -{ - dwc3_uboot_handle_interrupt(index); - return 0; -} - -int board_usb_init(int index, enum usb_init_type init) -{ - debug("%s: index %x\n", __func__, index); - -#if defined(CONFIG_USB_GADGET_DOWNLOAD) - g_dnl_set_serialnumber(CONFIG_SYS_CONFIG_NAME); -#endif - - switch (index) { - case 0: - return dwc3_uboot_init(&dwc3_device_data0); - case 1: - return dwc3_uboot_init(&dwc3_device_data1); - }; - - return -1; -} - -int board_usb_cleanup(int index, enum usb_init_type init) -{ - dwc3_uboot_exit(index); - return 0; -} -#endif diff --git a/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig b/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig index 3aa39306520f..f5a33342fa64 100644 --- a/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig +++ b/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig @@ -83,6 +83,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig b/configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig index 1bd52ab79124..7f7ee558ee7e 100644 --- a/configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig +++ b/configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig @@ -79,6 +79,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig b/configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig index e1e7d22a3a62..2add3bafe278 100644 --- a/configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig +++ b/configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig @@ -75,6 +75,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu100_revC_defconfig b/configs/xilinx_zynqmp_zcu100_revC_defconfig index 3dd6ae9a0b3b..2a6a5a69cdfe 100644 --- a/configs/xilinx_zynqmp_zcu100_revC_defconfig +++ b/configs/xilinx_zynqmp_zcu100_revC_defconfig @@ -73,6 +73,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig b/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig index 0ddec9986697..4cb3959f3626 100644 --- a/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig +++ b/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig @@ -93,6 +93,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu102_revA_defconfig b/configs/xilinx_zynqmp_zcu102_revA_defconfig index 94dc62a61643..e989d1635c30 100644 --- a/configs/xilinx_zynqmp_zcu102_revA_defconfig +++ b/configs/xilinx_zynqmp_zcu102_revA_defconfig @@ -91,6 +91,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu102_revB_defconfig b/configs/xilinx_zynqmp_zcu102_revB_defconfig index 8889f1909ac0..bd67df904a2d 100644 --- a/configs/xilinx_zynqmp_zcu102_revB_defconfig +++ b/configs/xilinx_zynqmp_zcu102_revB_defconfig @@ -91,6 +91,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu104_revA_defconfig b/configs/xilinx_zynqmp_zcu104_revA_defconfig index 3d3d941d375c..a76b9cf54622 100644 --- a/configs/xilinx_zynqmp_zcu104_revA_defconfig +++ b/configs/xilinx_zynqmp_zcu104_revA_defconfig @@ -84,6 +84,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu104_revC_defconfig b/configs/xilinx_zynqmp_zcu104_revC_defconfig index 7c22d7f020ed..dcd4897f2fbd 100644 --- a/configs/xilinx_zynqmp_zcu104_revC_defconfig +++ b/configs/xilinx_zynqmp_zcu104_revC_defconfig @@ -84,6 +84,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu106_revA_defconfig b/configs/xilinx_zynqmp_zcu106_revA_defconfig index 017940e98361..a5fa33e366ae 100644 --- a/configs/xilinx_zynqmp_zcu106_revA_defconfig +++ b/configs/xilinx_zynqmp_zcu106_revA_defconfig @@ -90,6 +90,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/configs/xilinx_zynqmp_zcu111_revA_defconfig b/configs/xilinx_zynqmp_zcu111_revA_defconfig index 028a7b532844..4d9b91563523 100644 --- a/configs/xilinx_zynqmp_zcu111_revA_defconfig +++ b/configs/xilinx_zynqmp_zcu111_revA_defconfig @@ -84,6 +84,7 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_XHCI_ZYNQMP=y CONFIG_USB_DWC3=y CONFIG_USB_DWC3_GADGET=y +CONFIG_USB_DWC3_GENERIC=y CONFIG_USB_ULPI_VIEWPORT=y CONFIG_USB_ULPI=y CONFIG_USB_STORAGE=y diff --git a/include/configs/xilinx_zynqmp_zc1751_xm015_dc1.h b/include/configs/xilinx_zynqmp_zc1751_xm015_dc1.h index 852c2238de4a..f0ab3f159222 100644 --- a/include/configs/xilinx_zynqmp_zc1751_xm015_dc1.h +++ b/include/configs/xilinx_zynqmp_zc1751_xm015_dc1.h @@ -11,7 +11,6 @@ #define CONFIG_ZYNQ_SDHCI0 #define CONFIG_ZYNQ_SDHCI1 -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR} #include diff --git a/include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h b/include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h index 2533ab860906..bfebbb3cd197 100644 --- a/include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h +++ b/include/configs/xilinx_zynqmp_zc1751_xm016_dc2.h @@ -9,8 +9,6 @@ #ifndef __CONFIG_ZYNQMP_ZC1751_XM016_DC2_H #define __CONFIG_ZYNQMP_ZC1751_XM016_DC2_H -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB1_XHCI_BASEADDR} - #include #endif /* __CONFIG_ZYNQMP_ZC1751_XM016_DC2_H */ diff --git a/include/configs/xilinx_zynqmp_zc1751_xm017_dc3.h b/include/configs/xilinx_zynqmp_zc1751_xm017_dc3.h index f7d4ab2800c9..bd4a0c3178b8 100644 --- a/include/configs/xilinx_zynqmp_zc1751_xm017_dc3.h +++ b/include/configs/xilinx_zynqmp_zc1751_xm017_dc3.h @@ -11,9 +11,6 @@ #define CONFIG_ZYNQ_SDHCI1 -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \ - ZYNQMP_USB1_XHCI_BASEADDR} - #include #endif /* __CONFIG_ZYNQMP_ZC1751_XM017_DC3_H */ diff --git a/include/configs/xilinx_zynqmp_zcu100.h b/include/configs/xilinx_zynqmp_zcu100.h index 029347da479c..b65d0c1cddd2 100644 --- a/include/configs/xilinx_zynqmp_zcu100.h +++ b/include/configs/xilinx_zynqmp_zcu100.h @@ -24,9 +24,6 @@ {0, {{I2C_MUX_PCA9548, 0x75, 7} } }, \ } -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR, \ - ZYNQMP_USB1_XHCI_BASEADDR} - #define CONFIG_USB_HOST_ETHER #define CONFIG_USB_ETHER_ASIX diff --git a/include/configs/xilinx_zynqmp_zcu102.h b/include/configs/xilinx_zynqmp_zcu102.h index c61e1b5e27c2..ca11b97c7c4c 100644 --- a/include/configs/xilinx_zynqmp_zcu102.h +++ b/include/configs/xilinx_zynqmp_zcu102.h @@ -35,8 +35,6 @@ #define CONFIG_PCA953X -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR} - #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 #define CONFIG_ZYNQ_EEPROM_BUS 5 #define CONFIG_ZYNQ_GEM_EEPROM_ADDR 0x54 diff --git a/include/configs/xilinx_zynqmp_zcu104.h b/include/configs/xilinx_zynqmp_zcu104.h index 8d417f45e014..7e3b9ad7058b 100644 --- a/include/configs/xilinx_zynqmp_zcu104.h +++ b/include/configs/xilinx_zynqmp_zcu104.h @@ -26,8 +26,6 @@ #define CONFIG_PCA953X -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR} - #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 #include diff --git a/include/configs/xilinx_zynqmp_zcu106.h b/include/configs/xilinx_zynqmp_zcu106.h index 01ac12a53c17..cc2d145ddd94 100644 --- a/include/configs/xilinx_zynqmp_zcu106.h +++ b/include/configs/xilinx_zynqmp_zcu106.h @@ -35,8 +35,6 @@ #define CONFIG_PCA953X -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR} - #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 #define CONFIG_ZYNQ_EEPROM_BUS 5 #define CONFIG_ZYNQ_GEM_EEPROM_ADDR 0x54 diff --git a/include/configs/xilinx_zynqmp_zcu111.h b/include/configs/xilinx_zynqmp_zcu111.h index 3233b379798d..8f8cb4f08707 100644 --- a/include/configs/xilinx_zynqmp_zcu111.h +++ b/include/configs/xilinx_zynqmp_zcu111.h @@ -38,8 +38,6 @@ #define CONFIG_PCA953X -#define CONFIG_ZYNQMP_XHCI_LIST {ZYNQMP_USB0_XHCI_BASEADDR} - #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 #define CONFIG_ZYNQ_EEPROM_BUS 5 #define CONFIG_ZYNQ_GEM_EEPROM_ADDR 0x54 From patchwork Fri May 18 11:15:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 916213 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="OzwVlsiW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40nQjs0gsrz9rxs for ; Fri, 18 May 2018 21:21:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D2EB7C21F64; Fri, 18 May 2018 11:20:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id BAE2AC21EC3; Fri, 18 May 2018 11:15:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C4D10C21FA3; Fri, 18 May 2018 11:15:33 +0000 (UTC) Received: from mail-wr0-f196.google.com (mail-wr0-f196.google.com [209.85.128.196]) by lists.denx.de (Postfix) with ESMTPS id 09A4DC21EC3 for ; Fri, 18 May 2018 11:15:20 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id x9-v6so5936579wrl.13 for ; Fri, 18 May 2018 04:15:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=kL/GPbE7sX6tq+fAykU0nYxHX79UO5k/eBZ3LFnsNTA=; b=OzwVlsiWcCR+hNKrGSQ8nvl3I6c7QJIWVlCRQwfhNU8k13fZVycrxL+ETcbSHSpPz7 PHQtagHpcmi6edjyVJu0Mx5nt5zIFYhv19REZvqwWDGBQI9DklGkvGy3G1v0c6l5D/6j W1RKQkHZHqy6aejNqao3j+zJhZrsjL7hP0Lr76++Rlan8rt5JqGDSWubvqMGm7O6sGJ8 EXh36H/kIztb7sXsquGJ7LDB4q17LL7k4fkoAEipmT+F21mJbNyYI+U7DI6NWHY0HgO2 07mDBKRpQIFY0rh/tiDiLQj4KVkmb0D+O0lGlsX08CLgS47r3kQw4kV0/RDziTMjfsXU X8Ag== 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:in-reply-to:references; bh=kL/GPbE7sX6tq+fAykU0nYxHX79UO5k/eBZ3LFnsNTA=; b=tBJ8T/K+ghFnpnsa24RCz8AIB6knPDzC/++v6SWmxh6nfIHtEWmbrupzFOteIuobhr AigqmnTVqFordAOjWi4pk5+QjBLjPy9U9tEK/4Fngf3dhoJEH0rlFkEwabsJ9ihxJfn0 HDMErr3Dtre9EpX3WNYyplSgyPyXHoB4xl0VqEL+hHZ/aIOKzcJlK3atylPy2pqEVwdw etprsR+PL371vSkxBFhuf5tDT2SqWv3N53/w9QwJrdkTetlYokTGq9rZAM6mPk/yWXTu sGtak7LA01bWx63Bldoi7Pqzk3dQY7n5vILzLK5sQrWg0t56mdTXLCU9HraoFtur8WV7 yPoQ== X-Gm-Message-State: ALKqPwe/+Yrc49NrcPNi9ydCABjwZ5tuWH6cJw14Po8pWAMLs9SFHwno whYS2r3N0bD2n/63Oy8ni+EkDg== X-Google-Smtp-Source: AB8JxZq8yPgeBp3wNcysrUkTQc1RLxJKugQfkYQpjeSiF1NO/tgxJ4hgnUQC05mf+ywZdbenWwJD9g== X-Received: by 2002:adf:8124:: with SMTP id 33-v6mr6296567wrm.109.1526642119742; Fri, 18 May 2018 04:15:19 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id m17-v6sm6812394wrh.3.2018.05.18.04.15.18 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 18 May 2018 04:15:19 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Fri, 18 May 2018 13:15:09 +0200 Message-Id: <63a670e66ceeccbc19a8d3e96aef5a56b7b9ee53.1526642103.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Cc: Alexey Brodkin , Ran Wang , Chris Packham Subject: [U-Boot] [PATCH v2 6/6] usb: xhci: zynqmp: Remove support for !DM_USB X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Switch to DM_USB was done and there is no need to keep !DM_USB code in tree. Signed-off-by: Michal Simek Reviewed-by: Simon Glass --- Changes in v2: None drivers/usb/host/Kconfig | 1 + drivers/usb/host/xhci-zynqmp.c | 46 ---------------------------------- scripts/config_whitelist.txt | 1 - 3 files changed, 1 insertion(+), 47 deletions(-) diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 3455e8113bb8..b4dd005651cf 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -75,6 +75,7 @@ config USB_XHCI_STI config USB_XHCI_ZYNQMP bool "Support for Xilinx ZynqMP on-chip xHCI USB controller" depends on ARCH_ZYNQMP + depends on DM_USB help Enables support for the on-chip xHCI controller on Xilinx ZynqMP SoCs. diff --git a/drivers/usb/host/xhci-zynqmp.c b/drivers/usb/host/xhci-zynqmp.c index 526a42a9a58a..e44e1ae1d915 100644 --- a/drivers/usb/host/xhci-zynqmp.c +++ b/drivers/usb/host/xhci-zynqmp.c @@ -55,23 +55,15 @@ #define USBOTGSS_IRQ_SET_1_DMADISABLECLR_EN BIT(17) struct zynqmp_xhci { -#ifdef CONFIG_DM_USB struct usb_platdata usb_plat; -#endif struct xhci_ctrl ctrl; struct xhci_hccr *hcd; struct dwc3 *dwc3_reg; }; -#ifdef CONFIG_DM_USB struct zynqmp_xhci_platdata { fdt_addr_t hcd_base; }; -#else -static struct zynqmp_xhci zynqmp_xhci; - -unsigned long ctr_addr[] = CONFIG_ZYNQMP_XHCI_LIST; -#endif static int zynqmp_xhci_core_init(struct zynqmp_xhci *zynqmp_xhci) { @@ -89,42 +81,6 @@ static int zynqmp_xhci_core_init(struct zynqmp_xhci *zynqmp_xhci) return ret; } -#ifndef CONFIG_DM_USB -int xhci_hcd_init(int index, struct xhci_hccr **hccr, struct xhci_hcor **hcor) -{ - struct zynqmp_xhci *ctx = &zynqmp_xhci; - int ret = 0; - uint32_t hclen; - - if (index < 0 || index >= ARRAY_SIZE(ctr_addr)) - return -EINVAL; - - ctx->hcd = (struct xhci_hccr *)ctr_addr[index]; - ctx->dwc3_reg = (struct dwc3 *)((void *)ctx->hcd + DWC3_REG_OFFSET); - - ret = board_usb_init(index, USB_INIT_HOST); - if (ret != 0) { - puts("Failed to initialize board for USB\n"); - return ret; - } - - ret = zynqmp_xhci_core_init(ctx); - if (ret < 0) { - puts("Failed to initialize xhci\n"); - return ret; - } - - *hccr = (struct xhci_hccr *)ctx->hcd; - hclen = HC_LENGTH(xhci_readl(&(*hccr)->cr_capbase)); - *hcor = (struct xhci_hcor *)((uintptr_t) *hccr + hclen); - - debug("zynqmp-xhci: init hccr %p and hcor %p hc_length %d\n", - *hccr, *hcor, hclen); - - return ret; -} -#endif - void xhci_hcd_stop(int index) { /* @@ -135,7 +91,6 @@ void xhci_hcd_stop(int index) return; } -#ifdef CONFIG_DM_USB static int xhci_usb_probe(struct udevice *dev) { struct zynqmp_xhci_platdata *plat = dev_get_platdata(dev); @@ -189,4 +144,3 @@ U_BOOT_DRIVER(dwc3_generic_host) = { .priv_auto_alloc_size = sizeof(struct zynqmp_xhci), .flags = DM_FLAG_ALLOC_PRIV_DMA, }; -#endif diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 71df6dbebde6..bfbdfcfc80ac 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -4782,7 +4782,6 @@ CONFIG_ZLIB CONFIG_ZLT CONFIG_ZM7300 CONFIG_ZYNQMP_EEPROM -CONFIG_ZYNQMP_XHCI_LIST CONFIG_ZYNQ_EEPROM CONFIG_ZYNQ_EEPROM_BUS CONFIG_ZYNQ_GEM_EEPROM_ADDR