From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757534AbcFAJG6 (ORCPT ); Wed, 1 Jun 2016 05:06:58 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:30659 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752489AbcFAJGw (ORCPT ); Wed, 1 Jun 2016 05:06:52 -0400 X-AuditID: cbfec7f4-f796c6d000001486-7d-574ea5a89bde Subject: Re: [PATCH v3 09/12] EXAMPLE CODE: usb: port: Parse pwrseq phandle from Device Tree To: Stephen Boyd References: <1464768141-25420-1-git-send-email-k.kozlowski@samsung.com> <1464768141-25420-10-git-send-email-k.kozlowski@samsung.com> <146477144362.1485.3331887341591876278@sboyd-linaro> Cc: Greg Kroah-Hartman , Bartlomiej Zolnierkiewicz , hzpeterchen@gmail.com, Ulf Hansson , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Javier Martinez Canillas , linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-pm@vger.kernel.or, Alan Stern , linux-usb@vger.kernel.org, Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Kukjin Kim , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org From: Krzysztof Kozlowski X-Enigmail-Draft-Status: N1110 Message-id: <574EA5A6.3090102@samsung.com> Date: Wed, 01 Jun 2016 11:06:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-version: 1.0 In-reply-to: <146477144362.1485.3331887341591876278@sboyd-linaro> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA03RbUhTURgH8M7u3d3dcHadbwcjjYUYkzSp4BBZ7dullxVkLKKyqTeV3JRN pRWiURYtdKaCNlvadDrnxNyEqaWpjAQFXzAXpS7TiPIFKbWWWbY5Ir/9z//8Hs4Dh8QEM3gY ma7IZpQKWYaQ4OGDf/pf7zUZJdJ99R9CUWtlCxuVflzCULVjiI0eNpZhSLvwlI1u17YQSDNu JdDQXCNAC4sWFpr/HIe0s/MYss462Wis8zGBHBtagB6NNuGocribhQz1hRgyvhlloZKKZhwV djk4aPB5NtKP93iqXyME6m+WHoO05YkF0GPFRSy6QzfFoRsbVgjaZhLRVvN9gp50viDol3oL h7bV5dNtWg+omnIDurjNDGjHagVOL1vDz/hf4B1OYTLScxll7JErvLRvPWZ2lp267rzbwykA Tj8N4JKQOgBnf1uAL4fAEVcLoQEkKaCMABZi3lpAfQKw27VJAqnL0LBRz/HmIEoEyyfXcQ3g eUwXgPrpUZb3gFE9BLQZ3xJeRVD7oa2hjvA9EA6LHpTi3sz3TOtcdrY341QkHJl5tmmCqfNQ Z3ezfCYAustcm55LiWH1ajvmXQ6jomB5udxbY1QEtFkWsRIQoNsyofuvdFtUDcDMIJjJSc5S JaXK42JUMrkqR5Eak5wptwLfz6+0g9pXh/oARQKhH3/X6CmpgC3LVanlfQCSmDCIH1AmkQr4 KTL1DUaZmajMyWBUfWAHiQtD+frOpQQBlSrLZq4xTBaj/HfLIrlhBUBypxX2HnwvHTiqiKlh axonk7jb1NMnoThNa1qOO20Q2/QzIXwe92a8UcI4okfm9tjeRSWL1s6J+9f6EuLda9uytwfv 3lkn7J+YII6vi6N/Dp8YLu2I/ZF3teqrX+z39bnIjrN5t75EmPIHtfciB+wGfCXRv0l9yRTY W3IRmoS4Kk0WJ8KUKtlf22sQyfUCAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/01/2016 10:57 AM, Stephen Boyd wrote: > Quoting Krzysztof Kozlowski (2016-06-01 01:02:18) >> Parse usb-pwrseq property from Device Tree to get the phandle to pwrseq >> device. The pwrseq device will be used by USB hub to cycle the power >> before activating ports. >> >> Signed-off-by: Krzysztof Kozlowski > > Drive by review comment. > > I was hoping this would help me with a problem I'm having where I have a > hub (smsc4604) that needs to be taken out of reset before my HSIC > controller sends a USB reset to it, but it seems this is more about > doing some sort of power on sequence after enumeration? This example is not finished but from what you wrote, it might suit your needs as well. The power sequence is done before enumeration because without it, the device won't enumerate. The exact power sequence for USB devices has to be still developed. Comments are welcomed. >> diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c >> index 460c855be0d0..89b9bdfc7061 100644 >> --- a/drivers/usb/core/port.c >> +++ b/drivers/usb/core/port.c >> @@ -18,6 +18,8 @@ >> >> #include >> #include >> +#include >> +#include >> >> #include "hub.h" >> >> @@ -526,6 +528,14 @@ int usb_hub_create_port_device(struct usb_hub *hub, int port1) >> return retval; >> } >> >> + port_dev->dev.of_node = usb_of_get_child_node(hdev->dev.parent->of_node, >> + port1); >> + port_dev->pwrseq = pwrseq_alloc(&port_dev->dev, "usb-pwrseq"); >> + if (IS_ERR(port_dev->pwrseq)) { >> + device_unregister(&port_dev->dev); >> + return PTR_ERR(port_dev->pwrseq); > > Are we certain that port_dev hasn't been freed at this point? We just > called device_unregister() on it, so it seems safer to save away the > return value before calling device_unregister() here. Right, good point. Thanks for feedback. Best regards, Krzysztof