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
Kirill Smelkov
linux
Commits
fd172807
Commit
fd172807
authored
Mar 06, 2005
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge pobox.com:/garz/repo/netdev-2.6/sk_mca
into pobox.com:/garz/repo/net-drivers-2.6
parents
06e34c35
2bb50058
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
69 additions
and
76 deletions
+69
-76
drivers/net/sk_mca.c
drivers/net/sk_mca.c
+64
-62
drivers/net/sk_mca.h
drivers/net/sk_mca.h
+5
-14
No files found.
drivers/net/sk_mca.c
View file @
fd172807
...
@@ -127,12 +127,13 @@ static unsigned char poly[] =
...
@@ -127,12 +127,13 @@ static unsigned char poly[] =
#ifdef DEBUG
#ifdef DEBUG
static
void
dumpmem
(
struct
net_device
*
dev
,
u32
start
,
u32
len
)
static
void
dumpmem
(
struct
net_device
*
dev
,
u32
start
,
u32
len
)
{
{
skmca_priv
*
priv
=
netdev_priv
(
dev
);
int
z
;
int
z
;
for
(
z
=
0
;
z
<
len
;
z
++
)
{
for
(
z
=
0
;
z
<
len
;
z
++
)
{
if
((
z
&
15
)
==
0
)
if
((
z
&
15
)
==
0
)
printk
(
"%04x:"
,
z
);
printk
(
"%04x:"
,
z
);
printk
(
" %02x"
,
SKMCA_READB
(
dev
->
mem_start
+
start
+
z
));
printk
(
" %02x"
,
readb
(
priv
->
base
+
start
+
z
));
if
((
z
&
15
)
==
15
)
if
((
z
&
15
)
==
15
)
printk
(
"
\n
"
);
printk
(
"
\n
"
);
}
}
...
@@ -220,21 +221,21 @@ static int __init dofind(int *junior, int firstslot)
...
@@ -220,21 +221,21 @@ static int __init dofind(int *junior, int firstslot)
static
void
ResetBoard
(
struct
net_device
*
dev
)
static
void
ResetBoard
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
SKMCA_WRITEB
(
CTRL_RESET_ON
,
priv
->
ctrladdr
);
writeb
(
CTRL_RESET_ON
,
priv
->
ctrladdr
);
udelay
(
10
);
udelay
(
10
);
SKMCA_WRITEB
(
CTRL_RESET_OFF
,
priv
->
ctrladdr
);
writeb
(
CTRL_RESET_OFF
,
priv
->
ctrladdr
);
}
}
/* wait for LANCE interface to become not busy */
/* wait for LANCE interface to become not busy */
static
int
WaitLANCE
(
struct
net_device
*
dev
)
static
int
WaitLANCE
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
int
t
=
0
;
int
t
=
0
;
while
((
SKMCA_READB
(
priv
->
ctrladdr
)
&
STAT_IO_BUSY
)
==
while
((
readb
(
priv
->
ctrladdr
)
&
STAT_IO_BUSY
)
==
STAT_IO_BUSY
)
{
STAT_IO_BUSY
)
{
udelay
(
1
);
udelay
(
1
);
if
(
++
t
>
1000
)
{
if
(
++
t
>
1000
)
{
...
@@ -250,7 +251,7 @@ static int WaitLANCE(struct net_device *dev)
...
@@ -250,7 +251,7 @@ static int WaitLANCE(struct net_device *dev)
static
void
SetLANCE
(
struct
net_device
*
dev
,
u16
addr
,
u16
value
)
static
void
SetLANCE
(
struct
net_device
*
dev
,
u16
addr
,
u16
value
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
unsigned
long
flags
;
unsigned
long
flags
;
/* disable interrupts */
/* disable interrupts */
...
@@ -263,19 +264,17 @@ static void SetLANCE(struct net_device *dev, u16 addr, u16 value)
...
@@ -263,19 +264,17 @@ static void SetLANCE(struct net_device *dev, u16 addr, u16 value)
/* transfer register address to RAP */
/* transfer register address to RAP */
SKMCA_WRITEB
(
CTRL_RESET_OFF
|
CTRL_RW_WRITE
|
CTRL_ADR_RAP
,
writeb
(
CTRL_RESET_OFF
|
CTRL_RW_WRITE
|
CTRL_ADR_RAP
,
priv
->
ctrladdr
);
priv
->
ctrladdr
);
writew
(
addr
,
priv
->
ioregaddr
);
SKMCA_WRITEW
(
addr
,
priv
->
ioregaddr
);
writeb
(
IOCMD_GO
,
priv
->
cmdaddr
);
SKMCA_WRITEB
(
IOCMD_GO
,
priv
->
cmdaddr
);
udelay
(
1
);
udelay
(
1
);
WaitLANCE
(
dev
);
WaitLANCE
(
dev
);
/* transfer data to register */
/* transfer data to register */
SKMCA_WRITEB
(
CTRL_RESET_OFF
|
CTRL_RW_WRITE
|
CTRL_ADR_DATA
,
writeb
(
CTRL_RESET_OFF
|
CTRL_RW_WRITE
|
CTRL_ADR_DATA
,
priv
->
ctrladdr
);
priv
->
ctrladdr
);
writew
(
value
,
priv
->
ioregaddr
);
SKMCA_WRITEW
(
value
,
priv
->
ioregaddr
);
writeb
(
IOCMD_GO
,
priv
->
cmdaddr
);
SKMCA_WRITEB
(
IOCMD_GO
,
priv
->
cmdaddr
);
udelay
(
1
);
udelay
(
1
);
WaitLANCE
(
dev
);
WaitLANCE
(
dev
);
...
@@ -288,7 +287,7 @@ static void SetLANCE(struct net_device *dev, u16 addr, u16 value)
...
@@ -288,7 +287,7 @@ static void SetLANCE(struct net_device *dev, u16 addr, u16 value)
static
u16
GetLANCE
(
struct
net_device
*
dev
,
u16
addr
)
static
u16
GetLANCE
(
struct
net_device
*
dev
,
u16
addr
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
unsigned
long
flags
;
unsigned
long
flags
;
unsigned
int
res
;
unsigned
int
res
;
...
@@ -302,21 +301,19 @@ static u16 GetLANCE(struct net_device *dev, u16 addr)
...
@@ -302,21 +301,19 @@ static u16 GetLANCE(struct net_device *dev, u16 addr)
/* transfer register address to RAP */
/* transfer register address to RAP */
SKMCA_WRITEB
(
CTRL_RESET_OFF
|
CTRL_RW_WRITE
|
CTRL_ADR_RAP
,
writeb
(
CTRL_RESET_OFF
|
CTRL_RW_WRITE
|
CTRL_ADR_RAP
,
priv
->
ctrladdr
);
priv
->
ctrladdr
);
writew
(
addr
,
priv
->
ioregaddr
);
SKMCA_WRITEW
(
addr
,
priv
->
ioregaddr
);
writeb
(
IOCMD_GO
,
priv
->
cmdaddr
);
SKMCA_WRITEB
(
IOCMD_GO
,
priv
->
cmdaddr
);
udelay
(
1
);
udelay
(
1
);
WaitLANCE
(
dev
);
WaitLANCE
(
dev
);
/* transfer data from register */
/* transfer data from register */
SKMCA_WRITEB
(
CTRL_RESET_OFF
|
CTRL_RW_READ
|
CTRL_ADR_DATA
,
writeb
(
CTRL_RESET_OFF
|
CTRL_RW_READ
|
CTRL_ADR_DATA
,
priv
->
ctrladdr
);
priv
->
ctrladdr
);
writeb
(
IOCMD_GO
,
priv
->
cmdaddr
);
SKMCA_WRITEB
(
IOCMD_GO
,
priv
->
cmdaddr
);
udelay
(
1
);
udelay
(
1
);
WaitLANCE
(
dev
);
WaitLANCE
(
dev
);
res
=
SKMCA_READW
(
priv
->
ioregaddr
);
res
=
readw
(
priv
->
ioregaddr
);
/* reenable interrupts */
/* reenable interrupts */
...
@@ -329,6 +326,7 @@ static u16 GetLANCE(struct net_device *dev, u16 addr)
...
@@ -329,6 +326,7 @@ static u16 GetLANCE(struct net_device *dev, u16 addr)
static
void
InitDscrs
(
struct
net_device
*
dev
)
static
void
InitDscrs
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
netdev_priv
(
dev
);
u32
bufaddr
;
u32
bufaddr
;
/* Set up Tx descriptors. The board has only 16K RAM so bits 16..23
/* Set up Tx descriptors. The board has only 16K RAM so bits 16..23
...
@@ -344,11 +342,10 @@ static void InitDscrs(struct net_device *dev)
...
@@ -344,11 +342,10 @@ static void InitDscrs(struct net_device *dev)
descr
.
Flags
=
0
;
descr
.
Flags
=
0
;
descr
.
Len
=
0xf000
;
descr
.
Len
=
0xf000
;
descr
.
Status
=
0
;
descr
.
Status
=
0
;
SKMCA_TOIO
(
dev
->
mem_start
+
RAM_TXBASE
+
memcpy_toio
(
priv
->
base
+
RAM_TXBASE
+
(
z
*
sizeof
(
LANCE_TxDescr
)),
&
descr
,
(
z
*
sizeof
(
LANCE_TxDescr
)),
&
descr
,
sizeof
(
LANCE_TxDescr
));
sizeof
(
LANCE_TxDescr
));
SKMCA_SETIO
(
dev
->
mem_start
+
bufaddr
,
0
,
memset_io
(
priv
->
base
+
bufaddr
,
0
,
RAM_BUFSIZE
);
RAM_BUFSIZE
);
bufaddr
+=
RAM_BUFSIZE
;
bufaddr
+=
RAM_BUFSIZE
;
}
}
}
}
...
@@ -364,11 +361,10 @@ static void InitDscrs(struct net_device *dev)
...
@@ -364,11 +361,10 @@ static void InitDscrs(struct net_device *dev)
descr
.
Flags
=
RXDSCR_FLAGS_OWN
;
descr
.
Flags
=
RXDSCR_FLAGS_OWN
;
descr
.
MaxLen
=
-
RAM_BUFSIZE
;
descr
.
MaxLen
=
-
RAM_BUFSIZE
;
descr
.
Len
=
0
;
descr
.
Len
=
0
;
SKMCA_TOIO
(
dev
->
mem_start
+
RAM_RXBASE
+
memcpy_toio
(
priv
->
base
+
RAM_RXBASE
+
(
z
*
sizeof
(
LANCE_RxDescr
)),
&
descr
,
(
z
*
sizeof
(
LANCE_RxDescr
)),
&
descr
,
sizeof
(
LANCE_RxDescr
));
sizeof
(
LANCE_RxDescr
));
SKMCA_SETIO
(
dev
->
mem_start
+
bufaddr
,
0
,
memset_io
(
priv
->
base
+
bufaddr
,
0
,
RAM_BUFSIZE
);
RAM_BUFSIZE
);
bufaddr
+=
RAM_BUFSIZE
;
bufaddr
+=
RAM_BUFSIZE
;
}
}
}
}
...
@@ -425,7 +421,7 @@ static unsigned int GetHash(char *address)
...
@@ -425,7 +421,7 @@ static unsigned int GetHash(char *address)
static
void
InitLANCE
(
struct
net_device
*
dev
)
static
void
InitLANCE
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
/* build up descriptors. */
/* build up descriptors. */
...
@@ -478,6 +474,7 @@ static void StopLANCE(struct net_device *dev)
...
@@ -478,6 +474,7 @@ static void StopLANCE(struct net_device *dev)
static
void
InitBoard
(
struct
net_device
*
dev
)
static
void
InitBoard
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
netdev_priv
(
dev
);
LANCE_InitBlock
block
;
LANCE_InitBlock
block
;
/* Lay out the shared RAM - first we create the init block for the LANCE.
/* Lay out the shared RAM - first we create the init block for the LANCE.
...
@@ -492,7 +489,7 @@ static void InitBoard(struct net_device *dev)
...
@@ -492,7 +489,7 @@ static void InitBoard(struct net_device *dev)
block
.
RdrP
=
(
RAM_RXBASE
&
0xffffff
)
|
(
LRXCOUNT
<<
29
);
block
.
RdrP
=
(
RAM_RXBASE
&
0xffffff
)
|
(
LRXCOUNT
<<
29
);
block
.
TdrP
=
(
RAM_TXBASE
&
0xffffff
)
|
(
LTXCOUNT
<<
29
);
block
.
TdrP
=
(
RAM_TXBASE
&
0xffffff
)
|
(
LTXCOUNT
<<
29
);
SKMCA_TOIO
(
dev
->
mem_start
+
RAM_INITBASE
,
&
block
,
sizeof
(
block
));
memcpy_toio
(
priv
->
base
+
RAM_INITBASE
,
&
block
,
sizeof
(
block
));
/* initialize LANCE. Implicitly sets up other structures in RAM. */
/* initialize LANCE. Implicitly sets up other structures in RAM. */
...
@@ -572,7 +569,7 @@ static u16 irqstart_handler(struct net_device *dev, u16 oldcsr0)
...
@@ -572,7 +569,7 @@ static u16 irqstart_handler(struct net_device *dev, u16 oldcsr0)
static
u16
irqmiss_handler
(
struct
net_device
*
dev
,
u16
oldcsr0
)
static
u16
irqmiss_handler
(
struct
net_device
*
dev
,
u16
oldcsr0
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
/* update statistics */
/* update statistics */
...
@@ -588,7 +585,7 @@ static u16 irqmiss_handler(struct net_device *dev, u16 oldcsr0)
...
@@ -588,7 +585,7 @@ static u16 irqmiss_handler(struct net_device *dev, u16 oldcsr0)
static
u16
irqrx_handler
(
struct
net_device
*
dev
,
u16
oldcsr0
)
static
u16
irqrx_handler
(
struct
net_device
*
dev
,
u16
oldcsr0
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
LANCE_RxDescr
descr
;
LANCE_RxDescr
descr
;
unsigned
int
descraddr
;
unsigned
int
descraddr
;
...
@@ -597,7 +594,7 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
...
@@ -597,7 +594,7 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
descraddr
=
RAM_RXBASE
+
(
priv
->
nextrx
*
sizeof
(
LANCE_RxDescr
));
descraddr
=
RAM_RXBASE
+
(
priv
->
nextrx
*
sizeof
(
LANCE_RxDescr
));
while
(
1
)
{
while
(
1
)
{
/* read descriptor */
/* read descriptor */
SKMCA_FROMIO
(
&
descr
,
dev
->
mem_start
+
descraddr
,
memcpy_fromio
(
&
descr
,
priv
->
base
+
descraddr
,
sizeof
(
LANCE_RxDescr
));
sizeof
(
LANCE_RxDescr
));
/* if we reach a descriptor we do not own, we're done */
/* if we reach a descriptor we do not own, we're done */
...
@@ -629,8 +626,8 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
...
@@ -629,8 +626,8 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
if
(
skb
==
NULL
)
if
(
skb
==
NULL
)
priv
->
stat
.
rx_dropped
++
;
priv
->
stat
.
rx_dropped
++
;
else
{
else
{
SKMCA_FROMIO
(
skb_put
(
skb
,
descr
.
Len
),
memcpy_fromio
(
skb_put
(
skb
,
descr
.
Len
),
dev
->
mem_start
+
priv
->
base
+
descr
.
LowAddr
,
descr
.
Len
);
descr
.
LowAddr
,
descr
.
Len
);
skb
->
dev
=
dev
;
skb
->
dev
=
dev
;
skb
->
protocol
=
eth_type_trans
(
skb
,
dev
);
skb
->
protocol
=
eth_type_trans
(
skb
,
dev
);
...
@@ -647,7 +644,7 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
...
@@ -647,7 +644,7 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
descr
.
Flags
|=
RXDSCR_FLAGS_OWN
;
descr
.
Flags
|=
RXDSCR_FLAGS_OWN
;
/* update descriptor in shared RAM */
/* update descriptor in shared RAM */
SKMCA_TOIO
(
dev
->
mem_start
+
descraddr
,
&
descr
,
memcpy_toio
(
priv
->
base
+
descraddr
,
&
descr
,
sizeof
(
LANCE_RxDescr
));
sizeof
(
LANCE_RxDescr
));
/* go to next descriptor */
/* go to next descriptor */
...
@@ -669,7 +666,7 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
...
@@ -669,7 +666,7 @@ static u16 irqrx_handler(struct net_device *dev, u16 oldcsr0)
static
u16
irqtx_handler
(
struct
net_device
*
dev
,
u16
oldcsr0
)
static
u16
irqtx_handler
(
struct
net_device
*
dev
,
u16
oldcsr0
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
LANCE_TxDescr
descr
;
LANCE_TxDescr
descr
;
unsigned
int
descraddr
;
unsigned
int
descraddr
;
...
@@ -679,7 +676,7 @@ static u16 irqtx_handler(struct net_device *dev, u16 oldcsr0)
...
@@ -679,7 +676,7 @@ static u16 irqtx_handler(struct net_device *dev, u16 oldcsr0)
RAM_TXBASE
+
(
priv
->
nexttxdone
*
sizeof
(
LANCE_TxDescr
));
RAM_TXBASE
+
(
priv
->
nexttxdone
*
sizeof
(
LANCE_TxDescr
));
while
(
priv
->
txbusy
>
0
)
{
while
(
priv
->
txbusy
>
0
)
{
/* read descriptor */
/* read descriptor */
SKMCA_FROMIO
(
&
descr
,
dev
->
mem_start
+
descraddr
,
memcpy_fromio
(
&
descr
,
priv
->
base
+
descraddr
,
sizeof
(
LANCE_TxDescr
));
sizeof
(
LANCE_TxDescr
));
/* if the LANCE still owns this one, we've worked out all sent packets */
/* if the LANCE still owns this one, we've worked out all sent packets */
...
@@ -798,9 +795,7 @@ static int skmca_getinfo(char *buf, int slot, void *d)
...
@@ -798,9 +795,7 @@ static int skmca_getinfo(char *buf, int slot, void *d)
if
(
dev
==
NULL
)
if
(
dev
==
NULL
)
return
len
;
return
len
;
if
(
dev
->
priv
==
NULL
)
priv
=
netdev_priv
(
dev
);
return
len
;
priv
=
(
skmca_priv
*
)
dev
->
priv
;
/* print info */
/* print info */
...
@@ -825,7 +820,7 @@ static int skmca_getinfo(char *buf, int slot, void *d)
...
@@ -825,7 +820,7 @@ static int skmca_getinfo(char *buf, int slot, void *d)
static
int
skmca_open
(
struct
net_device
*
dev
)
static
int
skmca_open
(
struct
net_device
*
dev
)
{
{
int
result
;
int
result
;
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
/* register resources - only necessary for IRQ */
/* register resources - only necessary for IRQ */
result
=
result
=
...
@@ -868,7 +863,7 @@ static int skmca_close(struct net_device *dev)
...
@@ -868,7 +863,7 @@ static int skmca_close(struct net_device *dev)
static
int
skmca_tx
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
static
int
skmca_tx
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
LANCE_TxDescr
descr
;
LANCE_TxDescr
descr
;
unsigned
int
address
;
unsigned
int
address
;
int
tmplen
,
retval
=
0
;
int
tmplen
,
retval
=
0
;
...
@@ -894,8 +889,7 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
...
@@ -894,8 +889,7 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
/* get TX descriptor */
/* get TX descriptor */
address
=
RAM_TXBASE
+
(
priv
->
nexttxput
*
sizeof
(
LANCE_TxDescr
));
address
=
RAM_TXBASE
+
(
priv
->
nexttxput
*
sizeof
(
LANCE_TxDescr
));
SKMCA_FROMIO
(
&
descr
,
dev
->
mem_start
+
address
,
memcpy_fromio
(
&
descr
,
priv
->
base
+
address
,
sizeof
(
LANCE_TxDescr
));
sizeof
(
LANCE_TxDescr
));
/* enter packet length as 2s complement - assure minimum length */
/* enter packet length as 2s complement - assure minimum length */
tmplen
=
skb
->
len
;
tmplen
=
skb
->
len
;
...
@@ -911,14 +905,14 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
...
@@ -911,14 +905,14 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
unsigned
int
destoffs
=
0
,
l
=
strlen
(
fill
);
unsigned
int
destoffs
=
0
,
l
=
strlen
(
fill
);
while
(
destoffs
<
tmplen
)
{
while
(
destoffs
<
tmplen
)
{
SKMCA_TOIO
(
dev
->
mem_start
+
descr
.
LowAddr
+
memcpy_toio
(
priv
->
base
+
descr
.
LowAddr
+
destoffs
,
fill
,
l
);
destoffs
,
fill
,
l
);
destoffs
+=
l
;
destoffs
+=
l
;
}
}
}
}
/* do the real data copying */
/* do the real data copying */
SKMCA_TOIO
(
dev
->
mem_start
+
descr
.
LowAddr
,
skb
->
data
,
skb
->
len
);
memcpy_toio
(
priv
->
base
+
descr
.
LowAddr
,
skb
->
data
,
skb
->
len
);
/* hand descriptor over to LANCE - this is the first and last chunk */
/* hand descriptor over to LANCE - this is the first and last chunk */
descr
.
Flags
=
descr
.
Flags
=
...
@@ -945,8 +939,7 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
...
@@ -945,8 +939,7 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
netif_stop_queue
(
dev
);
netif_stop_queue
(
dev
);
/* write descriptor back to RAM */
/* write descriptor back to RAM */
SKMCA_TOIO
(
dev
->
mem_start
+
address
,
&
descr
,
memcpy_toio
(
priv
->
base
+
address
,
&
descr
,
sizeof
(
LANCE_TxDescr
));
sizeof
(
LANCE_TxDescr
));
/* if no descriptors were active, give the LANCE a hint to read it
/* if no descriptors were active, give the LANCE a hint to read it
immediately */
immediately */
...
@@ -967,7 +960,7 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
...
@@ -967,7 +960,7 @@ static int skmca_tx(struct sk_buff *skb, struct net_device *dev)
static
struct
net_device_stats
*
skmca_stats
(
struct
net_device
*
dev
)
static
struct
net_device_stats
*
skmca_stats
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
(
skmca_priv
*
)
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
return
&
(
priv
->
stat
);
return
&
(
priv
->
stat
);
}
}
...
@@ -977,13 +970,14 @@ static struct net_device_stats *skmca_stats(struct net_device *dev)
...
@@ -977,13 +970,14 @@ static struct net_device_stats *skmca_stats(struct net_device *dev)
static
void
skmca_set_multicast_list
(
struct
net_device
*
dev
)
static
void
skmca_set_multicast_list
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
netdev_priv
(
dev
);
LANCE_InitBlock
block
;
LANCE_InitBlock
block
;
/* first stop the LANCE... */
/* first stop the LANCE... */
StopLANCE
(
dev
);
StopLANCE
(
dev
);
/* ...then modify the initialization block... */
/* ...then modify the initialization block... */
SKMCA_FROMIO
(
&
block
,
dev
->
mem_start
+
RAM_INITBASE
,
sizeof
(
block
));
memcpy_fromio
(
&
block
,
priv
->
base
+
RAM_INITBASE
,
sizeof
(
block
));
if
(
dev
->
flags
&
IFF_PROMISC
)
if
(
dev
->
flags
&
IFF_PROMISC
)
block
.
Mode
|=
LANCE_INIT_PROM
;
block
.
Mode
|=
LANCE_INIT_PROM
;
else
else
...
@@ -1003,7 +997,7 @@ static void skmca_set_multicast_list(struct net_device *dev)
...
@@ -1003,7 +997,7 @@ static void skmca_set_multicast_list(struct net_device *dev)
}
}
}
}
SKMCA_TOIO
(
dev
->
mem_start
+
RAM_INITBASE
,
&
block
,
sizeof
(
block
));
memcpy_toio
(
priv
->
base
+
RAM_INITBASE
,
&
block
,
sizeof
(
block
));
/* ...then reinit LANCE with the correct flags */
/* ...then reinit LANCE with the correct flags */
InitLANCE
(
dev
);
InitLANCE
(
dev
);
...
@@ -1017,10 +1011,11 @@ static int startslot; /* counts through slots when probing multiple devices */
...
@@ -1017,10 +1011,11 @@ static int startslot; /* counts through slots when probing multiple devices */
static
void
cleanup_card
(
struct
net_device
*
dev
)
static
void
cleanup_card
(
struct
net_device
*
dev
)
{
{
skmca_priv
*
priv
=
dev
->
priv
;
skmca_priv
*
priv
=
netdev_priv
(
dev
)
;
DeinitBoard
(
dev
);
DeinitBoard
(
dev
);
if
(
dev
->
irq
!=
0
)
if
(
dev
->
irq
!=
0
)
free_irq
(
dev
->
irq
,
dev
);
free_irq
(
dev
->
irq
,
dev
);
iounmap
(
priv
->
base
);
mca_mark_as_unused
(
priv
->
slot
);
mca_mark_as_unused
(
priv
->
slot
);
mca_set_adapter_procfn
(
priv
->
slot
,
NULL
,
NULL
);
mca_set_adapter_procfn
(
priv
->
slot
,
NULL
,
NULL
);
}
}
...
@@ -1104,13 +1099,20 @@ struct net_device * __init skmca_probe(int unit)
...
@@ -1104,13 +1099,20 @@ struct net_device * __init skmca_probe(int unit)
printk
(
"%s: SKNet %s adapter found in slot %d
\n
"
,
dev
->
name
,
printk
(
"%s: SKNet %s adapter found in slot %d
\n
"
,
dev
->
name
,
junior
?
"Junior MC2"
:
"MC2+"
,
slot
+
1
);
junior
?
"Junior MC2"
:
"MC2+"
,
slot
+
1
);
/* allocate structure */
priv
=
netdev_priv
(
dev
);
priv
=
dev
->
priv
;
priv
->
base
=
ioremap
(
base
,
0x4000
);
if
(
!
priv
->
base
)
{
mca_set_adapter_procfn
(
slot
,
NULL
,
NULL
);
mca_mark_as_unused
(
slot
);
free_netdev
(
dev
);
return
ERR_PTR
(
-
ENOMEM
);
}
priv
->
slot
=
slot
;
priv
->
slot
=
slot
;
priv
->
macbase
=
base
+
0x3fc0
;
priv
->
macbase
=
priv
->
base
+
0x3fc0
;
priv
->
ioregaddr
=
base
+
0x3ff0
;
priv
->
ioregaddr
=
priv
->
base
+
0x3ff0
;
priv
->
ctrladdr
=
base
+
0x3ff2
;
priv
->
ctrladdr
=
priv
->
base
+
0x3ff2
;
priv
->
cmdaddr
=
base
+
0x3ff3
;
priv
->
cmdaddr
=
priv
->
base
+
0x3ff3
;
priv
->
medium
=
medium
;
priv
->
medium
=
medium
;
memset
(
&
priv
->
stat
,
0
,
sizeof
(
struct
net_device_stats
));
memset
(
&
priv
->
stat
,
0
,
sizeof
(
struct
net_device_stats
));
spin_lock_init
(
&
priv
->
lock
);
spin_lock_init
(
&
priv
->
lock
);
...
@@ -1147,7 +1149,7 @@ struct net_device * __init skmca_probe(int unit)
...
@@ -1147,7 +1149,7 @@ struct net_device * __init skmca_probe(int unit)
/* copy out MAC address */
/* copy out MAC address */
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
dev
->
dev_addr
[
i
]
=
SKMCA_READB
(
priv
->
macbase
+
(
i
<<
1
));
dev
->
dev_addr
[
i
]
=
readb
(
priv
->
macbase
+
(
i
<<
1
));
/* print config */
/* print config */
printk
(
"%s: IRQ %d, memory %#lx-%#lx, "
printk
(
"%s: IRQ %d, memory %#lx-%#lx, "
...
...
drivers/net/sk_mca.h
View file @
fd172807
...
@@ -5,16 +5,6 @@
...
@@ -5,16 +5,6 @@
#ifdef _SK_MCA_DRIVER_
#ifdef _SK_MCA_DRIVER_
/* version-dependent functions/structures */
#define SKMCA_READB(addr) isa_readb(addr)
#define SKMCA_READW(addr) isa_readw(addr)
#define SKMCA_WRITEB(data, addr) isa_writeb(data, addr)
#define SKMCA_WRITEW(data, addr) isa_writew(data, addr)
#define SKMCA_TOIO(dest, src, len) isa_memcpy_toio(dest, src, len)
#define SKMCA_FROMIO(dest, src, len) isa_memcpy_fromio(dest, src, len)
#define SKMCA_SETIO(dest, val, len) isa_memset_io(dest, val, len)
/* Adapter ID's */
/* Adapter ID's */
#define SKNET_MCA_ID 0x6afd
#define SKNET_MCA_ID 0x6afd
#define SKNET_JUNIOR_MCA_ID 0x6be9
#define SKNET_JUNIOR_MCA_ID 0x6be9
...
@@ -29,10 +19,11 @@ typedef enum { Media_10Base2, Media_10BaseT,
...
@@ -29,10 +19,11 @@ typedef enum { Media_10Base2, Media_10BaseT,
/* private structure */
/* private structure */
typedef
struct
{
typedef
struct
{
unsigned
int
slot
;
/* MCA-Slot-# */
unsigned
int
slot
;
/* MCA-Slot-# */
unsigned
int
macbase
;
/* base address of MAC address PROM */
void
__iomem
*
base
;
unsigned
int
ioregaddr
;
/* address of I/O-register (Lo) */
void
__iomem
*
macbase
;
/* base address of MAC address PROM */
unsigned
int
ctrladdr
;
/* address of control/stat register */
void
__iomem
*
ioregaddr
;
/* address of I/O-register (Lo) */
unsigned
int
cmdaddr
;
/* address of I/O-command register */
void
__iomem
*
ctrladdr
;
/* address of control/stat register */
void
__iomem
*
cmdaddr
;
/* address of I/O-command register */
int
nextrx
;
/* index of next RX descriptor to
int
nextrx
;
/* index of next RX descriptor to
be read */
be read */
int
nexttxput
;
/* index of next free TX descriptor */
int
nexttxput
;
/* index of next free TX descriptor */
...
...
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