From mboxrd@z Thu Jan 1 00:00:00 1970 From: Guenter Roeck Subject: Re: [PATCH v2 1/3] power: reset: read priority from device tree Date: Mon, 1 Dec 2014 09:42:15 -0800 Message-ID: <20141201174215.GB24692@roeck-us.net> References: <1417453389-1588-1-git-send-email-stefan@agner.ch> <1417453389-1588-2-git-send-email-stefan@agner.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Feng Kan Cc: Stefan Agner , shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, Arnd Bergmann , sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Dmitry Eremin-Solenikov , David Woodhouse , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" List-Id: devicetree@vger.kernel.org On Mon, Dec 01, 2014 at 09:38:09AM -0800, Feng Kan wrote: > On Mon, Dec 1, 2014 at 9:29 AM, Stefan Agner wrote: > > On 2014-12-01 18:15, Feng Kan wrote: > >> On Mon, Dec 1, 2014 at 9:03 AM, Stefan Agner wrote: > >>> This patch adds an optional property which allows to specify the > >>> reset source priority. This priority is used by the kernel restart > >>> handler call chain to sort out the proper reset/restart method. > >>> Depending on the power design of a board or other machine/board > >>> specific peculiarity, it is not possible to pick a generic priority. > >>> > >>> Signed-off-by: Stefan Agner > >>> --- > >>> Documentation/devicetree/bindings/power/reset/syscon-reboot.txt | 3 +++ > >>> drivers/power/reset/syscon-reboot.c | 5 ++++- > >>> 2 files changed, 7 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/Documentation/devicetree/bindings/power/reset/syscon-reboot.txt b/Documentation/devicetree/bindings/power/reset/syscon-reboot.txt > >>> index 1190631..ee41d9c 100644 > >>> --- a/Documentation/devicetree/bindings/power/reset/syscon-reboot.txt > >>> +++ b/Documentation/devicetree/bindings/power/reset/syscon-reboot.txt > >>> @@ -11,6 +11,9 @@ Required properties: > >>> - offset: offset in the register map for the reboot register (in bytes) > >>> - mask: the reset value written to the reboot register (32 bit access) > >>> > >>> +Optional properties: > >>> +- priority: define the priority of the reset (0-255, defaults to 128) > >>> + > >>> Default will be little endian mode, 32 bit access only. > >>> > >>> Examples: > >>> diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c > >>> index 815b901..3060d6b 100644 > >>> --- a/drivers/power/reset/syscon-reboot.c > >>> +++ b/drivers/power/reset/syscon-reboot.c > >>> @@ -67,8 +67,11 @@ static int syscon_reboot_probe(struct platform_device *pdev) > >>> if (of_property_read_u32(pdev->dev.of_node, "mask", &ctx->mask)) > >>> return -EINVAL; > >>> > >>> - ctx->restart_handler.notifier_call = syscon_restart_handle; > >>> ctx->restart_handler.priority = 128; > >>> + of_property_read_u32(pdev->dev.of_node, "priority", > >>> + &ctx->restart_handler.priority); > >> > >> What is this for? > > > > What do you mean? The moved line "ctx->restart_handler.notifier_call = > > syscon_restart_handle;"? When one reads the diff, it looks like that > > line was moved, in fact I tried to keep the of_property_read function > > calls together. But I had to move the assignation of the default > > priority in front of restart_handler.priority. That's what is the > > outcome... > > I believe Guenter explained above already. Actually this help to solve one of > my problem. Thanks. Since Mark doesn't seem to be happy with the idea of making the priority dt-configurable, the alternative might be to just set a higher priority for syscon triggered resets, as suggested by Stefan. Not as flexible, but it should be ok for most use cases. Guenter -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html