From patchwork Wed Apr 24 12:50:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 16379 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f198.google.com (mail-qc0-f198.google.com [209.85.216.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3C70C23918 for ; Wed, 24 Apr 2013 12:54:59 +0000 (UTC) Received: by mail-qc0-f198.google.com with SMTP id v20sf2693338qcm.5 for ; Wed, 24 Apr 2013 05:54:08 -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=VieSCZyxgl2bHwm4PF3ZijZjiuZDn3EtRBl3Ydc5vjw=; b=GP+eHGlMMR2g+21zJnCrwVh2iEV4MWsHyWfQqOQ5h9Tgcjih5CkWjAeypOf7S2m9S8 mAdTRNkjvZFKqbcchYLRzYBFuylS5svkJdX8QIUtuEwI6GDd1+Sejp8sc8FQH01AsPUA nY2f+6Cw/68++R3QdTYcvy57rBBPfoGsyq93go2NCOADBHBwXPjD6BIwB9SuAMbqQlDQ tXhnB5vDNBKv/MEejAEGwGnkHsiLeiZ3xEnsnkq2c+cf58hVc/sJFWj7199Oi7RV8OUR Ed03QuLei6hOIuspfsHH41VFl3Xbn5ZDX3lIXhin68KetkAv4QiQYLRCdmx9wPQonbSz vOvQ== X-Received: by 10.236.139.230 with SMTP id c66mr17538002yhj.55.1366808048278; Wed, 24 Apr 2013 05:54:08 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.41.7 with SMTP id b7ls361886qel.12.gmail; Wed, 24 Apr 2013 05:54:07 -0700 (PDT) X-Received: by 10.52.69.179 with SMTP id f19mr21244460vdu.93.1366808047932; Wed, 24 Apr 2013 05:54:07 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sa4si1198327vdc.10.2013.04.24.05.54.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 24 Apr 2013 05:54:07 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id m17so1728063vca.11 for ; Wed, 24 Apr 2013 05:54:07 -0700 (PDT) X-Received: by 10.220.242.73 with SMTP id lh9mr24797431vcb.49.1366808047803; Wed, 24 Apr 2013 05:54: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.127.98 with SMTP id nf2csp172583veb; Wed, 24 Apr 2013 05:54:06 -0700 (PDT) X-Received: by 10.68.176.37 with SMTP id cf5mr47235938pbc.173.1366808046357; Wed, 24 Apr 2013 05:54:06 -0700 (PDT) Received: from mailout3.samsung.com (mailout3.samsung.com. [203.254.224.33]) by mx.google.com with ESMTP id my1si2474016pbc.273.2013.04.24.05.54.05 for ; Wed, 24 Apr 2013 05:54:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of gautam.vivek@samsung.com designates 203.254.224.33 as permitted sender) client-ip=203.254.224.33; Received: from epcpsbgr5.samsung.com (u145.gpu120.samsung.co.kr [203.254.230.145]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MLR001J6FTXIYT0@mailout3.samsung.com> for patches@linaro.org; Wed, 24 Apr 2013 21:54:05 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr5.samsung.com (EPCPMTA) with SMTP id 5B.76.22414.CE5D7715; Wed, 24 Apr 2013 21:54:04 +0900 (KST) X-AuditID: cbfee691-b7f0e6d00000578e-d8-5177d5ec4db3 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 62.85.10837.CE5D7715; Wed, 24 Apr 2013 21:54: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 <0MLR00K76FQAD320@mmp1.samsung.com>; Wed, 24 Apr 2013 21:54:04 +0900 (KST) From: Vivek Gautam To: u-boot@lists.denx.de, marex@denx.de Cc: jwerner@chromium.org, u-boot-review@google.com, patches@linaro.org, rajeshwari.s@samsung.com, vikas.sajjan@samsung.com Subject: [PATCH 2/3] usb: fix: Fixing Port status and feature number constants Date: Wed, 24 Apr 2013 18:20:12 +0530 Message-id: <1366807813-10481-3-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1366807813-10481-1-git-send-email-gautam.vivek@samsung.com> References: <1366807813-10481-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRmVeSWpSXmKPExsWyRsSkVvfN1fJAg8v9ChYdhx4zWbxpa2S0 mHL4C4tFy9oDrBbLX29kt3i7t5Pd4uaz7UwO7B6zGy6yeMybdYLFY8GmUo871/aweZy9s4PR o2/LKsYAtigum5TUnMyy1CJ9uwSujJ7dF9gKpqtVTDv4gLWBsUO+i5GTQ0LAROLD87dMELaY xIV769m6GLk4hASWMkqcf/CUCaao4dxiJojEIkaJV9+f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oBBrYllxZe4hRgkOZiUR3k3bygOFeFMSK6tS i/Lji0pzUosPMSYDHTWRWUo0OR8Y63kl8YbGJuamxqaWJhYmZpakCSuJ8x5otQ4UEkhPLEnN Tk0tSC2C2cLEwSnVwOj80PPb8XVCPAf3nn3kpK3O/8w09cDH44HrhJvNjtV9muqlaNrT8kHk B/P7sBUfer3L3B3eSWS9vvJS55JPodeEjZdi9OJN5HhalSbr/WjQ2exq88Tn89kbMjYV6ovk 6r+bPOV+Pe1ZQ9wkl26v3YcutFs1PFHYqbtvO//0ZRGZt4ovZdyrS1NiKc5INNRiLipOBAD0 nlP06wIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQmeX2etA6h7PdfHl0MWIZ9iR4Hgku5iXHOEFzLIodMOUxnwn4tKfhYGTp+6kNWIVMBHUAr0 X-Original-Sender: gautam.vivek@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 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: , Fix the Port status bit constants and Port feature number constants as a part of USB 2.0 and USB 3.0 Hub class. Signed-off-by: Vivek Gautam --- common/usb_hub.c | 40 ++++++++++++++++++++++++++++------------ include/usb_defs.h | 39 +++++++++++++++++++++++---------------- 2 files changed, 51 insertions(+), 28 deletions(-) diff --git a/common/usb_hub.c b/common/usb_hub.c index dad0409..d9816e4 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -170,14 +170,24 @@ static struct usb_hub_device *usb_hub_allocate(void) static inline char *portspeed(int portstatus) { - 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"; - else - return "12 Mb/s"; + char *speed_str; + + switch (portstatus & USB_PORT_STAT_SPEED_MASK) { + case USB_PORT_STAT_SUPER_SPEED: + speed_str = "5 Gb/s"; + break; + case USB_PORT_STAT_HIGH_SPEED: + speed_str = "480 Mb/s"; + break; + case USB_PORT_STAT_LOW_SPEED: + speed_str = "1.5 Mb/s"; + break; + default: + speed_str = "12 Mb/s"; + break; + } + + return speed_str; } int hub_port_reset(struct usb_device *dev, int port, @@ -275,14 +285,20 @@ 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_SUPER_SPEED) + switch (portstatus & USB_PORT_STAT_SPEED_MASK) { + case USB_PORT_STAT_SUPER_SPEED: usb->speed = USB_SPEED_SUPER; - else if (portstatus & USB_PORT_STAT_HIGH_SPEED) + break; + case USB_PORT_STAT_HIGH_SPEED: usb->speed = USB_SPEED_HIGH; - else if (portstatus & USB_PORT_STAT_LOW_SPEED) + break; + case USB_PORT_STAT_LOW_SPEED: usb->speed = USB_SPEED_LOW; - else + break; + default: usb->speed = USB_SPEED_FULL; + break; + } dev->children[port] = usb; usb->parent = dev; diff --git a/include/usb_defs.h b/include/usb_defs.h index 6ce6791..4f3601a 100644 --- a/include/usb_defs.h +++ b/include/usb_defs.h @@ -215,8 +215,6 @@ #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 @@ -224,6 +222,17 @@ #define USB_PORT_FEAT_C_RESET 20 #define USB_PORT_FEAT_TEST 21 +/* + * Changes to Port feature numbers for Super speed, + * from USB 3.0 spec Table 10-8 + */ +#define USB_SS_PORT_FEAT_U1_TIMEOUT 23 +#define USB_SS_PORT_FEAT_U2_TIMEOUT 24 +#define USB_SS_PORT_FEAT_C_LINK_STATE 25 +#define USB_SS_PORT_FEAT_C_CONFIG_ERROR 26 +#define USB_SS_PORT_FEAT_BH_RESET 28 +#define USB_SS_PORT_FEAT_C_BH_RESET 29 + /* wPortStatus bits */ #define USB_PORT_STAT_CONNECTION 0x0001 #define USB_PORT_STAT_ENABLE 0x0002 @@ -233,20 +242,18 @@ #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_FULL_SPEED | USB_PORT_STAT_SUPER_SPEED) +#define USB_PORT_STAT_SUPER_SPEED 0x0600 /* faking support to XHCI */ +#define USB_PORT_STAT_SPEED_MASK \ + (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED) /* - * Additions to wPortStatus bit field from USB 3.0 - * See USB 3.0 spec Table 10-10 + * Changes to wPortStatus bit field in USB 3.0 + * See USB 3.0 spec Table 10-11 */ -#define USB_PORT_STAT_LINK_STATE 0x01e0 +#define USB_SS_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 +#define USB_SS_PORT_STAT_SPEED_5GBPS 0x0000 /* wPortChange bits */ #define USB_PORT_STAT_C_CONNECTION 0x0001 @@ -256,12 +263,12 @@ #define USB_PORT_STAT_C_RESET 0x0010 /* - * Addition to wPortChange bit fields form USB 3.0 - * See USB 3.0 spec Table 10-11 + * Changes to wPortChange bit fields in USB 3.0 + * See USB 3.0 spec Table 10-12 */ -#define USB_PORT_STAT_C_BH_RESET 0x0020 -#define USB_PORT_STAT_C_LINK_STATE 0x0040 -#define USB_PORT_STAT_C_CONFIG_ERROR 0x0080 +#define USB_SS_PORT_STAT_C_BH_RESET 0x0020 +#define USB_SS_PORT_STAT_C_LINK_STATE 0x0040 +#define USB_SS_PORT_STAT_C_CONFIG_ERROR 0x0080 /* wHubCharacteristics (masks) */ #define HUB_CHAR_LPSM 0x0003