From patchwork Fri Jun 17 10:09:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 9183273 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 516186075F for ; Fri, 17 Jun 2016 10:20:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F26B1FF60 for ; Fri, 17 Jun 2016 10:20:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3395F28388; Fri, 17 Jun 2016 10:20:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BDE9B1FF60 for ; Fri, 17 Jun 2016 10:19:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDqrC-000809-IG; Fri, 17 Jun 2016 10:18:34 +0000 Received: from mail-bn1bon0062.outbound.protection.outlook.com ([157.56.111.62] helo=na01-bn1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1bDqq4-0006Pm-DJ for linux-arm-kernel@lists.infradead.org; Fri, 17 Jun 2016 10:17:30 +0000 Received: from BY2PR03CA048.namprd03.prod.outlook.com (10.141.249.21) by SN1PR0301MB1629.namprd03.prod.outlook.com (10.162.130.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.523.12; Fri, 17 Jun 2016 10:17:02 +0000 Received: from BN1BFFO11FD038.protection.gbl (2a01:111:f400:7c10::1:176) by BY2PR03CA048.outlook.office365.com (2a01:111:e400:2c5d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.517.8 via Frontend Transport; Fri, 17 Jun 2016 10:16:55 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; nxp.com; dmarc=none action=none header.from=nxp.com; nxp.com; dkim=none (message not signed) header.d=none; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD038.mail.protection.outlook.com (10.58.144.101) with Microsoft SMTP Server (TLS) id 15.1.511.7 via Frontend Transport; Fri, 17 Jun 2016 10:16:54 +0000 Received: from shlinux2.ap.freescale.net (shlinux2.ap.freescale.net [10.192.224.44]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id u5HAFbSw029984; Fri, 17 Jun 2016 03:16:48 -0700 From: Peter Chen To: , , , , , Subject: [PATCH 10/12] usb: core: add power sequence handling for USB devices Date: Fri, 17 Jun 2016 18:09:23 +0800 Message-ID: <1466158165-9380-11-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1466158165-9380-1-git-send-email-peter.chen@nxp.com> References: <1466158165-9380-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131106322153423776; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(7916002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(5001770100001)(19580395003)(48376002)(5003940100001)(97736004)(586003)(50466002)(19580405001)(229853001)(36756003)(2201001)(106466001)(105606002)(5008740100001)(87936001)(50226002)(8936002)(33646002)(2171001)(2950100001)(92566002)(2906002)(4326007)(189998001)(68736007)(6806005)(77096005)(575784001)(86362001)(104016004)(356003)(8666005)(85426001)(47776003)(8676002)(81156014)(50986999)(76176999)(81166006)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1629; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD038; 1:CfQawb6k2h2yvG4WrXk/Q74djBeDr8ntGfZqcaliqpLfRqWxI17tdn1bu3Xfu/3R735GRMIk04rzZeVVVn19zEiNxpyWReXvFBAS+Galr4VNKnhk0ovPXCpYFqP8O77q7n8tC7ja64ki3fXoKLTlKPqqed39pvQxPcQqRvQrqtd9MQoYG9ypkyBiLb8UYpjOpHVv3nlUEZgbPrnDQPK2Eh+GlAU6WgA3YKt9RK05SczvVDUAW9d5mVGvWqM9u+1hQvyRPFRuPnxw3jL5VSxMx4hyxiTgqK40qiOkOeuLvGEkq4oyfe219sKzJOxKqr4mynMYUSrEFTEwFBe1rvX6SHNf479v+nrq+FH9mkwFl11fkaXQV/5LZe0sYvjSxins7OUEbXjHdxSutnBqIQ6i4kUf3x3xAQaFn+TDil9SLWwcQ55s1jakqoC2wNiCvui1AIR5At04MWH/LGT4L3D3Rmdn2J6/gpQDymyn349YHZZRO6gPqr6SjyrXZJf0qCn7ONqAILa+9gNwhu++flE8oLuN4+B05J+RTGjdp4ZgyNpC8aiO4IaG4FNxrBnOWKPchVSXUErJaGL2qyp8n/1Z4xgkvMriunCcPjkkH7djcRgZMi34WxBhHFjHYqaTW88stWfAaqj3czaW5HpAWKcZrlIp9Neo+ypLBkBP3VfkjVqqO8qryLul7qKV/kQEXmksfRPV6nIrHFl16G8nlQtsKZiQ7k7nQAyEk1Z7C4nOsGE= MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 083cfde8-887b-472e-43a0-08d39698823a X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 2:M4WyE3jQufQ2O5/p3lbd7X1iwi36glFBvtGCv8ZBbBkoRbGDEF2v36TsEc6YLbZNl7xOSVXNZ23BZlI6B/HSsvmErOtdYbDI1bqBQ90+GTOiDD5wnaWjM6pqJFRrJ6Tj87gQXJLUs1eoUKVPjzNGu36Kaa3T969h2nnSYnthl4fT5R4kfz2PROkw5JdkB32S; 3:sykszmXv04Zf/LyDt7TOy+j/RcLn401F2a5TLV36kO1tewDFDvzsVeNgtLLx1auOIyi/nTMUGYL12CVPe79Hs/Azq7pL1HarnLxoPyhZjCeEQgZ3DZkiHmQmqEAkWq743bF3kQM+cHcIhAFM+BFefGEglwoVmyY2YsU28teLCOFd2/65TqNipkIoMNmZX3/T+Cmclrmf1ZweOjoKg3XpBOxWdqgIAtfLH6VWYJbn6zI= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB1629; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 25:jJ5neWM0EuRoXACE1ILtIOcLcQRgdg0uIOzjlh9n3xXhY3kvnjLMyG6T2aACaVIOc2vjMF3wTQdFlTmWcJ/j+K2IphXF9sifEwJNf2jzkUoDh596AHKNr6S4XLbPVOQ3SoCaCejm3Lgwu/oGs0DDbhoihpPCoZaX9RdCQbAlhMXme2Mj9HEIM10LfoeqXhvudoTnhjdmIkDHWs71ocayw+oMpzqdtgaY/Jjz9NNMhYcSIt1Vn8purmXfzyKTV+s+qS3ITuA7JbEGRxD+fdEj7THQwbKulwgeurl3C20k6Yb5ws3oEZJhCrBZw41RHHmRN8wQKk7THPOy6ySi2ZpSqFRx3dmZC/lT3lxPqkEK4oVGlyIxaxd28fWNCOw8X5OfbteXnlccLt/vm3hepLzocYWirrf8dBdIIgvw8d40QQ1gOVA2wdgIyAP1dXhgIMf2sLOZr2QkSa7mTZJv60+b/7R9s9/zdwrTlYOS6q/fp5WRMG8YxaOoCxo8vlu07dJYbJ0Cr7fJU9qVEF3a+ASbZl/2NYCwLBMVVYCSgzDOfbxVx2fyW9LZjHVZgmM73ItK2kq9a7wWOpEupj6EVOZN8AHIy+NoJKVR5BLzUYa9zEluG2o/6MEP/hTGAyevId/33ZHLeK1hSxqhwekkF4p1kHwDb/KHco38gj4vN4E/ZeHc+32dqIJWCyjJhiREhgXujyqO81+E/Bsysqw6Tr3y1MRSTeg/unPrTTBnIStUe1Ddy+rszjafQcaau2WLAi35 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(13023025)(13024025)(13015025)(13018025)(13017025)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:SN1PR0301MB1629; BCL:0; PCL:0; RULEID:(400006); SRVR:SN1PR0301MB1629; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 4:08kD+KxVx9uACW+aq4Vx5ldBQ+UIcSkNve8fhphPWi/zq+0NdoAVBbO5G7sAZPjhKqYJ92rFaOJT8FGJo/58N7fBsotnBNXnNGOhxoiVo4AfgMHknxvKKx6mgtDSFr7WVmCQ45gw8urS5NT4eSVxVCnXqWWp2lWMsyhTFoCjKvLNMmHyUwDYVnYM5/g3SGH1h3HMdMXLn5x61HVxbAf7b490RkwDjus6o5uD+tnEAYFmkeZPM41nYUrfyZA6bX4rmvaxfgdx1f6YDbHbVDNmRErbT7JnGsvqD5e58ihq4kt29vo/9pbWbjQStw0x4S9xTXhbpAkibS1A8iE26ayoVFugBRYJBEUzstixG6OzBvkqyrx///T4bVNH6/HZXl961X54k3INjHMSQUcFAHM8fCafY6+SL3O0Jr0BGp9oTn+ZXkTerHC91yiN8/SpHtvXVvLrq2UEZ9Md0vKojFK5HERmOFhd9dIRtMqK7pwJB2pb6LrA+s7wH8tIBNdHZgfMRsyaH5YCB+g4KVYL/Dlbug== X-Forefront-PRVS: 09760A0505 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR0301MB1629; 23:t35S8adqtycQlgGPXUzK0ZI/aBfSxf4X+aGz2vw?= =?us-ascii?Q?g9ce6rNgsY7atPBgC3CfEF93TfFj2pZukNNybgtqaEx2v8F8/BYKK9S79+pj?= =?us-ascii?Q?Gb1T3qX4z8UoWFOBj2KLLOjjy/8vZh7IT7WZN2XuGH8iJdKBlmrEeoyM6+3j?= =?us-ascii?Q?2tylbaBUdQ2ECViV6V1dPqz7Wz8IFTKLrQFVCaxolCdNA8e4G7LAvOgdDUAu?= =?us-ascii?Q?+9GctVxmJjmm9tRrBdhtd1ckCdYE6L2/vHGUL5fZ+weon5g65uodkf7ufHcD?= =?us-ascii?Q?t/L7CEB38Djidy5i8d9yUwm7m4QRIphLuiX3pE/sxcUxEepgRx4ItfmKgSnI?= =?us-ascii?Q?Fog8PjdOPWgCbrPQT4qvwKxCMTZgJUBh2T5uknYiirXn+Q6VIEadya1tQS+i?= =?us-ascii?Q?F7BebWprntQxHdvkoY3VfNIveZ72SU3/gZoldLlZPkfRWLttYs3eMQCpWJo6?= =?us-ascii?Q?pZd1G092q8cr+WSF4MG/yeBdmRcT08BNe4Yw9lssGET4s8K5e85bE0707qQ5?= =?us-ascii?Q?ctb0LcFaoMgbBPMwv2KNT+eQ93x1gKocjo6Jf20T3NjZlzkVsYYxuOAbQ6c1?= =?us-ascii?Q?a/SHCwv48oCgFbUmScnIqwZKT+HXXDTB0GhHEGYQWzfdVOoYj2jKwEwClLCZ?= =?us-ascii?Q?2rsh0e4iR7m0+bLuQLUxQBvfJyswT91RnuW9rAd7Djsrnv4Z3BYdrUBA8oLs?= =?us-ascii?Q?EetMQsRJO609jmHC3Zi+9XKifxW8U5GApxMh50Tpy+5yXFJJka6aTiMSFIG6?= =?us-ascii?Q?vGPniJKoIJuqG9FxcryqsypE2Y4bndnvCUzBxE2PoSgGja3FCUUgRxxICQvn?= =?us-ascii?Q?cBL+l3qlsFyo1w2W2qs8zFX3kY4yROuy0X7N8g+B1HVd3Q6sPxJJ0MjT532b?= =?us-ascii?Q?zeHNn3UfwLSZCwmH5TYdG4vCRsxn0N081BLN6bmpRurPnyKe7YcDuAJZxKjS?= =?us-ascii?Q?fyicapAtWKPFA5Stx9PRtCqJ2eJj6bojc7X3TY+BLcN5OR49YcFqMHvBreCH?= =?us-ascii?Q?7nHqglCI2aLji+E3YkNbsdlZdpxPaEdctOLFaqyKqsm6+YgiMWHbRV6IK65x?= =?us-ascii?Q?Tqe3HGZcOuZweQoKI+LTY8IKft9MEz5stahdfutA1wYe4+prEFKHbQdE2dIv?= =?us-ascii?Q?wonCakzb1c2Ly0fliTWhLROvY+x6lPbde6Ihz8kCxWEpZMV8pyjJr6g=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1629; 6:/CADrfPaLWKgIXoM6hM59P3+453ZeU+NWZX/HMSxcczDGfSMwOWqL5zFKigCAPPkm1oMYFUpRqc8jMDzXf0Coie0IuCX7Jz3NEL9BioA3h0OVS2JpttKEmmNIQ4onwIQO7wRctEf89/WfVNkMS/C9GmIxFFYdXtGft7CWbEBxMh/qctYQFkXNRW/PGTRWBuXqMoUJqup9y3qpNmIntPEu/NVbGEsyPwJICIpiQW1zOLYhRbxAozdyTCcp9ZLft3yYaHtLOyLDE2wp3Z7fw3k2A==; 5:+ZGn7ts6K9qTeKhPS3yGhDynEAqNS4JCmWiTJ8uqjX5kaMUiMHNdq8IYyq/Ll+jXffsIrVrM+N+4nwcufbLbn2MDtF/i2N1DA5iskLvW3+r1ZC2tYmxUT3WQtNPCZgwt6y8bOQJhzJEDyeYS0Hxf0szEUEYbjXq1K3B+50Xcl4w=; 24:bRhdo3YBp2IYLyD06PIl8nWHbuIkdplWgT06i/s3d0IjQUrM7sCcjIA/rHAKsqy0VMZYRRaWejhMQaY8SV04Y5eSg9BQCbTZPoiyoOXFbpQ=; 7:flPhadOVMPfNBCzirIeJGpQLk0xRdH3/FCsVKqH2rf26jGBL6ukklOudq3CCH5wZIgJxQq1wxmp+VYCwjPf8aPqpAA9TSM5+rE1wNEe4QgIWesddk+rjEqYIMnspZaAoDhHJE+Z0LWyzEx1Y0Juv1ODO3eZKJXZpnLGeM8tCmxyOBUal8jD7PD2w6pIwipm5QsCGlGT+lSevPsRfg3h9/A== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2016 10:16:54.9055 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB1629 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160617_031725_038962_8F3D3186 X-CRM114-Status: GOOD ( 20.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, devicetree@vger.kernel.org, k.kozlowski@samsung.com, stephen.boyd@linaro.org, oscar@naiandei.net, arnd@arndb.de, pawel.moll@arm.com, linux-pm@vger.kernel.org, s.hauer@pengutronix.de, linux-usb@vger.kernel.org, linux-mmc@vger.kernel.org, mail@maciej.szmigiero.name, troy.kisky@boundarydevices.com, javier@osg.samsung.com, Peter Chen , p.zabel@pengutronix.de, festevam@gmail.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some hard-wired USB devices need to do power sequence to let the device work normally, the typical power sequence like: enable USB PHY clock, toggle reset pin, etc. But current Linux USB driver lacks of such code to do it, it may cause some hard-wired USB devices works abnormal or can't be recognized by controller at all. In this patch, it will do power on sequence at hub's probe for all devices under this hub (includes root hub) if this device is described at dts and there is a phandle "usb-pwrseq" for it. At hub_disconnect, it will do power off sequence which is at powered on list. Signed-off-by: Peter Chen --- drivers/usb/core/hub.c | 73 +++++++++++++++++++++++++++++++++++++++++++++++--- drivers/usb/core/hub.h | 1 + include/linux/pwrseq.h | 6 +++++ 3 files changed, 77 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index bee1351..cc0f942 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -1684,6 +1685,66 @@ static void hub_release(struct kref *kref) static unsigned highspeed_hubs; +static void hub_of_pwrseq_off(struct usb_interface *intf) +{ + struct usb_hub *hub = usb_get_intfdata(intf); + struct pwrseq *hdev_pwrseq; + struct pwrseq_node_powered_on *pwrseq_node, *tmp_node; + + list_for_each_entry_safe(pwrseq_node, tmp_node, + &hub->pwrseq_list, list) { + hdev_pwrseq = pwrseq_node->pwrseq_on; + pwrseq_power_off(hdev_pwrseq); + list_del(&pwrseq_node->list); + pwrseq_free(hdev_pwrseq); + kfree(pwrseq_node); + } +} + +static int hub_of_pwrseq_on(struct usb_interface *intf) +{ + struct device *parent; + struct device_node *node; + struct pwrseq *hdev_pwrseq; + struct usb_device *hdev = interface_to_usbdev(intf); + struct usb_hub *hub = usb_get_intfdata(intf); + struct pwrseq_node_powered_on *pwrseq_node; + int ret = 0; + + if (hdev->parent) + parent = &hdev->dev; + else + parent = bus_to_hcd(hdev->bus)->self.controller; + + for_each_child_of_node(parent->of_node, node) { + hdev_pwrseq = pwrseq_alloc(node, "usb-pwrseq"); + if (!IS_ERR_OR_NULL(hdev_pwrseq)) { + pwrseq_node = kzalloc(sizeof(pwrseq_node), GFP_KERNEL); + if (!pwrseq_node) { + ret = -ENOMEM; + goto err1; + } + /* power on sequence */ + ret = pwrseq_pre_power_on(hdev_pwrseq); + if (ret) + goto err2; + + pwrseq_node->pwrseq_on = hdev_pwrseq; + list_add(&pwrseq_node->list, &hub->pwrseq_list); + } else if (IS_ERR(hdev_pwrseq)) { + return PTR_ERR(hdev_pwrseq); + } + } + + return ret; + +err2: + kfree(pwrseq_node); +err1: + pwrseq_free(hdev_pwrseq); + return ret; +} + static void hub_disconnect(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata(intf); @@ -1700,6 +1761,7 @@ static void hub_disconnect(struct usb_interface *intf) hub->error = 0; hub_quiesce(hub, HUB_DISCONNECT); + hub_of_pwrseq_off(intf); mutex_lock(&usb_port_peer_mutex); /* Avoid races with recursively_mark_NOTATTACHED() */ @@ -1733,6 +1795,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) struct usb_endpoint_descriptor *endpoint; struct usb_device *hdev; struct usb_hub *hub; + int ret = -ENODEV; desc = intf->cur_altsetting; hdev = interface_to_usbdev(intf); @@ -1839,6 +1902,7 @@ descriptor_error: INIT_DELAYED_WORK(&hub->leds, led_work); INIT_DELAYED_WORK(&hub->init_work, NULL); INIT_WORK(&hub->events, hub_event); + INIT_LIST_HEAD(&hub->pwrseq_list); usb_get_intf(intf); usb_get_dev(hdev); @@ -1852,11 +1916,14 @@ descriptor_error: if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND) hub->quirk_check_port_auto_suspend = 1; - if (hub_configure(hub, endpoint) >= 0) - return 0; + if (hub_configure(hub, endpoint) >= 0) { + ret = hub_of_pwrseq_on(intf); + if (!ret) + return 0; + } hub_disconnect(intf); - return -ENODEV; + return ret; } static int diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 34c1a7e..f52169c 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h @@ -78,6 +78,7 @@ struct usb_hub { struct delayed_work init_work; struct work_struct events; struct usb_port **ports; + struct list_head pwrseq_list; /* powered on pwrseq node list */ }; /** diff --git a/include/linux/pwrseq.h b/include/linux/pwrseq.h index f726e7e..36dde42 100644 --- a/include/linux/pwrseq.h +++ b/include/linux/pwrseq.h @@ -15,6 +15,12 @@ struct pwrseq { struct module *owner; }; +/* This structure is used for recording powered on pwrseq node */ +struct pwrseq_node_powered_on { + struct pwrseq *pwrseq_on; + struct list_head list; +}; + struct pwrseq_ops { int (*pre_power_on)(struct pwrseq *pwrseq); void (*post_power_on)(struct pwrseq *pwrseq);