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
8e8d6301
Commit
8e8d6301
authored
Nov 28, 2010
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nic: added ioctl method, calling external functions
parent
95fd5c81
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
3 deletions
+53
-3
nic-core.c
nic/nic-core.c
+16
-2
wr-nic.h
nic/wr-nic.h
+37
-1
No files found.
nic/nic-core.c
View file @
8e8d6301
...
...
@@ -104,8 +104,22 @@ struct net_device_stats *wrn_get_stats(struct net_device *dev)
static
int
wrn_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
int
cmd
)
{
/* FIXME: ioctl is missing */
return
-
ENOIOCTLCMD
;
struct
wrn_ep
*
ep
=
netdev_priv
(
dev
);
int
res
;
switch
(
cmd
)
{
case
SIOCSHWTSTAMP
:
return
wrn_tstamp_ioctl
(
dev
,
rq
,
cmd
);
case
PRIV_IOCGCALIBRATE
:
return
wrn_calib_ioctl
(
dev
,
rq
,
cmd
);
case
PRIV_IOCGGETPHASE
:
return
wrn_phase_ioctl
(
dev
,
rq
,
cmd
);
default:
spin_lock_irq
(
&
ep
->
lock
);
res
=
generic_mii_ioctl
(
&
ep
->
mii
,
if_mii
(
rq
),
cmd
,
NULL
);
spin_unlock_irq
(
&
ep
->
lock
);
return
res
;
}
}
static
const
struct
net_device_ops
wrn_netdev_ops
=
{
...
...
nic/wr-nic.h
View file @
8e8d6301
...
...
@@ -113,9 +113,37 @@ enum wrn_resnames {
#define wrn_ep_read(ep, reg) __raw_readl(&(ep)->ep_regs->reg)
#define wrn_ep_write(ep, reg, val) __raw_writel((val), &(ep)->ep_regs->reg)
/* Private ioctls, like in wr_minic.c */
#define PRIV_IOCGCALIBRATE (SIOCDEVPRIVATE+1)
#define PRIV_IOCGGETPHASE (SIOCDEVPRIVATE+2)
/* Structures straight from wr_minic.c -- should user-space include this? */
struct
wrn_calibration_req
{
int
cmd
;
int
cal_present
;
};
struct
wrn_phase_req
{
int
ready
;
u32
phase
;
};
#define WRN_DMTD_AVG_SAMPLES 256
#define WRN_DMTD_MAX_PHASE 16384
#define WRN_CAL_TX_ON 1
#define WRN_CAL_TX_OFF 2
#define WRN_CAL_RX_ON 3
#define WRN_CAL_RX_OFF 4
#define WRN_CAL_RX_CHECK 5
/* This a WR-specific register in the dmdio space */
#define WRN_MDIO_WR_SPEC 0x00000010
#define WRN_MDIO_WR_SPEC_TX_CAL 0x01
/* TX calib pattern */
#define WRN_MDIO_WR_SPEC_RX_CAL_STAT 0x02
/* RX calib status */
#define WRN_MDIO_WR_SPEC_CAL_CRST 0x04
/* Reset calibration counter */
/* Following functions in in nic-core.c */
/* Following functions are in nic-core.c */
extern
irqreturn_t
wrn_interrupt
(
int
irq
,
void
*
dev_id
);
extern
int
wrn_netops_init
(
struct
net_device
*
netdev
);
...
...
@@ -136,4 +164,12 @@ extern int wrn_ep_close(struct net_device *dev);
extern
int
wrn_endpoint_probe
(
struct
net_device
*
netdev
);
extern
void
wrn_endpoint_remove
(
struct
net_device
*
netdev
);
/* Following functions from timestamp.c */
extern
int
wrn_tstamp_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
int
cmd
);
/* Following functions from dmtd.c */
extern
int
wrn_phase_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
int
cmd
);
extern
int
wrn_calib_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
int
cmd
);
#endif
/* __WR_NIC_H__ */
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