ARM: Samsung: fix watchdog reset issue with clk_get()
Subsystems (3)
PATCH v3 1/1 ARM: Samsung: fix watchdog reset issue with clk_get()
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.
--- 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
arch/arm/plat-samsung/clock.c +11 -0
@@ -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)
arch/arm/plat-samsung/include/plat/clock.h +3 -0
@@ -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;
arch/arm/plat-samsung/include/plat/watchdog-reset.h +3 -7
@@ -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 );
Signature · 1 line
1.7.1.569.g6f426
Hi,
Quoted 13 lines · Marek Szyprowski
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<[email protected]>Signed-off-by Kyungmin Park<[email protected]>--- 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(-)
Quoted 6 lines
history:
v3:
- moved initialization toarch_initcall, cleaned the codev2:
- 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)
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
From: Tushar Behera <[email protected]>
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.
--- arch/arm/mm/proc-v7.S | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mm/proc-v7.S +2 -0
@@ -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)
Signature · 7 lines
1.7.4.1 -- Tushar Behera
Hello,
Quoted 45 lines · Tushar Behera
Hi,
Quoted 13 lines · Marek Szyprowski
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<[email protected]>Signed-off-by Kyungmin Park<[email protected]>--- 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(-)Quoted 6 lines
history:
v3:
- moved initialization toarch_initcall, cleaned the codev2:
- 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.cor u-boot [1]?[1]
git://git.linaro.org/people/angus/u-boot.git(origen)Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
From: Tushar Behera <[email protected]>
Date: Fri, 19 Aug 2011 14:47:04 +0530
Subject: [PATCH] [TEST] ARM: Disabling cache operation during system reset
Quoted 6 lines
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
Signature · 2 lines
Marek Szyprowski Samsung Poland R&D Center
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
Quoted 121 lines · Marek Szyprowski
Hello,
Quoted 45 lines · Tushar Behera
Hi,
Quoted 13 lines · Marek Szyprowski
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<[email protected]>Signed-off-by Kyungmin Park<[email protected]>---
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(-)Quoted 6 lines
history:
v3:
- moved initialization toarch_initcall, cleaned the codev2:
- 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.cor u-boot [1]?[1]
git://git.linaro.org/people/angus/u-boot.git(origen)>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
From: Tushar Behera <[email protected]>
Date: Fri, 19 Aug 2011 14:47:04 +0530
Subject: [PATCH] [TEST] ARM: Disabling cache operation during system resetQuoted 6 lines
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 atkernel/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):0It 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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Kyungmin,
Quoted 4 lines · Kyungmin Park
Interesting. there's no
s5p_reset_hookat exynos4. Anyway, after implement thes5p_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.
Quoted 5 lines
Send it another mail.
Thank you,
Kyungmin Park
Signature · 1 line
Tushar Behera
arch/arm/plat-samsung/include/plat/clock.h extern int s3c64xx_sclk_ctrl(struct clk *clk, int
Quoted 50 lines · Marek Szyprowski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- 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 toarch_initcall, cleaned the codev2:
- added missing '__init' section modifiersarch/arm/plat-samsung/clock.c +11
-0@@ -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)arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/clock.h +0
-0
samsung/include/plat/clock.h
index 87d5b38..8f95700 100644arch/arm/plat-samsung/include/plat/clock.h +0
-0@@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int
enable);
Review
Quoted 7 lines
arch/arm/plat-samsung/include/plat/clock.h +3
-0extern void s3c_pwmclk_init (void ); +/* Global watchdog clock used by arch_wtd_reset() callback */ + +extern struct clk *s3c2410_wdtclk;(quoted diff) +0
-0
b/arch/arm/plat-
Quoted 13 lines
samsung/include/plat/watchdog-reset.h
index 54b762a..40dbb2b 100644arch/arm/plat-samsung/include/plat/watchdog-reset.h +1
-0@@ -10,6 +10,7 @@* published by the Free Software Foundation. */ +#include <plat/clock.h> #include <plat/regs-watchdog.h> #include <mach/map.h>
arch/arm/plat-samsung/include/plat/watchdog-reset.h line 25
Quoted 8 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +0
-2@@ -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
*/
Quoted 13 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +2
-6- 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 ); --
Quoted 1 line
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 <[email protected]> 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.
(quoted diff) +0 -0
b/arch/arm/plat-samsung/include/plat/clock.h
index 8f95700..092be14 100644
arch/arm/plat-samsung/include/plat/clock.h +5 -0
@@ -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 <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
Hello,
Quoted 195 lines · Kukjin Kim
arch/arm/plat-samsung/include/plat/clock.h extern int s3c64xx_sclk_ctrl(struct clk *clk, int
Quoted 50 lines · Marek Szyprowski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- 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 toarch_initcall, cleaned the codev2:
- added missing '__init' section modifiersarch/arm/plat-samsung/clock.c +11
-0@@ -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)arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/clock.h +0
-0
samsung/include/plat/clock.h
index 87d5b38..8f95700 100644arch/arm/plat-samsung/include/plat/clock.h +0
-0@@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, intenable);
Review
Quoted 7 lines
arch/arm/plat-samsung/include/plat/clock.h +3
-0extern void s3c_pwmclk_init (void ); +/* Global watchdog clock used by arch_wtd_reset() callback */ + +extern struct clk *s3c2410_wdtclk;(quoted diff) +0
-0b/arch/arm/plat-
Quoted 13 lines
samsung/include/plat/watchdog-reset.h
index 54b762a..40dbb2b 100644arch/arm/plat-samsung/include/plat/watchdog-reset.h +1
-0@@ -10,6 +10,7 @@* published by the Free Software Foundation. */ +#include <plat/clock.h> #include <plat/regs-watchdog.h> #include <mach/map.h> arch/arm/plat-samsung/include/plat/watchdog-reset.h line 25
Quoted 8 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +0
-2@@ -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 */
Quoted 13 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +2
-6- 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 ); --Quoted 1 line
1.7.1.569.g6f426
Looks good but happens following:
Hmm...
Withs3c2410_defconfig:In file included from
arch/arm/plat-s3c24xx/cpu.c:48:arch/arm/plat-samsung/include/plat/clock.h:32: error: redefinition of 'structclk_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 herearch/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 herearch/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 herearch/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 herearch/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
CHKinclude/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.mapInconsistent kallsyms data
This is a bug - please report about it
Try make KALLSYMS_EXTRA_PASS=1 as a workaround
make: *** [vmlinux] Error 1The building error of
s3c2410_defconfigcan be fixed with below.
---
commitc5f80e2eb419437a7e4272d28bc7258b650b0934Author: Kukjin Kim <[email protected]> Date: Fri Aug 19 21:12:19 2011 +0900ARM: SAMSUNG: fix to prevent declaring duplicated
The
plat/clock.hrevised to prevent declaring duplicated.Signed-off-by Kukjin Kim <[email protected]>arch/arm/plat-samsung/include/plat/clock.h +5
-1@@ -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 */ ---
Quoted 1 line
But, the error of
s5p64x0_defconfighappens 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
Signature · 2 lines
Marek Szyprowski Samsung Poland R&D Center
Quoted 21 lines · Marek Szyprowski
Hello,
Quoted 10 lines · Kukjin Kim
Quoted 9 lines · Marek Szyprowski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- arch/arm/plat-samsung/clock.c | 11+++++++++++
Quoted 5 lines
Quoted 5 lines
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(-)
Quoted 8 lines
Quoted 8 lines
Review
Quoted 8 lines
history:
v3:
- moved initialization toarch_initcall, cleaned the codev2:
- added missing '__init' section modifiers(quoted diff) +0
-0
b/arch/arm/plat-samsung/clock.c
Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
index 302c426..3b44519 100644
arch/arm/plat-samsung/clock.c +11
-0@@ -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 */
Quoted 2 lines
Quoted 2 lines
Review
Quoted 2 lines
static int
clk_null_enable(struct clk *clk, int enable)(quoted diff) +0
-0
b/arch/arm/plat-
Quoted 56 lines
Quoted 56 lines
arch/arm/plat-samsung/include/plat/clock.h extern int s3c64xx_sclk_ctrl(struct clk *clk, int
Quoted 5 lines
samsung/include/plat/clock.h
index 87d5b38..8f95700 100644arch/arm/plat-samsung/include/plat/clock.h +0
-0@@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, intenable);
Review
Quoted 7 lines
arch/arm/plat-samsung/include/plat/clock.h +3
-0extern void s3c_pwmclk_init (void ); +/* Global watchdog clock used by arch_wtd_reset() callback */ + +extern struct clk *s3c2410_wdtclk;(quoted diff) +0
-0b/arch/arm/plat-
Quoted 13 lines
samsung/include/plat/watchdog-reset.h
index 54b762a..40dbb2b 100644arch/arm/plat-samsung/include/plat/watchdog-reset.h +1
-0@@ -10,6 +10,7 @@* published by the Free Software Foundation. */ +#include <plat/clock.h> #include <plat/regs-watchdog.h> #include <mach/map.h> arch/arm/plat-samsung/include/plat/watchdog-reset.h line 25
Quoted 8 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +0
-2@@ -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 */
Quoted 13 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +2
-6- 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 ); --Quoted 1 line
1.7.1.569.g6f426
Looks good but happens following:
Hmm...
Withs3c2410_defconfig:
Quoted 6 lines
Quoted 6 lines
In file included from
arch/arm/plat-s3c24xx/cpu.c:48:arch/arm/plat-samsung/include/plat/clock.h:32: error: redefinition of 'structclk_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
Quoted 2 lines
Quoted 2 lines
'
s3c24xx_dclk0'arch/arm/plat-samsung/include/plat/clock.h:60: note: previous
declaration of
Quoted 2 lines
Quoted 2 lines
'
s3c24xx_dclk0' was herearch/arm/plat-samsung/include/plat/clock.h:61: error: conflicting types
for
Quoted 2 lines
Quoted 2 lines
'
s3c24xx_dclk1'arch/arm/plat-samsung/include/plat/clock.h:61: note: previous
declaration of
Quoted 2 lines
Quoted 2 lines
'
s3c24xx_dclk1' was herearch/arm/plat-samsung/include/plat/clock.h:62: error: conflicting types
for
Quoted 2 lines
Quoted 2 lines
'
s3c24xx_clkout0'arch/arm/plat-samsung/include/plat/clock.h:62: note: previous
declaration of
Quoted 5 lines
Quoted 5 lines
'
s3c24xx_clkout0' was here(snip)
arch/arm/plat-samsung/include/plat/clock.h:101: error: conflicting types
for
Quoted 2 lines
Quoted 2 lines
'
s3c_disable_clocks'arch/arm/plat-samsung/include/plat/clock.h:101: note: previous
declaration
Quoted 2 lines
Quoted 2 lines
of '
s3c_disable_clocks' was herearch/arm/plat-samsung/include/plat/clock.h:118: error: conflicting types
for
Quoted 2 lines
Quoted 2 lines
'
s3c64xx_sclk_ctrl'arch/arm/plat-samsung/include/plat/clock.h:118: note: previous
declaration
Quoted 2 lines
Quoted 2 lines
of '
s3c64xx_sclk_ctrl' was herearch/arm/plat-samsung/include/plat/clock.h:126: error: conflicting types
for
Quoted 2 lines
Quoted 2 lines
'
s3c2410_wdtclk'arch/arm/plat-samsung/include/plat/clock.h:126: note: previous
declaration
Quoted 57 lines
Quoted 57 lines
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
CHKinclude/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.mapInconsistent kallsyms data
This is a bug - please report about it
Try make KALLSYMS_EXTRA_PASS=1 as a workaround
make: *** [vmlinux] Error 1The building error of
s3c2410_defconfigcan be fixed with below.
---
commitc5f80e2eb419437a7e4272d28bc7258b650b0934Author: Kukjin Kim <[email protected]> Date: Fri Aug 19 21:12:19 2011 +0900ARM: SAMSUNG: fix to prevent declaring duplicated
The
plat/clock.hrevised to prevent declaring duplicated.Signed-off-by Kukjin Kim <[email protected]>arch/arm/plat-samsung/include/plat/clock.h +3
-0@@ -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 */
Quoted 8 lines
Quoted 6 lines
arch/arm/plat-samsung/include/plat/clock.h +2
-1extern struct clk *s3c2410_wdtclk; + +#endif /* __ASM_PLAT_CLOCK_H */ ---But, the error of
s5p64x0_defconfighappens still :(Well, this issue is definitely not related to my patch. The strange thing
is
Quoted 2 lines
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 <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.
arch/arm/plat-samsung/include/plat/clock.h extern int s3c64xx_sclk_ctrl(struct clk *clk, int
Quoted 50 lines · Marek Szyprowski
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>--- 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 toarch_initcall, cleaned the codev2:
- added missing '__init' section modifiersarch/arm/plat-samsung/clock.c +11
-0@@ -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)arch/arm/plat- renamed from arch/arm/plat-samsung/include/plat/clock.h +0
-0
samsung/include/plat/clock.h
index 87d5b38..8f95700 100644arch/arm/plat-samsung/include/plat/clock.h +0
-0@@ -121,3 +121,6 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int
enable);
Review
Quoted 7 lines
arch/arm/plat-samsung/include/plat/clock.h +3
-0extern void s3c_pwmclk_init (void ); +/* Global watchdog clock used by arch_wtd_reset() callback */ + +extern struct clk *s3c2410_wdtclk;(quoted diff) +0
-0
b/arch/arm/plat-
Quoted 13 lines
samsung/include/plat/watchdog-reset.h
index 54b762a..40dbb2b 100644arch/arm/plat-samsung/include/plat/watchdog-reset.h +1
-0@@ -10,6 +10,7 @@* published by the Free Software Foundation. */ +#include <plat/clock.h> #include <plat/regs-watchdog.h> #include <mach/map.h>
arch/arm/plat-samsung/include/plat/watchdog-reset.h line 25
Quoted 8 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +0
-2@@ -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
*/
Quoted 13 lines
arch/arm/plat-samsung/include/plat/watchdog-reset.h +2
-6- 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 ); --
Quoted 1 line
1.7.1.569.g6f426
Looks ok to me, applied.
Thanks.
Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.