Re: [RFC PATCH v3] reset: Add a defer reset object to send board specific reset
From: Maxime Ripard
Date: Fri Jun 20 2014 - 05:40:13 EST
On Wed, Jun 18, 2014 at 09:37:53PM +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.
I don't see why not. I don't get the difference with an optional
regulator, or an optional GPIO, or whatever. And there's already some
support for such a case, with reset_control_get_optional.
>
> 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
> ----------------
> Example 1:
> defer_reset_vbus {
> compatible = "defer-reset";
> reset-gpios = <&gpx3 5 GPIO_ACTIVE_LOW>;
This doesn't follow the generic reset bindings.
> duration = <5>;
> };
>
> Example 2:
> defer_reset_vbus {
> compatible = "defer-reset";
> reset-gpios = <&gpx3 5 GPIO_ACTIVE_HIGH>;
> duration = <0>;
> };
>
> Block Diagram of dts File
> -------------------------
> +-------------------------------------+
> | usb-ehci-chip@1211000 |
> | +-------------------------+ |
> | | defer-reset(gpx3) | |
> | +-------------------------+ |
> +-------------------------------------+
And this goes against the current way of doing things, with the resets
property holding a phandle.
Why not just having something like:
usb {
compatible = "whatever";
resets = <&rst_gpio <duration>>;
}
Which uses the generic bindings, and doesn't require anything fancy
either in the driver or the DT.
Maxime
--
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
Attachment:
signature.asc
Description: Digital signature