From patchwork Mon Apr 8 10:35:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 15966 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-ye0-f198.google.com (mail-ye0-f198.google.com [209.85.213.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A9D9E23900 for ; Mon, 8 Apr 2013 10:38:15 +0000 (UTC) Received: by mail-ye0-f198.google.com with SMTP id m12sf7819835yen.5 for ; Mon, 08 Apr 2013 03:38:01 -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=scy6OdGYDQMoMXKgA9+frekPrMwddfEkjzVzlx2Ygbc=; b=JGWlVpd55GHMcV5gbrNp/ioshZNDqv9re/Jwp3BrB5i7e1/jOWxjfX33kaeOflkqK5 uJcSp4PozZB/j+43FW2FbU9wg9oZTPek9PkJ65WgpaQaXbpX+Cf9MpA4l8oSC2D+z/2H weajDx/jx4w6Q+YZGBgyvAx2NPRs/xwe1CPLSlpqM6sDnOk2erjf6yKDNcJliPwEMG1s 2OhWYiKnKIxfVMTLlC8F207imEHgXppXjStsXr6VEP99L+A8PKdDS9PLiMqXVJsOxxsV uTevNRZlQWDD+PUB+fG1rHu53JzhSmQ+kMFlSlZcQMat4Lv3Wtb/hye1oEefjiV2ifZr ihQg== X-Received: by 10.224.219.146 with SMTP id hu18mr5606391qab.3.1365417481095; Mon, 08 Apr 2013 03:38:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.48.232 with SMTP id p8ls3090211qen.50.gmail; Mon, 08 Apr 2013 03:38:01 -0700 (PDT) X-Received: by 10.220.65.1 with SMTP id g1mr15386667vci.63.1365417481017; Mon, 08 Apr 2013 03:38:01 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id x12si18003713vcv.72.2013.04.08.03.38.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 08 Apr 2013 03:38:01 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.178 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.178; Received: by mail-vc0-f178.google.com with SMTP id hv10so639853vcb.37 for ; Mon, 08 Apr 2013 03:38:00 -0700 (PDT) X-Received: by 10.52.245.6 with SMTP id xk6mr5706021vdc.114.1365417480897; Mon, 08 Apr 2013 03:38:00 -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 h8csp12561vez; Mon, 8 Apr 2013 03:38:00 -0700 (PDT) X-Received: by 10.66.26.44 with SMTP id i12mr36414954pag.151.1365417479965; Mon, 08 Apr 2013 03:37:59 -0700 (PDT) Received: from mailout2.samsung.com (mailout2.samsung.com. [203.254.224.25]) by mx.google.com with ESMTP id r4si9496954pan.101.2013.04.08.03.37.59; Mon, 08 Apr 2013 03:37:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of gautam.vivek@samsung.com designates 203.254.224.25 as permitted sender) client-ip=203.254.224.25; Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MKX000HRMVATP21@mailout2.samsung.com> for patches@linaro.org; Mon, 08 Apr 2013 19:37:58 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id 2F.49.20872.60E92615; Mon, 08 Apr 2013 19:37:58 +0900 (KST) X-AuditID: cbfee68d-b7f786d000005188-60-51629e062f87 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 89.2E.17838.60E92615; Mon, 08 Apr 2013 19:37:58 +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:37:58 +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 2/5] usb: hub: Power-cycle on root-hub ports Date: Mon, 08 Apr 2013 16:05:55 +0530 Message-id: <1365417358-31921-3-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+NgFvrHLMWRmVeSWpSXmKPExsWyRsSkVpdtXlKgQdcOOYsvCzrZLd60NTJa TDn8hcWiZe0BVotvW7YxWix/vZHd4u1eoOzNZ9uZHDg8ZjdcZPGYN+sEi8eCTaUed67tYfM4 e2cHo0ffllWMAWxRXDYpqTmZZalF+nYJXBmzH11nLzgiULH7/T7GBsYW3i5GTg4JAROJAwvX M0LYYhIX7q1nA7GFBJYySmzfxA9Ts+vUPaYuRi6g+C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C4eia1g3Flg8UhRgEORiUeXskfiYFCrIllxZW5hxglOJiVRHjFZyYFCvGm JFZWpRblxxeV5qQWH2JMBrppIrOUaHI+MObzSuINjU3MTY1NLU0sTMwsSRNWEuc90GodKCSQ nliSmp2aWpBaBLOFiYNTqoHRNzpa9mvL3cNfmqr53i1U+ZIx/6wxn/aH/aHpP8u1ixluP38f oVggZLg69dqu2kwpxsqG8DncTUeb3dqLNoU/i7GW27vr8qq2Lxq5k59la6W13jz3/PUs9se6 b69lHndN8dvR6sb/fZKKRtS6V0K5mQc+VSRFzYjqcH587LPWpx9bL+9epH1BiaU4I9FQi7mo OBEACLk9xe8CAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQlwmrJNcz2oNzck0mlkMWNvypXCZ6kIj3Rf3dngxN7vtXFlTwmzpMZJqQRBAOeyx/Nbpvsi X-Original-Sender: gautam.vivek@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.178 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: , XHCI ports are powered on after a H/W reset, however EHCI ports are not. So disabling and re-enabling power on all ports invariably. Signed-off-by: Amar Signed-off-by: Vivek Gautam --- common/usb_hub.c | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/common/usb_hub.c b/common/usb_hub.c index b5eeb62..4bfed09 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -111,11 +111,47 @@ static void usb_hub_power_on(struct usb_hub_device *hub) int i; struct usb_device *dev; unsigned pgood_delay = hub->desc.bPwrOn2PwrGood * 2; + ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1); + unsigned short portstatus; + int ret; dev = hub->pusb_dev; /* Enable power to the ports */ USB_HUB_PRINTF("enabling power on all ports\n"); for (i = 0; i < dev->maxchild; i++) { + /* + * Power-cycle the ports here: aka, + * turning them off and turning on again. + */ + usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); + USB_HUB_PRINTF("port %d returns %lX\n", i + 1, dev->status); + + /* Wait at least 2*bPwrOn2PwrGood for PP to change */ + mdelay(pgood_delay); + + ret = usb_get_port_status(dev, i + 1, portsts); + if (ret < 0) { + USB_HUB_PRINTF("port %d: get_port_status failed\n", + i + 1); + return; + } + + /* + * Check to confirm the state of Port Power: + * xHCI says "After modifying PP, s/w shall read + * PP and confirm that it has reached the desired state + * before modifying it again, undefined behavior may occur + * if this procedure is not followed". + * EHCI doesn't say anything like this, but no harm in keeping + * this. + */ + portstatus = le16_to_cpu(portsts->wPortStatus); + if (portstatus & (USB_PORT_STAT_POWER << 1)) { + USB_HUB_PRINTF("port %d: Port power change failed\n", + i + 1); + return; + } + usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); USB_HUB_PRINTF("port %d returns %lX\n", i + 1, dev->status); }