* [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock
@ 2014-06-13 7:26 Alexander Shiyan
2014-06-13 7:26 ` [PATCH 2/2] ARM: i.MX system: Add a reset fallback if base address of watchdog is not set Alexander Shiyan
2014-06-20 4:26 ` [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock Shawn Guo
0 siblings, 2 replies; 7+ messages in thread
From: Alexander Shiyan @ 2014-06-13 7:26 UTC (permalink / raw)
To: linux-arm-kernel
This patch simplifies handling watchdog clock a bit.
As an additional change, now we properly check WDT clock in a reset
function.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-imx/system.c | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index 3b0733e..ae521f3 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -42,7 +42,7 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
{
unsigned int wcr_enable;
- if (wdog_clk)
+ if (!IS_ERR_OR_NULL(wdog_clk))
clk_enable(wdog_clk);
if (cpu_is_mx1())
@@ -79,13 +79,10 @@ void __init mxc_arch_reset_init(void __iomem *base)
wdog_base = base;
wdog_clk = clk_get_sys("imx2-wdt.0", NULL);
- if (IS_ERR(wdog_clk)) {
+ if (IS_ERR(wdog_clk))
pr_warn("%s: failed to get wdog clock\n", __func__);
- wdog_clk = NULL;
- return;
- }
-
- clk_prepare(wdog_clk);
+ else
+ clk_prepare(wdog_clk);
}
void __init mxc_arch_reset_init_dt(void)
@@ -97,13 +94,10 @@ void __init mxc_arch_reset_init_dt(void)
WARN_ON(!wdog_base);
wdog_clk = of_clk_get(np, 0);
- if (IS_ERR(wdog_clk)) {
+ if (IS_ERR(wdog_clk))
pr_warn("%s: failed to get wdog clock\n", __func__);
- wdog_clk = NULL;
- return;
- }
-
- clk_prepare(wdog_clk);
+ else
+ clk_prepare(wdog_clk);
}
#ifdef CONFIG_CACHE_L2X0
--
1.8.5.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] ARM: i.MX system: Add a reset fallback if base address of watchdog is not set
2014-06-13 7:26 [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock Alexander Shiyan
@ 2014-06-13 7:26 ` Alexander Shiyan
2014-06-20 4:26 ` [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock Shawn Guo
1 sibling, 0 replies; 7+ messages in thread
From: Alexander Shiyan @ 2014-06-13 7:26 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds a reset fallback if base address of watchdog is not set.
This is intended for a targets not compatible with imx-21 watchdog,
i.MX1 for example.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
arch/arm/mach-imx/system.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
index ae521f3..3b9259b 100644
--- a/arch/arm/mach-imx/system.c
+++ b/arch/arm/mach-imx/system.c
@@ -42,6 +42,9 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
{
unsigned int wcr_enable;
+ if (!wdog_base)
+ goto reset_fallback;
+
if (!IS_ERR_OR_NULL(wdog_clk))
clk_enable(wdog_clk);
@@ -70,6 +73,7 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
/* delay to allow the serial port to show the message */
mdelay(50);
+reset_fallback:
/* we'll take a jump through zero as a poor second */
soft_restart(0);
}
--
1.8.5.5
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock
2014-06-13 7:26 [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock Alexander Shiyan
2014-06-13 7:26 ` [PATCH 2/2] ARM: i.MX system: Add a reset fallback if base address of watchdog is not set Alexander Shiyan
@ 2014-06-20 4:26 ` Shawn Guo
2014-06-20 4:36 ` Alexander Shiyan
1 sibling, 1 reply; 7+ messages in thread
From: Shawn Guo @ 2014-06-20 4:26 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 13, 2014 at 11:26:12AM +0400, Alexander Shiyan wrote:
> This patch simplifies handling watchdog clock a bit.
> As an additional change, now we properly check WDT clock in a reset
> function.
>
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
> arch/arm/mach-imx/system.c | 20 +++++++-------------
> 1 file changed, 7 insertions(+), 13 deletions(-)
>
> diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
> index 3b0733e..ae521f3 100644
> --- a/arch/arm/mach-imx/system.c
> +++ b/arch/arm/mach-imx/system.c
> @@ -42,7 +42,7 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
> {
> unsigned int wcr_enable;
>
> - if (wdog_clk)
> + if (!IS_ERR_OR_NULL(wdog_clk))
I think this should just be if (!IS_ERR(wdog_clk)).
Shawn
> clk_enable(wdog_clk);
>
> if (cpu_is_mx1())
> @@ -79,13 +79,10 @@ void __init mxc_arch_reset_init(void __iomem *base)
> wdog_base = base;
>
> wdog_clk = clk_get_sys("imx2-wdt.0", NULL);
> - if (IS_ERR(wdog_clk)) {
> + if (IS_ERR(wdog_clk))
> pr_warn("%s: failed to get wdog clock\n", __func__);
> - wdog_clk = NULL;
> - return;
> - }
> -
> - clk_prepare(wdog_clk);
> + else
> + clk_prepare(wdog_clk);
> }
>
> void __init mxc_arch_reset_init_dt(void)
> @@ -97,13 +94,10 @@ void __init mxc_arch_reset_init_dt(void)
> WARN_ON(!wdog_base);
>
> wdog_clk = of_clk_get(np, 0);
> - if (IS_ERR(wdog_clk)) {
> + if (IS_ERR(wdog_clk))
> pr_warn("%s: failed to get wdog clock\n", __func__);
> - wdog_clk = NULL;
> - return;
> - }
> -
> - clk_prepare(wdog_clk);
> + else
> + clk_prepare(wdog_clk);
> }
>
> #ifdef CONFIG_CACHE_L2X0
> --
> 1.8.5.5
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock
2014-06-20 4:26 ` [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock Shawn Guo
@ 2014-06-20 4:36 ` Alexander Shiyan
2014-06-20 7:50 ` Shawn Guo
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Shiyan @ 2014-06-20 4:36 UTC (permalink / raw)
To: linux-arm-kernel
Fri, 20 Jun 2014 12:26:52 +0800 ?? Shawn Guo <shawn.guo@freescale.com>:
> On Fri, Jun 13, 2014 at 11:26:12AM +0400, Alexander Shiyan wrote:
> > This patch simplifies handling watchdog clock a bit.
> > As an additional change, now we properly check WDT clock in a reset
> > function.
> >
> > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > ---
> > arch/arm/mach-imx/system.c | 20 +++++++-------------
> > 1 file changed, 7 insertions(+), 13 deletions(-)
> >
> > diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
> > index 3b0733e..ae521f3 100644
> > --- a/arch/arm/mach-imx/system.c
> > +++ b/arch/arm/mach-imx/system.c
> > @@ -42,7 +42,7 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
> > {
> > unsigned int wcr_enable;
> >
> > - if (wdog_clk)
> > + if (!IS_ERR_OR_NULL(wdog_clk))
>
> I think this should just be if (!IS_ERR(wdog_clk)).
No, this is a part of commit log.
wdog_clk can be NULL if mxc_arch_reset_init() is not called,
so we just protect mxc_restart() for such cases.
---
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock
2014-06-20 4:36 ` Alexander Shiyan
@ 2014-06-20 7:50 ` Shawn Guo
2014-06-20 7:57 ` Alexander Shiyan
0 siblings, 1 reply; 7+ messages in thread
From: Shawn Guo @ 2014-06-20 7:50 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 20, 2014 at 08:36:46AM +0400, Alexander Shiyan wrote:
> Fri, 20 Jun 2014 12:26:52 +0800 ?? Shawn Guo <shawn.guo@freescale.com>:
> > On Fri, Jun 13, 2014 at 11:26:12AM +0400, Alexander Shiyan wrote:
> > > This patch simplifies handling watchdog clock a bit.
> > > As an additional change, now we properly check WDT clock in a reset
> > > function.
> > >
> > > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > > ---
> > > arch/arm/mach-imx/system.c | 20 +++++++-------------
> > > 1 file changed, 7 insertions(+), 13 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
> > > index 3b0733e..ae521f3 100644
> > > --- a/arch/arm/mach-imx/system.c
> > > +++ b/arch/arm/mach-imx/system.c
> > > @@ -42,7 +42,7 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
> > > {
> > > unsigned int wcr_enable;
> > >
> > > - if (wdog_clk)
> > > + if (!IS_ERR_OR_NULL(wdog_clk))
> >
> > I think this should just be if (!IS_ERR(wdog_clk)).
>
> No, this is a part of commit log.
> wdog_clk can be NULL if mxc_arch_reset_init() is not called,
> so we just protect mxc_restart() for such cases.
I think clk API can take NULL as input.
Shawn
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock
2014-06-20 7:50 ` Shawn Guo
@ 2014-06-20 7:57 ` Alexander Shiyan
2014-06-20 8:52 ` Shawn Guo
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Shiyan @ 2014-06-20 7:57 UTC (permalink / raw)
To: linux-arm-kernel
Fri, 20 Jun 2014 15:50:34 +0800 ?? Shawn Guo <shawn.guo@freescale.com>:
> On Fri, Jun 20, 2014 at 08:36:46AM +0400, Alexander Shiyan wrote:
> > Fri, 20 Jun 2014 12:26:52 +0800 ?? Shawn Guo <shawn.guo@freescale.com>:
> > > On Fri, Jun 13, 2014 at 11:26:12AM +0400, Alexander Shiyan wrote:
> > > > This patch simplifies handling watchdog clock a bit.
> > > > As an additional change, now we properly check WDT clock in a reset
> > > > function.
> > > >
> > > > Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> > > > ---
> > > > arch/arm/mach-imx/system.c | 20 +++++++-------------
> > > > 1 file changed, 7 insertions(+), 13 deletions(-)
> > > >
> > > > diff --git a/arch/arm/mach-imx/system.c b/arch/arm/mach-imx/system.c
> > > > index 3b0733e..ae521f3 100644
> > > > --- a/arch/arm/mach-imx/system.c
> > > > +++ b/arch/arm/mach-imx/system.c
> > > > @@ -42,7 +42,7 @@ void mxc_restart(enum reboot_mode mode, const char *cmd)
> > > > {
> > > > unsigned int wcr_enable;
> > > >
> > > > - if (wdog_clk)
> > > > + if (!IS_ERR_OR_NULL(wdog_clk))
> > >
> > > I think this should just be if (!IS_ERR(wdog_clk)).
> >
> > No, this is a part of commit log.
> > wdog_clk can be NULL if mxc_arch_reset_init() is not called,
> > so we just protect mxc_restart() for such cases.
>
> I think clk API can take NULL as input.
You are right.
If this is the only issue on this series, could you fix it during the applying?
---
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock
2014-06-20 7:57 ` Alexander Shiyan
@ 2014-06-20 8:52 ` Shawn Guo
0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2014-06-20 8:52 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Jun 20, 2014 at 11:57:45AM +0400, Alexander Shiyan wrote:
> You are right.
> If this is the only issue on this series, could you fix it during the applying?
Okay. Fixed it and applied both patches.
Shawn
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-06-20 8:52 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-13 7:26 [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock Alexander Shiyan
2014-06-13 7:26 ` [PATCH 2/2] ARM: i.MX system: Add a reset fallback if base address of watchdog is not set Alexander Shiyan
2014-06-20 4:26 ` [PATCH 1/2] ARM: i.MX system: Simplify handling watchdog clock Shawn Guo
2014-06-20 4:36 ` Alexander Shiyan
2014-06-20 7:50 ` Shawn Guo
2014-06-20 7:57 ` Alexander Shiyan
2014-06-20 8:52 ` Shawn Guo
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).