Commit c78a5bc2 authored by Cyril Chemparathy's avatar Cyril Chemparathy Committed by Kevin Hilman

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: default avatarCyril Chemparathy <cyril@ti.com>
Tested-by: default avatarSandeep Paulraj <s-paulraj@ti.com>
Signed-off-by: default avatarKevin Hilman <khilman@deeprootsystems.com>
parent 5b3a05ca
...@@ -120,6 +120,7 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv, ...@@ -120,6 +120,7 @@ int davinci_set_pllrate(struct pll_data *pll, unsigned int prediv,
unsigned int mult, unsigned int postdiv); unsigned int mult, unsigned int postdiv);
extern struct platform_device davinci_wdt_device; extern struct platform_device davinci_wdt_device;
extern void davinci_watchdog_reset(struct platform_device *);
#endif #endif
......
...@@ -77,6 +77,9 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info) ...@@ -77,6 +77,9 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
local_flush_tlb_all(); local_flush_tlb_all();
flush_cache_all(); flush_cache_all();
if (!davinci_soc_info.reset)
davinci_soc_info.reset = davinci_watchdog_reset;
/* /*
* We want to check CPU revision early for cpu_is_xxxx() macros. * We want to check CPU revision early for cpu_is_xxxx() macros.
* IO space mapping must be initialized before we can do that. * IO space mapping must be initialized before we can do that.
......
...@@ -1206,6 +1206,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = { ...@@ -1206,6 +1206,7 @@ static struct davinci_soc_info davinci_soc_info_da830 = {
.gpio_irq = IRQ_DA8XX_GPIO0, .gpio_irq = IRQ_DA8XX_GPIO0,
.serial_dev = &da8xx_serial_device, .serial_dev = &da8xx_serial_device,
.emac_pdata = &da8xx_emac_pdata, .emac_pdata = &da8xx_emac_pdata,
.reset_device = &da8xx_wdt_device,
}; };
void __init da830_init(void) void __init da830_init(void)
......
...@@ -1093,6 +1093,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = { ...@@ -1093,6 +1093,7 @@ static struct davinci_soc_info davinci_soc_info_da850 = {
.emac_pdata = &da8xx_emac_pdata, .emac_pdata = &da8xx_emac_pdata,
.sram_dma = DA8XX_ARM_RAM_BASE, .sram_dma = DA8XX_ARM_RAM_BASE,
.sram_len = SZ_8K, .sram_len = SZ_8K,
.reset_device = &da8xx_wdt_device,
}; };
void __init da850_init(void) void __init da850_init(void)
......
...@@ -326,7 +326,7 @@ static struct resource da8xx_watchdog_resources[] = { ...@@ -326,7 +326,7 @@ static struct resource da8xx_watchdog_resources[] = {
}, },
}; };
struct platform_device davinci_wdt_device = { struct platform_device da8xx_wdt_device = {
.name = "watchdog", .name = "watchdog",
.id = -1, .id = -1,
.num_resources = ARRAY_SIZE(da8xx_watchdog_resources), .num_resources = ARRAY_SIZE(da8xx_watchdog_resources),
...@@ -335,7 +335,7 @@ struct platform_device davinci_wdt_device = { ...@@ -335,7 +335,7 @@ struct platform_device davinci_wdt_device = {
int __init da8xx_register_watchdog(void) int __init da8xx_register_watchdog(void)
{ {
return platform_device_register(&davinci_wdt_device); return platform_device_register(&da8xx_wdt_device);
} }
static struct resource da8xx_emac_resources[] = { static struct resource da8xx_emac_resources[] = {
......
...@@ -861,6 +861,7 @@ static struct davinci_soc_info davinci_soc_info_dm355 = { ...@@ -861,6 +861,7 @@ static struct davinci_soc_info davinci_soc_info_dm355 = {
.serial_dev = &dm355_serial_device, .serial_dev = &dm355_serial_device,
.sram_dma = 0x00010000, .sram_dma = 0x00010000,
.sram_len = SZ_32K, .sram_len = SZ_32K,
.reset_device = &davinci_wdt_device,
}; };
void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata) void __init dm355_init_asp1(u32 evt_enable, struct snd_platform_data *pdata)
......
...@@ -1068,6 +1068,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = { ...@@ -1068,6 +1068,7 @@ static struct davinci_soc_info davinci_soc_info_dm365 = {
.emac_pdata = &dm365_emac_pdata, .emac_pdata = &dm365_emac_pdata,
.sram_dma = 0x00010000, .sram_dma = 0x00010000,
.sram_len = SZ_32K, .sram_len = SZ_32K,
.reset_device = &davinci_wdt_device,
}; };
void __init dm365_init_asp(struct snd_platform_data *pdata) void __init dm365_init_asp(struct snd_platform_data *pdata)
......
...@@ -753,6 +753,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = { ...@@ -753,6 +753,7 @@ static struct davinci_soc_info davinci_soc_info_dm644x = {
.emac_pdata = &dm644x_emac_pdata, .emac_pdata = &dm644x_emac_pdata,
.sram_dma = 0x00008000, .sram_dma = 0x00008000,
.sram_len = SZ_16K, .sram_len = SZ_16K,
.reset_device = &davinci_wdt_device,
}; };
void __init dm644x_init_asp(struct snd_platform_data *pdata) void __init dm644x_init_asp(struct snd_platform_data *pdata)
......
...@@ -837,6 +837,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = { ...@@ -837,6 +837,7 @@ static struct davinci_soc_info davinci_soc_info_dm646x = {
.emac_pdata = &dm646x_emac_pdata, .emac_pdata = &dm646x_emac_pdata,
.sram_dma = 0x10010000, .sram_dma = 0x10010000,
.sram_len = SZ_32K, .sram_len = SZ_32K,
.reset_device = &davinci_wdt_device,
}; };
void __init dm646x_init_mcasp0(struct snd_platform_data *pdata) void __init dm646x_init_mcasp0(struct snd_platform_data *pdata)
......
...@@ -70,6 +70,8 @@ struct davinci_soc_info { ...@@ -70,6 +70,8 @@ struct davinci_soc_info {
struct emac_platform_data *emac_pdata; struct emac_platform_data *emac_pdata;
dma_addr_t sram_dma; dma_addr_t sram_dma;
unsigned sram_len; unsigned sram_len;
struct platform_device *reset_device;
void (*reset)(struct platform_device *);
}; };
extern struct davinci_soc_info davinci_soc_info; extern struct davinci_soc_info davinci_soc_info;
......
...@@ -87,6 +87,8 @@ extern struct emac_platform_data da8xx_emac_pdata; ...@@ -87,6 +87,8 @@ extern struct emac_platform_data da8xx_emac_pdata;
extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata; extern struct da8xx_lcdc_platform_data sharp_lcd035q3dg01_pdata;
extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata; extern struct da8xx_lcdc_platform_data sharp_lk043t1dg01_pdata;
extern struct platform_device da8xx_wdt_device;
extern const short da830_emif25_pins[]; extern const short da830_emif25_pins[];
extern const short da830_spi0_pins[]; extern const short da830_spi0_pins[];
extern const short da830_spi1_pins[]; extern const short da830_spi1_pins[];
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#ifndef __ASM_ARCH_SYSTEM_H #ifndef __ASM_ARCH_SYSTEM_H
#define __ASM_ARCH_SYSTEM_H #define __ASM_ARCH_SYSTEM_H
extern void davinci_watchdog_reset(void); #include <mach/common.h>
static inline void arch_idle(void) static inline void arch_idle(void)
{ {
...@@ -20,7 +20,8 @@ static inline void arch_idle(void) ...@@ -20,7 +20,8 @@ static inline void arch_idle(void)
static inline void arch_reset(char mode, const char *cmd) static inline void arch_reset(char mode, const char *cmd)
{ {
davinci_watchdog_reset(); if (davinci_soc_info.reset)
davinci_soc_info.reset(davinci_soc_info.reset_device);
} }
#endif /* __ASM_ARCH_SYSTEM_H */ #endif /* __ASM_ARCH_SYSTEM_H */
...@@ -399,13 +399,16 @@ struct sys_timer davinci_timer = { ...@@ -399,13 +399,16 @@ struct sys_timer davinci_timer = {
/* reset board using watchdog timer */ /* reset board using watchdog timer */
void davinci_watchdog_reset(void) void davinci_watchdog_reset(struct platform_device *pdev)
{ {
u32 tgcr, wdtcr; u32 tgcr, wdtcr;
struct platform_device *pdev = &davinci_wdt_device; void __iomem *base;
void __iomem *base = IO_ADDRESS(pdev->resource[0].start);
struct clk *wd_clk; struct clk *wd_clk;
base = ioremap(pdev->resource[0].start, SZ_4K);
if (WARN_ON(!base))
return;
wd_clk = clk_get(&pdev->dev, NULL); wd_clk = clk_get(&pdev->dev, NULL);
if (WARN_ON(IS_ERR(wd_clk))) if (WARN_ON(IS_ERR(wd_clk)))
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment