Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752463AbdFUGnp (ORCPT ); Wed, 21 Jun 2017 02:43:45 -0400 Received: from mail-co1nam03on0075.outbound.protection.outlook.com ([104.47.40.75]:57840 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752276AbdFUGnV (ORCPT ); Wed, 21 Jun 2017 02:43:21 -0400 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=fail action=none header.from=nxp.com; From: Peter Chen To: , , , , , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH v16 4/7] usb: core: add power sequence handling for USB devices Date: Wed, 21 Jun 2017 14:42:05 +0800 Message-ID: <1498027328-25078-5-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1498027328-25078-1-git-send-email-peter.chen@nxp.com> References: <1498027328-25078-1-git-send-email-peter.chen@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131425009985045742;(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)(336005)(39450400003)(39860400002)(39840400002)(39400400002)(39850400002)(39380400002)(39410400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(189998001)(498600001)(86362001)(50466002)(36756003)(50226002)(8936002)(48376002)(2201001)(356003)(7416002)(7406005)(104016004)(8676002)(77096006)(81166006)(39060400002)(305945005)(38730400002)(33646002)(2906002)(8656002)(54906002)(2950100002)(105606002)(50986999)(76176999)(106466001)(6666003)(5660300001)(5003940100001)(53936002)(47776003)(2171002)(4326008)(85426001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR0301MB0632;H:tx30smr01.am.freescale.net;FPR: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CpTPq+2zkWPW9rDzXaD7wgHtrb4apSyhXa0?= =?us-ascii?Q?zG0h7N5OYjT3PDVucnvRAmxOQet8r/52GiaFeKohajnRxhevZGO5lggAJNR4?= =?us-ascii?Q?+1stZIeFZRe49QFQs7WS7jmwvGlaiRajdAjvdcIDqp+ilWxx7pHvmPoL3a9l?= =?us-ascii?Q?3qG0rZPj4kS5bwUBxuAOIz2JN+Ntfj7jedA3kFyQpFCHOrt65pebUlK4RUMC?= =?us-ascii?Q?Hyo49vPrMzp47W4NwQorWWD1AO5JUT5rdkPUM3oBcfIi/QENBZe/STr5bTyv?= =?us-ascii?Q?s5pBRV2xqYlDE6rBrYcuuSEFyLY07Rqj+O6eZqes++17j/yWA=3D=3D?= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62fd7b4f-f73b-4e96-022c-08d4b870cd35 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131430075)(201703131517081);SRVR:BY2PR0301MB0632; X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB0632;3:DJowLJ166Z16VgpZlnrFnslyhGpuuIsu8eKZQChG8rCGFEZfxpwfK1UFqIQXD/3mhCIvhCZIhHJxugoSqOUUj3LLyQ102mSfM95+I8Po/S0z5Q5zCs8yWayjEp7O16Nq0R13/OqzqXZkjR2y/Vh1T+8N/1skr/6hdr9j1YYYjLPHQm9oL3BtGQIil5CzmB51QfMRM7HeTmN2D7hL3lmysEKYKYnz5XohxOmzvg0wfop25ldDeJkVbfVDcAcIJhiyTBawJvpruhSeZpidj2/2BzDkZDHvYliroHV5D17WwEyvDXV2wSSKlqvOh4hfXC3fDHizrn74oKhUUpvBf7M9o38VlWTmtdxBY+7drQ3RXaxctc5U4JGhnVlqsUboHCL2rMvJfK13YGZHdWkZ4k8rSwkBljpaCYKhBUyezV8SwumcOVs9jFRXT9QSKy3IcpLz;25:RKEJe4se33xkcmhbnzV/vO4+oRh8Scp3XRbHYapGQemK4nhd40/agqStPR5ipKQJd60BhhSds16Xk6DxaJ79q46fqISWu8xCWJtmVXL5Yimwlmi6oZQXv+kzdqs+LpbNUVDyqJSt4Xjd0w4l040qhvKXhY684huUOZPLqK0fzbmJy4zTy7KSojSOq473yGmE21UW8Gx1wtBJ8l/fWuYaPn7kLD1o135b6DZzWJlfnVitLanORrFMOGSuCPVZeaO8lu0gYxbgKczuKJ403tUbYlIFxr1GDSIXHXKD5+QjF2BtgPTHIr/BEQkyB7//jm3iP4ll9RocYrGXATghrVi5s99JguDKdoMz2arshEwsovqrJxjkpWhdfbi61i2ZyYWrL5D9rbuDun2RwdUl4ilz+XERXBeUVzQ2er/uSD8DOvPXbR1QCaE+iFFsFG1Xe8rJ6DsGpiuzBoDkNxwxxdP6iYlIZM/EihE6bDAdR/WqMFQ= X-MS-TrafficTypeDiagnostic: BY2PR0301MB0632: X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB0632;31:pyUO0g0Ex8zz2+b05SsZ+kWu+q/Gvjy1IiVACqGC2ATLtTr8hLEaPWypD3g0l5jjJrXQZjneLL6PKN2YjxHnygvuS8U/+bKTkxhLavtkotWFE3WLU5/wai12AlvyBnTBwGQDZ7fwjmTihh2zyUWHYar07q0lT0uwrVz8qnFXOK1KlqNlXbMlUC+jcRlolvkuvUi9O48HTNSEi81oc3VYNRRH/E8ckA16d97b2MzVQ8e3VhggaLBNHIA5GVpCKSMOhjNnTnwxXRfJgZsBzZMQpg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(35762410373642); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(5005006)(13016025)(8121501046)(13018025)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123561025)(20161123565025)(20161123563025)(20161123556025)(20161123559100)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR0301MB0632;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR0301MB0632; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0301MB0632;4:XbwaJBg7Wjvo+eqclEXVL3SbkKYMTKn+MyyY3CbE?= =?us-ascii?Q?ikk3qs8vLs7kUXz6FiabQsTgetx8RXzQQMf/Jj7RmK/m76MCUIUneOP9nsHH?= =?us-ascii?Q?0nLaDGhTzkgUM3O44TfUiXKRlAe7S9p/jRBjXZ8h4C/QV40KfAeapKjqXyoJ?= =?us-ascii?Q?1LiqqvzOL6q5ozwCQV9/bWNhkHrs0SG74IM2ySO3Z+i3TwgDguSvAHK5GIeW?= =?us-ascii?Q?yIuCbkzHCNUJIP5+lO5PuyYD6wjbMk00jgz+5v2ViRxDLoFjmc2PdVuLMFbZ?= =?us-ascii?Q?FMooleKw3Yga8XViu5qR/PivrPPI1qL1yBQzfSXYRhEqwnxUTEp8kZ2DJkWg?= =?us-ascii?Q?jWiQPceEohNiR8Tzgi89sjsMqRPPguzUXAIDK17FXZKsJmNCLUrOQxTtQuVb?= =?us-ascii?Q?2mLdYWMCaFvfyUIzAcpasTzyjUL8+2i2Glhd/QfQNEo5n5hsm6mvd1Lyrmz3?= =?us-ascii?Q?IGAg61+ybH34+teo0Rt2xbU2PBsn63SyJyKRfd8H4gPeIKpHdSe8iPuBMRJE?= =?us-ascii?Q?YcddZeq1NAKFdUSiI9AGQw7aX/VbBbxP3JklzqjO/s7NrVcCAlGR65B2B0mb?= =?us-ascii?Q?PVkPEuQb7sXDg2i8iLNRrZkoIFwZTE/6BtaOEvHkmVxX1ApFBvkpHcqB3pJn?= =?us-ascii?Q?JxbhIuUNxJ8wE2QxSTtWYrhGfsWAfUJbTm98UD9vLg+k6OXV7+vEdQ7kQchA?= =?us-ascii?Q?T5VYCViBzX4p7HGJzF5z/pivFC/Gnpgj49TgEouCe0maxcprlxQQJaT0fin6?= =?us-ascii?Q?XndyvP4tidetfahkPZz21TKIFbionVT2BWZ4032sz1Aipw+37ypFytfUqPZW?= =?us-ascii?Q?r9BZnmO4BWyqvhQm3YEHBKyBPNbcBCo8fmFjCTUzdPNQehHUnX0KLpLx7w99?= =?us-ascii?Q?1jifcTcaL9CVRbK9VIxrAehsvW24BFuYcyNgvA5GZ1pOmbhKShIfEAtfwt85?= =?us-ascii?Q?KqHuY7ZZvrkEaXasHjz3Zf7X7GVBErbKiG9AJJVJl7SDDhBcDY0+nhsLh+FT?= =?us-ascii?Q?VWZEXJFdSKR9iYWBIY7A8n2Am0vRy6l8L/l4dFhOPHrPucllQ51SnSDRdgs1?= =?us-ascii?Q?Xqj5I+7Fk9esedWcSauAAnbzQjzGe7vjOZgG8x3IwWKZ4ne5KkzWW+uX5tdq?= =?us-ascii?Q?4HvBhPFKSKvClZM6mgkmFDXWk67bX1BPBVoGcTYVNe+yp5ECwahOhr/Is3O7?= =?us-ascii?Q?RP25nc5b4CnVTFqbZCdH296V5dvEUAN4HruFb9be1oF40QAx6UQgCU6owU6A?= =?us-ascii?Q?e2GLuPVXJ2QaM6RhOqjLg9XqePcKgnzyNHL1w/DxwnJq5yUVOdHQ10SypKNh?= =?us-ascii?Q?4A=3D=3D?= X-Forefront-PRVS: 0345CFD558 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0301MB0632;23:GxJ+RxsrrF1SdRI4C94X7Hq2gzMPeUk7tU8T95S?= =?us-ascii?Q?DFZYR5A5QK+JBAIYCP/tq1dVBXMGpUbmtFfjJ2h/eMYtLcQj3LMqoVuwIx8Z?= =?us-ascii?Q?Av1+prLA7EWX4bgffemijKQPIxDzyGp3GnwP35v6ukh/Tpy3EiR50Zco6oBj?= =?us-ascii?Q?n7N39VwH6wwQuRBHf/9JOPJ4pi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a2+MxUH70?= =?us-ascii?Q?KAAwkNvje8rqU8pfrreuuQDuoymQLYe+bnvHPmzUbJd47imsRW6BajV0pNTL?= =?us-ascii?Q?cJsF9QZ3PFzyDuLz1azPfEjHQuwpr6q1tBKqqnuFaA9qGqhDFxZlxQaruuUX?= =?us-ascii?Q?KF22ZnH6o1yTpkJrUx/Ziz2WsSRMfvO4nUuIIq+sGft4UHmXU+myCHC5XhAO?= =?us-ascii?Q?BZOnnBg5Kx+CnVTA9PTpfpjarx8n1U9kP4Dm9vGajgbymI3WILyJuvVOwEaL?= =?us-ascii?Q?kiQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR0301MB0632;6:9ebFJPM0T2mXS7HP/kMBktARzvygjVuMu/AO+Jqz?= =?us-ascii?Q?eFOnBsac7ad4eykZSPyCD6SglhEiSzZ2+arwOdMlkIpqAHkmA4S2U6bLGCVy?= =?us-ascii?Q?suGgX4oUiioFtEtSI2bqoAIBEPNg7e4l2tmw5uoxN3bnYMIPslAzJs9G6EPE?= =?us-ascii?Q?jdQSr4GMLBwH0B505XOkLJqg4ms7ZwGnO4nSbwDukWasOe267rSbOOoj6tG9?= =?us-ascii?Q?Bk2/8495YFRexYr984hSDhi/7lRgmbNBegjRsGvQcNfQWNydObHUXduAPxmV?= =?us-ascii?Q?G3Y1Zf1vfm9irIss+b3ZNxfUpBwi4DRs0YJs7drZRAm/f3vOPEj81CMVwAuN?= =?us-ascii?Q?F4qPzxq2fKpO/ASw149pEuhbFkCwZ+5eYvKS2QvvGZltzaGiwsZXxZrWYrHQ?= =?us-ascii?Q?u80dQR0PPUIG80MhMeB6Pgol9Nqk/r2TQMhHTUlVFYYzU9Ahr8JTn8ZaxgP6?= =?us-ascii?Q?DjtFXXrSwRkNFong5uDx1NVkDecKyahVxsti9gkpbsQ2lJyN2gh05GwIfa0u?= =?us-ascii?Q?3nRue6XykdtsWqJXAS+egCamJU+9hNV3ID7vMgESfLzR4//Lh1cuE0cR4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fww==;24:i1ssaexJ/o+2FyB/qthcd1G546Qaixs0XD5bl7hk9tz0IR2tPBqI209zsyoD5hGt/XKlug+LiA+P6Kt3ELHXc/GvNPSoP6nGzlT8HE5/pfM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BY2PR0301MB0632;7:oozUB8ispu+TFthUSQcbWgE1cmfKbl/EF2dNG3n6qB9wdSIuwx81M9GRlfFyNUVCzP+iQmNQmL9Euuk/h7YDCaQAXP70VPxnjTQuHqJl8fQVGtavjEbTM1+akyyoYKww2cIRU0s1xREA4aCge7A/g/l/CjxWVIZ7S7A6IejoTfr6wrU82sUhwtH50c2H+FZqcW8aOOmtwcj5WPGsjAc6YBc6I5Iyvmo7FJWHTOLLDOcWrQ0kXmQZ6VzEOcohRd4N4A8wCK8k+unP+Op4ys/iRdb3t5Jnsinau4IJVHxRFbaaiNlbM5my2DI2vFaRn4AuaWyDcJR8IpzP82a/xLlc41f5GcWzJ6OXhtuYiIn45i1E5uOJRz9QfUG7dZwBiK25w9V5Ly7uDIKBMZHwgB69huQGVeq6ocH3mg0tKtkyu87kVuDad2rOHnysSQhn3/v3JLklLe/JQm6J6VNBGSIwQDB08hrsviwqQl8IrlNIcTkFoHw3CXomKEPUBAvhqOyUEy15VpBzI+t+d3eZFCoQ6pnq0qcYdRDNEYWnXYv5NGoqR3QM5COx32hglK7sDpNRyNfPm1O141K1nZx7sbsg7AYL8smGcBtD/GC/4d0QUg3Dau8A9nxWEIvTrym4DduJzLZn7EkB2ap+Xp7bRizK/vqE1Uq7gF7CEYmaCuc2gvj+5gUVnp43ua4R8N8hJ7FXayvxpF0KYjr4zPI6ZMWBh4sJ3ts1hp0TLqa3ecpf0zXg9l2wqS/tV00aVywZow+efwszum+jidu+6Zc4TZ/Fv2QJTCU70U1NdTGRl31TmeA= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2017 06:43:18.0053 (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: BY2PR0301MB0632 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4682 Lines: 159 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 calls power sequence library APIs to finish the power sequence events. It will do power on sequence at hub's probe for all devices under this hub (includes root hub). At hub_disconnect, it will do power off sequence which is at powered on list. Signed-off-by: Peter Chen Tested-by Joshua Clayton Tested-by: Maciej S. Szmigiero Reviewed-by: Vaibhav Hiremath Acked-by: Alan Stern --- drivers/usb/Kconfig | 1 + drivers/usb/core/hub.c | 49 +++++++++++++++++++++++++++++++++++++++++++++---- drivers/usb/core/hub.h | 1 + 3 files changed, 47 insertions(+), 4 deletions(-) diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index 939a63b..b6f626e 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig @@ -39,6 +39,7 @@ config USB tristate "Support for Host-side USB" depends on USB_ARCH_HAS_HCD select USB_COMMON + select POWER_SEQUENCE select NLS # for UTF-8 strings ---help--- Universal Serial Bus (USB) is a specification for a serial bus diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 9dca59e..0439d4f 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -1619,6 +1620,7 @@ static void hub_disconnect(struct usb_interface *intf) hub->error = 0; hub_quiesce(hub, HUB_DISCONNECT); + of_pwrseq_off_list(&hub->pwrseq_list); mutex_lock(&usb_port_peer_mutex); /* Avoid races with recursively_mark_NOTATTACHED() */ @@ -1646,12 +1648,42 @@ static void hub_disconnect(struct usb_interface *intf) kref_put(&hub->kref, hub_release); } +#ifdef CONFIG_OF +static int hub_of_pwrseq_on(struct usb_hub *hub) +{ + struct device *parent; + struct usb_device *hdev = hub->hdev; + struct device_node *np; + int ret; + + if (hdev->parent) + parent = &hdev->dev; + else + parent = bus_to_hcd(hdev->bus)->self.sysdev; + + for_each_child_of_node(parent->of_node, np) { + ret = of_pwrseq_on_list(np, &hub->pwrseq_list); + /* Maybe no power sequence library is chosen */ + if (ret && ret != -ENOENT) + return ret; + } + + return 0; +} +#else +static int hub_of_pwrseq_on(struct usb_hub *hub) +{ + return 0; +} +#endif + static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_host_interface *desc; 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); @@ -1756,6 +1788,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) 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); @@ -1769,11 +1802,14 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) 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(hub); + if (!ret) + return 0; + } hub_disconnect(intf); - return -ENODEV; + return ret; } static int @@ -3593,14 +3629,19 @@ static int hub_suspend(struct usb_interface *intf, pm_message_t msg) /* stop hub_wq and related activity */ hub_quiesce(hub, HUB_SUSPEND); - return 0; + return pwrseq_suspend_list(&hub->pwrseq_list); } static int hub_resume(struct usb_interface *intf) { struct usb_hub *hub = usb_get_intfdata(intf); + int ret; dev_dbg(&intf->dev, "%s\n", __func__); + ret = pwrseq_resume_list(&hub->pwrseq_list); + if (ret) + return ret; + hub_activate(hub, HUB_RESUME); return 0; } diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 34c1a7e..27f56a6 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 pwrseq node list */ }; /** -- 2.7.4