Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751346AbdFEGzr (ORCPT ); Mon, 5 Jun 2017 02:55:47 -0400 Received: from mail-by2nam03on0041.outbound.protection.outlook.com ([104.47.42.41]:44992 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751267AbdFEGzn (ORCPT ); Mon, 5 Jun 2017 02:55:43 -0400 Authentication-Results: spf=softfail (sender IP is 192.88.168.50) smtp.mailfrom=gmail.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=gmail.com; Date: Mon, 5 Jun 2017 14:55:37 +0800 From: Peter Chen To: Peter Chen CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v14 4/7] usb: core: add power sequence handling for USB devices Message-ID: <20170605065537.GE20014@b29397-desktop> References: <1495068543-6938-1-git-send-email-peter.chen@nxp.com> <1495068543-6938-5-git-send-email-peter.chen@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1495068543-6938-5-git-send-email-peter.chen@nxp.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-EOPAttributedMessage: 0 X-Matching-Connectors: 131411193406841277;(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)(39380400002)(39850400002)(39410400002)(39840400002)(39860400002)(39400400002)(2980300002)(24454002)(189002)(199003)(9170700003)(97756001)(33716001)(105596002)(106466001)(356003)(50986999)(76176999)(54356999)(8656002)(83322999)(189998001)(4326008)(55016002)(33656002)(305945005)(104016004)(82202002)(39060400002)(8676002)(2950100002)(6260500002)(8936002)(73392002)(81166006)(229853002)(77096006)(1076002)(47776003)(2906002)(1720100001)(50466002)(6916009)(73972006)(7406005)(7416002)(81442002)(23726003)(4001350100001)(5660300001)(966005)(110136004)(38730400002)(83506001)(46406003)(54906002)(498600001)(6246003)(53936002)(9686003)(6306002)(86362001)(76482006)(87572001)(18370500001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR03MB2573;H:tx30smr01.am.freescale.net;FPR:;SPF:SoftFail;MLV:ovrnspm;MX:1;A:1;PTR:InfoDomainNonexistent;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD025;1:Ji2KJNNpEi0uejws7EncNV5BcXr4jckM5dUn1+LSL0J1JhGKdcSlxAbYKS1+QhiYeHpZX+l625ofL8WVeEBLfQ5EpR/NwaJlI2Zg2aORNKjPkFerBD190xT2ErGvTJ7O/fd0qYi7xu8uacFTDZ7tR9i7nCT3wk/2uhkn9ezwIV8Fpzx4K/gGxBSK4bz8UYy7w7rFRWLCOpIowmxdItDtR/iaFAEz6pvLlHvcwYn8cfK0ZvICqq02TZcIwREIGMOgic7pC2pM2BJNWjmsssgW+mEt68GeyAUlRs8jDLx/oBu3wk/by4mZteoUhD9WhTDKwSttZBXOkLLyEnIgIla5FHOIGhphaQLgDvySopmRW9OZncrA9GIXdb4gtRJ2j7Ax/+7yLbDF0CZZ3nsWLN2wIXF+l4CUpF9csFRmaoRIbuRj3Jt9rLyk0D1QXYcgSMC3JpvD4te6C1RZF9xx20yXcQifL0NXTgBgUtjwgDKx/2CvR/wQ5P5u9PvjmCsiNxH/WUzYm6zcAMvUqaXgylIGm9+sBEYfU1j+DIo0LtPBQbGu2EOA8kwhQt7oPmDtreYS X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR03MB2573: X-MS-Office365-Filtering-Correlation-Id: 7e739a79-db4c-4e20-005d-08d4abdfe0fb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(201703131430075)(201703131517081);SRVR:MWHPR03MB2573; X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2573;3:TkldhYzWhFREnDrNrLudRZ0kF+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br1eipKfJ9JiZfX8JHb5Z/8mXpqBKEOjKjw+dJz8u60g6JfFi+IM7UBOGnS+4WBiTgdnqdHpYO7VX2lvnrCewg6UbhMJLjnNNkO6qibrSz1PM0PEfJ4D2ydSINJYnKP5SHhl1nibG2MAe4Q== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(258649278758335); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13018025)(8121501046)(5005006)(13016025)(100000703101)(100105400095)(3002001)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123559100)(20161123561025)(20161123556025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123563025)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:MWHPR03MB2573;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:MWHPR03MB2573; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR03MB2573;4:SRgJ7YqlEA8WPV6C6P1WXHZa/WhrFfndD0zQNyTBC0?= =?us-ascii?Q?g77R4+EorZlCcFxAcA0K/KGWsI+hnfZxzTEZ/wNwXb0j+PBOrC2blX89AzSC?= =?us-ascii?Q?lLAizjiLTe7r4TWyU6J7TzAujrx9VWaUhN3/m9hZWsNvg5ScZPUfQpZXMYIw?= =?us-ascii?Q?zKZtyZeV693PhtiSH5HmWXUaOI3maZglm0uSo8RNRXQAXA7afGZTtAwDIn1T?= =?us-ascii?Q?2TGTNwKeCtnly3X5tSMmVVbxu1YdSpyadMIjI5s6u3PWTB4r/QxxPIERrVK/?= =?us-ascii?Q?7K6moMBT0YzLv+raEAt62U8KRvCzvaercqAatoOxo8yvG5IIw+A4oeVFyEO0?= =?us-ascii?Q?DH/EYc3/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us-ascii?Q?7BFr0yph4SqjhyXQBQ5gKUbyu0q7pwhmC3uDmEwyYe/ENDpaNcpWkQvsxFuw?= =?us-ascii?Q?=3D=3D?= X-Forefront-PRVS: 0329B15C8A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR03MB2573;23:h91bYGz0S4lKHD2s1XdsoJ4arPzTmiDrUnbQ+fzTy?= =?us-ascii?Q?Azhd5G0ShSu7dyAdagbAa/TdWZ7/fr2Js/noOmwVpMfhpJ0KWNK5fgHk5MYi?= =?us-ascii?Q?k7zlyL7p9i8IcML3D/Qd1nZTFsYE29zDwqEld/PQS0yMExl94+lURX9UOC9o?= =?us-ascii?Q?ePlX+tp+2LOhp8JVnPBnOOZjQbHg75RYtjKv6WrqcqOMpiy1Fc5GD7tmjsjl?= =?us-ascii?Q?X9CD6Af+tgTfGs+l5juFIMYz+/EV0yNcJpheg+wHbcmKiCZP4VGK93OvzLFR?= =?us-ascii?Q?C4UwYkf7XuQWrJibCqH6uvmV25Zr8VE6tJhmYbVH1NE5n55bsaidyXJ+q4zN?= =?us-ascii?Q?l/6UxQz4/lxtycVV5FehgwnehdrHke1EqTnw1Aar0lVn54mWL2tp1klqn7IA?= =?us-ascii?Q?t3leJqpG74sin04D+kVz+qIvxd/MbZaQtbqtMs1OW9Gdiwy6iC4TLO9Y1kbR?= =?us-ascii?Q?ZrFxH96wiAIIomCfpuIKwwQPXxpxdppXEH5wrFFwdF1Bo6UFgJiqeFEHsnkW?= =?us-ascii?Q?N5AiSI8e6GUXCQQGuM+rPIAU9zccMhZ0koEeaNMZcJxduFq4fwGlQEXj6+uD?= =?us-ascii?Q?/0Mfl36soAVWxBOjvA0aIinwVJaxSMyq5r0+EifFGpeOjplAd8QJXuD1k5In?= =?us-ascii?Q?qCI9QHdcmFDqfSlCxp7xybLVUkq1DI8mlRJ7YnPmvpocwczlA666IxHg0Ciy?= =?us-ascii?Q?oS6M8LYftbX7nNRbimlvcHGKbH0f2VnfIH2ivSOxDko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dVmdMR+YtMqnEHjLhzMbPxPCXSgdchwNw5E=3D?= X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2573;6:lFJ07hzACP736j8weVKh7zXt07qD6IFvMa4hB25z991RUZalZbXxw35S2mAu+s/es1RFDu26kuaD0E/hHe3rpWyXy2sRxmeq+PxM7ArjdKNUCWJMVo/wlZr66dRN9jUU3Nac9R4uaejeFBW+UoaAQPh+/IveKiODAXVS2osfEGpgHcDqh5h0QfB0VENEj0xt31TQSBdmy0WGpu8NwOocgj3oCFKCSm1gOsYAnIV/ri8sQgsuIYmYxM1qcqZCFn5VWCObCvyLGtqI6TWoRyTnUe115IDKc/8VU0pAmYeINmgfINAXwYKTh95Lw+5ZST2aVASfohfrwVveWWgGhz1UENbZ/E/qjo1sNX4hv8ZxRwQK8p/RFW24snA3tiR6a+oWoW2uYvWqgBSsB+WCy1AVdagToIUdot55bglmQrmmRpaaAmM/h9zOd4nEZpQ+uCvOCxRchzQcZbt+/+nrdDp3728+aWDsH6kzdelkgTXnKjenSEP99v6zR1gbHC8OCbwl9XsEZLgpzMfP50AxKtbGAw== X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2573;5:hyILYVlQSJfk74RKnWRojGCODbTMuvq1o3xfMSPy4I0eno2xkJF1A8i5OGZdjkYTxMPrwlCQSB8AZHcdwYfDJWbYGTCC+LTrz00iGfLCG28PTuy1KEFTQBSyFjhAD6va7To1WNeTLihNmgI9w2qkmxTpaNf7zFcIsh3ovHz7pgoTtRmwb5GtBgRYG1pTWcIIrNUHosXdVxNj5Nwyq7sVN9R/+ACUogWZulc2eaznG8NE7Hcde1JYkSMc19dDHFfwtmVRVrFrK4VVASpINRnzdWxKy7oLaosj4VJPUzpV7OIMlED/z3fOM6Gji7K+t9sQbwx1HC+See45t0SVL1YTK45iZuePRlkzsZb7LNRBFl81oNSvqv5hR2RHnLbT0x/B63OeB8jEC6sWBimKazCI5RWpVbhYWrX83AERDTsoAdJnYeNLWEgvnB1kOVOVkJioljkakVsZL7vQ7Ym2peDs0+VGeTkL2aI+Mnh5OeWPwTvce9r8vunsBQkQk5tuCIQjv2+81AkvovyIqoRj3WGxCA==;24:4Ea6hqOV6P4HI9uOFOB3SAnJ4rS3YwNy+JlMb8YXeC4yAkpr1Ry0pkqWDu1LEFr3nj4dt/GMehPL5xK1X9/cz+k1HHxRBSvlBCEA6UfJyt0= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2573;7:PS92XqKplv4UBy5bzxGmO1ldFF3kyPORAOxFd/zI35CAbFuOfm5MJPaIOSHcV2W4J4Dcs7F8HloNW3KPpy2xi2XiQ15QVkC4SDAml3Z8FggF0momXBQd/WWXrwqVCGZxqU59qlFg9NoMLhC2zqy8l8ETxtkRbbgvWFjw4AaT54BffqR504WTGoQS7Vcb4s9B8r387azv3MLxmqpxAuXmVCCVgLmorJTZ1bo0ndCt4gKsyYlnHglG9Jf5FySCyOu6YvYcwvw87HC220V1p3H9QPJ9seM3go4ScUGYD98tES14zyf0RcMDxSoWa84a+dVQZJL60EhRgf+2mjYdYJ7dlg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jun 2017 06:55:40.3877 (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: MWHPR03MB2573 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5427 Lines: 177 On Thu, May 18, 2017 at 08:49:00AM +0800, Peter Chen wrote: > 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. > Greg, Alan, would you please help on reviewing it? It seems Rafael is waiting for USB MAINTAINERS's comments or ack. It resolves some USB HUB issues for several persons. Peter > Signed-off-by: Peter Chen > Tested-by Joshua Clayton > Tested-by: Maciej S. Szmigiero > Reviewed-by: Vaibhav Hiremath > --- > 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..7a67296 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_on_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_on_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_on_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_on_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_on_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..cd86f91 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_on_list; /* powered pwrseq node list */ > }; > > /** > -- > 2.7.4 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Best Regards, Peter Chen