From patchwork Thu May 19 14:15:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 68129 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp3229323qge; Thu, 19 May 2016 07:16:08 -0700 (PDT) X-Received: by 10.28.169.130 with SMTP id s124mr3239967wme.47.1463667368686; Thu, 19 May 2016 07:16:08 -0700 (PDT) Return-Path: Received: from theia.denx.de (theia.denx.de. [85.214.87.163]) by mx.google.com with ESMTP id k71si18783647wmd.68.2016.05.19.07.16.08; Thu, 19 May 2016 07:16:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) client-ip=85.214.87.163; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 85.214.87.163 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 85D40A7519; Thu, 19 May 2016 16:16:07 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Gz48cXVMQBr; Thu, 19 May 2016 16:16:07 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D5CC8A74E3; Thu, 19 May 2016 16:16:06 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B2363A74E3 for ; Thu, 19 May 2016 16:16:01 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bNTekWWZU4Wz for ; Thu, 19 May 2016 16:16:01 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from devils.ext.ti.com (devils.ext.ti.com [198.47.26.153]) by theia.denx.de (Postfix) with ESMTPS id 36BBAA7498 for ; Thu, 19 May 2016 16:15:56 +0200 (CEST) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id u4JEFo7I028821; Thu, 19 May 2016 09:15:50 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4JEFon2006109; Thu, 19 May 2016 09:15:50 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.294.0; Thu, 19 May 2016 09:15:49 -0500 Received: from [192.168.2.6] (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u4JEFk5o001125; Thu, 19 May 2016 09:15:47 -0500 To: References: <1463141873-10604-1-git-send-email-rogerq@ti.com> <1463141873-10604-2-git-send-email-rogerq@ti.com> From: Roger Quadros Message-ID: <573DCA92.6070900@ti.com> Date: Thu, 19 May 2016 17:15:46 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <1463141873-10604-2-git-send-email-rogerq@ti.com> Cc: kishon@ti.com, u-boot@lists.denx.de Subject: [U-Boot] [PATCH v2 1/4] usb: dwc3: fix kconfig X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" DWC3 can be used as host or as gadget controller and the actual mode is determined at runtime so USB_DWC3_DUAL_ROLE must be the default mode when both host and gadget drivers are available. As DWC3 core implements an XHCI host controller, we use USB_XHCI_HCD to check if host driver is available. USB_DWC3_HOST and USB_DWC3_GADGET are only set if a particular mode needs to be forced or if both host and gadget drivers are not available. Build the dwc3 gadget drivers only if gadget mode can be used at runtime. Signed-off-by: Roger Quadros --- v2: - don't depend on USB as dwc3/kconfig already depends on that - use USB_XHCI_HCD to decide whether host operation is available. - Add USB_DWC3_DUAL_ROLE, which means that controller can operate either in host or gadget mode. The actual mode is decided at runtime based on dwc3->dr_mode. drivers/usb/dwc3/Kconfig | 18 +++++++++++++----- drivers/usb/dwc3/Makefile | 4 +++- drivers/usb/dwc3/core.h | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) -- 2.7.4 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig index e93398f..0db536e 100644 --- a/drivers/usb/dwc3/Kconfig +++ b/drivers/usb/dwc3/Kconfig @@ -1,19 +1,20 @@ config USB_DWC3 bool "DesignWare USB3 DRD Core Support" - depends on (USB && USB_GADGET) - select USB_GADGET_DUALSPEED + select USB_GADGET_DUALSPEED if USB_GADGET help - Say Y here if your system has a Dual Role SuperSpeed - USB controller based on the DesignWare USB3 IP Core. + Say Y here if your system has DesignWare USB3 IP Core. if USB_DWC3 choice bool "DWC3 Mode Selection" + default USB_DWC3_DUAL_ROLE if (USB_GADGET && USB_XHCI_HCD) + default USB_DWC3_HOST if (!USB_GADGET && USB_XHCI_HCD) + default USB_DWC3_GADGET if (USB_GADGET && !USB_XHCI_HCD) config USB_DWC3_HOST bool "Host only mode" - depends on USB + depends on USB_XHCI_HCD help Select this when you want to use DWC3 in host mode only, thereby the gadget feature will be regressed. @@ -25,6 +26,13 @@ config USB_DWC3_GADGET Select this when you want to use DWC3 in gadget mode only, thereby the host feature will be regressed. +config USB_DWC3_DUAL_ROLE + bool "Dual role mode" + depends on (USB_XHCI_HCD && USB_GADGET) + help + This is the default mode of working of DWC3 controller where + both host and gadget features are enabled. + endchoice comment "Platform Glue Driver Support" diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile index 0cd7302..d2ad2e9 100644 --- a/drivers/usb/dwc3/Makefile +++ b/drivers/usb/dwc3/Makefile @@ -6,7 +6,9 @@ obj-$(CONFIG_USB_DWC3) += dwc3.o dwc3-y := core.o -dwc3-y += gadget.o ep0.o +ifneq ($(filter y,$(CONFIG_USB_DWC3_GADGET) $(CONFIG_USB_DWC3_DUAL_ROLE)),) +dwc3-yi += gadget.o ep0.o +endif obj-$(CONFIG_USB_DWC3_OMAP) += dwc3-omap.o obj-$(CONFIG_USB_DWC3_PHY_OMAP) += ti_usb_phy.o diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 72d2fcd..faf0c0f 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -989,7 +989,7 @@ struct dwc3_gadget_ep_cmd_params { /* prototypes */ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc); -#ifdef CONFIG_USB_DWC3_HOST +#if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) int dwc3_host_init(struct dwc3 *dwc); void dwc3_host_exit(struct dwc3 *dwc); #else @@ -999,7 +999,7 @@ static inline void dwc3_host_exit(struct dwc3 *dwc) { } #endif -#ifdef CONFIG_USB_DWC3_GADGET +#if IS_ENABLED(CONFIG_USB_DWC3_GADGET) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) int dwc3_gadget_init(struct dwc3 *dwc); void dwc3_gadget_exit(struct dwc3 *dwc); int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode);