aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-davinci
diff options
context:
space:
mode:
authorCyril Chemparathy <cyril@ti.com>2010-05-01 18:38:28 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-05-06 18:02:09 -0400
commitc78a5bc2e77e8fc5be29cda5b28c9b9afd0f4b6d (patch)
treefc54260054d1b46d9f4e6f47c56952a82ee6b1e4 /arch/arm/mach-davinci
parent5b3a05ca911688c53680f2b020a1512b9da29c89 (diff)
Davinci: watchdog reset separation across socs
The earlier watchdog reset mechanism had a couple of limitations. First, it embedded a reference to "davinci_wdt_device" inside common code. This forced all derived platforms (da8xx and tnetv107x) to define such a device. This also would have caused problems in including multiple socs in a single build due to symbol redefinition. With this patch, davinci_watchdog_reset() now takes the platform device as an argument. The davinci_soc_info struct has been extended to include a reset function and a watchdog platform_device. arch_reset() then uses these elements to reset the system in a SoC specific fashion. Signed-off-by: Cyril Chemparathy <cyril@ti.com> Tested-by: Sandeep Paulraj <s-paulraj@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci')
-rw-r--r--arch/arm/mach-davinci/clock.h1
-rw-r--r--arch/arm/mach-davinci/common.c3
-rw-r--r--arch/arm/mach-davinci/da830.c1
-rw-r--r--arch/arm/mach-davinci/da850.c1
-rw-r--r--arch/arm/mach-davinci/devices-da8xx.c4
-rw-r--r--arch/arm/mach-davinci/dm355.c1
-rw-r--r--arch/arm/mach-davinci/dm365.c1
-rw-r--r--arch/arm/mach-davinci/dm644x.c1
-rw-r--r--arch/arm/mach-davinci/dm646x.c1
-rw-r--r--arch/arm/mach-davinci/include/mach/common.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/da8xx.h2
-rw-r--r--arch/arm/mach-davinci/include/mach/system.h5
-rw-r--r--arch/arm/mach-davinci/time.c9
13 files changed, 25 insertions, 7 deletions
diff --git a/arch/arm/mach-davinci/clock.h b/arch/arm/mach-davinci/clock.h
index ce260153a717..01e36483ac3d 100644
--- a/arch/arm/mach-davinci/clock.h
+++ b/arch/arm/mach-davinci/clock.h
@@ -120,6 +120,7 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
120 unsigned int mult, unsigned int postdiv); 120 unsigned int mult, unsigned int postdiv);
121 121
122extern struct platform_device davinci_wdt_device; 122extern struct platform_device davinci_wdt_device;
123extern void davinci_watchdog_reset(struct platform_device *);
123 124
124#endif 125#endif
125 126
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index 94f27cbcd55a..f8221c5ee380 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -77,6 +77,9 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
77 local_flush_tlb_all(); 77 local_flush_tlb_all();
78 flush_cache_all(); 78 flush_cache_all();
79 79
80 if (!davinci_soc_info.reset)
81 davinci_soc_info.reset = davinci_watchdog_reset;
82
80 /* 83 /*
81 * We want to check CPU revision early for cpu_is_xxxx() macros. 84 * We want to check CPU revision early for cpu_is_xxxx() macros.
82 * IO space mapping must be initialized before we can do that. 85 * IO space mapping must be initialized before we can do that.
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 68e52337a1d9..83879f894a21 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -1206,6 +1206,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
1206 .gpio_irq = IRQ_DA8XX_GPIO0, 1206 .gpio_irq = IRQ_DA8XX_GPIO0,
1207 .serial_dev = &da8xx_serial_device, 1207 .serial_dev = &da8xx_serial_device,
1208 .emac_pdata = &da8xx_emac_pdata, 1208 .emac_pdata = &da8xx_emac_pdata,
1209 .reset_device = &da8xx_wdt_device,
1209}; 1210};
1210 1211
1211void __init da830_init(void) 1212void __init da830_init(void)
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 8aefcffa5ae2..2b6dd59d72f2 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -1093,6 +1093,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
1093 .emac_pdata = &da8xx_emac_pdata, 1093 .emac_pdata = &da8xx_emac_pdata,
1094 .sram_dma = DA8XX_ARM_RAM_BASE, 1094 .sram_dma = DA8XX_ARM_RAM_BASE,
1095 .sram_len = SZ_8K, 1095 .sram_len = SZ_8K,
1096 .reset_device = &da8xx_wdt_device,
1096}; 1097};
1097 1098
1098void __init da850_init(void) 1099void __init da850_init(void)
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 0a96791d3b0f..67a6fbcb2e09 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -326,7 +326,7 @@ static struct resource da8xx_watchdog_resources[] = {
326 }, 326 },
327}; 327};
328 328
329struct platform_device davinci_wdt_device = { 329struct platform_device da8xx_wdt_device = {
330 .name = "watchdog", 330 .name = "watchdog",
331 .id = -1, 331 .id = -1,
332 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources), 332 .num_resources = ARRAY_SIZE(da8xx_watchdog_resources),
@@ -335,7 +335,7 @@ struct platform_device davinci_wdt_device = {
335 335
336int __init da8xx_register_watchdog(void) 336int __init da8xx_register_watchdog(void)
337{ 337{
338 return platform_device_register(&davinci_wdt_device); 338 return platform_device_register(&da8xx_wdt_device);
339} 339}
340 340
341static struct resource da8xx_emac_resources[] = { 341static struct resource da8xx_emac_resources[] = {
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index f91e9a1ab921..0c62a68a90a3 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -861,6 +861,7 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
861 .serial_dev = &dm355_serial_device, 861 .serial_dev = &dm355_serial_device,
862 .sram_dma = 0x00010000, 862 .sram_dma = 0x00010000,
863 .sram_len = SZ_32K, 863 .sram_len = SZ_32K,
864 .reset_device = &davinci_wdt_device,
864}; 865};
865 866
866void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata) 867void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata)
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index f2b1d93b2256..ed7645088052 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -1068,6 +1068,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = {
1068 .emac_pdata = &dm365_emac_pdata, 1068 .emac_pdata = &dm365_emac_pdata,
1069 .sram_dma = 0x00010000, 1069 .sram_dma = 0x00010000,
1070 .sram_len = SZ_32K, 1070 .sram_len = SZ_32K,
1071 .reset_device = &davinci_wdt_device,
1071}; 1072};
1072 1073
1073void __init dm365_init_asp(struct snd_platform_data *pdata) 1074void __init dm365_init_asp(struct snd_platform_data *pdata)
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 85c88ecd6cf0..7f36c22a2684 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -753,6 +753,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
753 .emac_pdata = &dm644x_emac_pdata, 753 .emac_pdata = &dm644x_emac_pdata,
754 .sram_dma = 0x00008000, 754 .sram_dma = 0x00008000,
755 .sram_len = SZ_16K, 755 .sram_len = SZ_16K,
756 .reset_device = &davinci_wdt_device,
756}; 757};
757 758
758void __init dm644x_init_asp(struct snd_platform_data *pdata) 759void __init dm644x_init_asp(struct snd_platform_data *pdata)
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index a8189c919e92..8dd0afee7593 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -837,6 +837,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
837 .emac_pdata = &dm646x_emac_pdata, 837 .emac_pdata = &dm646x_emac_pdata,
838 .sram_dma = 0x10010000, 838 .sram_dma = 0x10010000,
839 .sram_len = SZ_32K, 839 .sram_len = SZ_32K,
840 .reset_device = &davinci_wdt_device,
840}; 841};
841 842
842void __init dm646x_init_mcasp0(struct snd_platform_data *pdata) 843void __init dm646x_init_mcasp0(struct snd_platform_data *pdata)
diff --git a/arch/arm/mach-davinci/include/mach/common.h b/arch/arm/mach-davinci/include/mach/common.h
index 8ffef5bbd9cf..a58bd88ba02d 100644
--- a/arch/arm/mach-davinci/include/mach/common.h
+++ b/arch/arm/mach-davinci/include/mach/common.h
@@ -70,6 +70,8 @@ struct davinci_soc_info {
70 struct emac_platform_data *emac_pdata; 70 struct emac_platform_data *emac_pdata;
71 dma_addr_t sram_dma; 71 dma_addr_t sram_dma;
72 unsigned sram_len; 72 unsigned sram_len;
73 struct platform_device *reset_device;
74 void (*reset)(struct platform_device *);
73}; 75};
74 76
75extern struct davinci_soc_info davinci_soc_info; 77extern struct davinci_soc_info davinci_soc_info;
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index dbb4ebe4d114..1b31a9aa8fba 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -87,6 +87,8 @@ extern struct emac_platform_data da8xx_emac_pdata;
87extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata; 87extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata;
88extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata; 88extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata;
89 89
90extern struct platform_device da8xx_wdt_device;
91
90extern const short da830_emif25_pins[]; 92extern const short da830_emif25_pins[];
91extern const short da830_spi0_pins[]; 93extern const short da830_spi0_pins[];
92extern const short da830_spi1_pins[]; 94extern const short da830_spi1_pins[];
diff --git a/arch/arm/mach-davinci/include/mach/system.h b/arch/arm/mach-davinci/include/mach/system.h
index 5a7d7581b8ce..e65629c20769 100644
--- a/arch/arm/mach-davinci/include/mach/system.h
+++ b/arch/arm/mach-davinci/include/mach/system.h
@@ -11,7 +11,7 @@
11#ifndef __ASM_ARCH_SYSTEM_H 11#ifndef __ASM_ARCH_SYSTEM_H
12#define __ASM_ARCH_SYSTEM_H 12#define __ASM_ARCH_SYSTEM_H
13 13
14extern void davinci_watchdog_reset(void); 14#include <mach/common.h>
15 15
16static inline void arch_idle(void) 16static inline void arch_idle(void)
17{ 17{
@@ -20,7 +20,8 @@ static inline void arch_idle(void)
20 20
21static inline void arch_reset(char mode, const char *cmd) 21static inline void arch_reset(char mode, const char *cmd)
22{ 22{
23 davinci_watchdog_reset(); 23 if (davinci_soc_info.reset)
24 davinci_soc_info.reset(davinci_soc_info.reset_device);
24} 25}
25 26
26#endif /* __ASM_ARCH_SYSTEM_H */ 27#endif /* __ASM_ARCH_SYSTEM_H */
diff --git a/arch/arm/mach-davinci/time.c b/arch/arm/mach-davinci/time.c
index b21f7633d9a8..e5c598a387be 100644
--- a/arch/arm/mach-davinci/time.c
+++ b/arch/arm/mach-davinci/time.c
@@ -399,13 +399,16 @@ struct sys_timer davinci_timer = {
399 399
400 400
401/* reset board using watchdog timer */ 401/* reset board using watchdog timer */
402void davinci_watchdog_reset(void) 402void davinci_watchdog_reset(struct platform_device *pdev)
403{ 403{
404 u32 tgcr, wdtcr; 404 u32 tgcr, wdtcr;
405 struct platform_device *pdev = &davinci_wdt_device; 405 void __iomem *base;
406 void __iomem *base = IO_ADDRESS(pdev->resource[0].start);
407 struct clk *wd_clk; 406 struct clk *wd_clk;
408 407
408 base = ioremap(pdev->resource[0].start, SZ_4K);
409 if (WARN_ON(!base))
410 return;
411
409 wd_clk = clk_get(&pdev->dev, NULL); 412 wd_clk = clk_get(&pdev->dev, NULL);
410 if (WARN_ON(IS_ERR(wd_clk))) 413 if (WARN_ON(IS_ERR(wd_clk)))
411 return; 414 return;