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
ffb5fccf
Commit
ffb5fccf
authored
Mar 02, 2005
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Net: Convert ether1 and ether3 to use iomem accesses.
Signed-off-by:
Russell King
<
rmk@arm.linux.org.uk
>
parent
fe12455c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
126 additions
and
101 deletions
+126
-101
drivers/net/arm/ether1.c
drivers/net/arm/ether1.c
+78
-67
drivers/net/arm/ether1.h
drivers/net/arm/ether1.h
+5
-4
drivers/net/arm/ether3.c
drivers/net/arm/ether3.c
+32
-21
drivers/net/arm/ether3.h
drivers/net/arm/ether3.h
+11
-9
No files found.
drivers/net/arm/ether1.c
View file @
ffb5fccf
...
...
@@ -86,8 +86,8 @@ static char version[] __initdata = "ether1 ethernet driver (c) 2000 Russell King
#define DISABLEIRQS 1
#define NORMALIRQS 0
#define ether1_
in
w(dev, addr, type, offset, svflgs) ether1_inw_p (dev, addr + (int)(&((type *)0)->offset), svflgs)
#define ether1_
out
w(dev, val, addr, type, offset, svflgs) ether1_outw_p (dev, val, addr + (int)(&((type *)0)->offset), svflgs)
#define ether1_
read
w(dev, addr, type, offset, svflgs) ether1_inw_p (dev, addr + (int)(&((type *)0)->offset), svflgs)
#define ether1_
write
w(dev, val, addr, type, offset, svflgs) ether1_outw_p (dev, val, addr + (int)(&((type *)0)->offset), svflgs)
static
inline
unsigned
short
ether1_inw_p
(
struct
net_device
*
dev
,
int
addr
,
int
svflgs
)
...
...
@@ -98,8 +98,8 @@ ether1_inw_p (struct net_device *dev, int addr, int svflgs)
if
(
svflgs
)
local_irq_save
(
flags
);
outb
(
addr
>>
12
,
REG_PAGE
);
ret
=
inw
(
ETHER1_RAM
+
((
addr
&
4095
)
>>
1
));
writeb
(
addr
>>
12
,
REG_PAGE
);
ret
=
readw
(
ETHER1_RAM
+
((
addr
&
4095
)
<<
1
));
if
(
svflgs
)
local_irq_restore
(
flags
);
return
ret
;
...
...
@@ -113,8 +113,8 @@ ether1_outw_p (struct net_device *dev, unsigned short val, int addr, int svflgs)
if
(
svflgs
)
local_irq_save
(
flags
);
outb
(
addr
>>
12
,
REG_PAGE
);
outw
(
val
,
ETHER1_RAM
+
((
addr
&
4095
)
>>
1
));
writeb
(
addr
>>
12
,
REG_PAGE
);
writew
(
val
,
ETHER1_RAM
+
((
addr
&
4095
)
<<
1
));
if
(
svflgs
)
local_irq_restore
(
flags
);
}
...
...
@@ -131,11 +131,12 @@ ether1_outw_p (struct net_device *dev, unsigned short val, int addr, int svflgs)
static
void
ether1_writebuffer
(
struct
net_device
*
dev
,
void
*
data
,
unsigned
int
start
,
unsigned
int
length
)
{
unsigned
int
page
,
thislen
,
offset
,
addr
;
unsigned
int
page
,
thislen
,
offset
;
void
__iomem
*
addr
;
offset
=
start
&
4095
;
page
=
start
>>
12
;
addr
=
ioaddr
(
ETHER1_RAM
+
(
offset
>>
1
)
);
addr
=
ETHER1_RAM
+
(
offset
<<
1
);
if
(
offset
+
length
>
4096
)
thislen
=
4096
-
offset
;
...
...
@@ -145,7 +146,7 @@ ether1_writebuffer (struct net_device *dev, void *data, unsigned int start, unsi
do
{
int
used
;
out
b
(
page
,
REG_PAGE
);
write
b
(
page
,
REG_PAGE
);
length
-=
thislen
;
__asm__
__volatile__
(
...
...
@@ -181,7 +182,7 @@ ether1_writebuffer (struct net_device *dev, void *data, unsigned int start, unsi
:
"=&r"
(
used
),
"=&r"
(
data
)
:
"r"
(
addr
),
"r"
(
thislen
),
"1"
(
data
));
addr
=
ioaddr
(
ETHER1_RAM
)
;
addr
=
ETHER1_RAM
;
thislen
=
length
;
if
(
thislen
>
4096
)
...
...
@@ -193,11 +194,12 @@ ether1_writebuffer (struct net_device *dev, void *data, unsigned int start, unsi
static
void
ether1_readbuffer
(
struct
net_device
*
dev
,
void
*
data
,
unsigned
int
start
,
unsigned
int
length
)
{
unsigned
int
page
,
thislen
,
offset
,
addr
;
unsigned
int
page
,
thislen
,
offset
;
void
__iomem
*
addr
;
offset
=
start
&
4095
;
page
=
start
>>
12
;
addr
=
ioaddr
(
ETHER1_RAM
+
(
offset
>>
1
)
);
addr
=
ETHER1_RAM
+
(
offset
<<
1
);
if
(
offset
+
length
>
4096
)
thislen
=
4096
-
offset
;
...
...
@@ -207,7 +209,7 @@ ether1_readbuffer (struct net_device *dev, void *data, unsigned int start, unsig
do
{
int
used
;
out
b
(
page
,
REG_PAGE
);
write
b
(
page
,
REG_PAGE
);
length
-=
thislen
;
__asm__
__volatile__
(
...
...
@@ -243,7 +245,7 @@ ether1_readbuffer (struct net_device *dev, void *data, unsigned int start, unsig
:
"=&r"
(
used
),
"=&r"
(
data
)
:
"r"
(
addr
),
"r"
(
thislen
),
"1"
(
data
));
addr
=
ioaddr
(
ETHER1_RAM
)
;
addr
=
ETHER1_RAM
;
thislen
=
length
;
if
(
thislen
>
4096
)
...
...
@@ -302,7 +304,7 @@ ether1_ramtest(struct net_device *dev, unsigned char byte)
static
int
ether1_reset
(
struct
net_device
*
dev
)
{
outb
(
CTRL_RST
|
CTRL_ACK
,
REG_CONTROL
);
writeb
(
CTRL_RST
|
CTRL_ACK
,
REG_CONTROL
);
return
BUS_16
;
}
...
...
@@ -451,7 +453,7 @@ ether1_init_for_open (struct net_device *dev)
int
failures
=
0
;
unsigned
long
timeout
;
outb
(
CTRL_RST
|
CTRL_ACK
,
REG_CONTROL
);
writeb
(
CTRL_RST
|
CTRL_ACK
,
REG_CONTROL
);
for
(
i
=
0
;
i
<
6
;
i
++
)
init_sa
.
sa_addr
[
i
]
=
dev
->
dev_addr
[
i
];
...
...
@@ -466,7 +468,7 @@ ether1_init_for_open (struct net_device *dev)
ether1_writebuffer
(
dev
,
&
init_tdr
,
TDR_ADDR
,
TDR_SIZE
);
ether1_writebuffer
(
dev
,
&
init_nop
,
NOP_ADDR
,
NOP_SIZE
);
if
(
ether1_
inw
(
dev
,
CFG_ADDR
,
cfg_t
,
cfg_command
,
NORMALIRQS
)
!=
CMD_CONFIG
)
{
if
(
ether1_
readw
(
dev
,
CFG_ADDR
,
cfg_t
,
cfg_command
,
NORMALIRQS
)
!=
CMD_CONFIG
)
{
printk
(
KERN_ERR
"%s: detected either RAM fault or compiler bug
\n
"
,
dev
->
name
);
return
1
;
...
...
@@ -510,13 +512,13 @@ ether1_init_for_open (struct net_device *dev)
/* release reset & give 586 a prod */
priv
(
dev
)
->
resetting
=
1
;
priv
(
dev
)
->
initialising
=
1
;
outb
(
CTRL_RST
,
REG_CONTROL
);
outb
(
0
,
REG_CONTROL
);
outb
(
CTRL_CA
,
REG_CONTROL
);
writeb
(
CTRL_RST
,
REG_CONTROL
);
writeb
(
0
,
REG_CONTROL
);
writeb
(
CTRL_CA
,
REG_CONTROL
);
/* 586 should now unset iscp.busy */
timeout
=
jiffies
+
HZ
/
2
;
while
(
ether1_
inw
(
dev
,
ISCP_ADDR
,
iscp_t
,
iscp_busy
,
DISABLEIRQS
)
==
1
)
{
while
(
ether1_
readw
(
dev
,
ISCP_ADDR
,
iscp_t
,
iscp_busy
,
DISABLEIRQS
)
==
1
)
{
if
(
time_after
(
jiffies
,
timeout
))
{
printk
(
KERN_WARNING
"%s: can't initialise 82586: iscp is busy
\n
"
,
dev
->
name
);
return
1
;
...
...
@@ -525,7 +527,7 @@ ether1_init_for_open (struct net_device *dev)
/* check status of commands that we issued */
timeout
+=
HZ
/
10
;
while
(((
status
=
ether1_
inw
(
dev
,
CFG_ADDR
,
cfg_t
,
cfg_status
,
DISABLEIRQS
))
while
(((
status
=
ether1_
readw
(
dev
,
CFG_ADDR
,
cfg_t
,
cfg_status
,
DISABLEIRQS
))
&
STAT_COMPLETE
)
==
0
)
{
if
(
time_after
(
jiffies
,
timeout
))
break
;
...
...
@@ -534,15 +536,15 @@ ether1_init_for_open (struct net_device *dev)
if
((
status
&
(
STAT_COMPLETE
|
STAT_OK
))
!=
(
STAT_COMPLETE
|
STAT_OK
))
{
printk
(
KERN_WARNING
"%s: can't initialise 82586: config status %04X
\n
"
,
dev
->
name
,
status
);
printk
(
KERN_DEBUG
"%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]
\n
"
,
dev
->
name
,
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
failures
+=
1
;
}
timeout
+=
HZ
/
10
;
while
(((
status
=
ether1_
inw
(
dev
,
SA_ADDR
,
sa_t
,
sa_status
,
DISABLEIRQS
))
while
(((
status
=
ether1_
readw
(
dev
,
SA_ADDR
,
sa_t
,
sa_status
,
DISABLEIRQS
))
&
STAT_COMPLETE
)
==
0
)
{
if
(
time_after
(
jiffies
,
timeout
))
break
;
...
...
@@ -551,15 +553,15 @@ ether1_init_for_open (struct net_device *dev)
if
((
status
&
(
STAT_COMPLETE
|
STAT_OK
))
!=
(
STAT_COMPLETE
|
STAT_OK
))
{
printk
(
KERN_WARNING
"%s: can't initialise 82586: set address status %04X
\n
"
,
dev
->
name
,
status
);
printk
(
KERN_DEBUG
"%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]
\n
"
,
dev
->
name
,
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
failures
+=
1
;
}
timeout
+=
HZ
/
10
;
while
(((
status
=
ether1_
inw
(
dev
,
MC_ADDR
,
mc_t
,
mc_status
,
DISABLEIRQS
))
while
(((
status
=
ether1_
readw
(
dev
,
MC_ADDR
,
mc_t
,
mc_status
,
DISABLEIRQS
))
&
STAT_COMPLETE
)
==
0
)
{
if
(
time_after
(
jiffies
,
timeout
))
break
;
...
...
@@ -568,15 +570,15 @@ ether1_init_for_open (struct net_device *dev)
if
((
status
&
(
STAT_COMPLETE
|
STAT_OK
))
!=
(
STAT_COMPLETE
|
STAT_OK
))
{
printk
(
KERN_WARNING
"%s: can't initialise 82586: set multicast status %04X
\n
"
,
dev
->
name
,
status
);
printk
(
KERN_DEBUG
"%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]
\n
"
,
dev
->
name
,
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
failures
+=
1
;
}
timeout
+=
HZ
;
while
(((
status
=
ether1_
inw
(
dev
,
TDR_ADDR
,
tdr_t
,
tdr_status
,
DISABLEIRQS
))
while
(((
status
=
ether1_
readw
(
dev
,
TDR_ADDR
,
tdr_t
,
tdr_status
,
DISABLEIRQS
))
&
STAT_COMPLETE
)
==
0
)
{
if
(
time_after
(
jiffies
,
timeout
))
break
;
...
...
@@ -585,12 +587,12 @@ ether1_init_for_open (struct net_device *dev)
if
((
status
&
(
STAT_COMPLETE
|
STAT_OK
))
!=
(
STAT_COMPLETE
|
STAT_OK
))
{
printk
(
KERN_WARNING
"%s: can't tdr (ignored)
\n
"
,
dev
->
name
);
printk
(
KERN_DEBUG
"%s: SCB=[STS=%04X CMD=%04X CBL=%04X RFA=%04X]
\n
"
,
dev
->
name
,
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
),
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
}
else
{
status
=
ether1_
inw
(
dev
,
TDR_ADDR
,
tdr_t
,
tdr_result
,
DISABLEIRQS
);
status
=
ether1_
readw
(
dev
,
TDR_ADDR
,
tdr_t
,
tdr_result
,
DISABLEIRQS
);
if
(
status
&
TDR_XCVRPROB
)
printk
(
KERN_WARNING
"%s: i/f failed tdr: transceiver problem
\n
"
,
dev
->
name
);
else
if
((
status
&
(
TDR_SHORT
|
TDR_OPEN
))
&&
(
status
&
TDR_TIME
))
{
...
...
@@ -732,7 +734,7 @@ ether1_sendpacket (struct sk_buff *skb, struct net_device *dev)
priv
(
dev
)
->
tx_link
=
nopaddr
;
/* now reset the previous nop pointer */
ether1_
outw
(
dev
,
txaddr
,
tmp
,
nop_t
,
nop_link
,
NORMALIRQS
);
ether1_
writew
(
dev
,
txaddr
,
tmp
,
nop_t
,
nop_link
,
NORMALIRQS
);
local_irq_restore
(
flags
);
...
...
@@ -766,11 +768,11 @@ ether1_xmit_done (struct net_device *dev)
switch
(
nop
.
nop_command
&
CMD_MASK
)
{
case
CMD_TDR
:
/* special case */
if
(
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
)
if
(
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
)
!=
(
unsigned
short
)
I82586_NULL
)
{
ether1_outw
(
dev
,
SCB_CMDCUCSTART
|
SCB_CMDRXSTART
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
);
outb
(
CTRL_CA
,
REG_CONTROL
);
writeb
(
CTRL_CA
,
REG_CONTROL
);
}
priv
(
dev
)
->
tx_tail
=
NOP_ADDR
;
return
;
...
...
@@ -860,11 +862,11 @@ ether1_recv_done (struct net_device *dev)
rbd_t
rbd
;
do
{
status
=
ether1_
inw
(
dev
,
priv
(
dev
)
->
rx_head
,
rfd_t
,
rfd_status
,
NORMALIRQS
);
status
=
ether1_
readw
(
dev
,
priv
(
dev
)
->
rx_head
,
rfd_t
,
rfd_status
,
NORMALIRQS
);
if
((
status
&
RFD_COMPLETE
)
==
0
)
break
;
rbdaddr
=
ether1_
inw
(
dev
,
priv
(
dev
)
->
rx_head
,
rfd_t
,
rfd_rbdoffset
,
NORMALIRQS
);
rbdaddr
=
ether1_
readw
(
dev
,
priv
(
dev
)
->
rx_head
,
rfd_t
,
rfd_rbdoffset
,
NORMALIRQS
);
ether1_readbuffer
(
dev
,
&
rbd
,
rbdaddr
,
RBD_SIZE
);
if
((
rbd
.
rbd_status
&
(
RBD_EOF
|
RBD_ACNTVALID
))
==
(
RBD_EOF
|
RBD_ACNTVALID
))
{
...
...
@@ -891,18 +893,18 @@ ether1_recv_done (struct net_device *dev)
priv
(
dev
)
->
stats
.
rx_dropped
++
;
}
nexttail
=
ether1_
inw
(
dev
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_link
,
NORMALIRQS
);
nexttail
=
ether1_
readw
(
dev
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_link
,
NORMALIRQS
);
/* nexttail should be rx_head */
if
(
nexttail
!=
priv
(
dev
)
->
rx_head
)
printk
(
KERN_ERR
"%s: receiver buffer chaining error (%04X != %04X)
\n
"
,
dev
->
name
,
nexttail
,
priv
(
dev
)
->
rx_head
);
ether1_
outw
(
dev
,
RFD_CMDEL
|
RFD_CMDSUSPEND
,
nexttail
,
rfd_t
,
rfd_command
,
NORMALIRQS
);
ether1_
outw
(
dev
,
0
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_command
,
NORMALIRQS
);
ether1_
outw
(
dev
,
0
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_status
,
NORMALIRQS
);
ether1_
outw
(
dev
,
0
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_rbdoffset
,
NORMALIRQS
);
ether1_
writew
(
dev
,
RFD_CMDEL
|
RFD_CMDSUSPEND
,
nexttail
,
rfd_t
,
rfd_command
,
NORMALIRQS
);
ether1_
writew
(
dev
,
0
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_command
,
NORMALIRQS
);
ether1_
writew
(
dev
,
0
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_status
,
NORMALIRQS
);
ether1_
writew
(
dev
,
0
,
priv
(
dev
)
->
rx_tail
,
rfd_t
,
rfd_rbdoffset
,
NORMALIRQS
);
priv
(
dev
)
->
rx_tail
=
nexttail
;
priv
(
dev
)
->
rx_head
=
ether1_
inw
(
dev
,
priv
(
dev
)
->
rx_head
,
rfd_t
,
rfd_link
,
NORMALIRQS
);
priv
(
dev
)
->
rx_head
=
ether1_
readw
(
dev
,
priv
(
dev
)
->
rx_head
,
rfd_t
,
rfd_link
,
NORMALIRQS
);
}
while
(
1
);
}
...
...
@@ -912,12 +914,12 @@ ether1_interrupt (int irq, void *dev_id, struct pt_regs *regs)
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
int
status
;
status
=
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
);
status
=
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
);
if
(
status
)
{
ether1_outw
(
dev
,
status
&
(
SCB_STRNR
|
SCB_STCNA
|
SCB_STFR
|
SCB_STCX
),
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
);
outb
(
CTRL_CA
|
CTRL_ACK
,
REG_CONTROL
);
writeb
(
CTRL_CA
|
CTRL_ACK
,
REG_CONTROL
);
if
(
status
&
SCB_STCX
)
{
ether1_xmit_done
(
dev
);
}
...
...
@@ -926,10 +928,10 @@ ether1_interrupt (int irq, void *dev_id, struct pt_regs *regs)
printk
(
KERN_WARNING
"%s: CU went not ready ???
\n
"
,
dev
->
name
);
else
priv
(
dev
)
->
resetting
+=
1
;
if
(
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
)
if
(
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_cbl_offset
,
NORMALIRQS
)
!=
(
unsigned
short
)
I82586_NULL
)
{
ether1_
outw
(
dev
,
SCB_CMDCUCSTART
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
);
outb
(
CTRL_CA
,
REG_CONTROL
);
ether1_
writew
(
dev
,
SCB_CMDCUCSTART
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
);
writeb
(
CTRL_CA
,
REG_CONTROL
);
}
if
(
priv
(
dev
)
->
resetting
==
2
)
priv
(
dev
)
->
resetting
=
0
;
...
...
@@ -938,19 +940,19 @@ ether1_interrupt (int irq, void *dev_id, struct pt_regs *regs)
ether1_recv_done
(
dev
);
}
if
(
status
&
SCB_STRNR
)
{
if
(
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
)
&
SCB_STRXSUSP
)
{
if
(
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
)
&
SCB_STRXSUSP
)
{
printk
(
KERN_WARNING
"%s: RU went not ready: RU suspended
\n
"
,
dev
->
name
);
ether1_
outw
(
dev
,
SCB_CMDRXRESUME
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
);
outb
(
CTRL_CA
,
REG_CONTROL
);
ether1_
writew
(
dev
,
SCB_CMDRXRESUME
,
SCB_ADDR
,
scb_t
,
scb_command
,
NORMALIRQS
);
writeb
(
CTRL_CA
,
REG_CONTROL
);
priv
(
dev
)
->
stats
.
rx_dropped
++
;
/* we suspended due to lack of buffer space */
}
else
printk
(
KERN_WARNING
"%s: RU went not ready: %04X
\n
"
,
dev
->
name
,
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
));
printk
(
KERN_WARNING
"RU ptr = %04X
\n
"
,
ether1_
inw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_status
,
NORMALIRQS
));
printk
(
KERN_WARNING
"RU ptr = %04X
\n
"
,
ether1_
readw
(
dev
,
SCB_ADDR
,
scb_t
,
scb_rfa_offset
,
NORMALIRQS
));
}
}
else
outb
(
CTRL_ACK
,
REG_CONTROL
);
writeb
(
CTRL_ACK
,
REG_CONTROL
);
return
IRQ_HANDLED
;
}
...
...
@@ -1012,9 +1014,15 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
}
SET_MODULE_OWNER
(
dev
);
SET_NETDEV_DEV
(
dev
,
&
ec
->
dev
);
dev
->
base_addr
=
ecard_address
(
ec
,
ECARD_IOC
,
ECARD_FAST
);
dev
->
irq
=
ec
->
irq
;
priv
(
dev
)
->
base
=
ioremap
(
ecard_resource_start
(
ec
,
ECARD_RES_IOCFAST
),
ecard_resource_len
(
ec
,
ECARD_RES_IOCFAST
));
if
(
!
priv
(
dev
)
->
base
)
{
ret
=
-
ENOMEM
;
goto
free
;
}
if
((
priv
(
dev
)
->
bus_type
=
ether1_reset
(
dev
))
==
0
)
{
ret
=
-
ENODEV
;
...
...
@@ -1022,7 +1030,7 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
}
for
(
i
=
0
;
i
<
6
;
i
++
)
dev
->
dev_addr
[
i
]
=
inb
(
IDPROM_ADDRESS
+
i
);
dev
->
dev_addr
[
i
]
=
readb
(
IDPROM_ADDRESS
+
(
i
<<
2
)
);
if
(
ether1_init_2
(
dev
))
{
ret
=
-
ENODEV
;
...
...
@@ -1051,6 +1059,8 @@ ether1_probe(struct expansion_card *ec, const struct ecard_id *id)
return
0
;
free:
if
(
priv
(
dev
)
->
base
)
iounmap
(
priv
(
dev
)
->
base
);
free_netdev
(
dev
);
release:
ecard_release_resources
(
ec
);
...
...
@@ -1065,6 +1075,7 @@ static void __devexit ether1_remove(struct expansion_card *ec)
ecard_set_drvdata
(
ec
,
NULL
);
unregister_netdev
(
dev
);
iounmap
(
priv
(
dev
)
->
base
);
free_netdev
(
dev
);
ecard_release_resources
(
ec
);
}
...
...
drivers/net/arm/ether1.h
View file @
ffb5fccf
...
...
@@ -22,21 +22,22 @@
#define priv(dev) ((struct ether1_priv *)netdev_priv(dev))
/* Page register */
#define REG_PAGE (
dev->base_addr + 0x
00)
#define REG_PAGE (
priv(dev)->base + 0x00
00)
/* Control register */
#define REG_CONTROL (
dev->base_addr + 0x01
)
#define REG_CONTROL (
priv(dev)->base + 0x0004
)
#define CTRL_RST 0x01
#define CTRL_LOOPBACK 0x02
#define CTRL_CA 0x04
#define CTRL_ACK 0x08
#define ETHER1_RAM (
dev->base_addr + 0x8
00)
#define ETHER1_RAM (
priv(dev)->base + 0x20
00)
/* HW address */
#define IDPROM_ADDRESS (
dev->base_addr + 0x09
)
#define IDPROM_ADDRESS (
priv(dev)->base + 0x0024
)
struct
ether1_priv
{
void
__iomem
*
base
;
struct
net_device_stats
stats
;
unsigned
int
tx_link
;
unsigned
int
tx_head
;
...
...
drivers/net/arm/ether3.c
View file @
ffb5fccf
...
...
@@ -104,19 +104,19 @@ typedef enum {
* The SEEQ8005 doesn't like us writing to its registers
* too quickly.
*/
static
inline
void
ether3_outb
(
int
v
,
const
int
r
)
static
inline
void
ether3_outb
(
int
v
,
const
void
__iomem
*
r
)
{
out
b
(
v
,
r
);
write
b
(
v
,
r
);
udelay
(
1
);
}
static
inline
void
ether3_outw
(
int
v
,
const
int
r
)
static
inline
void
ether3_outw
(
int
v
,
const
void
__iomem
*
r
)
{
out
w
(
v
,
r
);
write
w
(
v
,
r
);
udelay
(
1
);
}
#define ether3_inb(r) ({ unsigned int __v =
in
b((r)); udelay(1); __v; })
#define ether3_inw(r) ({ unsigned int __v =
in
w((r)); udelay(1); __v; })
#define ether3_inb(r) ({ unsigned int __v =
read
b((r)); udelay(1); __v; })
#define ether3_inw(r) ({ unsigned int __v =
read
w((r)); udelay(1); __v; })
static
int
ether3_setbuffer
(
struct
net_device
*
dev
,
buffer_rw_t
read
,
int
start
)
...
...
@@ -149,28 +149,28 @@ ether3_setbuffer(struct net_device *dev, buffer_rw_t read, int start)
* write data to the buffer memory
*/
#define ether3_writebuffer(dev,data,length) \
out
sw(REG_BUFWIN, (data), (length) >> 1)
write
sw(REG_BUFWIN, (data), (length) >> 1)
#define ether3_writeword(dev,data) \
out
w((data), REG_BUFWIN)
write
w((data), REG_BUFWIN)
#define ether3_writelong(dev,data) { \
unsigned long
reg_bufwin = REG_BUFWIN; \
out
w((data), reg_bufwin); \
outw((data) >> 16, reg_bufwin);
\
void __iomem *
reg_bufwin = REG_BUFWIN; \
write
w((data), reg_bufwin); \
writew((data) >> 16, reg_bufwin);
\
}
/*
* read data from the buffer memory
*/
#define ether3_readbuffer(dev,data,length) \
in
sw(REG_BUFWIN, (data), (length) >> 1)
read
sw(REG_BUFWIN, (data), (length) >> 1)
#define ether3_readword(dev) \
in
w(REG_BUFWIN)
read
w(REG_BUFWIN)
#define ether3_readlong(dev) \
inw(REG_BUFWIN) | (in
w(REG_BUFWIN) << 16)
readw(REG_BUFWIN) | (read
w(REG_BUFWIN) << 16)
/*
* Switch LED off...
...
...
@@ -371,10 +371,10 @@ ether3_probe_bus_8(struct net_device *dev, int val)
printk
(
KERN_DEBUG
"ether3_probe: write8 [%02X:%02X]"
,
write_high
,
write_low
);
ether3_outb
(
write_low
,
REG_RECVPTR
);
ether3_outb
(
write_high
,
REG_RECVPTR
+
1
);
ether3_outb
(
write_high
,
REG_RECVPTR
+
4
);
read_low
=
ether3_inb
(
REG_RECVPTR
);
read_high
=
ether3_inb
(
REG_RECVPTR
+
1
);
read_high
=
ether3_inb
(
REG_RECVPTR
+
4
);
printk
(
", read8 [%02X:%02X]
\n
"
,
read_high
,
read_low
);
...
...
@@ -434,7 +434,7 @@ ether3_close(struct net_device *dev)
ether3_outw
(
CMD_RXOFF
|
CMD_TXOFF
,
REG_COMMAND
);
priv
(
dev
)
->
regs
.
command
=
0
;
while
(
ether3_inw
(
REG_STATUS
)
&
(
STAT_RXON
|
STAT_TXON
));
ether3_outb
(
0x80
,
REG_CONFIG2
+
1
);
ether3_outb
(
0x80
,
REG_CONFIG2
+
4
);
ether3_outw
(
0
,
REG_COMMAND
);
free_irq
(
dev
->
irq
,
dev
);
...
...
@@ -778,16 +778,16 @@ ether3_get_dev(struct net_device *dev, struct expansion_card *ec)
{
const
char
*
name
=
"ether3"
;
dev
->
base_addr
=
ecard_address
(
ec
,
ECARD_MEMC
,
0
);
dev
->
irq
=
ec
->
irq
;
priv
(
dev
)
->
seeq
=
priv
(
dev
)
->
base
;
if
(
ec
->
cid
.
manufacturer
==
MANU_ANT
&&
ec
->
cid
.
product
==
PROD_ANT_ETHERB
)
{
dev
->
base_addr
+=
0x2
00
;
priv
(
dev
)
->
seeq
=
priv
(
dev
)
->
base
+
0x8
00
;
name
=
"etherb"
;
}
ec
->
irqaddr
=
(
volatile
unsigned
char
*
)
ioaddr
(
dev
->
base_addr
)
;
ec
->
irqaddr
=
priv
(
dev
)
->
seeq
;
ec
->
irqmask
=
0xf0
;
ether3_addr
(
dev
->
dev_addr
,
ec
);
...
...
@@ -815,6 +815,14 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
}
SET_MODULE_OWNER
(
dev
);
SET_NETDEV_DEV
(
dev
,
&
ec
->
dev
);
priv
(
dev
)
->
base
=
ioremap
(
ecard_resource_start
(
ec
,
ECARD_RES_MEMC
),
ecard_resource_len
(
ec
,
ECARD_RES_MEMC
));
if
(
!
priv
(
dev
)
->
base
)
{
ret
=
-
ENOMEM
;
goto
free
;
}
name
=
ether3_get_dev
(
dev
,
ec
);
if
(
!
name
)
{
...
...
@@ -826,7 +834,7 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
/* Reset card...
*/
ether3_outb
(
0x80
,
REG_CONFIG2
+
1
);
ether3_outb
(
0x80
,
REG_CONFIG2
+
4
);
bus_type
=
BUS_UNKNOWN
;
udelay
(
4
);
...
...
@@ -883,6 +891,8 @@ ether3_probe(struct expansion_card *ec, const struct ecard_id *id)
return
0
;
free:
if
(
priv
(
dev
)
->
base
)
iounmap
(
priv
(
dev
)
->
base
);
free_netdev
(
dev
);
release:
ecard_release_resources
(
ec
);
...
...
@@ -897,6 +907,7 @@ static void __devexit ether3_remove(struct expansion_card *ec)
ecard_set_drvdata
(
ec
,
NULL
);
unregister_netdev
(
dev
);
iounmap
(
priv
(
dev
)
->
base
);
free_netdev
(
dev
);
ecard_release_resources
(
ec
);
}
...
...
drivers/net/arm/ether3.h
View file @
ffb5fccf
...
...
@@ -25,7 +25,7 @@
#define priv(dev) ((struct dev_priv *)netdev_priv(dev))
/* Command register definitions & bits */
#define REG_COMMAND (
dev->base_addr + 0x
00)
#define REG_COMMAND (
priv(dev)->seeq + 0x00
00)
#define CMD_ENINTDMA 0x0001
#define CMD_ENINTRX 0x0002
#define CMD_ENINTTX 0x0004
...
...
@@ -44,7 +44,7 @@
#define CMD_FIFOWRITE 0x8000
/* status register */
#define REG_STATUS (
dev->base_addr + 0x
00)
#define REG_STATUS (
priv(dev)->seeq + 0x00
00)
#define STAT_ENINTSTAT 0x0001
#define STAT_ENINTRX 0x0002
#define STAT_ENINTTX 0x0004
...
...
@@ -61,7 +61,7 @@
#define STAT_FIFODIR 0x8000
/* configuration register 1 */
#define REG_CONFIG1 (
dev->base_addr + 0x1
0)
#define REG_CONFIG1 (
priv(dev)->seeq + 0x004
0)
#define CFG1_BUFSELSTAT0 0x0000
#define CFG1_BUFSELSTAT1 0x0001
#define CFG1_BUFSELSTAT2 0x0002
...
...
@@ -94,7 +94,7 @@
#define CFG1_RECVCOMPSTAT5 0x2000
/* configuration register 2 */
#define REG_CONFIG2 (
dev->base_addr + 0x2
0)
#define REG_CONFIG2 (
priv(dev)->seeq + 0x008
0)
#define CFG2_BYTESWAP 0x0001
#define CFG2_ERRENCRC 0x0008
#define CFG2_ERRENDRIBBLE 0x0010
...
...
@@ -108,15 +108,15 @@
#define CFG2_CTRLO 0x1000
#define CFG2_RESET 0x8000
#define REG_RECVEND (
dev->base_addr + 0x3
0)
#define REG_RECVEND (
priv(dev)->seeq + 0x00c
0)
#define REG_BUFWIN (
dev->base_addr + 0x4
0)
#define REG_BUFWIN (
priv(dev)->seeq + 0x010
0)
#define REG_RECVPTR (
dev->base_addr + 0x5
0)
#define REG_RECVPTR (
priv(dev)->seeq + 0x014
0)
#define REG_TRANSMITPTR (
dev->base_addr + 0x6
0)
#define REG_TRANSMITPTR (
priv(dev)->seeq + 0x018
0)
#define REG_DMAADDR (
dev->base_addr + 0x7
0)
#define REG_DMAADDR (
priv(dev)->seeq + 0x01c
0)
/*
* Cards transmit/receive headers
...
...
@@ -154,6 +154,8 @@
#define MAX_TX_BUFFERED 10
struct
dev_priv
{
void
__iomem
*
base
;
void
__iomem
*
seeq
;
struct
{
unsigned
int
command
;
unsigned
int
config1
;
...
...
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