From patchwork Mon Apr 8 10:35:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 15969 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 142BF23900 for ; Mon, 8 Apr 2013 10:38:22 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id o13sf4002176qaj.8 for ; Mon, 08 Apr 2013 03:38:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:mime-version:x-beenthere:x-received:received-spf :x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-auditid:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-brightmail-tracker:x-brightmail-tracker :dlp-filter:x-mtr:x-cfilter-loop:x-gm-message-state :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:x-google-group-id:list-post:list-help :list-archive:list-unsubscribe; bh=8KmI+r8ltCMf15QqI9Llahn+iYZz2EwK2jlaJswjfBs=; b=ZMD5SlPXeJ+k/VG/JRMWc2+zDs5funEXHhmIzBPs1wSCBN/5csXebEtrf0XxnDiRbH 0HD9FRr97JRt0iF+tBxlhK5T+b46SEbTYEY03LP/Gi8/sEkQjXYYcBxaGvg4OrwTBe9Y 0O8SqCz6KQWRocn5xeTDdMbeiFk1NrL1pvfZHlgarWkeaXfA2nvlYXJuy8b7ktG5hynY WD5Eu8rGvaAnxrZ/pbD8a7Ap8R+j3AK/O8g1tyNo7ZLoFaKg7DJE7HKFYow+GGLO36O4 t66n4AKdZbdvpwDoTKIKGnWq0hapJc0DO3eS2pfJombPzCo6dweC3x3KWaJP73aTyV3P MwGg== X-Received: by 10.236.130.147 with SMTP id k19mr9702596yhi.43.1365417487863; Mon, 08 Apr 2013 03:38:07 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.127.111 with SMTP id nf15ls3113101qeb.25.gmail; Mon, 08 Apr 2013 03:38:07 -0700 (PDT) X-Received: by 10.52.21.175 with SMTP id w15mr13014842vde.100.1365417487787; Mon, 08 Apr 2013 03:38:07 -0700 (PDT) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id ex4si13428685vdb.131.2013.04.08.03.38.07 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 03:38:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id cz11so5309737veb.10 for ; Mon, 08 Apr 2013 03:38:07 -0700 (PDT) X-Received: by 10.52.65.147 with SMTP id x19mr13186998vds.27.1365417487664; Mon, 08 Apr 2013 03:38:07 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.58.85.136 with SMTP id h8csp12566vez; Mon, 8 Apr 2013 03:38:07 -0700 (PDT) X-Received: by 10.66.222.228 with SMTP id qp4mr35521657pac.113.1365417486618; Mon, 08 Apr 2013 03:38:06 -0700 (PDT) Received: from mailout1.samsung.com (mailout1.samsung.com. [203.254.224.24]) by mx.google.com with ESMTP id lm2si29061184pab.35.2013.04.08.03.38.05; Mon, 08 Apr 2013 03:38:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of gautam.vivek@samsung.com designates 203.254.224.24 as permitted sender) client-ip=203.254.224.24; Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKX00GW3MVCZZF0@mailout1.samsung.com> for patches@linaro.org; Mon, 08 Apr 2013 19:38:05 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.123]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id E5.77.05174.C0E92615; Mon, 08 Apr 2013 19:38:04 +0900 (KST) X-AuditID: cbfee68f-b7f4a6d000001436-a9-51629e0ccda8 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 68.6F.13494.C0E92615; Mon, 08 Apr 2013 19:38:04 +0900 (KST) Received: from vivekkumarg-linuxpc.sisodomain.com ([107.108.214.169]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MKX008PGMUQGH60@mmp1.samsung.com>; Mon, 08 Apr 2013 19:38:04 +0900 (KST) From: Vivek Gautam To: u-boot@lists.denx.de Cc: patches@linaro.org, u-boot-review@google.com, marex@denx.de, sjg@chromium.org, rajeshwari.s@samsung.com, vikas.sajjan@samsung.com, amarendra.xt@samsung.com Subject: [PATCH v2 5/5] USB: SS: Add support for Super Speed USB interface Date: Mon, 08 Apr 2013 16:05:58 +0530 Message-id: <1365417358-31921-6-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1365417358-31921-1-git-send-email-gautam.vivek@samsung.com> References: <1365417358-31921-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrDLMWRmVeSWpSXmKPExsWyRsSkWpdnXlKgwZFnphZfFnSyW7xpa2S0 mHL4C4tFy9oDrBbftmxjtFj+eiO7xdu9QNmbz7YzOXB4zG64yOIxb9YJFo8Fm0o97lzbw+Zx 9s4ORo++LasYA9iiuGxSUnMyy1KL9O0SuDL2z3rJWPBGteLLnSbGBsZ7cl2MHBwSAiYSfX/U uhg5gUwxiQv31rN1MX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FecWJu cWleul5yfu4mRnBMPZPewbiqweIQowAHoxIP74GviYFCrIllxZW5hxglOJiVRHjFZyYFCvGm JFZWpRblxxeV5qQWH2JMBrppIrOUaHI+MN7zSuINjU3MTY1NLU0sTMwsSRNWEuc92GodKCSQ nliSmp2aWpBaBLOFiYNTqoHRI5vxx9/iU2J/fW9nyMUcbPAQKK74oz+d4fSXjoYrxswLg7gO 50Wu9z12aqKi9b83jFFX10y2SRA9J8E9LZxfde3/8mWXHlTFsM+5xhH2k315mcia4ABW7uDG O2+EnSbNYW0TmP3h/bdbvM8tGq6s4j8h87SRobajv0juY8zduXNOVh/bpaCuxFKckWioxVxU nAgAL61ebe0CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQmRFuDDNywu7wlTi+3fUaxQ/i4z6MSvSeWq2g7CwLO+b29G1R8ZKQkVHtIqoE69kK/5qlOZ X-Original-Sender: gautam.vivek@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This adds usb framework support for super-speed usb, which will further facilitate to add stack support for xHCI. Signed-off-by: Vikas C Sajjan Signed-off-by: Vivek Gautam --- common/cmd_usb.c | 4 +++- common/usb.c | 5 +++++ common/usb_hub.c | 8 ++++++-- include/usb.h | 6 ++++++ include/usb_defs.h | 24 +++++++++++++++++++++++- 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/common/cmd_usb.c b/common/cmd_usb.c index dacdc2d..5702c28 100644 --- a/common/cmd_usb.c +++ b/common/cmd_usb.c @@ -271,7 +271,9 @@ static void usb_display_config(struct usb_device *dev) static inline char *portspeed(int speed) { - if (speed == USB_SPEED_HIGH) + if (speed == USB_SPEED_SUPER) + return "5 Gb/s"; + else if (speed == USB_SPEED_HIGH) return "480 Mb/s"; else if (speed == USB_SPEED_LOW) return "1.5 Mb/s"; diff --git a/common/usb.c b/common/usb.c index fd1cad1..6227f70 100644 --- a/common/usb.c +++ b/common/usb.c @@ -421,6 +421,11 @@ static int usb_parse_config(struct usb_device *dev, wMaxPacketSize); USB_PRINTF("if %d, ep %d\n", ifno, epno); break; + case USB_DT_SS_ENDPOINT_COMP: + if_desc = &dev->config.if_desc[ifno]; + memcpy(&(if_desc->ss_ep_comp_desc[epno]), + &buffer[index], buffer[index]); + break; default: if (head->bLength == 0) return 1; diff --git a/common/usb_hub.c b/common/usb_hub.c index 1757dc6..2462640 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -178,7 +178,9 @@ static struct usb_hub_device *usb_hub_allocate(void) static inline char *portspeed(int portstatus) { - if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED)) + if (portstatus & (1 << USB_PORT_FEAT_SUPERSPEED)) + return "5 Gb/s"; + else if (portstatus & (1 << USB_PORT_FEAT_HIGHSPEED)) return "480 Mb/s"; else if (portstatus & (1 << USB_PORT_FEAT_LOWSPEED)) return "1.5 Mb/s"; @@ -282,7 +284,9 @@ void usb_hub_port_connect_change(struct usb_device *dev, int port) /* Allocate a new device struct for it */ usb = usb_alloc_new_device(dev->controller); - if (portstatus & USB_PORT_STAT_HIGH_SPEED) + if (portstatus & USB_PORT_STAT_SUPER_SPEED) + usb->speed = USB_SPEED_SUPER; + else if (portstatus & USB_PORT_STAT_HIGH_SPEED) usb->speed = USB_SPEED_HIGH; else if (portstatus & USB_PORT_STAT_LOW_SPEED) usb->speed = USB_SPEED_LOW; diff --git a/include/usb.h b/include/usb.h index d79c865..d7b082d 100644 --- a/include/usb.h +++ b/include/usb.h @@ -76,6 +76,12 @@ struct usb_interface { unsigned char act_altsetting; struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS]; + /* + * Super Speed Device will have Super Speed Endpoint + * Companion Descriptor (section 9.6.7 of usb 3.0 spec) + * Revision 1.0 June 6th 2011 + */ + struct usb_ss_ep_comp_descriptor ss_ep_comp_desc[USB_MAXENDPOINTS]; } __attribute__ ((packed)); /* Configuration information.. */ diff --git a/include/usb_defs.h b/include/usb_defs.h index 0c78d9d..e2aaef3 100644 --- a/include/usb_defs.h +++ b/include/usb_defs.h @@ -203,6 +203,8 @@ #define USB_PORT_FEAT_POWER 8 #define USB_PORT_FEAT_LOWSPEED 9 #define USB_PORT_FEAT_HIGHSPEED 10 +#define USB_PORT_FEAT_FULLSPEED 11 +#define USB_PORT_FEAT_SUPERSPEED 12 #define USB_PORT_FEAT_C_CONNECTION 16 #define USB_PORT_FEAT_C_ENABLE 17 #define USB_PORT_FEAT_C_SUSPEND 18 @@ -218,8 +220,20 @@ #define USB_PORT_STAT_POWER 0x0100 #define USB_PORT_STAT_LOW_SPEED 0x0200 #define USB_PORT_STAT_HIGH_SPEED 0x0400 /* support for EHCI */ +#define USB_PORT_STAT_FULL_SPEED 0x0800 +#define USB_PORT_STAT_SUPER_SPEED 0x1000 /* support for XHCI */ #define USB_PORT_STAT_SPEED \ - (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED) + (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED | \ + USB_PORT_STAT_FULL_SPEED | USB_PORT_STAT_SUPER_SPEED) + +/* + * Additions to wPortStatus bit field from USB 3.0 + * See USB 3.0 spec Table 10-10 + */ +#define USB_PORT_STAT_LINK_STATE 0x01e0 +#define USB_SS_PORT_STAT_POWER 0x0200 +#define USB_SS_PORT_STAT_SPEED 0x1c00 +#define USB_PORT_STAT_SPEED_5GBPS 0x0000 /* wPortChange bits */ #define USB_PORT_STAT_C_CONNECTION 0x0001 @@ -228,6 +242,14 @@ #define USB_PORT_STAT_C_OVERCURRENT 0x0008 #define USB_PORT_STAT_C_RESET 0x0010 +/* + * Addition to wPortChange bit fields form USB 3.0 + * See USB 3.0 spec Table 10-11 + */ +#define USB_PORT_STAT_C_BH_RESET 0x0020 +#define USB_PORT_STAT_C_LINK_STATE 0x0040 +#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 + /* wHubCharacteristics (masks) */ #define HUB_CHAR_LPSM 0x0003 #define HUB_CHAR_COMPOUND 0x0004