From patchwork Fri Apr 12 11:04:35 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vivek Gautam X-Patchwork-Id: 16080 Return-Path: X-Original-To: linaro@staging.patches.linaro.org Delivered-To: linaro@staging.patches.linaro.org Received: from mail-vc0-f199.google.com (mail-vc0-f199.google.com [209.85.220.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4C41126EB0 for ; Fri, 12 Apr 2013 11:07:10 +0000 (UTC) Received: by mail-vc0-f199.google.com with SMTP id ha12sf3907745vcb.2 for ; Fri, 12 Apr 2013 04:06:46 -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=i2o7Nga3w8FSS6idrXA64M/0iGUX3ywdCfHgw9VpFDU=; b=gahntkRE2g40okeLOHedKQvWlhexY+aKYb0WyerRu4G+myZmKPbVmQOnsQyQr4ttIY 1q6fYT2Es7AEuiRduvG7WwXoSRzzHnUtsz5rgWP447mqP2i7ZmS34ME8MUpkFybIUvu1 pyjfxUZyey4fZXaVHn4NzEjrstN7NMrIG5Fez/RTd+BM+4sZk0RPWq2G2optLf/jQp5l FwszaxRqtZWcHnH9JFJbLqMQB7+0KV9857d8e7ZJb8MkM+6P2+bsOLXFDNAnhVw6EEur bEhddRiEmMQMeqvwImqWiUYNvK3ttCgHE2q2RUmxKxgRGegyVu0oHsbNLicFFmK1P4zI lxsg== X-Received: by 10.224.65.6 with SMTP id g6mr5971559qai.4.1365764806825; Fri, 12 Apr 2013 04:06:46 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.76 with SMTP id 12ls1175162qec.40.gmail; Fri, 12 Apr 2013 04:06:46 -0700 (PDT) X-Received: by 10.220.174.19 with SMTP id r19mr7986190vcz.17.1365764806704; Fri, 12 Apr 2013 04:06:46 -0700 (PDT) Received: from mail-vb0-x229.google.com (mail-vb0-x229.google.com [2607:f8b0:400c:c02::229]) by mx.google.com with ESMTPS id cs9si6179639vdc.77.2013.04.12.04.06.46 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 12 Apr 2013 04:06:46 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::229 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::229; Received: by mail-vb0-f41.google.com with SMTP id f13so2077203vbg.0 for ; Fri, 12 Apr 2013 04:06:46 -0700 (PDT) X-Received: by 10.58.205.179 with SMTP id lh19mr7935217vec.7.1365764806545; Fri, 12 Apr 2013 04:06:46 -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 nf2csp60872veb; Fri, 12 Apr 2013 04:06:45 -0700 (PDT) X-Received: by 10.68.90.36 with SMTP id bt4mr14089003pbb.42.1365764805536; Fri, 12 Apr 2013 04:06:45 -0700 (PDT) Received: from mailout4.samsung.com (mailout4.samsung.com. [203.254.224.34]) by mx.google.com with ESMTP id tr3si8329488pbc.318.2013.04.12.04.06.44; Fri, 12 Apr 2013 04:06:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of gautam.vivek@samsung.com designates 203.254.224.34 as permitted sender) client-ip=203.254.224.34; Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0ML500MW12V7D2X0@mailout4.samsung.com> for patches@linaro.org; Fri, 12 Apr 2013 20:06:44 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.123]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 7A.5B.07735.3CAE7615; Fri, 12 Apr 2013 20:06:43 +0900 (KST) X-AuditID: cbfee68e-b7f946d000001e37-0b-5167eac376f6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id B8.44.17838.3CAE7615; Fri, 12 Apr 2013 20:06:43 +0900 (KST) Received: from vivekkumarg-linuxpc.sisodomain.com ([107.108.214.169]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0ML500IF52UIWD90@mmp2.samsung.com>; Fri, 12 Apr 2013 20:06:43 +0900 (KST) From: Vivek Gautam To: u-boot@lists.denx.de Cc: u-boot-review@google.com, patches@linaro.org, marex@denx.de, rajeshwari.s@samsung.com, sjg@chromium.org, vikas.sajjan@samsung.com, amarendra.xt@samsung.com, vipin.kumar@st.com, gautam.vivek@samsung.com Subject: [PATCH v3 3/8] usb: hub: Power-cycle on root-hub ports Date: Fri, 12 Apr 2013 16:34:35 +0530 Message-id: <1365764680-10917-4-git-send-email-gautam.vivek@samsung.com> X-Mailer: git-send-email 1.7.6.5 In-reply-to: <1365764680-10917-1-git-send-email-gautam.vivek@samsung.com> References: <1365764680-10917-1-git-send-email-gautam.vivek@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRmVeSWpSXmKPExsWyRsSkWvfwq/RAg0uHzS2+LOhkt2i7cpDd 4k1bI6PFlMNfWCxa1h5gtfi2ZRujxfLXG9kt3u4FKrn5bDuTxb9L11gduDxmN1xk8Zg36wSL x4JNpR53ru1h8zh7ZwejR9+WVYweT3/sZQ5gj+KySUnNySxLLdK3S+D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qROvEx6wgNq+Ah8SWVRugtilIvLn9DGwmp4CnxPmlb9lBbCGgmpX9u1kmMPIuYGRY xSiaWpBcUJyUnmuoV5yYW1yal66XnJ+7iREcec+kdjCubLA4xCjAwajEw/tCOD1QiDWxrLgy 9xCjBAezkghvzN60QCHelMTKqtSi/Pii0pzU4kOMyUBXTWSWEk3OByaFvJJ4Q2MTc1NjU0sT CxMzS9KElcR5D7RaBwoJpCeWpGanphakFsFsYeLglGpg7JK6O7k84csp19TZMbFzzfgZny7r urQ0+MPhY8sWs5euSc2bdDAl8anhzPb78/o2tGbP4ZzE1N1yqlXz0acdHSLdRi5GmjPfmP46 N6uw1/Pe9maJnonl5a9t3ic5Jt+1d1uRnRmvb2mnrNB5fs7m+yInPWTbvkrPqp79XkVAVLZJ tknVvv6GEktxRqKhFnNRcSIAHdx7jQADAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Gm-Message-State: ALoCoQl9CpvSQWKg3BGG2v7wpbLtVUi+3ZHx6E+lfP4k60HZo56JotH3JSKJhOLYRcOsa+Lv4f4g X-Original-Sender: gautam.vivek@samsung.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::229 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 --- Changes from v2: - Replaced USB_HUB_PRINTFs to debug() common/usb_hub.c | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/common/usb_hub.c b/common/usb_hub.c index f2a0285..e4f4e3c 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -100,11 +100,45 @@ 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 */ debug("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); + debug("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) { + debug("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)) { + debug("port %d: Port power change failed\n", i + 1); + return; + } + usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER); debug("port %d returns %lX\n", i + 1, dev->status); }