linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Houcheng Lin <houcheng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] [RFC PATCH v2] power:reset: Add defer reset object to send board specific reset
Date: Sun, 15 Jun 2014 11:09:38 +0200	[thread overview]
Message-ID: <20140615090932.GA29771@earth.universe> (raw)
In-Reply-To: <1402816289-7024-1-git-send-email-houcheng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 4967 bytes --]

Hi,

On Sun, Jun 15, 2014 at 03:11:29PM +0800, Houcheng Lin wrote:
> The Problem
> -----------
> The reset signal on a hardware board is send either:
>     - during machine initialization
>     - during bus master's initialization
> 
> In some hardware design, devices on bus need a non-standard and extra reset
> signal after bus is initialied. Most reason is to wake up device from hanging
> state.
> 
> The board spefic reset code can not be put into machine init code, as it is
> too early. This code can not also be put onto chip's driver, as it is board
> specific and not suitable for a common chip driver.
> 
> Defer Reset Object
> ------------------
> The defer reset object is to resolve this issue, developer can put a defer-
> reset device on the board's dts file and enable DEFER RESET OBJECT CONFIG.
> During driver init-calls, a defer-reset object is created and issue reset signal
> after the enclosing device is initialized.
> 
> This eliminate the need to rewrite a driver module with only one purpose: sending
> a board specific reset. This also allow mainstream kernel to support many boards
> that modify the common drivers to send board specific reset. Configuring defer-reset
> device in dts leave the board specific reset rules on board level and simple to
> maintain.
> 
> Example dts File
> ----------------
>     usb-ehci-chip@1211000{
>         usb-phy = <&usb2_phy>;
>         defer_reset_vbus {
>             compatible = "defer-reset";
>             reset-gpios = <&gpx3 5 1>;
>             reset-init = <0>;
>             reset-end = <1>;
>             delay = <5>;
>         };
>     };
> 
> Block Diagram of dts File
> -------------------------
>     +-------------------------------------+
>     | usb-ehci-chip@1211000               |
>     |   +-------------------------+       |
>     |   | defer-reset(gpx3)       |       |
>     |   +-------------------------+       |
>     +-------------------------------------+
> 
> Signed-off-by: Houcheng Lin <houcheng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  .../devicetree/bindings/gpio/gpio-defer-reset.txt  |  22 +++
>  drivers/power/reset/Kconfig                        |   8 +
>  drivers/power/reset/Makefile                       |   1 +
>  drivers/power/reset/gpio-defer-reset.c             | 192 +++++++++++++++++++++

I think this belongs to drivers/reset and not to drivers/power/reset.
The drivers in drivers/power/reset are about board reboot / shutdown.
This driver seems to be used for periphals.

>  4 files changed, 223 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/gpio/gpio-defer-reset.txt
>  create mode 100644 drivers/power/reset/gpio-defer-reset.c
> 
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-defer-reset.txt b/Documentation/devicetree/bindings/gpio/gpio-defer-reset.txt
> new file mode 100644
> index 0000000..5d55830
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio-defer-reset.txt
> @@ -0,0 +1,22 @@
> +GPIO defer reset binding
> +
> +Put a defer-reset device in a device node and enable DEFER RESET OBJECT CONFIG.
> +During driver init-calls, a defer-reset object will be created and issue reset
> +signal after the enclosing device node's initialization complete.
> +
> +Required properties:
> +- compatible:
> +  - "defer-reset" for creating defer reset object
> +- reset-gpio: specify gpio pin, can be an array.
> +- reset-init: specify reset signal initial value, can be 0 or 1.

You can simply use GPIO's HIGH_ACTIVE / LOW_ACTIVE flag for the
"initial value".

> +- reset-end: specify reset signal end value, can be 0 or 1.

You can use a property without a value for booleans. If the property
is there, the value is 1 and if its missing the value is 0.

For example in your case you could use

hold-reset-line;

to inform the system, that the reset signal should not be changed
back after the specified time.

> +- delay: specify reset duration in ms.

Alternatively you could do this via the duration. An infinite long
reset signal basically means, that the line is never changed back.

> +
> +Example:
> +	defer_reset_vbus {
> +		compatible = "defer-reset";
> +		reset-gpios = <&gpx3 5 1>;
> +		reset-init = <0>;
> +		reset-end = <1>;
> +		delay = <5>;
> +	};

To give a few examples for the above comments:

/* keep "gpx3 5" low for 5ms, change back to high afterwards */
defer_reset_vbus {
    compatible = "defer-reset";
    reset-gpios = <&gpx3 5 GPIO_ACTIVE_LOW>;
    duration = <5>;
};

/* keep "gpx3 5" high for 5ms, change back to low afterwards */
defer_reset_vbus {
    compatible = "defer-reset";
    reset-gpios = <&gpx3 5 GPIO_ACTIVE_HIGH>;
    duration = <5>;
};

/* keep "gpx3 5" low */
defer_reset_vbus {
    compatible = "defer-reset";
    reset-gpios = <&gpx3 5 GPIO_ACTIVE_LOW>;
    duration = <0>;
};

> [...]

-- Sebastian

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2014-06-15  9:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-15  7:11 [PATCH] [RFC PATCH v2] power:reset: Add defer reset object to send board specific reset Houcheng Lin
     [not found] ` <1402816289-7024-1-git-send-email-houcheng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-15  9:09   ` Sebastian Reichel [this message]
2014-06-17 15:44     ` Houcheng Lin

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=20140615090932.GA29771@earth.universe \
    --to=sre-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=gnurou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=houcheng-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-gpio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).