All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Chen <hzpeterchen@gmail.com>
To: Rob Herring <robh@kernel.org>
Cc: "Mark Rutland" <mark.rutland@arm.com>,
	"Peter Chen" <peter.chen@nxp.com>,
	"Ulf Hansson" <ulf.hansson@linaro.org>,
	"Stephen Boyd" <stephen.boyd@linaro.org>,
	"Krzysztof Kozłowski" <k.kozlowski@samsung.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Javier Martinez Canillas" <javier@osg.samsung.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	troy.kisky@boundarydevices.com, "Mark Brown" <broonie@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	oscar@naiandei.net,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Linux USB List" <linux-usb@vger.kernel.org>, linux-mmc@vger.
Subject: Re: [PATCH 08/12] doc: binding: pwrseq-usb-generic: add binding doc for generic usb power sequence driver
Date: Wed, 22 Jun 2016 09:14:39 +0800	[thread overview]
Message-ID: <20160622011439.GA21361@shlinux2> (raw)
In-Reply-To: <20160621212653.GA22764@rob-hp-laptop>

On Tue, Jun 21, 2016 at 04:26:53PM -0500, Rob Herring wrote:
> On Tue, Jun 21, 2016 at 10:11:17AM +0800, Peter Chen wrote:
> > On Mon, Jun 20, 2016 at 11:16:07AM -0500, Rob Herring wrote:
> > > On Mon, Jun 20, 2016 at 07:26:51PM +0800, Peter Chen wrote:
> > > > On Fri, Jun 17, 2016 at 12:16:48PM -0500, Rob Herring wrote:
> > > > > On Fri, Jun 17, 2016 at 5:09 AM, Peter Chen <peter.chen@nxp.com> wrote:
> > > > > > Add binding doc for generic usb power sequence driver, and update
> > > > > > generic usb device binding-doc accordingly.
> 
> [...]
> 
> > > > 		clocks = <&clks IMX6SX_CLK_CKO>;
> > > > 
> > > > 		#address-cells = <1>;
> > > > 		#size-cells = <0>;
> > > > 		ethernet: asix@1 {
> > > > 			compatible = "usbb95,1708";
> > > > 			reg = <1>;
> > > > 
> > > > 			power-sequence;
> > > > 			reset-gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; /* ethernet_rst */
> > > > 			reset-duration-us = <15>;
> > > > 			clocks = <&clks IMX6SX_CLK_IPG>;
> > > > 		};
> > > > 	};
> > > > };
> > > > 
> > > > If the node has property "power-sequence", the pwrseq core will create
> > > > related platform device, and the driver under pwrseq driver will handle
> > > > power sequence stuffs. 
> > > 
> > > This I have issue with. If you are creating a platform device here, you 
> > > are trying to work-around limitations in the linux driver model.
> > 
> > My current solution like below, but it seems you didn't agree with that.
> > I just double confirm here, if you don't, I give up the solution for
> > using generic power sequence framework.
> > 
> > In drivers/usb/core/hub.c
> > 
> > 	for_each_child_of_node(parent->of_node, node) {
> > 		hdev_pwrseq = pwrseq_alloc(node, "usb_pwrseq_generic");
> > 		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);
> 
> Why does this function need to do anything more than:
> 
> - Check if the child has a "power-sequence" property
> - Get the "reset-gpios" GPIO
> - Assert reset for specified/default time
> - Deassert reset
> 

Besides gpios, it may exist clock and regulator operation, and the
operation may be failed. I thought these operations can be easy
done belongs to a device, but now, let me try this straight-forward
way, thanks.

Peter
> Then continue on as normal. That seems straight-forward to me.
> 
> There is no reason you need a platform device in the mix. Perhaps trying 
> to move the MMC pwr-seq code is pointless as it adds needless 
> complexity.
> 
> [...]
> 
> > > Either 
> > > we need some sort of pre-probe hook to the drivers to call or each 
> > > parent node driver is responsible for checking and calling pwr-seq 
> > > functions for child nodes. e.g. The host controller calls pwr-seq for 
> > > the hub, the hub driver calls the power seq for the asix chip. Soon as 
> > > we have a case too complex for the generic pwr-seq, we're going to need 
> > > the pre-probe hook as I don't want to see a continual expansion of 
> > > generic pwr-seq binding for ever more complex cases.
> > > 
> > 
> > How the driver know what it needs to handle (eg, gpio, clock) if there
> > is no device for it? The most important we need to consider is which
> > device owns there power sequence properties, then the corresponding
> > driver can handle it.
> 
> What can be handled by is defined by presence of power-sequence 
> property. There can be 1 driver for the device. That is the USB hub 
> driver in this example. You should not have 2 "devices".
> 
> Rob

-- 

Best Regards,
Peter Chen

WARNING: multiple messages have this Message-ID (diff)
From: hzpeterchen@gmail.com (Peter Chen)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 08/12] doc: binding: pwrseq-usb-generic: add binding doc for generic usb power sequence driver
Date: Wed, 22 Jun 2016 09:14:39 +0800	[thread overview]
Message-ID: <20160622011439.GA21361@shlinux2> (raw)
In-Reply-To: <20160621212653.GA22764@rob-hp-laptop>

On Tue, Jun 21, 2016 at 04:26:53PM -0500, Rob Herring wrote:
> On Tue, Jun 21, 2016 at 10:11:17AM +0800, Peter Chen wrote:
> > On Mon, Jun 20, 2016 at 11:16:07AM -0500, Rob Herring wrote:
> > > On Mon, Jun 20, 2016 at 07:26:51PM +0800, Peter Chen wrote:
> > > > On Fri, Jun 17, 2016 at 12:16:48PM -0500, Rob Herring wrote:
> > > > > On Fri, Jun 17, 2016 at 5:09 AM, Peter Chen <peter.chen@nxp.com> wrote:
> > > > > > Add binding doc for generic usb power sequence driver, and update
> > > > > > generic usb device binding-doc accordingly.
> 
> [...]
> 
> > > > 		clocks = <&clks IMX6SX_CLK_CKO>;
> > > > 
> > > > 		#address-cells = <1>;
> > > > 		#size-cells = <0>;
> > > > 		ethernet: asix at 1 {
> > > > 			compatible = "usbb95,1708";
> > > > 			reg = <1>;
> > > > 
> > > > 			power-sequence;
> > > > 			reset-gpios = <&gpio4 6 GPIO_ACTIVE_LOW>; /* ethernet_rst */
> > > > 			reset-duration-us = <15>;
> > > > 			clocks = <&clks IMX6SX_CLK_IPG>;
> > > > 		};
> > > > 	};
> > > > };
> > > > 
> > > > If the node has property "power-sequence", the pwrseq core will create
> > > > related platform device, and the driver under pwrseq driver will handle
> > > > power sequence stuffs. 
> > > 
> > > This I have issue with. If you are creating a platform device here, you 
> > > are trying to work-around limitations in the linux driver model.
> > 
> > My current solution like below, but it seems you didn't agree with that.
> > I just double confirm here, if you don't, I give up the solution for
> > using generic power sequence framework.
> > 
> > In drivers/usb/core/hub.c
> > 
> > 	for_each_child_of_node(parent->of_node, node) {
> > 		hdev_pwrseq = pwrseq_alloc(node, "usb_pwrseq_generic");
> > 		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);
> 
> Why does this function need to do anything more than:
> 
> - Check if the child has a "power-sequence" property
> - Get the "reset-gpios" GPIO
> - Assert reset for specified/default time
> - Deassert reset
> 

Besides gpios, it may exist clock and regulator operation, and the
operation may be failed. I thought these operations can be easy
done belongs to a device, but now, let me try this straight-forward
way, thanks.

Peter
> Then continue on as normal. That seems straight-forward to me.
> 
> There is no reason you need a platform device in the mix. Perhaps trying 
> to move the MMC pwr-seq code is pointless as it adds needless 
> complexity.
> 
> [...]
> 
> > > Either 
> > > we need some sort of pre-probe hook to the drivers to call or each 
> > > parent node driver is responsible for checking and calling pwr-seq 
> > > functions for child nodes. e.g. The host controller calls pwr-seq for 
> > > the hub, the hub driver calls the power seq for the asix chip. Soon as 
> > > we have a case too complex for the generic pwr-seq, we're going to need 
> > > the pre-probe hook as I don't want to see a continual expansion of 
> > > generic pwr-seq binding for ever more complex cases.
> > > 
> > 
> > How the driver know what it needs to handle (eg, gpio, clock) if there
> > is no device for it? The most important we need to consider is which
> > device owns there power sequence properties, then the corresponding
> > driver can handle it.
> 
> What can be handled by is defined by presence of power-sequence 
> property. There can be 1 driver for the device. That is the USB hub 
> driver in this example. You should not have 2 "devices".
> 
> Rob

-- 

