Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
159859b6
Commit
159859b6
authored
Feb 10, 2009
by
Kevin Hilman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
watchdog: davinci: use clock framework for timer frequency
Signed-off-by:
Kevin Hilman
<
khilman@deeprootsystems.com
>
parent
b27da366
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
2 deletions
+19
-2
drivers/watchdog/davinci_wdt.c
drivers/watchdog/davinci_wdt.c
+19
-2
No files found.
drivers/watchdog/davinci_wdt.c
View file @
159859b6
...
...
@@ -25,6 +25,7 @@
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/device.h>
#include <linux/clk.h>
#define MODULE_NAME "DAVINCI-WDT: "
...
...
@@ -69,6 +70,7 @@ static unsigned long wdt_status;
static
struct
resource
*
wdt_mem
;
static
void
__iomem
*
wdt_base
;
struct
clk
*
wdt_clk
;
static
void
wdt_service
(
void
)
{
...
...
@@ -86,6 +88,10 @@ static void wdt_enable(void)
{
u32
tgcr
;
u32
timer_margin
;
u32
wdt_freq
;
BUG_ON
(
!
wdt_clk
);
wdt_freq
=
clk_get_rate
(
wdt_clk
);
spin_lock
(
&
io_lock
);
...
...
@@ -99,9 +105,9 @@ static void wdt_enable(void)
iowrite32
(
0
,
wdt_base
+
TIM12
);
iowrite32
(
0
,
wdt_base
+
TIM34
);
/* set timeout period */
timer_margin
=
(((
u64
)
heartbeat
*
CLOCK_TICK_RATE
)
&
0xffffffff
);
timer_margin
=
(((
u64
)
heartbeat
*
wdt_freq
)
&
0xffffffff
);
iowrite32
(
timer_margin
,
wdt_base
+
PRD12
);
timer_margin
=
(((
u64
)
heartbeat
*
CLOCK_TICK_RATE
)
>>
32
);
timer_margin
=
(((
u64
)
heartbeat
*
wdt_freq
)
>>
32
);
iowrite32
(
timer_margin
,
wdt_base
+
PRD34
);
/* enable run continuously */
iowrite32
(
ENAMODE12_PERIODIC
,
wdt_base
+
TCR
);
...
...
@@ -199,6 +205,11 @@ static int __devinit davinci_wdt_probe(struct platform_device *pdev)
struct
resource
*
res
;
struct
device
*
dev
=
&
pdev
->
dev
;
wdt_clk
=
clk_get
(
dev
,
NULL
);
if
(
WARN_ON
(
!
wdt_clk
))
return
-
ENODEV
;
clk_enable
(
wdt_clk
);
if
(
heartbeat
<
1
||
heartbeat
>
MAX_HEARTBEAT
)
heartbeat
=
DEFAULT_HEARTBEAT
;
...
...
@@ -245,6 +256,12 @@ static int __devexit davinci_wdt_remove(struct platform_device *pdev)
kfree
(
wdt_mem
);
wdt_mem
=
NULL
;
}
if
(
wdt_clk
)
{
clk_disable
(
wdt_clk
);
clk_put
(
wdt_clk
);
}
return
0
;
}
...
...
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