Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
216886db
Commit
216886db
authored
Jan 12, 2003
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Add support for the StrongARM-11x0 watchdog.
Add sa1100_wdt watchdog support.
parent
47010443
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
231 additions
and
0 deletions
+231
-0
drivers/char/watchdog/Kconfig
drivers/char/watchdog/Kconfig
+13
-0
drivers/char/watchdog/Makefile
drivers/char/watchdog/Makefile
+1
-0
drivers/char/watchdog/sa1100_wdt.c
drivers/char/watchdog/sa1100_wdt.c
+217
-0
No files found.
drivers/char/watchdog/Kconfig
View file @
216886db
...
...
@@ -168,6 +168,19 @@ config 977_WATCHDOG
Not sure? It's safe to say N.
config SA1100_WATCHDOG
tristate "SA1100 watchdog"
depends on WATCHDOG && ARCH_SA1100
help
Watchdog timer embedded into SA11x0 chips. This will reboot your
system when timeout is reached.
NOTE, that once enabled, this timer cannot be disabled.
This driver is also available as a module ( = code which can be
inserted in and removed from the running kernel whenever you want).
If you want to compile it as a module, say M here and read
Documentation/modules.txt. The module will be called sa1100_wdt.o.
config EUROTECH_WDT
tristate "Eurotech CPU-1220/1410 Watchdog Timer"
depends on WATCHDOG
...
...
drivers/char/watchdog/Makefile
View file @
216886db
...
...
@@ -21,5 +21,6 @@ obj-$(CONFIG_977_WATCHDOG) += wdt977.o
obj-$(CONFIG_I810_TCO)
+=
i810-tco.o
obj-$(CONFIG_MACHZ_WDT)
+=
machzwd.o
obj-$(CONFIG_SH_WDT)
+=
shwdt.o
obj-$(CONFIG_SA1100_WATCHDOG)
+=
sa1100_wdt.o
obj-$(CONFIG_EUROTECH_WDT)
+=
eurotechwdt.o
obj-$(CONFIG_SOFT_WATCHDOG)
+=
softdog.o
drivers/char/watchdog/sa1100_wdt.c
0 → 100644
View file @
216886db
/*
* Watchdog driver for the SA11x0
*
* (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
* Based on SoftDog driver by Alan Cox <alan@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* Neither Oleg Drokin nor iXcelerator.com admit liability nor provide
* warranty for any of this software. This material is provided
* "AS-IS" and at no charge.
*
* (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
*
* 27/11/2000 Initial release
*/
#include <linux/config.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/watchdog.h>
#include <linux/smp_lock.h>
#include <linux/init.h>
#include <asm/hardware.h>
#include <asm/bitops.h>
#include <asm/uaccess.h>
#define OSCR_FREQ 3686400
#define SA1100_CLOSE_MAGIC (0x5afc4453)
static
unsigned
long
sa1100wdt_users
;
static
int
expect_close
;
static
int
pre_margin
;
static
int
boot_status
;
#ifdef CONFIG_WATCHDOG_NOWAYOUT
static
int
nowayout
=
1
;
#else
static
int
nowayout
=
0
;
#endif
/*
* Allow only one person to hold it open
*/
static
int
sa1100dog_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
if
(
test_and_set_bit
(
1
,
&
sa1100wdt_users
))
return
-
EBUSY
;
/* Activate SA1100 Watchdog timer */
OSMR3
=
OSCR
+
pre_margin
;
OSSR
=
OSSR_M3
;
OWER
=
OWER_WME
;
OIER
|=
OIER_E3
;
return
0
;
}
/*
* Shut off the timer.
* Lock it in if it's a module and we defined ...NOWAYOUT
* Oddly, the watchdog can only be enabled, but we can turn off
* the interrupt, which appears to prevent the watchdog timing out.
*/
static
int
sa1100dog_release
(
struct
inode
*
inode
,
struct
file
*
file
)
{
OSMR3
=
OSCR
+
pre_margin
;
if
(
expect_close
==
SA1100_CLOSE_MAGIC
)
{
OIER
&=
~
OIER_E3
;
}
else
{
printk
(
KERN_CRIT
"WATCHDOG: WDT device closed unexpectedly. WDT will not stop!
\n
"
);
}
clear_bit
(
1
,
&
sa1100wdt_users
);
return
0
;
}
static
ssize_t
sa1100dog_write
(
struct
file
*
file
,
const
char
*
data
,
size_t
len
,
loff_t
*
ppos
)
{
/* Can't seek (pwrite) on this device */
if
(
ppos
!=
&
file
->
f_pos
)
return
-
ESPIPE
;
if
(
len
)
{
if
(
!
nowayout
)
{
size_t
i
;
expect_close
=
0
;
for
(
i
=
0
;
i
!=
len
;
i
++
)
{
char
c
;
if
(
get_user
(
c
,
data
+
i
))
return
-
EFAULT
;
if
(
c
==
'V'
)
expect_close
=
SA1100_CLOSE_MAGIC
;
}
}
/* Refresh OSMR3 timer. */
OSMR3
=
OSCR
+
pre_margin
;
}
return
len
?
1
:
0
;
}
static
struct
watchdog_info
ident
=
{
.
options
=
WDIOF_CARDRESET
|
WDIOF_MAGICCLOSE
|
WDIOF_SETTIMEOUT
|
WDIOF_KEEPALIVEPING
,
.
identity
=
"SA1100 Watchdog"
,
};
static
int
sa1100dog_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
int
ret
=
-
ENOIOCTLCMD
;
int
time
;
switch
(
cmd
)
{
case
WDIOC_GETSUPPORT
:
ret
=
copy_to_user
((
struct
watchdog_info
*
)
arg
,
&
ident
,
sizeof
(
ident
))
?
-
EFAULT
:
0
;
break
;
case
WDIOC_GETSTATUS
:
ret
=
put_user
(
0
,
(
int
*
)
arg
);
break
;
case
WDIOC_GETBOOTSTATUS
:
ret
=
put_user
(
boot_status
,
(
int
*
)
arg
);
break
;
case
WDIOC_SETTIMEOUT
:
ret
=
get_user
(
time
,
(
int
*
)
arg
);
if
(
ret
)
break
;
if
(
time
<=
0
||
time
>
255
)
{
ret
=
-
EINVAL
;
break
;
}
pre_margin
=
OSCR_FREQ
*
time
;
OSMR3
=
OSCR
+
pre_margin
;
/*fall through*/
case
WDIOC_GETTIMEOUT
:
ret
=
put_user
(
pre_margin
/
OSCR_FREQ
,
(
int
*
)
arg
);
break
;
case
WDIOC_KEEPALIVE
:
OSMR3
=
OSCR
+
pre_margin
;
ret
=
0
;
break
;
}
return
ret
;
}
static
struct
file_operations
sa1100dog_fops
=
{
.
owner
=
THIS_MODULE
,
.
write
=
sa1100dog_write
,
.
ioctl
=
sa1100dog_ioctl
,
.
open
=
sa1100dog_open
,
.
release
=
sa1100dog_release
,
};
static
struct
miscdevice
sa1100dog_miscdev
=
{
.
minor
=
WATCHDOG_MINOR
,
.
name
=
"SA1100 watchdog"
,
.
fops
=
&
sa1100dog_fops
,
};
static
int
margin
__initdata
=
60
;
/* (secs) Default is 1 minute */
static
int
__init
sa1100dog_init
(
void
)
{
int
ret
;
/*
* Read the reset status, and save it for later. If
* we suspend, RCSR will be cleared, and the watchdog
* reset reason will be lost.
*/
boot_status
=
(
RCSR
&
RCSR_WDR
)
?
WDIOF_CARDRESET
:
0
;
pre_margin
=
OSCR_FREQ
*
margin
;
ret
=
misc_register
(
&
sa1100dog_miscdev
);
if
(
ret
==
0
)
printk
(
"SA1100 Watchdog Timer: timer margin %d sec
\n
"
,
margin
);
return
ret
;
}
static
void
__exit
sa1100dog_exit
(
void
)
{
misc_deregister
(
&
sa1100dog_miscdev
);
}
module_init
(
sa1100dog_init
);
module_exit
(
sa1100dog_exit
);
MODULE_AUTHOR
(
"Oleg Drokin <green@crimea.edu>"
);
MODULE_DESCRIPTION
(
"SA1100 Watchdog"
);
MODULE_PARM
(
margin
,
"i"
);
MODULE_PARM_DESC
(
margin
,
"Watchdog margin in seconds (default 60s)"
);
MODULE_PARM
(
nowayout
,
"i"
);
MODULE_PARM_DESC
(
nowayout
,
"Watchdog cannot be stopped once started"
);
MODULE_LICENSE
(
"GPL"
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment