From patchwork Wed May 16 14:26: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: 914660 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="ueO4XcWP"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mGwJ11VDz9s4r for ; Thu, 17 May 2018 00:26:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 53B04C21EFF; Wed, 16 May 2018 14:26:53 +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 E0291C21F13; Wed, 16 May 2018 14:26:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 16A01C21D4A; Wed, 16 May 2018 14:26:13 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id B5519C21C57 for ; Wed, 16 May 2018 14:26:12 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id j4-v6so2143215wme.1 for ; Wed, 16 May 2018 07:26: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=CL0yeFv3glE9JP5LORzH6YO9VSKYCPMSBOrGCyUw9j4=; b=ueO4XcWPgF69WCtuI59Hx+/L16koqnski9jju+I040Au3bI8b/Fe4nfQfGSCPnta+A 8qnCcKw/rgrYcBP215ctaNZWJBrxQaoeWGZIMLZTw0UzMjFdr+NgOf+dKMT/io4N/HWY tNlZvqs+7El9DXNVTM3gaekDn9L906ODXLKB16wUl77+1DjrFw3Hw+QEoeL/kQ/MMIrR SYBMzTg5suJ8ThfGUfIXY6gm9RSmNtg261zMWup605O3t6XsrGIFMd+R5PWmzGKc0D6A iyVNmsh0XEsmpVmE7ZKUryEue9/QFp23pPixTGHTgPieSqMk5Lb4xfoZfuFAgG7sFEll /uLg== 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=CL0yeFv3glE9JP5LORzH6YO9VSKYCPMSBOrGCyUw9j4=; b=t2mNoH2bIGg3PU0yYWvLz9dFPNAW2bL1FCoO5BnJyLk91J3wJR+e/4q39Bw7Se+JtV MkdhJGmzixsE7NZYqVUZmJtjGBcXj7Ng9NJwFPdspXUIid/vsnJ/qiSpo4G9C7cDwT3C bK/Ydk0KE2Y6R7cHGlJxRAz+UE84P/umjZRBSjFe9n6ToRRZVgGpUiNI8vVAtrgZHz4q Pj16aG0x7jhwonXVbZN7OIp3ks8ENX84NE7nElHmZZjmbU9WX9lt5iK1tw37fCZAyfYy YZMQmX7ALoz3aMQZGZ5G2S4tK/maIMazezi/eLJ8xi37kTNRHs4JFjYgn8nhAYgk9SEK V39Q== X-Gm-Message-State: ALKqPwdZH6I2iTRddWn3d9llmHbu1iRXL9hrvdeQTTocFBPIokaeB2zG mxXGdyDIrd1RXR7hPRpBN04a8w== X-Google-Smtp-Source: AB8JxZoWKcPhmFQS8iljPMGFKJ99bsmYk7RxlhDZZr3QE0mGdgI1J5akeY4pHirEUpNcZuOLWxwUAw== X-Received: by 2002:a1c:3653:: with SMTP id d80-v6mr869351wma.3.1526480772375; Wed, 16 May 2018 07:26:12 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id g127-v6sm2779977wmf.42.2018.05.16.07.26.11 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 07:26:11 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Wed, 16 May 2018 16:26:04 +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 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 --- Origin series here: https://patchwork.ozlabs.org/patch/775108/ - Fix labels as was asked in previous review. --- drivers/usb/dwc3/core.c | 57 +++++++++++++++++++++++++++++++++++++++++ drivers/usb/dwc3/core.h | 6 +++++ 2 files changed, 63 insertions(+) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index dbdad22d1134..e533325dda07 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -602,6 +602,8 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc) #define DWC3_ALIGN_MASK (16 - 1) +#ifndef CONFIG_DM_USB + /** * dwc3_uboot_init - dwc3 core uboot initialization code * @dwc3_dev: struct dwc3_device containing initialization data @@ -788,3 +790,58 @@ MODULE_ALIAS("platform:dwc3"); MODULE_AUTHOR("Felipe Balbi "); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver"); + +#else + +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..ad16c9b7c46c 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -712,7 +712,11 @@ struct dwc3 { /* device lock */ spinlock_t lock; +#ifndef CONFIG_DM_USB struct device *dev; +#else + struct udevice *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); From patchwork Wed May 16 14:26: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: 914662 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="1pcHmsvV"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mGwz1dXlz9s2L for ; Thu, 17 May 2018 00:27:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AEDE0C21E85; Wed, 16 May 2018 14:27:20 +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 9F9D9C21F34; Wed, 16 May 2018 14:26:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D4406C21F1F; Wed, 16 May 2018 14:26:19 +0000 (UTC) Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by lists.denx.de (Postfix) with ESMTPS id 1E634C21E85 for ; Wed, 16 May 2018 14:26:14 +0000 (UTC) Received: by mail-wr0-f193.google.com with SMTP id p18-v6so1538394wrm.1 for ; Wed, 16 May 2018 07:26:14 -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=QI/8mpYYyTQODyLbKY04ma69jojvLso84TIkVspB3+U=; b=1pcHmsvVZENHN8kpQhHdHa1RSDUlPzrS+Zu1EL1NaDfp+tKpIIXlOIkTZQVBZOsBH/ anSKl8YqM8gvsHZOTYAZcecAFQopUn/U8LLlFnFBYNqeh60lwj9eKeRRWsuEzonQ2KhZ cuL/OG8ET21S5Y39v7njbBQbaxnEkU1h0IwmzKU5lfuqtSwdEBr8zDVcBhnram8ead4w +Ir7Nlfo4xJzqbA4xwGwylEL9QI9zHAeXUzHgOwHHuQxOvy+Oo5pjUB+wQKlwatRMmZO AKew35Ezn32WVDhZcqg31YJJHXpMfH0z6HL3Rqtx6ZCC5PgOfrKBsyyM/eVIXhY9/9/P yBbw== 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=QI/8mpYYyTQODyLbKY04ma69jojvLso84TIkVspB3+U=; b=p07K6i+bPziuyYrQU66fGTjy9pPzhfy9NlNKCDbPzSwIZvZuEmNHncNuyQvBRjc6+0 baR7WTjXd4xFcPIvcZRNLFk4O2gkgsyY5DX+1YYOby6bKqAyiepm9m26/yDFuK2wn7vf yRY1SWs6PV/yxYAuqmUd41Nz19SFJ7unAhZ89t9tCpgFwBHXOmyXIFBznwmAgOs27TfU kjTy/3FgCF3ZnmxTGerP6EaY64RAaGbOHmXWZIx1R59d5rsXG1awrm2uh0pKSrnwZQ4J SRcOr4XEKvuOu5an+l3ydZugAJmATCXXvIRrNSvorqXtNtB9xXT+wI8KZUR50w5Yhge2 mWpQ== X-Gm-Message-State: ALKqPwfMVMyf5DWuvp/ttMVlX/leWvqa/kpjvVaYoPh9NJBFRxneSjXu TZb4H6brYDc08+s6k5bHuDwraA== X-Google-Smtp-Source: AB8JxZo3dgA/Tf5L1b0AqNyIkubwuD4AALqsjcto3TpSSlnP73hVZH0GsWpCzazJ4eArj5TB5cIzCg== X-Received: by 2002:adf:9b1a:: with SMTP id b26-v6mr1089324wrc.206.1526480773844; Wed, 16 May 2018 07:26:13 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id p10-v6sm3323904wre.77.2018.05.16.07.26.13 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 07:26:13 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Wed, 16 May 2018 16:26: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 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 --- 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 Wed May 16 14:26: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: 914663 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="iKGflTy5"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mGxf56pjz9s3X for ; Thu, 17 May 2018 00:28:06 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 577BEC21F1C; Wed, 16 May 2018 14:27:46 +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 4BA12C21F0B; Wed, 16 May 2018 14:26:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 32EA6C21F00; Wed, 16 May 2018 14:26:23 +0000 (UTC) Received: from mail-wr0-f194.google.com (mail-wr0-f194.google.com [209.85.128.194]) by lists.denx.de (Postfix) with ESMTPS id B57B4C21F00 for ; Wed, 16 May 2018 14:26:15 +0000 (UTC) Received: by mail-wr0-f194.google.com with SMTP id y15-v6so1506456wrg.11 for ; Wed, 16 May 2018 07:26: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=r5TsVf75tRc3lF6B68LLGXFeXa6kkhqauSnpMDDDuy0=; b=iKGflTy5C+DedGywIKEonDOoavxPZ38lpvgRe2vGThO0ID5wjUa2jkTipFPrFxqKCO TRQyze33vWRGjHg/ZKRrLIRnDvrqtpiX0RGY8hMljrkP58pe0ZSE6AQJP5vb+b5NuQcT 3UDDfEnZY+RmNR+SQ1LkuYuYFSh/KTN0gCXVXkIDL8f7D8soq9NnKaUMX6suMr1t57iY Hbh7Hp0kS9qLYypYXo2l+8+zImcRVfz/viEGddVL5EosiqW+fjo55NaWIuqybluINgfJ NrUEnr3ZkBhkThAhJN09N2XWWRpD2SQXSW379FrVlP/Mh367c7kyzwOgf4ll5hOSx2Zw MWDw== 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=r5TsVf75tRc3lF6B68LLGXFeXa6kkhqauSnpMDDDuy0=; b=WQtyMiAPgGdWgMGHJTI2UmExF6Wfyw5rqDdBy5W50g0muzjbk8PcApYx2MKXh5NETV OdvQLoufzSXGeGD3Oy8S8U0rNDHmuFo3GUL2UOSbBIYrL7jqPzw94c53t5cuMUd27zPF zOTC74rHpYiddvOX3+GatOLkmXM6kJbJD+G1Q24Wm3ijlvfxQiVTOSGfoD/qO/8pxMMq 1zlASTQ2Hz95kWrSJC+zmSI6p0qaKYHInDURFIF21/7Q5g8JK95nJTlLJAVOqemf62rz Er6cu0jKQkbb+8LXK62RWqPINLs8rcaxtG5XmcOf3QC2v5b7i8v4lPLNknA8qD2WgvaW 54NA== X-Gm-Message-State: ALKqPwejdW8nnheyebsJJ7S+eS+/UNzTCODE+doTOHntI2t4I+6mexG7 x4+YbGANzH5U9PdZ1oF71f9wRA== X-Google-Smtp-Source: AB8JxZoPlzN1pOo9prXdvj3VOdOuIP57xqpjVYd5JTNllWxIvszU37ImJkjDJJg5gURqY+GLccR7qw== X-Received: by 2002:adf:b807:: with SMTP id h7-v6mr1013649wrf.113.1526480775376; Wed, 16 May 2018 07:26:15 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id d125-v6sm2878758wmd.24.2018.05.16.07.26.14 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 07:26:14 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Wed, 16 May 2018 16:26:06 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Subject: [U-Boot] [PATCH 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 --- drivers/usb/dwc3/Kconfig | 6 ++ drivers/usb/dwc3/Makefile | 1 + drivers/usb/dwc3/dwc3-generic.c | 165 ++++++++++++++++++++++++++++++++ 3 files changed, 172 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..7dd2555c2042 --- /dev/null +++ b/drivers/usb/dwc3/dwc3-generic.c @@ -0,0 +1,165 @@ +// 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; + + 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__); + ret = device_bind_driver_to_node(parent, + "dwc3-generic-peripheral", + name, + offset_to_ofnode(node), + &dev); + if (ret) { + debug("%s: not able to bind usb device mode\n", + __func__); + return ret; + } + break; + case USB_DR_MODE_HOST: + debug("%s: dr_mode: HOST\n", __func__); + ret = device_bind_driver_to_node(parent, + "dwc3-generic-host", + name, + offset_to_ofnode(node), + &dev); + if (ret) { + debug("%s: not able to bind usb host mode\n", + __func__); + return ret; + } + break; + default: + break; + }; + } + + 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 Wed May 16 14:26: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: 914665 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="lIgKpio7"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mGyd0wq1z9s3B for ; Thu, 17 May 2018 00:28:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BCF26C21F32; Wed, 16 May 2018 14:28: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_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 1AA1FC21D83; Wed, 16 May 2018 14:26:28 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C50D7C21F52; Wed, 16 May 2018 14:26:24 +0000 (UTC) Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by lists.denx.de (Postfix) with ESMTPS id 71F08C21F2A for ; Wed, 16 May 2018 14:26:17 +0000 (UTC) Received: by mail-wm0-f67.google.com with SMTP id t11-v6so2157744wmt.0 for ; Wed, 16 May 2018 07:26: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=tVYpXXHfZz5wKtoBknDgMGEist0ws9Hxt4tbrfQxumM=; b=lIgKpio7MKTPNewLvkUbf11K5onEqggMQPW7ZsZSTDQ+ar4evH5PoFQlXjAGdTNJT6 ZBBPnEc1f/5HQpzlERCQ64Mzqq7iuhquldJ61ZrnzgQ7yAARpEXQhSB7BGO9ptjgI11L frgUP5NiU4Q/9UdJTsTklkrHA7DrTQZ5S6nD36P1ASmvObdLYhqs0o9JV7L0co6747WB EClQJZLOJegPYpx3b0kmpd2XnQJzndEZWPcv3ayuMhPtX7KybGfxIu9NDNy8zmn8mQQ8 K6WvyYWN0dd237eJookp1opvaIiAsjL9XdpU7ZGXjPlzhNG/W31Ki8/nXmgBjZfP+Jw9 YXGA== 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=tVYpXXHfZz5wKtoBknDgMGEist0ws9Hxt4tbrfQxumM=; b=KXl5TqUXE3sxxOrGyF+tLRBTwmxXM3i4qJOUJs6l4Es6oPAiFwGBgf0U5jGoJqXV/v GxXHyFj/wQaiEiAaxHE56jLbdn4YkuCGEaBpWwoSEUwaOwnMygEEjf0TxPG2DsDTdgZq yBDQF1sPxj9g+Jasw5YJ+rWOt29Ch4UrNFSbXpLqJsOi77V4iFXZFgW5uRHL2+PEiYKX +pLWBYu6l/Wp2UOsQqWABpTTeczRDS/m0A6qL+LLhISSv7bjHJr/GbcUhvUIB1ZAsq9n PSUGV56jomRR2uJWkuYs90cAv+bXICflfvfosZuyU0KoIr3++dsF3g8vOZ2hmW3X/mmj Z/cw== X-Gm-Message-State: ALKqPwcCfRfRtaJRIlopoIkcmjPKZyEV3x3fu6Adgg2TVm57bonLlapp W/jtfuuU5jGwYXly81kc3g5BMfHE X-Google-Smtp-Source: AB8JxZqUhuMZ+GerC3uChauISc1gzyKHtUBqxc5yiVZpYOgHVmgACU+YVt5wkgy9KatwRaL4wC1y5g== X-Received: by 2002:a1c:1a53:: with SMTP id a80-v6mr863982wma.36.1526480777126; Wed, 16 May 2018 07:26:17 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id d83-v6sm4364609wmh.16.2018.05.16.07.26.16 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 07:26:16 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Wed, 16 May 2018 16:26:07 +0200 Message-Id: <6addd89d690244b6078db9dd99d7a590f139584b.1526480763.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 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 --- 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 Wed May 16 14:26: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: 914667 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="oAY0ybRA"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mGzb6Ljdz9s3B for ; Thu, 17 May 2018 00:29:47 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9F2C9C21F45; Wed, 16 May 2018 14:29:11 +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 8E9EEC21F50; Wed, 16 May 2018 14:26:31 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CDB56C21F5E; Wed, 16 May 2018 14:26:26 +0000 (UTC) Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by lists.denx.de (Postfix) with ESMTPS id 02EC8C21F3A for ; Wed, 16 May 2018 14:26:19 +0000 (UTC) Received: by mail-wr0-f181.google.com with SMTP id v60-v6so1518906wrc.7 for ; Wed, 16 May 2018 07:26:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=Pyft/tJl4uN3wVN+pvBHqFjTplKK0pjPAbxl2HpVo2c=; b=oAY0ybRADiZd4T4zIESI9AX3jIyitx/IhfoGcTHKJC17I82mzBWwOupZM9KC93agIB UHOZ8vlYPK9S1JbUYSrg/cYVOK2wvGZWvYKvDzk+7cF7SaxmsxvfnC9uyioXo9SOvJ2h 4H288jH3XJjbJkDBxEDWcw6IJZG8Q+w+xjbMzpEvOOYQDeKzmGxlzwaHFvUNgfIfwEUc OvKD/kNca9ASQv6fBr2qcSJI2pguYajKkP5RNixY5M0usIh1EKg8wJJRHFOeYSeAh1ii eRjRnfybmAndK+r/f+BlBfeyUDzSOjUbELzk/0HarJEEz5xG4RP9aM1rrZml0t5rDKht pkLw== 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:subject:date:message-id :in-reply-to:references:in-reply-to:references; bh=Pyft/tJl4uN3wVN+pvBHqFjTplKK0pjPAbxl2HpVo2c=; b=e6vRc/Tc56yGue7EBLQ2PGR4SpqJ8zRjGrad5MpheiiYSP4S0vvSHWf1KxLRJ6J/36 th0V/rIE1xMAD6BB4/TuaWaFyonPsnAefwdFZPd9K1L5NofkcpLvS4XZmf+BJlI2eYn9 2MTh/vRZxcL9DApQlvi4fei8QLG6TKf4LD7PTV23H8YoggZqxTRz8OrPWjmtOclFE4B8 i8h30/Z06k7VbhouUm3K+F3Lh93lHpy2q12d8a5FPlQD3Ei1gyw7C9YMlZCFfvAHiVnj rgoDbcml/aK6cR3s5vMyP45wONwmqI/vZmsFVOeWdYrRer7P6floN95KxiODhzTRwaxD rA0A== X-Gm-Message-State: ALKqPwdxT77bQcwT0pzAvghdiU8Bp+NDfViCsQ59X2Bi2csC0PGU5KDX SSlwLOREZ+RL0H7Tm/1x2bbJ8Q== X-Google-Smtp-Source: AB8JxZq79PpiYvcxEYj6uhyZTiJ0hPURHza6WnTWk+b9j4ihnzYHR97Xg7xizOa7xAif78O0/bMopA== X-Received: by 2002:adf:acae:: with SMTP id o43-v6mr986500wrc.132.1526480778562; Wed, 16 May 2018 07:26:18 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id r200-v6sm3310526wmb.39.2018.05.16.07.26.17 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 07:26:18 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Wed, 16 May 2018 16:26:08 +0200 Message-Id: X-Mailer: git-send-email 2.17.0 In-Reply-To: References: In-Reply-To: References: Subject: [U-Boot] [PATCH 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 --- 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 | 1 - include/configs/xilinx_zynqmp_zcu111.h | 2 - 20 files changed, 11 insertions(+), 62 deletions(-) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 415fa668a789..551921b888a0 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -601,49 +601,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 9e2c0127474b..f36ab6f06972 100644 --- a/configs/xilinx_zynqmp_zc1751_xm015_dc1_defconfig +++ b/configs/xilinx_zynqmp_zc1751_xm015_dc1_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_zc1751_xm016_dc2_defconfig b/configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig index bd6d77ed3fcf..56d09c2c07da 100644 --- a/configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig +++ b/configs/xilinx_zynqmp_zc1751_xm016_dc2_defconfig @@ -80,6 +80,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 2e7ba74c03d2..ea4069d49571 100644 --- a/configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig +++ b/configs/xilinx_zynqmp_zc1751_xm017_dc3_defconfig @@ -76,6 +76,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 95dc5c131196..cdab565add4f 100644 --- a/configs/xilinx_zynqmp_zcu100_revC_defconfig +++ b/configs/xilinx_zynqmp_zcu100_revC_defconfig @@ -78,6 +78,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 d3a226d4d2cf..0fa88b985aa2 100644 --- a/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig +++ b/configs/xilinx_zynqmp_zcu102_rev1_0_defconfig @@ -94,6 +94,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 af7fd000697b..264900a97f65 100644 --- a/configs/xilinx_zynqmp_zcu102_revA_defconfig +++ b/configs/xilinx_zynqmp_zcu102_revA_defconfig @@ -92,6 +92,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..c0774cd983c8 100644 --- a/include/configs/xilinx_zynqmp_zcu106.h +++ b/include/configs/xilinx_zynqmp_zcu106.h @@ -35,7 +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 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 Wed May 16 14:26: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: 914666 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="PY1d0Sqh"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mGyy1mR0z9s3B for ; Thu, 17 May 2018 00:29:13 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 91F97C21F0B; Wed, 16 May 2018 14:28:46 +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 91F9DC21F02; Wed, 16 May 2018 14:26:30 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B804BC21F3F; Wed, 16 May 2018 14:26:26 +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 459F6C21F05 for ; Wed, 16 May 2018 14:26:20 +0000 (UTC) Received: by mail-wr0-f196.google.com with SMTP id p4-v6so1534287wrh.3 for ; Wed, 16 May 2018 07:26: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=phLnnZxYcRjLMwevFNlRKauG1Cm8zJF5U3BrktaHIjg=; b=PY1d0SqhahU9lQv1T1Cg2/QS9ijLZT3XOm+JIwF3LMq/98+jqnuuQuEohy0cU7fptK +3QMUuDz6zhD/BRQ3tsd9LN30ExFcMeINozX2fvaWKYM+82N2oRIABKhsXA+qsgtehUu C/IPY4bu8XwSVPGd7txFBSn+ePTiAP2ErI02hLi6AN52RGj1iE5CDdidINpiHl7JJuXa 69dZ6UBjE7BUXS4JbA2vvUJji2KTGp4EPds88rEebOi83GWuHmWw1RBImjQNhtDZ40Wf X/3WjP7ePCeMSD/SK/NivrRTz9jJmE8c3Td4NGM3XlMvBEVDRUgFYpA3YqIX1R8/g+2Q hPSA== 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=phLnnZxYcRjLMwevFNlRKauG1Cm8zJF5U3BrktaHIjg=; b=TKL1IAREtiYRf52bpGelcPKms79eMEVjgh+fT6O16y+Sy89Ryug6oIjwzXPhOcM/nf ndENk6QhJ89PtWGmrHBgU6/2sao8fOpsDOSpIymChurLAJU9L2oG3589lTfn3RK/WUA/ QprKml1wDmly2nPD6Sj9fqfEoL1OH+XTmJxlmgSaJspHg1CpnqE6YH3c5esyGTQSLokt THw1JokaemdtoER7lgx0MQsshg8Pduwe5NEIx3gloAcZRuKIm34CnzOQigJwaPUqdsuM uYnFAFkKwUiDg6KmdW5RDGbw4hRxU1NDLHkfcmjK0YUPdYxgVK9KIlUQCiPETZ2J0V1Y 9bMQ== X-Gm-Message-State: ALKqPweeETJUqhkRkDAqSxS3VwtdGp/h0/vk130uG/PqnY0sU7E+tIug LjPXpI15gHy8FUqHGfyLwvhj+A== X-Google-Smtp-Source: AB8JxZqnfRYxPtMXaCICWO6nxxRuJGListkIq5xS0vQ7wJx4V5gHt0tvflDL1zIn6zpEYhZqr63b2A== X-Received: by 2002:adf:9cc2:: with SMTP id h2-v6mr1013734wre.11.1526480779996; Wed, 16 May 2018 07:26:19 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id h66-v6sm3045279wmf.8.2018.05.16.07.26.19 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 May 2018 07:26:19 -0700 (PDT) From: Michal Simek To: Marek Vasut , u-boot@lists.denx.de Date: Wed, 16 May 2018 16:26:09 +0200 Message-Id: <21e9aef4a5d4baa6ebaaeb52acb03e2c1450433e.1526480763.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 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 --- 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