diff options
Diffstat (limited to 'arch/arm/mach-omap1')
| -rw-r--r-- | arch/arm/mach-omap1/common.h | 2 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/devices.c | 21 | ||||
| -rw-r--r-- | arch/arm/mach-omap1/reset.c | 41 | 
3 files changed, 59 insertions, 5 deletions
diff --git a/arch/arm/mach-omap1/common.h b/arch/arm/mach-omap1/common.h index fc8c9449eba..b53e0854422 100644 --- a/arch/arm/mach-omap1/common.h +++ b/arch/arm/mach-omap1/common.h @@ -93,4 +93,6 @@ extern int ocpi_enable(void);  static inline int ocpi_enable(void) { return 0; }  #endif +extern u32 omap1_get_reset_sources(void); +  #endif /* __ARCH_ARM_MACH_OMAP1_COMMON_H */ diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index 7155ed8b97f..0af635205e8 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c @@ -17,6 +17,8 @@  #include <linux/platform_device.h>  #include <linux/spi/spi.h> +#include <linux/platform_data/omap-wd-timer.h> +  #include <asm/mach/map.h>  #include <mach/tc.h> @@ -447,18 +449,31 @@ static struct resource wdt_resources[] = {  };  static struct platform_device omap_wdt_device = { -	.name	   = "omap_wdt", -	.id	     = -1, +	.name		= "omap_wdt", +	.id		= -1,  	.num_resources	= ARRAY_SIZE(wdt_resources),  	.resource	= wdt_resources,  };  static int __init omap_init_wdt(void)  { +	struct omap_wd_timer_platform_data pdata; +	int ret; +  	if (!cpu_is_omap16xx())  		return -ENODEV; -	return platform_device_register(&omap_wdt_device); +	pdata.read_reset_sources = omap1_get_reset_sources; + +	ret = platform_device_register(&omap_wdt_device); +	if (!ret) { +		ret = platform_device_add_data(&omap_wdt_device, &pdata, +					       sizeof(pdata)); +		if (ret) +			platform_device_del(&omap_wdt_device); +	} + +	return ret;  }  subsys_initcall(omap_init_wdt);  #endif diff --git a/arch/arm/mach-omap1/reset.c b/arch/arm/mach-omap1/reset.c index b1770910386..5eebd7e889d 100644 --- a/arch/arm/mach-omap1/reset.c +++ b/arch/arm/mach-omap1/reset.c @@ -4,12 +4,24 @@  #include <linux/kernel.h>  #include <linux/io.h> -#include <plat/prcm.h> -  #include <mach/hardware.h> +#include "iomap.h"  #include "common.h" +/* ARM_SYSST bit shifts related to SoC reset sources */ +#define ARM_SYSST_POR_SHIFT				5 +#define ARM_SYSST_EXT_RST_SHIFT				4 +#define ARM_SYSST_ARM_WDRST_SHIFT			2 +#define ARM_SYSST_GLOB_SWRST_SHIFT			1 + +/* Standardized reset source bits (across all OMAP SoCs) */ +#define OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT		0 +#define OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT		1 +#define OMAP_MPU_WD_RST_SRC_ID_SHIFT			3 +#define OMAP_EXTWARM_RST_SRC_ID_SHIFT			5 + +  void omap1_restart(char mode, const char *cmd)  {  	/* @@ -23,3 +35,28 @@ void omap1_restart(char mode, const char *cmd)  	omap_writew(1, ARM_RSTCT1);  } + +/** + * omap1_get_reset_sources - return the source of the SoC's last reset + * + * Returns bits that represent the last reset source for the SoC.  The + * format is standardized across OMAPs for use by the OMAP watchdog. + */ +u32 omap1_get_reset_sources(void) +{ +	u32 ret = 0; +	u16 rs; + +	rs = __raw_readw(OMAP1_IO_ADDRESS(ARM_SYSST)); + +	if (rs & (1 << ARM_SYSST_POR_SHIFT)) +		ret |= 1 << OMAP_GLOBAL_COLD_RST_SRC_ID_SHIFT; +	if (rs & (1 << ARM_SYSST_EXT_RST_SHIFT)) +		ret |= 1 << OMAP_EXTWARM_RST_SRC_ID_SHIFT; +	if (rs & (1 << ARM_SYSST_ARM_WDRST_SHIFT)) +		ret |= 1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT; +	if (rs & (1 << ARM_SYSST_GLOB_SWRST_SHIFT)) +		ret |= 1 << OMAP_GLOBAL_WARM_RST_SRC_ID_SHIFT; + +	return ret; +}  |