Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
be3378cc
Commit
be3378cc
authored
Jan 20, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel modules: the clock is 62.5MHz, parametrize tick
parent
dd1cfdc2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
7 deletions
+9
-7
module.c
kernel/wr_nic/module.c
+3
-0
nic-core.c
kernel/wr_nic/nic-core.c
+1
-1
nic-hardware.h
kernel/wr_nic/nic-hardware.h
+3
-4
timestamp.c
kernel/wr_nic/timestamp.c
+2
-2
No files found.
kernel/wr_nic/module.c
View file @
be3378cc
...
...
@@ -62,6 +62,9 @@ static struct platform_device wrn_device = {
*/
int
__init
wrn_init
(
void
)
{
/* The clock period must be a multiple of 1ns, so bug out otherwise */
BUILD_BUG_ON
(
REFCLK_FREQ
*
NSEC_PER_TICK
!=
NSEC_PER_SEC
);
/* A few fields must be initialized at run time */
spin_lock_init
(
&
wrn_dev
.
lock
);
...
...
kernel/wr_nic/nic-core.c
View file @
be3378cc
...
...
@@ -339,7 +339,7 @@ static void __wrn_rx_descriptor(struct wrn_dev *wrn, int desc)
/* the bit says the rising edge cnter is 1tick ahead */
if
(
cntr_diff
==
1
||
cntr_diff
==
(
-
0xf
))
ts
.
tv_sec
|=
0x80000000
;
ts
.
tv_nsec
=
ts_r
*
8
;
/* scale to nanoseconds */
ts
.
tv_nsec
=
ts_r
*
NSEC_PER_TICK
;
pr_debug
(
"Timestamp: %li:%li, ahead = %d
\n
"
,
ts
.
tv_sec
&
0x7fffffff
,
...
...
kernel/wr_nic/nic-hardware.h
View file @
be3378cc
...
...
@@ -11,10 +11,9 @@
#ifndef __WR_NIC_HARDWARE_H__
#define __WR_NIC_HARDWARE_H__
/* Our host CPU is this one, no way out of it */
//#include <mach/at91sam9263.h>
#define REFCLK_FREQ 125000000
/* This is the clock used in internal counters. */
#define REFCLK_FREQ (125000000 / 2)
#define NSEC_PER_TICK (NSEC_PER_SEC / REFCLK_FREQ)
/* The interrupt is one of those managed by our WRVIC device */
#define WRN_IRQ_BASE 192
...
...
kernel/wr_nic/timestamp.c
View file @
be3378cc
...
...
@@ -43,7 +43,7 @@ void wrn_tstamp_find_skb(struct wrn_dev *wrn, int desc)
utc
--
;
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
ts
.
tv_nsec
=
wrn
->
ts_buf
[
i
].
ts
*
8
;
/* scale to nsecs */
ts
.
tv_nsec
=
wrn
->
ts_buf
[
i
].
ts
*
NSEC_PER_TICK
;
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
skb_tstamp_tx
(
skb
,
hwts
);
dev_kfree_skb_irq
(
skb
);
...
...
@@ -82,7 +82,7 @@ static int record_tstamp(struct wrn_dev *wrn, u32 tsval, u32 idreg)
utc
--
;
ts
.
tv_sec
=
(
s32
)
utc
&
0x7fffffff
;
ts
.
tv_nsec
=
(
tsval
&
0xfffffff
)
*
8
;
/* scale to nanoseconds */
ts
.
tv_nsec
=
(
tsval
&
0xfffffff
)
*
NSEC_PER_TICK
;
hwts
->
hwtstamp
=
timespec_to_ktime
(
ts
);
skb_tstamp_tx
(
skb
,
hwts
);
dev_kfree_skb_irq
(
skb
);
...
...
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