Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753895AbcJNDA1 (ORCPT ); Thu, 13 Oct 2016 23:00:27 -0400 Received: from mail-sn1nam02on0041.outbound.protection.outlook.com ([104.47.36.41]:60784 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751393AbcJNDAW (ORCPT ); Thu, 13 Oct 2016 23:00:22 -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;nxp.com; dkim=none (message not signed) header.d=none; From: Peter Chen To: , , , , , , , CC: , , , , , , , , , , , , , , , , , , , Peter Chen Subject: [PATCH v8 0/8] power: add power sequence library Date: Fri, 14 Oct 2016 10:59:47 +0800 Message-ID: <1476413995-20361-1-git-send-email-peter.chen@nxp.com> X-Mailer: git-send-email 2.7.4 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131208876189473351;(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)(1110001)(1109001)(339900001)(189002)(53754006)(199003)(68736007)(50466002)(77096005)(8936002)(15975445007)(36756003)(7416002)(2201001)(6666003)(626004)(50986999)(47776003)(105606002)(48376002)(5660300001)(11100500001)(5003940100001)(4326007)(92566002)(86362001)(229853001)(50226002)(356003)(2906002)(7846002)(81156014)(33646002)(8666005)(305945005)(19580395003)(106466001)(5001770100001)(85426001)(97736004)(586003)(87936001)(2171001)(8676002)(189998001)(81166006)(104016004)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:BLUPR03MB327;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11OLC005;1:5U2zisb5wUvUDnkKP1iY+VzPDjnSsaS92rd5GDoTMS7eT4ZN3E3RbyxhICKOMBRB7juyjA7spkarW4kPiLLHUP9vYSZPok3AG9OA4i1Mz17MsiaMh/AJHQgfXxnKqa4KW19rbF/u7RkyAOjwqqKdHLN8+QNGt9yJ5XTNHewNh1pw7ayB7qhL11+wP+0oG0wHKDge5PnYaYhhtDnJ/faJ7qDnD0DSxU1g5to7xWnkgS0wSxw2whdpgcjDd8DjHuIekBF9hfzVS1y2Q/Z8TKFI+C7NLyzAmReIt8MQnZ28IrLtFeSi0T4T27FQjwToOSvtYBhX7LGrHWw01oj3vV4CCyXuoTHDzYJO/OciRAuTLQ8jUweskx0J5efWL0oUpwtix4q37+3piXjaEJjuGJt00QlE7LlN9XSzRv1yI+/CVtzQregVjDzaqGMxrbGwmylFRtci8biK2VfWqFTnEuaSa8isnSUhrErqg/MgxVRWw33jK73z9ondgyQpStEmma3ElRf4u0/DsYszlItO7p56DAkRXkL6xMrJT10gWtxp63aA/Ofq8V54Jm7HTllLNG8qH+wMLApiV2/HECg1DVg9ehtUDUseQzbWfjRHihOmLx5K6FLaDyikaHEjQGnzkEZRAhcjzJhfMspjsGsbiEqjOWekP00Af0HAkmQ4X7jw/pn7/kFUaHHne1QAGp8zyBXA8vE46j8Q7WedZuk9rnyJTgyWb/4UjC5OFiXaTOUYWpXWRPxEUwXUwqqtRDmsgOHA MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: ca10bdcf-d8b9-486b-78e8-08d3f3de3b1b X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB327;2:qp4HTOD0F0qHRCAFj1bVx0rY/RUyx2593zpzjfGdKID3b4aKtoywGI3dY/iGfVQmDkNiDifft8XLAmaPVoM8Ql6XiKY0UZn/w2jsBhmmvvB9M7qDUZaAEYGNtzVIr1W94yfSVgf7SDr1HvsgEOLSmhU1io0vrBodgf7I1Xvr9DQeN6RXElfTsHBiMEBilFvp;3:UF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rue+tebgb22NYaH13fV3yfpHlRd2u2A9DRBud1XFzU76cS5OUrQhCFcCPvvXRadbJ96K0G06CZmnDChKJzxfSrOD+4M+WtLW7aq/MwQjPf+Kskdn3llHLNgXP2k= X-Microsoft-Exchange-Diagnostics: 1;BLUPR03MB327;31:urs8tfKDbmKMtD2zVT5Z4zD7CpNoosceGEqCB/1lrED9LJ16Rvjm7tQfHUuiXoxR3Gs6IZS22ksaJ58VBbuWrBXKAx7s6s5eAAnwvI5Pttjd7xnvvUPacRdS0mvcAu7Zbc8uPcwqQ/JroKFyO92iQjavBCRtss+7ZTWbUhhE+r0KSajurHc6a5AUylppn3cXzIzS/tkIkta/oX2HSqsBuyT4jUf3Ehk93LQIofFtaPhVG+LlCUv1G+yWKDv/TO+X67c8LMFPyhNZdxrwJ33uYBwzNgcujFvDpeAqVIfheXY=;4:L2UU5WpQLqjX0ISI0vMg0d04JxABbec1ItqwAxKtZ492y80650YVKl5Q1FulDKf7l8XN/hKXcTZcw3+vm8RDUz3O6uFSH8THFtqq2fnaiLYF/7wImqRm28A8tGl4uJWQQq7UbZe+ES9cKUUOJtKKXArpEOouZo8NEtoWvedB3HONHkETskbj7fHZd3Vg+JpRbOBgFNV9Al/HN9B1fLn+ynqsy8g3JRCS7Jhl2o84fu40qTcO8b0SsjtBGp6xLGTAlZCgqJt4OlyVfiizdC+j4mIpfnbXLcheqhyFRkMh08HmTobP13naHkmNKud1FZrhTjS7PpAVWeWfFsNxA8oMrH6Wmh8HdAOTI8+zkuUjYfGj7EQUTy8MmJxA15UdNCiTwn8ZEgnXSNOqIHcNb1uqVwl2f3WROH9ZWPQxtmVlQW4PjYtmr9lnfn0kUgVPo+KW+P4z2urBfSJ0/aLXLVoyfXCIfNWASEQmvn6fBwT8j8EKRKzRZfKoHcSsYJLD310p X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(13015025)(13024025)(13017025)(13023025)(13018025)(5005006)(3002001)(10201501046)(6055026);SRVR:BLUPR03MB327;BCL:0;PCL:0;RULEID:(400006);SRVR:BLUPR03MB327; X-Forefront-PRVS: 0095BCF226 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BLUPR03MB327;23:gYyQRJuK73zFg2jVbx/J95AhNctDy0g9UCFHssSNFj?= =?us-ascii?Q?HQic2iwZsaYirrs8o7cR81TKkNWoBMLAS+LxATYjbBuhvfz2hqiwg8W0tj1Q?= =?us-ascii?Q?ChTqv+3IJ4p3Ky1CD84Tq4VX1A+BU/3HAQBftmRAWYHXCfhMnipI3+yhIx9V?= =?us-ascii?Q?Wrj4oRt15bntEm0OLKzbBqD9C2HNlyxW9fgp4QaxWiI/twqBtt0uIYDJDL+J?= =?us-ascii?Q?TZHm6qj2azYDk4/s19C58kRhSlbTYWivmDnR4tGLBrWRyvrmqPK+BPITrxGL?= =?us-ascii?Q?fF18aELY4bVHN49k43ksWgJCUPaez9397jrkNh6hC/7V6ZCPr1k132WE5zIX?= =?us-ascii?Q?oXfd622jYVWPgUVB0MHPqxKCfH84W4kQVwsFnigLpWB7MSe84gVxqxjGKxKE?= =?us-ascii?Q?aEc7fAmfdRfpEsJeOho3cXWL9xQEEoSXAY+qpRxejGvNCS5PrDSzV32NJ5nM?= =?us-ascii?Q?y4vhF3of4oUgo4dmQeCzXBHnF9TkgOmHk7042TI2cCb7/6ve4USQHlp0bpIv?= =?us-ascii?Q?XC7oQlfypQa5bxuP4ZtE7bb/+gIM22yOFCkMmbhzTVjuDIAQudCfJ4+wYHgk?= =?us-ascii?Q?AeZwAgk4vlep+HQCjwDsrC87Op1HtmvZIiV4DVWdYDnFOV7oFcKaHZS3CBG+?= =?us-ascii?Q?jLiYBtY/8RY5RXmkq77yA0H/0xu1mijXqQ0LT0+AIPCOFnboVDY/vPGi3Zkp?= =?us-ascii?Q?qhLvWDMJZNgO20Fj0IJE0q+XEjtVwY2L81ARIcu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SIFwhQfpMGXZDQVY+9a59Qvj7vxsjstvfXd4Hx2jffjs/sAomMnuo6Jeo9IZBHvgBhc=;24:6RbaBepe1VEWD3yolRBAEYqezAYebjTx5zNvS78eKkxtwQfWl3L2wXwnIBHq4BMwcYOw9+qNRwDIpvDbF1EH+1T4fSjgEkjnKUEtYxInNTc=;7:iXrVunYOeewH6ckGDxU7YO0KjemO5Yf38SGSexCRp1AR/3u0DnMndfvUg+wriWxF1PCJg0lncw13vUMuBR+WILvvHbizhufUPjPK7nmGIPcp1Hz9jXONNQg6Q8dHFCEJqVAUCPlh+DZvzX7VJruDaKocjUIQ3x2NQ5L88ZU+IC/Kq5uGb6c6dtYWwZ/eVAGuOdxlzq1lmEQLZ2YuqlqL/Cyy+69fFHUUjeyl9NdipR92xbqrRkNwOWLLjfms4Vn6UVs2Rj4XUXHV27GIm4Hog8YPBiPsZ8YuI+r+aGZpkQUdq7ETHR3RRO6LUd7nQCxy7EgV6aKWqKOHlujGANadkg== SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Oct 2016 03:00:18.6977 (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: BLUPR03MB327 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5772 Lines: 121 Hi all, This is a follow-up for my last power sequence framework patch set [1]. According to Rob Herring and Ulf Hansson's comments[2]. The kinds of power sequence instances will be added at postcore_initcall, the match criteria is compatible string first, if the compatible string is not matched between dts and library, it will try to use generic power sequence. The host driver just needs to call of_pwrseq_on/of_pwrseq_off if only one power sequence instance is needed, for more power sequences are used, using of_pwrseq_on_list/of_pwrseq_off_list instead (eg, USB hub driver). In future, if there are special power sequence requirements, the special power sequence library can be created. This patch set is tested on i.mx6 sabresx evk using a dts change, I use two hot-plug devices to simulate this use case, the related binding change is updated at patch [1/6], The udoo board changes were tested using my last power sequence patch set.[3] Except for hard-wired MMC and USB devices, I find the USB ULPI PHY also need to power on itself before it can be found by ULPI bus. [1] http://www.spinics.net/lists/linux-usb/msg142755.html [2] http://www.spinics.net/lists/linux-usb/msg143106.html [3] http://www.spinics.net/lists/linux-usb/msg142815.html Changes for v8: - Allocate one extra pwrseq instance if pwrseq_get has succeed, it can avoid preallocate instances problem which the number of instance is decided at compile time, thanks for Heiko Stuebner's suggestion [Patch 2/8] - Delete pwrseq_compatible_sample.c which is the demo purpose to show compatible match method. [Patch 2/8] - Add Maciej S. Szmigiero's tested-by. [Patch 7/8] Changes for v7: - Create kinds of power sequence instance at postcore_initcall, and match the instance with node using compatible string, the beneit of this is the host driver doesn't need to consider which pwrseq instance needs to be used, and pwrseq core will match it, however, it eats some memories if less power sequence instances are used. [Patch 2/8] - Add pwrseq_compatible_sample.c to test match pwrseq using device_id. [Patch 2/8] - Fix the comments Vaibhav Hiremath adds for error path for clock and do not use device_node for parameters at pwrseq_on. [Patch 2/8] - Simplify the caller to use power sequence, follows Alan's commnets [Patch 4/8] - Tested three pwrseq instances together using both specific compatible string and generic libraries. Changes for v6: - Add Matthias Kaehlcke's Reviewed-by and Tested-by. (patch [2/6]) - Change chipidea core of_node assignment for coming user. (patch [5/6]) - Applies Joshua Clayton's three dts changes for two boards, the USB device's reg has only #address-cells, but without #size-cells. Changes for v5: - Delete pwrseq_register/pwrseq_unregister, which is useless currently - Fix the linker error when the pwrseq user is compiled as module Changes for v4: - Create the patch on next-20160722 - Fix the of_node is not NULL after chipidea driver is unbinded [Patch 5/6] - Using more friendly wait method for reset gpio [Patch 2/6] - Support multiple input clocks [Patch 2/6] - Add Rob Herring's ack for DT changes - Add Joshua Clayton's Tested-by Changes for v3: - Delete "power-sequence" property at binding-doc, and change related code at both library and user code. - Change binding-doc example node name with Rob's comments - of_get_named_gpio_flags only gets the gpio, but without setting gpio flags, add additional code request gpio with proper gpio flags - Add Philipp Zabel's Ack and MAINTAINER's entry Changes for v2: - Delete "pwrseq" prefix and clock-names for properties at dt binding - Should use structure not but its pointer for kzalloc - Since chipidea core has no of_node, let core's of_node equals glue layer's at core's probe Joshua Clayton (2): ARM: dts: imx6qdl: Enable usb node children with ARM: dts: imx6q-evi: Fix onboard hub reset line Peter Chen (6): binding-doc: power: pwrseq-generic: add binding doc for generic power sequence library power: add power sequence library binding-doc: usb: usb-device: add optional properties for power sequence usb: core: add power sequence handling for USB devices usb: chipidea: let chipidea core device of_node equal's glue layer device of_node ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property .../bindings/power/pwrseq/pwrseq-generic.txt | 48 ++++++ .../devicetree/bindings/usb/usb-device.txt | 10 +- MAINTAINERS | 9 + arch/arm/boot/dts/imx6q-evi.dts | 25 +-- arch/arm/boot/dts/imx6qdl-udoo.dtsi | 26 ++- arch/arm/boot/dts/imx6qdl.dtsi | 6 + drivers/power/Kconfig | 1 + drivers/power/Makefile | 1 + drivers/power/pwrseq/Kconfig | 19 ++ drivers/power/pwrseq/Makefile | 2 + drivers/power/pwrseq/core.c | 191 +++++++++++++++++++++ drivers/power/pwrseq/pwrseq_generic.c | 183 ++++++++++++++++++++ drivers/usb/chipidea/core.c | 27 ++- drivers/usb/core/hub.c | 41 ++++- drivers/usb/core/hub.h | 1 + include/linux/power/pwrseq.h | 72 ++++++++ 16 files changed, 621 insertions(+), 41 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/pwrseq/pwrseq-generic.txt create mode 100644 drivers/power/pwrseq/Kconfig create mode 100644 drivers/power/pwrseq/Makefile create mode 100644 drivers/power/pwrseq/core.c create mode 100644 drivers/power/pwrseq/pwrseq_generic.c create mode 100644 include/linux/power/pwrseq.h -- 2.7.4