From patchwork Tue Jan 14 11:01:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dinh Nguyen X-Patchwork-Id: 3485251 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 25D629F169 for ; Tue, 14 Jan 2014 11:03:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18A222012D for ; Tue, 14 Jan 2014 11:03:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 95019201F9 for ; Tue, 14 Jan 2014 11:03:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751838AbaANLDO (ORCPT ); Tue, 14 Jan 2014 06:03:14 -0500 Received: from mail-db8lp0189.outbound.messaging.microsoft.com ([213.199.154.189]:59213 "EHLO db8outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751451AbaANLDK (ORCPT ); Tue, 14 Jan 2014 06:03:10 -0500 Received: from mail85-db8-R.bigfish.com (10.174.8.250) by DB8EHSOBE004.bigfish.com (10.174.4.67) with Microsoft SMTP Server id 14.1.225.22; Tue, 14 Jan 2014 11:03:08 +0000 Received: from mail85-db8 (localhost [127.0.0.1]) by mail85-db8-R.bigfish.com (Postfix) with ESMTP id CDD73300204; Tue, 14 Jan 2014 11:03:08 +0000 (UTC) X-Forefront-Antispam-Report: CIP:66.35.236.231; KIP:(null); UIP:(null); IPV:NLI; H:sj-itexedge01.altera.priv.altera.com; RD:none; EFVD:NLI X-SpamScore: 1 X-BigFish: VS1(z551bizzz1f42h208ch1ee6h1de0h1fdah2073h2146h1202h1e76h2189h1d1ah1d2ah21a7h1fc6hzz1de098h8275bh8275dh1de097hz2fh2a8h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h14ddh1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah224fh1d0ch1d2eh1d3fh1dfeh1dffh1e1dh1e23h1fe8h1ff5h2218h2216h226dh22d0h2327h2336h2438h2461h1155h) Received-SPF: pass (mail85-db8: domain of altera.com designates 66.35.236.231 as permitted sender) client-ip=66.35.236.231; envelope-from=dinguyen@altera.com; helo=sj-itexedge01.altera.priv.altera.com ; v.altera.com ; Received: from mail85-db8 (localhost.localdomain [127.0.0.1]) by mail85-db8 (MessageSwitch) id 1389697386587706_24907; Tue, 14 Jan 2014 11:03:06 +0000 (UTC) Received: from DB8EHSMHS014.bigfish.com (unknown [10.174.8.232]) by mail85-db8.bigfish.com (Postfix) with ESMTP id 88C5834004F; Tue, 14 Jan 2014 11:03:06 +0000 (UTC) Received: from sj-itexedge01.altera.priv.altera.com (66.35.236.231) by DB8EHSMHS014.bigfish.com (10.174.4.24) with Microsoft SMTP Server (TLS) id 14.16.227.3; Tue, 14 Jan 2014 11:03:05 +0000 Received: from sj-mail01.altera.com (137.57.1.6) by sj-itexedge01.altera.priv.altera.com (66.35.236.231) with Microsoft SMTP Server id 8.3.298.1; Tue, 14 Jan 2014 02:54:11 -0800 Received: from linux-builds1.altera.com (linux-builds1.altera.com [137.57.188.114]) by sj-mail01.altera.com (8.13.7+Sun/8.13.7) with ESMTP id s0EB30Se016495; Tue, 14 Jan 2014 03:03:02 -0800 (PST) From: To: , CC: , Dinh Nguyen , Paul Zimmerman , Rashika Kheria , Matthijs Kooijman , Luis Ortega Perez de Villar , Dom Cobley , Ben Dooks , Kukjin Kim , Robert Baldyga , Kyungmin Park , Jingoo Han , , Subject: [RFC PATCH 1/2] staging: dwc2: Move DWC2 usb driver out of staging Date: Tue, 14 Jan 2014 05:01:01 -0600 Message-ID: <1389697262-29065-2-git-send-email-dinguyen@altera.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1389697262-29065-1-git-send-email-dinguyen@altera.com> References: <1389697262-29065-1-git-send-email-dinguyen@altera.com> MIME-Version: 1.0 X-OriginatorOrg: altera.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Dinh Nguyen Signed-off-by: Dinh Nguyen Cc: Paul Zimmerman Cc: Rashika Kheria Cc: Matthijs Kooijman Cc: Luis Ortega Perez de Villar Cc: Dom Cobley Cc: Ben Dooks Cc: Kukjin Kim Cc: Robert Baldyga Cc: Kyungmin Park Cc: Jingoo Han Cc: Felipe Balbi Cc: Greg Kroah-Hartman Cc: linux-samsung-soc@vger.kernel.org Cc: linux-usb@vger.kernel.org --- drivers/staging/Kconfig | 2 -- drivers/usb/Kconfig | 2 ++ drivers/usb/Makefile | 1 + drivers/{staging => usb}/dwc2/Kconfig | 29 +++++++++++++++++++++++++++++ drivers/{staging => usb}/dwc2/Makefile | 0 drivers/{staging => usb}/dwc2/core.c | 0 drivers/{staging => usb}/dwc2/core.h | 0 drivers/{staging => usb}/dwc2/core_intr.c | 0 drivers/{staging => usb}/dwc2/hcd.c | 0 drivers/{staging => usb}/dwc2/hcd.h | 0 drivers/{staging => usb}/dwc2/hcd_ddma.c | 0 drivers/{staging => usb}/dwc2/hcd_intr.c | 0 drivers/{staging => usb}/dwc2/hcd_queue.c | 0 drivers/{staging => usb}/dwc2/hw.h | 25 +++++++++++++++---------- drivers/{staging => usb}/dwc2/pci.c | 0 drivers/{staging => usb}/dwc2/platform.c | 0 16 files changed, 47 insertions(+), 12 deletions(-) rename drivers/{staging => usb}/dwc2/Kconfig (69%) rename drivers/{staging => usb}/dwc2/Makefile (100%) rename drivers/{staging => usb}/dwc2/core.c (100%) rename drivers/{staging => usb}/dwc2/core.h (100%) rename drivers/{staging => usb}/dwc2/core_intr.c (100%) rename drivers/{staging => usb}/dwc2/hcd.c (100%) rename drivers/{staging => usb}/dwc2/hcd.h (100%) rename drivers/{staging => usb}/dwc2/hcd_ddma.c (100%) rename drivers/{staging => usb}/dwc2/hcd_intr.c (100%) rename drivers/{staging => usb}/dwc2/hcd_queue.c (100%) rename drivers/{staging => usb}/dwc2/hw.h (97%) rename drivers/{staging => usb}/dwc2/pci.c (100%) rename drivers/{staging => usb}/dwc2/platform.c (100%) diff --git a/drivers/staging/dwc2/pci.c b/drivers/usb/dwc2/pci.c similarity index 100% rename from drivers/staging/dwc2/pci.c rename to drivers/usb/dwc2/pci.c diff --git a/drivers/staging/dwc2/platform.c b/drivers/usb/dwc2/platform.c similarity index 100% rename from drivers/staging/dwc2/platform.c rename to drivers/usb/dwc2/platform.c diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig index 3bfdaa8..16b3a5c 100644 --- a/drivers/staging/Kconfig +++ b/drivers/staging/Kconfig @@ -138,8 +138,6 @@ source "drivers/staging/netlogic/Kconfig" source "drivers/staging/mt29f_spinand/Kconfig" -source "drivers/staging/dwc2/Kconfig" - source "drivers/staging/lustre/Kconfig" source "drivers/staging/btmtk_usb/Kconfig" diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index a34fb98..3bbce71 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -106,6 +106,8 @@ endif source "drivers/usb/musb/Kconfig" +source "drivers/usb/dwc2/Kconfig" + source "drivers/usb/dwc3/Kconfig" source "drivers/usb/chipidea/Kconfig" diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index 70d7c5b..e4136d4 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile @@ -6,6 +6,7 @@ obj-$(CONFIG_USB) += core/ +obj-$(CONFIG_USB_DWC2) += dwc2/ obj-$(CONFIG_USB_DWC3) += dwc3/ obj-$(CONFIG_USB_MON) += mon/ diff --git a/drivers/staging/dwc2/Kconfig b/drivers/usb/dwc2/Kconfig similarity index 69% rename from drivers/staging/dwc2/Kconfig rename to drivers/usb/dwc2/Kconfig index be947d6..299227a 100644 --- a/drivers/staging/dwc2/Kconfig +++ b/drivers/usb/dwc2/Kconfig @@ -20,6 +20,35 @@ config USB_DWC2 if USB_DWC2 +choice + bool "DWC2 Mode Selection" + default USB_DWC2_DUAL_ROLE if (USB && USB_GADGET) + default USB_DWC2_HOST if (USB && !USB_GADGET) + default USB_DWC2_GADGET if (!USB && USB_GADGET) + +config USB_DWC2_HOST + bool "Host only mode" + depends on USB=y || USB=USB_DWC2 + help + Select this when you want to use DWC2 in host mode only, + thereby the gadget feature will be regressed. + +config USB_DWC2_GADGET + bool "Gadget only mode" + depends on USB_GADGET=y || USB_GADGET=USB_DWC2 + help + Select this when you want to use DWC2 in gadget mode only, + thereby the host feature will be regressed. + +config USB_DWC2_DUAL_ROLE + bool "Dual Role mode" + depends on ((USB=y || USB=USB_DWC2) && (USB_GADGET=y || USB_GADGET=USB_DWC2)) + help + This is the default mode of working of DWC2 controller where + both host and gadget features are enabled. + +endchoice + config USB_DWC2_DEBUG bool "Enable Debugging Messages" help diff --git a/drivers/staging/dwc2/Makefile b/drivers/usb/dwc2/Makefile similarity index 100% rename from drivers/staging/dwc2/Makefile rename to drivers/usb/dwc2/Makefile diff --git a/drivers/staging/dwc2/core.c b/drivers/usb/dwc2/core.c similarity index 100% rename from drivers/staging/dwc2/core.c rename to drivers/usb/dwc2/core.c diff --git a/drivers/staging/dwc2/core.h b/drivers/usb/dwc2/core.h similarity index 100% rename from drivers/staging/dwc2/core.h rename to drivers/usb/dwc2/core.h diff --git a/drivers/staging/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c similarity index 100% rename from drivers/staging/dwc2/core_intr.c rename to drivers/usb/dwc2/core_intr.c diff --git a/drivers/staging/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c similarity index 100% rename from drivers/staging/dwc2/hcd.c rename to drivers/usb/dwc2/hcd.c diff --git a/drivers/staging/dwc2/hcd.h b/drivers/usb/dwc2/hcd.h similarity index 100% rename from drivers/staging/dwc2/hcd.h rename to drivers/usb/dwc2/hcd.h diff --git a/drivers/staging/dwc2/hcd_ddma.c b/drivers/usb/dwc2/hcd_ddma.c similarity index 100% rename from drivers/staging/dwc2/hcd_ddma.c rename to drivers/usb/dwc2/hcd_ddma.c diff --git a/drivers/staging/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c similarity index 100% rename from drivers/staging/dwc2/hcd_intr.c rename to drivers/usb/dwc2/hcd_intr.c diff --git a/drivers/staging/dwc2/hcd_queue.c b/drivers/usb/dwc2/hcd_queue.c similarity index 100% rename from drivers/staging/dwc2/hcd_queue.c rename to drivers/usb/dwc2/hcd_queue.c diff --git a/drivers/staging/dwc2/hw.h b/drivers/usb/dwc2/hw.h similarity index 97% rename from drivers/staging/dwc2/hw.h rename to drivers/usb/dwc2/hw.h index 9c92a3c..c20d9d7 100644 --- a/drivers/staging/dwc2/hw.h +++ b/drivers/usb/dwc2/hw.h @@ -109,6 +109,7 @@ #define GUSBCFG_FSINTF (1 << 5) #define GUSBCFG_ULPI_UTMI_SEL (1 << 4) #define GUSBCFG_PHYIF16 (1 << 3) +#define GUSBCFG_PHYIF8 (0 << 3) #define GUSBCFG_TOUTCAL_MASK (0x7 << 0) #define GUSBCFG_TOUTCAL_SHIFT 0 #define GUSBCFG_TOUTCAL_LIMIT 0x7 @@ -151,7 +152,7 @@ #define GINTSTS_ENUMDONE (1 << 13) #define GINTSTS_USBRST (1 << 12) #define GINTSTS_USBSUSP (1 << 11) -#define GINTSTS_ERLYSUSP (1 << 10) +#define GINTSTS_EARLYSUSP (1 << 10) #define GINTSTS_I2CINT (1 << 9) #define GINTSTS_ULPI_CK_INT (1 << 8) #define GINTSTS_GOUTNAKEFF (1 << 7) @@ -169,14 +170,14 @@ #define GRXSTS_FN_SHIFT 25 #define GRXSTS_PKTSTS_MASK (0xf << 17) #define GRXSTS_PKTSTS_SHIFT 17 -#define GRXSTS_PKTSTS_GLOBALOUTNAK 1 -#define GRXSTS_PKTSTS_OUTRX 2 +#define GRXSTS_PKTSTS_GLOBALOUTNAK (0x1 << 17) +#define GRXSTS_PKTSTS_OUTRX (0x2 << 17) #define GRXSTS_PKTSTS_HCHIN 2 -#define GRXSTS_PKTSTS_OUTDONE 3 +#define GRXSTS_PKTSTS_OUTDONE (0x3 << 17) #define GRXSTS_PKTSTS_HCHIN_XFER_COMP 3 -#define GRXSTS_PKTSTS_SETUPDONE 4 +#define GRXSTS_PKTSTS_SETUPDONE (0x4 << 17) #define GRXSTS_PKTSTS_DATATOGGLEERR 5 -#define GRXSTS_PKTSTS_SETUPRX 6 +#define GRXSTS_PKTSTS_SETUPRX (0x6 << 17) #define GRXSTS_PKTSTS_HCHHALTED 7 #define GRXSTS_HCHNUM_MASK (0xf << 0) #define GRXSTS_HCHNUM_SHIFT 0 @@ -403,6 +404,9 @@ #define FIFOSIZE_DEPTH_SHIFT 16 #define FIFOSIZE_STARTADDR_MASK (0xffff << 0) #define FIFOSIZE_STARTADDR_SHIFT 0 +#define DPTXFSIZN_DPTXFSIZE_GET(_v) (((_v) >> 16) & 0xffff) +#define DPTXFSIZN_DPTXFSIZE(_x) ((_x) << 16) +#define DPTXFSIZN_DPTXFADDR(_x) ((_x) << 0) /* Device mode registers */ @@ -520,10 +524,11 @@ #define DXEPCTL_SNP (1 << 20) #define DXEPCTL_EPTYPE_MASK (0x3 << 18) #define DXEPCTL_EPTYPE_SHIFT 18 -#define DXEPCTL_EPTYPE_CONTROL 0 -#define DXEPCTL_EPTYPE_ISO 1 -#define DXEPCTL_EPTYPE_BULK 2 -#define DXEPCTL_EPTYPE_INTTERUPT 3 +#define DXEPCTL_EPTYPE_CONTROL (0x0 << 18) +#define DXEPCTL_EPTYPE_ISO (0x1 << 18) +#define DXEPCTL_EPTYPE_BULK (0x2 << 18) +#define DXEPCTL_EPTYPE_INTERRUPT (0x3 << 18) + #define DXEPCTL_NAKSTS (1 << 17) #define DXEPCTL_DPID (1 << 16) #define DXEPCTL_EOFRNUM (1 << 16)