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
nexedi
linux
Commits
511fec9e
Commit
511fec9e
authored
May 04, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr b44] use miilib for MII ioctl handling
parent
0e27ec86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
31 deletions
+36
-31
drivers/net/b44.c
drivers/net/b44.c
+34
-31
drivers/net/b44.h
drivers/net/b44.h
+2
-0
No files found.
drivers/net/b44.c
View file @
511fec9e
...
...
@@ -331,6 +331,29 @@ static int b44_writephy(struct b44 *bp, int reg, u32 val)
return
b44_wait_bit
(
bp
,
B44_EMAC_ISTAT
,
EMAC_INT_MII
,
100
,
0
);
}
/* miilib interface */
/* FIXME FIXME: phy_id is ignored, bp->phy_addr use is unconditional
* due to code existing before miilib use was added to this driver.
* Someone should remove this artificial driver limitation in
* b44_{read,write}phy. bp->phy_addr itself is fine (and needed).
*/
static
int
b44_mii_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
)
{
u32
val
;
struct
b44
*
bp
=
netdev_priv
(
dev
);
int
rc
=
b44_readphy
(
bp
,
location
,
&
val
);
if
(
rc
)
return
0xffffffff
;
return
val
;
}
static
void
b44_mii_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
,
int
val
)
{
struct
b44
*
bp
=
netdev_priv
(
dev
);
b44_writephy
(
bp
,
location
,
val
);
}
static
int
b44_phy_reset
(
struct
b44
*
bp
)
{
u32
val
;
...
...
@@ -1607,38 +1630,11 @@ static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
struct
b44
*
bp
=
netdev_priv
(
dev
);
int
err
;
switch
(
cmd
)
{
case
SIOCGMIIPHY
:
data
->
phy_id
=
bp
->
phy_addr
;
/* fallthru */
case
SIOCGMIIREG
:
{
u32
mii_regval
;
spin_lock_irq
(
&
bp
->
lock
);
err
=
b44_readphy
(
bp
,
data
->
reg_num
&
0x1f
,
&
mii_regval
);
spin_unlock_irq
(
&
bp
->
lock
);
data
->
val_out
=
mii_regval
;
return
err
;
}
case
SIOCSMIIREG
:
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
spin_lock_irq
(
&
bp
->
lock
);
err
=
b44_writephy
(
bp
,
data
->
reg_num
&
0x1f
,
data
->
val_in
);
spin_unlock_irq
(
&
bp
->
lock
);
return
err
;
spin_lock_irq
(
&
bp
->
lock
);
err
=
generic_mii_ioctl
(
&
bp
->
mii_if
,
data
,
cmd
,
NULL
);
spin_unlock_irq
(
&
bp
->
lock
);
default:
/* do nothing */
break
;
};
return
-
EOPNOTSUPP
;
return
err
;
}
/* Read 128-bytes of EEPROM. */
...
...
@@ -1790,6 +1786,13 @@ static int __devinit b44_init_one(struct pci_dev *pdev,
goto
err_out_iounmap
;
}
bp
->
mii_if
.
dev
=
dev
;
bp
->
mii_if
.
mdio_read
=
b44_mii_read
;
bp
->
mii_if
.
mdio_write
=
b44_mii_write
;
bp
->
mii_if
.
phy_id
=
bp
->
phy_addr
;
bp
->
mii_if
.
phy_id_mask
=
0x1f
;
bp
->
mii_if
.
reg_num_mask
=
0x1f
;
/* By default, advertise all speed/duplex settings. */
bp
->
flags
|=
(
B44_FLAG_ADV_10HALF
|
B44_FLAG_ADV_10FULL
|
B44_FLAG_ADV_100HALF
|
B44_FLAG_ADV_100FULL
);
...
...
drivers/net/b44.h
View file @
511fec9e
...
...
@@ -542,6 +542,8 @@ struct b44 {
u8
phy_addr
;
u8
mdc_port
;
u8
core_unit
;
struct
mii_if_info
mii_if
;
};
#endif
/* _B44_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