All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
@ 2011-08-18 10:25 Marek Szyprowski
  2011-08-19  9:37 ` Tushar Behera
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Marek Szyprowski @ 2011-08-18 10:25 UTC (permalink / raw)
  To: linux-samsung-soc
  Cc: Marek Szyprowski, Kyungmin Park, Kukjin Kim, Angus Ainslie

clkdev framework uses global mutex to protect clock tree, so it is not
possible to call clk_get() in interrupt context. This patch fixes this
issue and makes system reset by watchdog call working again.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 arch/arm/plat-samsung/clock.c                      |   11 +++++++++++
 arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
 .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
 3 files changed, 17 insertions(+), 7 deletions(-)


history:
v3:
- moved initialization to arch_initcall, cleaned the code

v2:
- added missing '__init' section modifiers

diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 302c426..3b44519 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -64,6 +64,17 @@ static LIST_HEAD(clocks);
  */
 DEFINE_SPINLOCK(clocks_lock);
 
+/* Global watchdog clock used by arch_wtd_reset() callback */
+struct clk *s3c2410_wdtclk;
+static int __init s3c_wdt_reset_init(void)
+{
+	s3c2410_wdtclk = clk_get(NULL, "watchdog");
+	if (IS_ERR(s3c2410_wdtclk))
+		printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
+	return 0;
+}
+arch_initcall(s3c_wdt_reset_init);
+
 /* enable and disable calls for use with the clk struct */
 
 static int clk_null_enable(struct clk *clk, int enable)
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
index 87d5b38..8f95700 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
 
 extern void s3c_pwmclk_init(void);
 
+/* Global watchdog clock used by arch_wtd_reset() callback */
+
+extern struct clk *s3c2410_wdtclk;
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
index 54b762a..40dbb2b 100644
--- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
+++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
@@ -10,6 +10,7 @@
  * published by the Free Software Foundation.
 */
 
+#include <plat/clock.h>
 #include <plat/regs-watchdog.h>
 #include <mach/map.h>
 
@@ -19,17 +20,12 @@
 
 static inline void arch_wdt_reset(void)
 {
-	struct clk *wdtclk;
-
 	printk("arch_reset: attempting watchdog reset\n");
 
 	__raw_writel(0, S3C2410_WTCON);	  /* disable watchdog, to be safe  */
 
-	wdtclk = clk_get(NULL, "watchdog");
-	if (!IS_ERR(wdtclk)) {
-		clk_enable(wdtclk);
-	} else
-		printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
+	if (s3c2410_wdtclk)
+		clk_enable(s3c2410_wdtclk);
 
 	/* put initial values into count and data */
 	__raw_writel(0x80, S3C2410_WTCNT);
-- 
1.7.1.569.g6f426

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-18 10:25 [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get() Marek Szyprowski
@ 2011-08-19  9:37 ` Tushar Behera
  2011-08-19 10:25   ` Marek Szyprowski
  2011-08-19 13:06 ` Kukjin Kim
  2011-09-05 11:32 ` Kukjin Kim
  2 siblings, 1 reply; 9+ messages in thread
From: Tushar Behera @ 2011-08-19  9:37 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: linux-samsung-soc, Kyungmin Park, Kukjin Kim, Angus Ainslie

Hi,

On Thursday 18 August 2011 03:55 PM, Marek Szyprowski wrote:
> clkdev framework uses global mutex to protect clock tree, so it is not
> possible to call clk_get() in interrupt context. This patch fixes this
> issue and makes system reset by watchdog call working again.
>
> Signed-off-by: Marek Szyprowski<m.szyprowski@samsung.com>
> Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
> ---
>   arch/arm/plat-samsung/clock.c                      |   11 +++++++++++
>   arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
>   .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
>   3 files changed, 17 insertions(+), 7 deletions(-)
>
>
> history:
> v3:
> - moved initialization to arch_initcall, cleaned the code
>
> v2:
> - added missing '__init' section modifiers
(snip)

I tried to test this patch with ORIGEN board.

I took the ORIGEN board support patch from kgene's
next-samsung-board-v3.1 branch and rebased it onto the for-next branch 
for testing.

The system reboot stops at a message saying "Restarting system" and hangs.

However applying below patch reboots the system without even applying 
Marek's patch.

Is there something wrong with mach-origen.c or u-boot [1]?

[1] git://git.linaro.org/people/angus/u-boot.git (origen)

 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

From: Tushar Behera <tushar.behera@linaro.org>
Date: Fri, 19 Aug 2011 14:47:04 +0530
Subject: [PATCH] [TEST] ARM: Disabling cache operation during system reset

On ORIGEN/SMDKV310 board, system reboot hangs during cache disabling
call in arm_machine_restart()=>cpu_proc_fin(). Applying given patch 
enables the system to reboot properly.

This patch is no way a proposed solution. It is intended for further
investigation.

Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
---
  arch/arm/mm/proc-v7.S |    2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index a30e785..1bffc35 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -43,10 +43,12 @@ ENTRY(cpu_v7_proc_init)
  ENDPROC(cpu_v7_proc_init)

  ENTRY(cpu_v7_proc_fin)
+#if 0
  	mrc	p15, 0, r0, c1, c0, 0		@ ctrl register
  	bic	r0, r0, #0x1000			@ ...i............
  	bic	r0, r0, #0x0006			@ .............ca.
  	mcr	p15, 0, r0, c1, c0, 0		@ disable caches
+#endif
  	mov	pc, lr
  ENDPROC(cpu_v7_proc_fin)

-- 
1.7.4.1




-- 
Tushar Behera

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-19  9:37 ` Tushar Behera
@ 2011-08-19 10:25   ` Marek Szyprowski
  2011-08-19 10:44     ` Kyungmin Park
  0 siblings, 1 reply; 9+ messages in thread
From: Marek Szyprowski @ 2011-08-19 10:25 UTC (permalink / raw)
  To: 'Tushar Behera', Marek Szyprowski
  Cc: linux-samsung-soc, 'Kyungmin Park', 'Kukjin Kim',
	'Angus Ainslie'

Hello,

On Friday, August 19, 2011 11:38 AM Tushar Behera wrote:

> Hi,
> 
> On Thursday 18 August 2011 03:55 PM, Marek Szyprowski wrote:
> > clkdev framework uses global mutex to protect clock tree, so it is not
> > possible to call clk_get() in interrupt context. This patch fixes this
> > issue and makes system reset by watchdog call working again.
> >
> > Signed-off-by: Marek Szyprowski<m.szyprowski@samsung.com>
> > Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
> > ---
> >   arch/arm/plat-samsung/clock.c                      |   11 +++++++++++
> >   arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
> >   .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
> >   3 files changed, 17 insertions(+), 7 deletions(-)
> >
> >
> > history:
> > v3:
> > - moved initialization to arch_initcall, cleaned the code
> >
> > v2:
> > - added missing '__init' section modifiers
> (snip)
> 
> I tried to test this patch with ORIGEN board.
> 
> I took the ORIGEN board support patch from kgene's
> next-samsung-board-v3.1 branch and rebased it onto the for-next branch
> for testing.
> 
> The system reboot stops at a message saying "Restarting system" and hangs.
> 
> However applying below patch reboots the system without even applying
> Marek's patch.
> 
> Is there something wrong with mach-origen.c or u-boot [1]?
> 
> [1] git://git.linaro.org/people/angus/u-boot.git (origen)
> 
>  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> 
> From: Tushar Behera <tushar.behera@linaro.org>
> Date: Fri, 19 Aug 2011 14:47:04 +0530
> Subject: [PATCH] [TEST] ARM: Disabling cache operation during system reset
> 
> On ORIGEN/SMDKV310 board, system reboot hangs during cache disabling
> call in arm_machine_restart()=>cpu_proc_fin(). Applying given patch
> enables the system to reboot properly.
> 
> This patch is no way a proposed solution. It is intended for further
> investigation.

My patch solves the following issue on all Samsung platforms:

