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
e6c0f208
Commit
e6c0f208
authored
Jan 24, 2012
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modules: added phy read/write ioctl to nic
parent
01e8a02d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
nic-core.c
kernel/wr_nic/nic-core.c
+13
-0
wr-nic.h
kernel/wr_nic/wr-nic.h
+9
-0
No files found.
kernel/wr_nic/nic-core.c
View file @
e6c0f208
...
...
@@ -239,6 +239,19 @@ static int wrn_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
if
(
put_user
(
reg
,
(
u32
*
)
rq
->
ifr_data
)
<
0
)
return
-
EFAULT
;
return
0
;
case
PRIV_IOCPHYREG
:
/* this command allows to read and write a phy register */
if
(
get_user
(
reg
,
(
u32
*
)
rq
->
ifr_data
)
<
0
)
return
-
EFAULT
;
if
(
reg
&
(
1
<<
31
))
{
wrn_phy_write
(
dev
,
0
,
(
reg
>>
16
)
&
0xff
,
reg
&
0xffff
);
return
0
;
}
reg
=
wrn_phy_read
(
dev
,
0
,
(
reg
>>
16
)
&
0xff
);
if
(
put_user
(
reg
,
(
u32
*
)
rq
->
ifr_data
)
<
0
)
return
-
EFAULT
;
return
0
;
default:
spin_lock_irq
(
&
ep
->
lock
);
...
...
kernel/wr_nic/wr-nic.h
View file @
e6c0f208
...
...
@@ -162,6 +162,15 @@ enum wrn_resnames {
#define PRIV_IOCGCALIBRATE (SIOCDEVPRIVATE + 1)
#define PRIV_IOCGGETPHASE (SIOCDEVPRIVATE + 2)
#define PRIV_IOCREADREG (SIOCDEVPRIVATE + 3)
#define PRIV_IOCPHYREG (SIOCDEVPRIVATE + 4)
#define NIC_READ_PHY_CMD(addr) (((addr) & 0xff) << 16)
#define NIC_RESULT_DATA(val) ((val) & 0xffff)
#define NIC_WRITE_PHY_CMD(addr, value) ((((addr) & 0xff) << 16) \
| (1 << 31) \
| ((value) & 0xffff))
/* Structures straight from wr_minic.c -- should user-space include this? */
struct
wrn_calibration_req
{
...
...
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