64 lines
1.4 KiB
C
64 lines
1.4 KiB
C
/*
|
|
* gsc3280_wdt.h - driver for gsc3280 watchdog
|
|
*
|
|
*
|
|
* Copyright (C) 2013 Loongson Corporation
|
|
*
|
|
* 2013-09-09
|
|
*/
|
|
#ifndef _GSC3280_WDT_H_
|
|
#define _GSC3280_WDT_H_
|
|
|
|
#ifdef BIT
|
|
#undef BIT
|
|
#endif
|
|
#define BIT(x) (1 << (x))
|
|
|
|
/*------------register offset ----------------*/
|
|
#define SYS_WDT_EN_OFFSET 0x08
|
|
#define SYS_WDT_CFG_OFFSET 0x98
|
|
|
|
|
|
#define GSC3280_WDT_SYS_CFG (unsigned int *)(GSC3280_SYSCTL_BASEADDR + SYS_WDT_CFG_OFFSET)
|
|
#define GSC3280_WDT_SYS_CFG_PAUSE BIT(4)
|
|
|
|
#define WDT_CR 0x00
|
|
#define WDT_TORR 0x04
|
|
#define WDT_CCVR 0x08
|
|
#define WDT_CRR 0x0c
|
|
#define WDT_STAT 0x10
|
|
#define WDT_EOI 0x14
|
|
|
|
#define WDT_IOC_MAGIC 'W'
|
|
#define WDT_IOC_MAXNR 6
|
|
#define WDT_START _IO(WDT_IOC_MAGIC, 0)
|
|
#define WDT_KEEPALIVE _IO(WDT_IOC_MAGIC, 1)
|
|
#define WDT_PAUSE _IO(WDT_IOC_MAGIC, 2)
|
|
#define WDT_READ _IO(WDT_IOC_MAGIC, 3)
|
|
#define WDT_SETTIMEOUT _IOWR(WDT_IOC_MAGIC, 4, int)
|
|
#define WDT_GETTIMEOUT _IOR(WDT_IOC_MAGIC, 5, int)
|
|
|
|
#define WDT_FEED_VALUE 0x76
|
|
#define GSC3280_WDT_NAME "gsc3280-wdt"
|
|
|
|
|
|
struct gsc3280_wdt {
|
|
unsigned int wdt_cr;
|
|
unsigned int torr;
|
|
unsigned int pclkOne;
|
|
char name[20];
|
|
unsigned suspend_flg:1;
|
|
|
|
struct clk *clk;
|
|
struct device *dev;
|
|
spinlock_t wdt_lock;
|
|
unsigned long open_lock;
|
|
struct resource *wdt_mem;
|
|
struct resource *wdt_irq;
|
|
void __iomem *wdt_base;
|
|
struct list_head device_entry;
|
|
};
|
|
|
|
#endif
|
|
|