Best Regards,
Peter Chen

  reply	other threads:[~2016-06-22  1:14 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 10:09 [PATCH 00/12] power: add generic power sequence framework Peter Chen
2016-06-17 10:09 ` Peter Chen
2016-06-17 10:09 ` [PATCH 01/12] power/mmc: Move pwrseq drivers to power/pwrseq Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-17 10:09 ` [PATCH 02/12] MAINTAINERS: Retain Ulf Hansson as the same maintainer of pwrseq Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-17 10:09 ` [PATCH 03/12] power: pwrseq: Enable COMPILE_TEST for drivers Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-17 10:09 ` [PATCH 05/12] power: pwrseq: Generalize mmc_pwrseq operations by removing mmc prefix Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-17 10:09 ` [PATCH 06/12] power: pwrseq: change common helpers as generic Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-17 10:09 ` [PATCH 07/12] power: pwrseq: rename file name for generic driver Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-20 12:48   ` Krzysztof Kozlowski
2016-06-20 12:48     ` Krzysztof Kozlowski
2016-06-21  2:19     ` Peter Chen
2016-06-21  2:19       ` Peter Chen
     [not found] ` <1466158165-9380-1-git-send-email-peter.chen-3arQi8VN3Tc@public.gmane.org>
2016-06-17 10:09   ` [PATCH 04/12] power: pwrseq: Remove mmc prefix from mmc_pwrseq Peter Chen
2016-06-17 10:09     ` Peter Chen
2016-06-17 10:09   ` [PATCH 08/12] doc: binding: pwrseq-usb-generic: add binding doc for generic usb power sequence driver Peter Chen
2016-06-17 10:09     ` Peter Chen
2016-06-17 17:16     ` Rob Herring
2016-06-17 17:16       ` Rob Herring
2016-06-20 11:26       ` Peter Chen
2016-06-20 11:26         ` Peter Chen
2016-06-20 12:29         ` Chen-Yu Tsai
2016-06-20 12:29           ` Chen-Yu Tsai
2016-06-21  2:14           ` Peter Chen
2016-06-21  2:14             ` Peter Chen
2016-06-20 16:16         ` Rob Herring
2016-06-20 16:16           ` Rob Herring
2016-06-20 17:06           ` Mark Brown
2016-06-20 17:06             ` Mark Brown
2016-06-21  2:11           ` Peter Chen
2016-06-21  2:11             ` Peter Chen
2016-06-21 21:26             ` Rob Herring
2016-06-21 21:26               ` Rob Herring
2016-06-22  1:14               ` Peter Chen [this message]
2016-06-22  1:14                 ` Peter Chen
2016-06-22  9:09               ` Ulf Hansson
2016-06-22  9:09                 ` Ulf Hansson
2016-06-24 15:25                 ` Rob Herring
2016-06-24 15:25                   ` Rob Herring
2016-06-17 10:09   ` [PATCH 10/12] usb: core: add power sequence handling for USB devices Peter Chen
2016-06-17 10:09     ` Peter Chen
     [not found]     ` <1466158165-9380-11-git-send-email-peter.chen-3arQi8VN3Tc@public.gmane.org>
2016-06-17 16:12       ` Alan Stern
2016-06-17 16:12         ` Alan Stern
2016-06-17 10:09   ` [PATCH 12/12] ARM: dts: imx6qdl-udoo.dtsi: fix onboard USB HUB property Peter Chen
2016-06-17 10:09     ` Peter Chen
2016-06-17 10:09 ` [PATCH 09/12] power: pwrseq: pwrseq_usb_generic: add generic power sequence support for USB deivces Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-17 10:09 ` [PATCH 11/12] usb: chipidea: host: let the hcd know's parent device node Peter Chen
2016-06-17 10:09   ` Peter Chen
2016-06-17 23:29 ` [PATCH 00/12] power: add generic power sequence framework Maciej S. Szmigiero
2016-06-17 23:29   ` Maciej S. Szmigiero
2016-06-20 11:27   ` Peter Chen
2016-06-20 11:27     ` Peter Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160622011439.GA21361@shlinux2 \
    --to=hzpeterchen@gmail.com \
    --cc=arnd@arndb.de \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=javier@osg.samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-mmc@vger. \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mail@maciej.szmigiero.name \
    --cc=mark.rutland@arm.com \
    --cc=oscar@naiandei.net \
    --cc=pawel.moll@arm.com \
    --cc=peter.chen@nxp.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=stephen.boyd@linaro.org \
    --cc=stern@rowland.harvard.edu \
    --cc=troy.kisky@boundarydevices.com \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.