[   32.636689] SysRq : Resetting
[   32.638319] arch_reset: attempting watchdog reset
[   32.642864] BUG: sleeping function called from invalid context at
kernel/mutex.c:271
[   32.650589] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper
[   32.657183] INFO: lockdep is turned off.
[   32.661090] irq event stamp: 6363
[   32.664388] hardirqs last  enabled at (6363): [<c0395ae4>]
_raw_spin_unlock_irq+0x24/0x50
[   32.672547] hardirqs last disabled at (6362): [<c0395370>]
_raw_spin_lock_irq+0x18/0x58
[   32.680532] softirqs last  enabled at (6358): [<c002d4f0>] irq_exit+0x58/0x68
[   32.687650] softirqs last disabled at (6291): [<c002d4f0>] irq_exit+0x58/0x68
[   32.694782] [<c0012fd0>] (unwind_backtrace+0x0/0xf0) from [<c03942e0>]
(mutex_lock_nested+0x30/0x324)
[   32.703980] [<c03942e0>] (mutex_lock_nested+0x30/0x324) from [<c0280d2c>]
(clk_get_sys+0x28/0xd0)
[   32.712834] [<c0280d2c>] (clk_get_sys+0x28/0xd0) from [<c000f0a0>]
(arm_machine_restart+0x68/0x120)
[   32.721859] [<c000f0a0>] (arm_machine_restart+0x68/0x120) from [<c000ea38>]
(machine_restart+0x18/0x20)
[   32.731233] [<c000ea38>] (machine_restart+0x18/0x20) from [<c01c475c>]
(__handle_sysrq+0xc0/0x16c)
[   32.740175] [<c01c475c>] (__handle_sysrq+0xc0/0x16c) from [<c01d7c50>]
(s3c24xx_serial_rx_chars+0x1c0/0x2d0)
[   32.749985] [<c01d7c50>] (s3c24xx_serial_rx_chars+0x1c0/0x2d0) from
[<c005f3ac>] (handle_irq_event_percpu+0x30/0x178)
[   32.760572] [<c005f3ac>] (handle_irq_event_percpu+0x30/0x178) from
[<c005f530>] (handle_irq_event+0x3c/0x5c)
[   32.770380] [<c005f530>] (handle_irq_event+0x3c/0x5c) from [<c00615bc>]
(handle_level_irq+0xc4/0xf4)
[   32.779494] [<c00615bc>] (handle_level_irq+0xc4/0xf4) from [<c005f0a0>]
(generic_handle_irq+0x28/0x3c)
[   32.788782] [<c005f0a0>] (generic_handle_irq+0x28/0x3c) from [<c001cf24>]
(s3c_irq_demux_uart+0x68/0xc0)
[   32.798242] [<c001cf24>] (s3c_irq_demux_uart+0x68/0xc0) from [<c005f0a0>]
(generic_handle_irq+0x28/0x3c)
[   32.807704] [<c005f0a0>] (generic_handle_irq+0x28/0x3c) from [<c000e94c>]
(handle_IRQ+0x60/0x84)
[   32.816470] [<c000e94c>] (handle_IRQ+0x60/0x84) from [<c000d58c>]
(__irq_svc+0x4c/0xb0)
[   32.824457] [<c000d58c>] (__irq_svc+0x4c/0xb0) from [<c001a2a0>]
(exynos4_idle+0x28/0x2c)
[   32.832615] [<c001a2a0>] (exynos4_idle+0x28/0x2c) from [<c000efe8>]
(cpu_idle+0x48/0x98)
[   32.840689] [<c000efe8>] (cpu_idle+0x48/0x98) from [<c04ca740>]
(start_kernel+0x268PMIC:ONOFF1 (LSB=LDO5):0

It looks that there is at least one more issue related to system reset
call, which is fixed or worked around by your patch.

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-19 10:25   ` Marek Szyprowski
@ 2011-08-19 10:44     ` Kyungmin Park
  2011-08-22  6:57       ` Tushar Behera
  0 siblings, 1 reply; 9+ messages in thread
From: Kyungmin Park @ 2011-08-19 10:44 UTC (permalink / raw)
  To: Marek Szyprowski
  Cc: Tushar Behera, linux-samsung-soc, Kukjin Kim, Angus Ainslie

Interesting. there's no s5p_reset_hook at exynos4.
Anyway, after implement the s5p_reset_hook, it's working without
hacking of v7-fin.

Send it another mail.

Thank you,
Kyungmin Park

On Fri, Aug 19, 2011 at 7:25 PM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Hello,
>
> On Friday, August 19, 2011 11:38 AM Tushar Behera wrote:
>
>> Hi,
>>
>> On Thursday 18 August 2011 03:55 PM, Marek Szyprowski wrote:
>> > clkdev framework uses global mutex to protect clock tree, so it is not
>> > possible to call clk_get() in interrupt context. This patch fixes this
>> > issue and makes system reset by watchdog call working again.
>> >
>> > Signed-off-by: Marek Szyprowski<m.szyprowski@samsung.com>
>> > Signed-off-by: Kyungmin Park<kyungmin.park@samsung.com>
>> > ---
>> >   arch/arm/plat-samsung/clock.c                      |   11 +++++++++++
>> >   arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
>> >   .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
>> >   3 files changed, 17 insertions(+), 7 deletions(-)
>> >
>> >
>> > history:
>> > v3:
>> > - moved initialization to arch_initcall, cleaned the code
>> >
>> > v2:
>> > - added missing '__init' section modifiers
>> (snip)
>>
>> I tried to test this patch with ORIGEN board.
>>
>> I took the ORIGEN board support patch from kgene's
>> next-samsung-board-v3.1 branch and rebased it onto the for-next branch
>> for testing.
>>
>> The system reboot stops at a message saying "Restarting system" and hangs.
>>
>> However applying below patch reboots the system without even applying
>> Marek's patch.
>>
>> Is there something wrong with mach-origen.c or u-boot [1]?
>>
>> [1] git://git.linaro.org/people/angus/u-boot.git (origen)
>>
>>  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>
>> From: Tushar Behera <tushar.behera@linaro.org>
>> Date: Fri, 19 Aug 2011 14:47:04 +0530
>> Subject: [PATCH] [TEST] ARM: Disabling cache operation during system reset
>>
>> On ORIGEN/SMDKV310 board, system reboot hangs during cache disabling
>> call in arm_machine_restart()=>cpu_proc_fin(). Applying given patch
>> enables the system to reboot properly.
>>
>> This patch is no way a proposed solution. It is intended for further
>> investigation.
>
> My patch solves the following issue on all Samsung platforms:
>
> [   32.636689] SysRq : Resetting
> [   32.638319] arch_reset: attempting watchdog reset
> [   32.642864] BUG: sleeping function called from invalid context at
> kernel/mutex.c:271
> [   32.650589] in_atomic(): 1, irqs_disabled(): 128, pid: 0, name: swapper
> [   32.657183] INFO: lockdep is turned off.
> [   32.661090] irq event stamp: 6363
> [   32.664388] hardirqs last  enabled at (6363): [<c0395ae4>]
> _raw_spin_unlock_irq+0x24/0x50
> [   32.672547] hardirqs last disabled at (6362): [<c0395370>]
> _raw_spin_lock_irq+0x18/0x58
> [   32.680532] softirqs last  enabled at (6358): [<c002d4f0>] irq_exit+0x58/0x68
> [   32.687650] softirqs last disabled at (6291): [<c002d4f0>] irq_exit+0x58/0x68
> [   32.694782] [<c0012fd0>] (unwind_backtrace+0x0/0xf0) from [<c03942e0>]
> (mutex_lock_nested+0x30/0x324)
> [   32.703980] [<c03942e0>] (mutex_lock_nested+0x30/0x324) from [<c0280d2c>]
> (clk_get_sys+0x28/0xd0)
> [   32.712834] [<c0280d2c>] (clk_get_sys+0x28/0xd0) from [<c000f0a0>]
> (arm_machine_restart+0x68/0x120)
> [   32.721859] [<c000f0a0>] (arm_machine_restart+0x68/0x120) from [<c000ea38>]
> (machine_restart+0x18/0x20)
> [   32.731233] [<c000ea38>] (machine_restart+0x18/0x20) from [<c01c475c>]
> (__handle_sysrq+0xc0/0x16c)
> [   32.740175] [<c01c475c>] (__handle_sysrq+0xc0/0x16c) from [<c01d7c50>]
> (s3c24xx_serial_rx_chars+0x1c0/0x2d0)
> [   32.749985] [<c01d7c50>] (s3c24xx_serial_rx_chars+0x1c0/0x2d0) from
> [<c005f3ac>] (handle_irq_event_percpu+0x30/0x178)
> [   32.760572] [<c005f3ac>] (handle_irq_event_percpu+0x30/0x178) from
> [<c005f530>] (handle_irq_event+0x3c/0x5c)
> [   32.770380] [<c005f530>] (handle_irq_event+0x3c/0x5c) from [<c00615bc>]
> (handle_level_irq+0xc4/0xf4)
> [   32.779494] [<c00615bc>] (handle_level_irq+0xc4/0xf4) from [<c005f0a0>]
> (generic_handle_irq+0x28/0x3c)
> [   32.788782] [<c005f0a0>] (generic_handle_irq+0x28/0x3c) from [<c001cf24>]
> (s3c_irq_demux_uart+0x68/0xc0)
> [   32.798242] [<c001cf24>] (s3c_irq_demux_uart+0x68/0xc0) from [<c005f0a0>]
> (generic_handle_irq+0x28/0x3c)
> [   32.807704] [<c005f0a0>] (generic_handle_irq+0x28/0x3c) from [<c000e94c>]
> (handle_IRQ+0x60/0x84)
> [   32.816470] [<c000e94c>] (handle_IRQ+0x60/0x84) from [<c000d58c>]
> (__irq_svc+0x4c/0xb0)
> [   32.824457] [<c000d58c>] (__irq_svc+0x4c/0xb0) from [<c001a2a0>]
> (exynos4_idle+0x28/0x2c)
> [   32.832615] [<c001a2a0>] (exynos4_idle+0x28/0x2c) from [<c000efe8>]
> (cpu_idle+0x48/0x98)
> [   32.840689] [<c000efe8>] (cpu_idle+0x48/0x98) from [<c04ca740>]
> (start_kernel+0x268PMIC:ONOFF1 (LSB=LDO5):0
>
> It looks that there is at least one more issue related to system reset
> call, which is fixed or worked around by your patch.
>
> Best regards
> --
> Marek Szyprowski
> Samsung Poland R&D Center
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-18 10:25 [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get() Marek Szyprowski
  2011-08-19  9:37 ` Tushar Behera
@ 2011-08-19 13:06 ` Kukjin Kim
  2011-08-19 13:41   ` Marek Szyprowski
  2011-09-05 11:32 ` Kukjin Kim
  2 siblings, 1 reply; 9+ messages in thread
From: Kukjin Kim @ 2011-08-19 13:06 UTC (permalink / raw)
  To: 'Marek Szyprowski', linux-samsung-soc
  Cc: 'Kyungmin Park', 'Angus Ainslie'

Marek Szyprowski wrote:
> 
> clkdev framework uses global mutex to protect clock tree, so it is not
> possible to call clk_get() in interrupt context. This patch fixes this
> issue and makes system reset by watchdog call working again.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/plat-samsung/clock.c                      |   11 +++++++++++
>  arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
>  .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
>  3 files changed, 17 insertions(+), 7 deletions(-)
> 
> 
> history:
> v3:
> - moved initialization to arch_initcall, cleaned the code
> 
> v2:
> - added missing '__init' section modifiers
> 
> diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
> index 302c426..3b44519 100644
> --- a/arch/arm/plat-samsung/clock.c
> +++ b/arch/arm/plat-samsung/clock.c
> @@ -64,6 +64,17 @@ static LIST_HEAD(clocks);
>   */
>  DEFINE_SPINLOCK(clocks_lock);
> 
> +/* Global watchdog clock used by arch_wtd_reset() callback */
> +struct clk *s3c2410_wdtclk;
> +static int __init s3c_wdt_reset_init(void)
> +{
> +	s3c2410_wdtclk = clk_get(NULL, "watchdog");
> +	if (IS_ERR(s3c2410_wdtclk))
> +		printk(KERN_WARNING "%s: warning: cannot get watchdog
> clock\n", __func__);
> +	return 0;
> +}
> +arch_initcall(s3c_wdt_reset_init);
> +
>  /* enable and disable calls for use with the clk struct */
> 
>  static int clk_null_enable(struct clk *clk, int enable)
> diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-
> samsung/include/plat/clock.h
> index 87d5b38..8f95700 100644
> --- a/arch/arm/plat-samsung/include/plat/clock.h
> +++ b/arch/arm/plat-samsung/include/plat/clock.h
> @@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int
enable);
> 
>  extern void s3c_pwmclk_init(void);
> 
> +/* Global watchdog clock used by arch_wtd_reset() callback */
> +
> +extern struct clk *s3c2410_wdtclk;
> diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
b/arch/arm/plat-
> samsung/include/plat/watchdog-reset.h
> index 54b762a..40dbb2b 100644
> --- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> +++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> @@ -10,6 +10,7 @@
>   * published by the Free Software Foundation.
>  */
> 
> +#include <plat/clock.h>
>  #include <plat/regs-watchdog.h>
>  #include <mach/map.h>
> 
> @@ -19,17 +20,12 @@
> 
>  static inline void arch_wdt_reset(void)
>  {
> -	struct clk *wdtclk;
> -
>  	printk("arch_reset: attempting watchdog reset\n");
> 
>  	__raw_writel(0, S3C2410_WTCON);	  /* disable watchdog, to be safe
*/
> 
> -	wdtclk = clk_get(NULL, "watchdog");
> -	if (!IS_ERR(wdtclk)) {
> -		clk_enable(wdtclk);
> -	} else
> -		printk(KERN_WARNING "%s: warning: cannot get watchdog
> clock\n", __func__);
> +	if (s3c2410_wdtclk)
> +		clk_enable(s3c2410_wdtclk);
> 
>  	/* put initial values into count and data */
>  	__raw_writel(0x80, S3C2410_WTCNT);
> --
> 1.7.1.569.g6f426

Looks good but happens following:

Hmm...
With s3c2410_defconfig:

In file included from arch/arm/plat-s3c24xx/cpu.c:48:
arch/arm/plat-samsung/include/plat/clock.h:32: error: redefinition of
'struct clk_ops'
arch/arm/plat-samsung/include/plat/clock.h:39: error: redefinition of
'struct clk'
arch/arm/plat-samsung/include/plat/clock.h:60: error: conflicting types for
's3c24xx_dclk0'
arch/arm/plat-samsung/include/plat/clock.h:60: note: previous declaration of
's3c24xx_dclk0' was here
arch/arm/plat-samsung/include/plat/clock.h:61: error: conflicting types for
's3c24xx_dclk1'
arch/arm/plat-samsung/include/plat/clock.h:61: note: previous declaration of
's3c24xx_dclk1' was here
arch/arm/plat-samsung/include/plat/clock.h:62: error: conflicting types for
's3c24xx_clkout0'
arch/arm/plat-samsung/include/plat/clock.h:62: note: previous declaration of
's3c24xx_clkout0' was here

(snip)

arch/arm/plat-samsung/include/plat/clock.h:101: error: conflicting types for
's3c_disable_clocks'
arch/arm/plat-samsung/include/plat/clock.h:101: note: previous declaration
of 's3c_disable_clocks' was here
arch/arm/plat-samsung/include/plat/clock.h:118: error: conflicting types for
's3c64xx_sclk_ctrl'
arch/arm/plat-samsung/include/plat/clock.h:118: note: previous declaration
of 's3c64xx_sclk_ctrl' was here
arch/arm/plat-samsung/include/plat/clock.h:126: error: conflicting types for
's3c2410_wdtclk'
arch/arm/plat-samsung/include/plat/clock.h:126: note: previous declaration
of 's3c2410_wdtclk' was here
make[1]: *** [arch/arm/plat-s3c24xx/cpu.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [arch/arm/plat-s3c24xx] Error 2
make: *** Waiting for unfinished jobs....

And, with s5p64x0_defconfig:

  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  KSYM    .tmp_kallsyms1.S
  AS      .tmp_kallsyms1.o
  LD      .tmp_vmlinux2
  KSYM    .tmp_kallsyms2.S
  AS      .tmp_kallsyms2.o
  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
Inconsistent kallsyms data
This is a bug - please report about it
Try make KALLSYMS_EXTRA_PASS=1 as a workaround
make: *** [vmlinux] Error 1


The building error of s3c2410_defconfig can be fixed with below.
---
commit c5f80e2eb419437a7e4272d28bc7258b650b0934
Author: Kukjin Kim <kgene.kim@samsung.com>
Date:   Fri Aug 19 21:12:19 2011 +0900

    ARM: SAMSUNG: fix to prevent declaring duplicated

    The plat/clock.h revised to prevent declaring duplicated.

    Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>

diff --git a/arch/arm/plat-samsung/include/plat/clock.h
b/arch/arm/plat-samsung/include/plat/clock.h
index 8f95700..092be14 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -9,6 +9,9 @@
  * published by the Free Software Foundation.
 */

+#ifndef __ASM_PLAT_CLOCK_H
+#define __ASM_PLAT_CLOCK_H __FILE__
+
 #include <linux/spinlock.h>
 #include <linux/clkdev.h>

@@ -124,3 +127,5 @@ extern void s3c_pwmclk_init(void);
 /* Global watchdog clock used by arch_wtd_reset() callback */

 extern struct clk *s3c2410_wdtclk;
+
+#endif /* __ASM_PLAT_CLOCK_H */
---

But, the error of s5p64x0_defconfig happens still :(

I know, the 'watchdog reset issue' should be fixed however, we need to sort
this out again.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* RE: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-19 13:06 ` Kukjin Kim
@ 2011-08-19 13:41   ` Marek Szyprowski
  2011-08-19 14:25     ` Kukjin Kim
  0 siblings, 1 reply; 9+ messages in thread
From: Marek Szyprowski @ 2011-08-19 13:41 UTC (permalink / raw)
  To: 'Kukjin Kim', linux-samsung-soc
  Cc: 'Kyungmin Park', 'Angus Ainslie'

Hello,

On Friday, August 19, 2011 3:06 PM Kukjin Kim wrote:

> Marek Szyprowski wrote:
> >
> > clkdev framework uses global mutex to protect clock tree, so it is not
> > possible to call clk_get() in interrupt context. This patch fixes this
> > issue and makes system reset by watchdog call working again.
> >
> > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > ---
> >  arch/arm/plat-samsung/clock.c                      |   11 +++++++++++
> >  arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
> >  .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
> >  3 files changed, 17 insertions(+), 7 deletions(-)
> >
> >
> > history:
> > v3:
> > - moved initialization to arch_initcall, cleaned the code
> >
> > v2:
> > - added missing '__init' section modifiers
> >
> > diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
> > index 302c426..3b44519 100644
> > --- a/arch/arm/plat-samsung/clock.c
> > +++ b/arch/arm/plat-samsung/clock.c
> > @@ -64,6 +64,17 @@ static LIST_HEAD(clocks);
> >   */
> >  DEFINE_SPINLOCK(clocks_lock);
> >
> > +/* Global watchdog clock used by arch_wtd_reset() callback */
> > +struct clk *s3c2410_wdtclk;
> > +static int __init s3c_wdt_reset_init(void)
> > +{
> > +	s3c2410_wdtclk = clk_get(NULL, "watchdog");
> > +	if (IS_ERR(s3c2410_wdtclk))
> > +		printk(KERN_WARNING "%s: warning: cannot get watchdog
> > clock\n", __func__);
> > +	return 0;
> > +}
> > +arch_initcall(s3c_wdt_reset_init);
> > +
> >  /* enable and disable calls for use with the clk struct */
> >
> >  static int clk_null_enable(struct clk *clk, int enable)
> > diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-
> > samsung/include/plat/clock.h
> > index 87d5b38..8f95700 100644
> > --- a/arch/arm/plat-samsung/include/plat/clock.h
> > +++ b/arch/arm/plat-samsung/include/plat/clock.h
> > @@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int
> enable);
> >
> >  extern void s3c_pwmclk_init(void);
> >
> > +/* Global watchdog clock used by arch_wtd_reset() callback */
> > +
> > +extern struct clk *s3c2410_wdtclk;
> > diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> b/arch/arm/plat-
> > samsung/include/plat/watchdog-reset.h
> > index 54b762a..40dbb2b 100644
> > --- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> > +++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> > @@ -10,6 +10,7 @@
> >   * published by the Free Software Foundation.
> >  */
> >
> > +#include <plat/clock.h>
> >  #include <plat/regs-watchdog.h>
> >  #include <mach/map.h>
> >
> > @@ -19,17 +20,12 @@
> >
> >  static inline void arch_wdt_reset(void)
> >  {
> > -	struct clk *wdtclk;
> > -
> >  	printk("arch_reset: attempting watchdog reset\n");
> >
> >  	__raw_writel(0, S3C2410_WTCON);	  /* disable watchdog, to be safe
> */
> >
> > -	wdtclk = clk_get(NULL, "watchdog");
> > -	if (!IS_ERR(wdtclk)) {
> > -		clk_enable(wdtclk);
> > -	} else
> > -		printk(KERN_WARNING "%s: warning: cannot get watchdog
> > clock\n", __func__);
> > +	if (s3c2410_wdtclk)
> > +		clk_enable(s3c2410_wdtclk);
> >
> >  	/* put initial values into count and data */
> >  	__raw_writel(0x80, S3C2410_WTCNT);
> > --
> > 1.7.1.569.g6f426
> 
> Looks good but happens following:
> 
> Hmm...
> With s3c2410_defconfig:
> 
> In file included from arch/arm/plat-s3c24xx/cpu.c:48:
> arch/arm/plat-samsung/include/plat/clock.h:32: error: redefinition of
> 'struct clk_ops'
> arch/arm/plat-samsung/include/plat/clock.h:39: error: redefinition of
> 'struct clk'
> arch/arm/plat-samsung/include/plat/clock.h:60: error: conflicting types for
> 's3c24xx_dclk0'
> arch/arm/plat-samsung/include/plat/clock.h:60: note: previous declaration of
> 's3c24xx_dclk0' was here
> arch/arm/plat-samsung/include/plat/clock.h:61: error: conflicting types for
> 's3c24xx_dclk1'
> arch/arm/plat-samsung/include/plat/clock.h:61: note: previous declaration of
> 's3c24xx_dclk1' was here
> arch/arm/plat-samsung/include/plat/clock.h:62: error: conflicting types for
> 's3c24xx_clkout0'
> arch/arm/plat-samsung/include/plat/clock.h:62: note: previous declaration of
> 's3c24xx_clkout0' was here
> 
> (snip)
> 
> arch/arm/plat-samsung/include/plat/clock.h:101: error: conflicting types for
> 's3c_disable_clocks'
> arch/arm/plat-samsung/include/plat/clock.h:101: note: previous declaration
> of 's3c_disable_clocks' was here
> arch/arm/plat-samsung/include/plat/clock.h:118: error: conflicting types for
> 's3c64xx_sclk_ctrl'
> arch/arm/plat-samsung/include/plat/clock.h:118: note: previous declaration
> of 's3c64xx_sclk_ctrl' was here
> arch/arm/plat-samsung/include/plat/clock.h:126: error: conflicting types for
> 's3c2410_wdtclk'
> arch/arm/plat-samsung/include/plat/clock.h:126: note: previous declaration
> of 's3c2410_wdtclk' was here
> make[1]: *** [arch/arm/plat-s3c24xx/cpu.o] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make: *** [arch/arm/plat-s3c24xx] Error 2
> make: *** Waiting for unfinished jobs....
> 
> And, with s5p64x0_defconfig:
> 
>   CHK     include/linux/version.h
>   CHK     include/generated/utsrelease.h
> make[1]: `include/generated/mach-types.h' is up to date.
>   CALL    scripts/checksyscalls.sh
>   CHK     include/generated/compile.h
>   KSYM    .tmp_kallsyms1.S
>   AS      .tmp_kallsyms1.o
>   LD      .tmp_vmlinux2
>   KSYM    .tmp_kallsyms2.S
>   AS      .tmp_kallsyms2.o
>   LD      vmlinux
>   SYSMAP  System.map
>   SYSMAP  .tmp_System.map
> Inconsistent kallsyms data
> This is a bug - please report about it
> Try make KALLSYMS_EXTRA_PASS=1 as a workaround
> make: *** [vmlinux] Error 1
> 
> 
> The building error of s3c2410_defconfig can be fixed with below.
> ---
> commit c5f80e2eb419437a7e4272d28bc7258b650b0934
> Author: Kukjin Kim <kgene.kim@samsung.com>
> Date:   Fri Aug 19 21:12:19 2011 +0900
> 
>     ARM: SAMSUNG: fix to prevent declaring duplicated
> 
>     The plat/clock.h revised to prevent declaring duplicated.
> 
>     Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> 
> diff --git a/arch/arm/plat-samsung/include/plat/clock.h
> b/arch/arm/plat-samsung/include/plat/clock.h
> index 8f95700..092be14 100644
> --- a/arch/arm/plat-samsung/include/plat/clock.h
> +++ b/arch/arm/plat-samsung/include/plat/clock.h
> @@ -9,6 +9,9 @@
>   * published by the Free Software Foundation.
>  */
> 
> +#ifndef __ASM_PLAT_CLOCK_H
> +#define __ASM_PLAT_CLOCK_H __FILE__
> +
>  #include <linux/spinlock.h>
>  #include <linux/clkdev.h>
> 
> @@ -124,3 +127,5 @@ extern void s3c_pwmclk_init(void);
>  /* Global watchdog clock used by arch_wtd_reset() callback */
> 
>  extern struct clk *s3c2410_wdtclk;
> +
> +#endif /* __ASM_PLAT_CLOCK_H */
> ---
> 
> But, the error of s5p64x0_defconfig happens still :(

Well, this issue is definitely not related to my patch. The strange thing is
the fact that it builds here correctly with s5p64x0_defconfig.
 
Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-19 13:41   ` Marek Szyprowski
@ 2011-08-19 14:25     ` Kukjin Kim
  0 siblings, 0 replies; 9+ messages in thread
From: Kukjin Kim @ 2011-08-19 14:25 UTC (permalink / raw)
  To: 'Marek Szyprowski', linux-samsung-soc
  Cc: 'Kyungmin Park', 'Angus Ainslie'

Marek Szyprowski wrote:
> 
> Hello,
> 
> On Friday, August 19, 2011 3:06 PM Kukjin Kim wrote:
> 
> > Marek Szyprowski wrote:
> > >
> > > clkdev framework uses global mutex to protect clock tree, so it is not
> > > possible to call clk_get() in interrupt context. This patch fixes this
> > > issue and makes system reset by watchdog call working again.
> > >
> > > Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> > > Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> > > ---
> > >  arch/arm/plat-samsung/clock.c                      |   11
> +++++++++++
> > >  arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
> > >  .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
> > >  3 files changed, 17 insertions(+), 7 deletions(-)
> > >
> > >
> > > history:
> > > v3:
> > > - moved initialization to arch_initcall, cleaned the code
> > >
> > > v2:
> > > - added missing '__init' section modifiers
> > >
> > > diff --git a/arch/arm/plat-samsung/clock.c
b/arch/arm/plat-samsung/clock.c
> > > index 302c426..3b44519 100644
> > > --- a/arch/arm/plat-samsung/clock.c
> > > +++ b/arch/arm/plat-samsung/clock.c
> > > @@ -64,6 +64,17 @@ static LIST_HEAD(clocks);
> > >   */
> > >  DEFINE_SPINLOCK(clocks_lock);
> > >
> > > +/* Global watchdog clock used by arch_wtd_reset() callback */
> > > +struct clk *s3c2410_wdtclk;
> > > +static int __init s3c_wdt_reset_init(void)
> > > +{
> > > +	s3c2410_wdtclk = clk_get(NULL, "watchdog");
> > > +	if (IS_ERR(s3c2410_wdtclk))
> > > +		printk(KERN_WARNING "%s: warning: cannot get watchdog
> > > clock\n", __func__);
> > > +	return 0;
> > > +}
> > > +arch_initcall(s3c_wdt_reset_init);
> > > +
> > >  /* enable and disable calls for use with the clk struct */
> > >
> > >  static int clk_null_enable(struct clk *clk, int enable)
> > > diff --git a/arch/arm/plat-samsung/include/plat/clock.h
b/arch/arm/plat-
> > > samsung/include/plat/clock.h
> > > index 87d5b38..8f95700 100644
> > > --- a/arch/arm/plat-samsung/include/plat/clock.h
> > > +++ b/arch/arm/plat-samsung/include/plat/clock.h
> > > @@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int
> > enable);
> > >
> > >  extern void s3c_pwmclk_init(void);
> > >
> > > +/* Global watchdog clock used by arch_wtd_reset() callback */
> > > +
> > > +extern struct clk *s3c2410_wdtclk;
> > > diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> > b/arch/arm/plat-
> > > samsung/include/plat/watchdog-reset.h
> > > index 54b762a..40dbb2b 100644
> > > --- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> > > +++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> > > @@ -10,6 +10,7 @@
> > >   * published by the Free Software Foundation.
> > >  */
> > >
> > > +#include <plat/clock.h>
> > >  #include <plat/regs-watchdog.h>
> > >  #include <mach/map.h>
> > >
> > > @@ -19,17 +20,12 @@
> > >
> > >  static inline void arch_wdt_reset(void)
> > >  {
> > > -	struct clk *wdtclk;
> > > -
> > >  	printk("arch_reset: attempting watchdog reset\n");
> > >
> > >  	__raw_writel(0, S3C2410_WTCON);	  /* disable watchdog, to be safe
> > */
> > >
> > > -	wdtclk = clk_get(NULL, "watchdog");
> > > -	if (!IS_ERR(wdtclk)) {
> > > -		clk_enable(wdtclk);
> > > -	} else
> > > -		printk(KERN_WARNING "%s: warning: cannot get watchdog
> > > clock\n", __func__);
> > > +	if (s3c2410_wdtclk)
> > > +		clk_enable(s3c2410_wdtclk);
> > >
> > >  	/* put initial values into count and data */
> > >  	__raw_writel(0x80, S3C2410_WTCNT);
> > > --
> > > 1.7.1.569.g6f426
> >
> > Looks good but happens following:
> >
> > Hmm...
> > With s3c2410_defconfig:
> >
> > In file included from arch/arm/plat-s3c24xx/cpu.c:48:
> > arch/arm/plat-samsung/include/plat/clock.h:32: error: redefinition of
> > 'struct clk_ops'
> > arch/arm/plat-samsung/include/plat/clock.h:39: error: redefinition of
> > 'struct clk'
> > arch/arm/plat-samsung/include/plat/clock.h:60: error: conflicting types
for
> > 's3c24xx_dclk0'
> > arch/arm/plat-samsung/include/plat/clock.h:60: note: previous
declaration of
> > 's3c24xx_dclk0' was here
> > arch/arm/plat-samsung/include/plat/clock.h:61: error: conflicting types
for
> > 's3c24xx_dclk1'
> > arch/arm/plat-samsung/include/plat/clock.h:61: note: previous
declaration of
> > 's3c24xx_dclk1' was here
> > arch/arm/plat-samsung/include/plat/clock.h:62: error: conflicting types
for
> > 's3c24xx_clkout0'
> > arch/arm/plat-samsung/include/plat/clock.h:62: note: previous
declaration of
> > 's3c24xx_clkout0' was here
> >
> > (snip)
> >
> > arch/arm/plat-samsung/include/plat/clock.h:101: error: conflicting types
for
> > 's3c_disable_clocks'
> > arch/arm/plat-samsung/include/plat/clock.h:101: note: previous
declaration
> > of 's3c_disable_clocks' was here
> > arch/arm/plat-samsung/include/plat/clock.h:118: error: conflicting types
for
> > 's3c64xx_sclk_ctrl'
> > arch/arm/plat-samsung/include/plat/clock.h:118: note: previous
declaration
> > of 's3c64xx_sclk_ctrl' was here
> > arch/arm/plat-samsung/include/plat/clock.h:126: error: conflicting types
for
> > 's3c2410_wdtclk'
> > arch/arm/plat-samsung/include/plat/clock.h:126: note: previous
declaration
> > of 's3c2410_wdtclk' was here
> > make[1]: *** [arch/arm/plat-s3c24xx/cpu.o] Error 1
> > make[1]: *** Waiting for unfinished jobs....
> > make: *** [arch/arm/plat-s3c24xx] Error 2
> > make: *** Waiting for unfinished jobs....
> >
> > And, with s5p64x0_defconfig:
> >
> >   CHK     include/linux/version.h
> >   CHK     include/generated/utsrelease.h
> > make[1]: `include/generated/mach-types.h' is up to date.
> >   CALL    scripts/checksyscalls.sh
> >   CHK     include/generated/compile.h
> >   KSYM    .tmp_kallsyms1.S
> >   AS      .tmp_kallsyms1.o
> >   LD      .tmp_vmlinux2
> >   KSYM    .tmp_kallsyms2.S
> >   AS      .tmp_kallsyms2.o
> >   LD      vmlinux
> >   SYSMAP  System.map
> >   SYSMAP  .tmp_System.map
> > Inconsistent kallsyms data
> > This is a bug - please report about it
> > Try make KALLSYMS_EXTRA_PASS=1 as a workaround
> > make: *** [vmlinux] Error 1
> >
> >
> > The building error of s3c2410_defconfig can be fixed with below.
> > ---
> > commit c5f80e2eb419437a7e4272d28bc7258b650b0934
> > Author: Kukjin Kim <kgene.kim@samsung.com>
> > Date:   Fri Aug 19 21:12:19 2011 +0900
> >
> >     ARM: SAMSUNG: fix to prevent declaring duplicated
> >
> >     The plat/clock.h revised to prevent declaring duplicated.
> >
> >     Signed-off-by: Kukjin Kim <kgene.kim@samsung.com>
> >
> > diff --git a/arch/arm/plat-samsung/include/plat/clock.h
> > b/arch/arm/plat-samsung/include/plat/clock.h
> > index 8f95700..092be14 100644
> > --- a/arch/arm/plat-samsung/include/plat/clock.h
> > +++ b/arch/arm/plat-samsung/include/plat/clock.h
> > @@ -9,6 +9,9 @@
> >   * published by the Free Software Foundation.
> >  */
> >
> > +#ifndef __ASM_PLAT_CLOCK_H
> > +#define __ASM_PLAT_CLOCK_H __FILE__
> > +
> >  #include <linux/spinlock.h>
> >  #include <linux/clkdev.h>
> >
> > @@ -124,3 +127,5 @@ extern void s3c_pwmclk_init(void);
> >  /* Global watchdog clock used by arch_wtd_reset() callback */
> >
> >  extern struct clk *s3c2410_wdtclk;
> > +
> > +#endif /* __ASM_PLAT_CLOCK_H */
> > ---
> >
> > But, the error of s5p64x0_defconfig happens still :(
> 
> Well, this issue is definitely not related to my patch. The strange thing
is
> the fact that it builds here correctly with s5p64x0_defconfig.
> 
Hi Marek,

Yes, the build error doesn't seem to be related to this.
But happens only with this :(

I'd like to clear, debug it in the next week...Then will apply.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-19 10:44     ` Kyungmin Park
@ 2011-08-22  6:57       ` Tushar Behera
  0 siblings, 0 replies; 9+ messages in thread
From: Tushar Behera @ 2011-08-22  6:57 UTC (permalink / raw)
  To: Kyungmin Park
  Cc: Marek Szyprowski, linux-samsung-soc, Kukjin Kim, Angus Ainslie

Hi Kyungmin,

On Friday 19 August 2011 04:14 PM, Kyungmin Park wrote:
> Interesting. there's no s5p_reset_hook at exynos4.
> Anyway, after implement the s5p_reset_hook, it's working without
> hacking of v7-fin.
>
Thanks for the pointer. After adding s5p_reset_hook, tested soft-reboot 
successfully on ORIGEN.

> Send it another mail.
>
> Thank you,
> Kyungmin Park
>

-- 
Tushar Behera

^ permalink raw reply	[flat|nested] 9+ messages in thread

* RE: [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get()
  2011-08-18 10:25 [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get() Marek Szyprowski
  2011-08-19  9:37 ` Tushar Behera
  2011-08-19 13:06 ` Kukjin Kim
@ 2011-09-05 11:32 ` Kukjin Kim
  2 siblings, 0 replies; 9+ messages in thread
From: Kukjin Kim @ 2011-09-05 11:32 UTC (permalink / raw)
  To: 'Marek Szyprowski', linux-samsung-soc
  Cc: 'Kyungmin Park', 'Angus Ainslie'

Marek Szyprowski wrote:
> 
> clkdev framework uses global mutex to protect clock tree, so it is not
> possible to call clk_get() in interrupt context. This patch fixes this
> issue and makes system reset by watchdog call working again.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  arch/arm/plat-samsung/clock.c                      |   11 +++++++++++
>  arch/arm/plat-samsung/include/plat/clock.h         |    3 +++
>  .../arm/plat-samsung/include/plat/watchdog-reset.h |   10 +++-------
>  3 files changed, 17 insertions(+), 7 deletions(-)
> 
> 
> history:
> v3:
> - moved initialization to arch_initcall, cleaned the code
> 
> v2:
> - added missing '__init' section modifiers
> 
> diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
> index 302c426..3b44519 100644
> --- a/arch/arm/plat-samsung/clock.c
> +++ b/arch/arm/plat-samsung/clock.c
> @@ -64,6 +64,17 @@ static LIST_HEAD(clocks);
>   */
>  DEFINE_SPINLOCK(clocks_lock);
> 
> +/* Global watchdog clock used by arch_wtd_reset() callback */
> +struct clk *s3c2410_wdtclk;
> +static int __init s3c_wdt_reset_init(void)
> +{
> +	s3c2410_wdtclk = clk_get(NULL, "watchdog");
> +	if (IS_ERR(s3c2410_wdtclk))
> +		printk(KERN_WARNING "%s: warning: cannot get watchdog
> clock\n", __func__);
> +	return 0;
> +}
> +arch_initcall(s3c_wdt_reset_init);
> +
>  /* enable and disable calls for use with the clk struct */
> 
>  static int clk_null_enable(struct clk *clk, int enable)
> diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-
> samsung/include/plat/clock.h
> index 87d5b38..8f95700 100644
> --- a/arch/arm/plat-samsung/include/plat/clock.h
> +++ b/arch/arm/plat-samsung/include/plat/clock.h
> @@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int
enable);
> 
>  extern void s3c_pwmclk_init(void);
> 
> +/* Global watchdog clock used by arch_wtd_reset() callback */
> +
> +extern struct clk *s3c2410_wdtclk;
> diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
b/arch/arm/plat-
> samsung/include/plat/watchdog-reset.h
> index 54b762a..40dbb2b 100644
> --- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> +++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
> @@ -10,6 +10,7 @@
>   * published by the Free Software Foundation.
>  */
> 
> +#include <plat/clock.h>
>  #include <plat/regs-watchdog.h>
>  #include <mach/map.h>
> 
> @@ -19,17 +20,12 @@
> 
>  static inline void arch_wdt_reset(void)
>  {
> -	struct clk *wdtclk;
> -
>  	printk("arch_reset: attempting watchdog reset\n");
> 
>  	__raw_writel(0, S3C2410_WTCON);	  /* disable watchdog, to be safe
*/
> 
> -	wdtclk = clk_get(NULL, "watchdog");
> -	if (!IS_ERR(wdtclk)) {
> -		clk_enable(wdtclk);
> -	} else
> -		printk(KERN_WARNING "%s: warning: cannot get watchdog
> clock\n", __func__);
> +	if (s3c2410_wdtclk)
> +		clk_enable(s3c2410_wdtclk);
> 
>  	/* put initial values into count and data */
>  	__raw_writel(0x80, S3C2410_WTCNT);
> --
> 1.7.1.569.g6f426

Looks ok to me, applied.
Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-09-05 11:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-18 10:25 [PATCH v3] ARM: Samsung: fix watchdog reset issue with clk_get() Marek Szyprowski
2011-08-19  9:37 ` Tushar Behera
2011-08-19 10:25   ` Marek Szyprowski
2011-08-19 10:44     ` Kyungmin Park
2011-08-22  6:57       ` Tushar Behera
2011-08-19 13:06 ` Kukjin Kim
2011-08-19 13:41   ` Marek Szyprowski
2011-08-19 14:25     ` Kukjin Kim
2011-09-05 11:32 ` Kukjin Kim

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.