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
7bedd791
Commit
7bedd791
authored
Dec 26, 2004
by
Jeff Garzik
Browse files
Options
Browse Files
Download
Plain Diff
Merge pobox.com:/garz/repo/netdev-2.6/viro-eth1
into pobox.com:/garz/repo/net-drivers-2.6
parents
90b14f29
2f5a21d6
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
417 additions
and
435 deletions
+417
-435
drivers/net/mace.c
drivers/net/mace.c
+32
-34
drivers/net/skfp/h/fplustm.h
drivers/net/skfp/h/fplustm.h
+1
-5
drivers/net/skfp/h/targethw.h
drivers/net/skfp/h/targethw.h
+1
-5
drivers/net/skfp/h/targetos.h
drivers/net/skfp/h/targetos.h
+1
-1
drivers/net/skfp/h/types.h
drivers/net/skfp/h/types.h
+6
-15
drivers/net/skfp/skfddi.c
drivers/net/skfp/skfddi.c
+16
-9
drivers/net/starfire.c
drivers/net/starfire.c
+40
-39
drivers/net/sundance.c
drivers/net/sundance.c
+121
-138
drivers/net/tokenring/lanstreamer.c
drivers/net/tokenring/lanstreamer.c
+12
-12
drivers/net/tokenring/lanstreamer.h
drivers/net/tokenring/lanstreamer.h
+1
-1
drivers/net/tokenring/olympic.c
drivers/net/tokenring/olympic.c
+44
-46
drivers/net/wireless/airo.c
drivers/net/wireless/airo.c
+21
-21
drivers/net/wireless/arlan-main.c
drivers/net/wireless/arlan-main.c
+45
-45
drivers/net/wireless/arlan-proc.c
drivers/net/wireless/arlan-proc.c
+10
-5
drivers/net/wireless/arlan.h
drivers/net/wireless/arlan.h
+11
-13
drivers/net/wireless/netwave_cs.c
drivers/net/wireless/netwave_cs.c
+40
-35
drivers/net/wireless/wavelan_cs.c
drivers/net/wireless/wavelan_cs.c
+14
-11
drivers/net/wireless/wavelan_cs.p.h
drivers/net/wireless/wavelan_cs.p.h
+1
-0
No files found.
drivers/net/mace.c
View file @
7bedd791
...
@@ -40,10 +40,10 @@ static int port_aaui = -1;
...
@@ -40,10 +40,10 @@ static int port_aaui = -1;
#define TX_DMA_ERR 0x80
#define TX_DMA_ERR 0x80
struct
mace_data
{
struct
mace_data
{
volatile
struct
mace
*
mace
;
volatile
struct
mace
__iomem
*
mace
;
volatile
struct
dbdma_regs
*
tx_dma
;
volatile
struct
dbdma_regs
__iomem
*
tx_dma
;
int
tx_dma_intr
;
int
tx_dma_intr
;
volatile
struct
dbdma_regs
*
rx_dma
;
volatile
struct
dbdma_regs
__iomem
*
rx_dma
;
int
rx_dma_intr
;
int
rx_dma_intr
;
volatile
struct
dbdma_cmd
*
tx_cmds
;
/* xmit dma command list */
volatile
struct
dbdma_cmd
*
tx_cmds
;
/* xmit dma command list */
volatile
struct
dbdma_cmd
*
rx_cmds
;
/* recv dma command list */
volatile
struct
dbdma_cmd
*
rx_cmds
;
/* recv dma command list */
...
@@ -88,7 +88,7 @@ static irqreturn_t mace_txdma_intr(int irq, void *dev_id, struct pt_regs *regs);
...
@@ -88,7 +88,7 @@ static irqreturn_t mace_txdma_intr(int irq, void *dev_id, struct pt_regs *regs);
static
irqreturn_t
mace_rxdma_intr
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
);
static
irqreturn_t
mace_rxdma_intr
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
);
static
void
mace_set_timeout
(
struct
net_device
*
dev
);
static
void
mace_set_timeout
(
struct
net_device
*
dev
);
static
void
mace_tx_timeout
(
unsigned
long
data
);
static
void
mace_tx_timeout
(
unsigned
long
data
);
static
inline
void
dbdma_reset
(
volatile
struct
dbdma_regs
*
dma
);
static
inline
void
dbdma_reset
(
volatile
struct
dbdma_regs
__iomem
*
dma
);
static
inline
void
mace_clean_rings
(
struct
mace_data
*
mp
);
static
inline
void
mace_clean_rings
(
struct
mace_data
*
mp
);
static
void
__mace_set_address
(
struct
net_device
*
dev
,
void
*
addr
);
static
void
__mace_set_address
(
struct
net_device
*
dev
,
void
*
addr
);
...
@@ -164,7 +164,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
...
@@ -164,7 +164,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
macio_set_drvdata
(
mdev
,
dev
);
macio_set_drvdata
(
mdev
,
dev
);
dev
->
base_addr
=
macio_resource_start
(
mdev
,
0
);
dev
->
base_addr
=
macio_resource_start
(
mdev
,
0
);
mp
->
mace
=
(
volatile
struct
mace
*
)
ioremap
(
dev
->
base_addr
,
0x1000
);
mp
->
mace
=
ioremap
(
dev
->
base_addr
,
0x1000
);
if
(
mp
->
mace
==
NULL
)
{
if
(
mp
->
mace
==
NULL
)
{
printk
(
KERN_ERR
"MACE: can't map IO resources !
\n
"
);
printk
(
KERN_ERR
"MACE: can't map IO resources !
\n
"
);
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
...
@@ -183,8 +183,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
...
@@ -183,8 +183,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
mp
->
maccc
=
ENXMT
|
ENRCV
;
mp
->
maccc
=
ENXMT
|
ENRCV
;
mp
->
tx_dma
=
(
volatile
struct
dbdma_regs
*
)
mp
->
tx_dma
=
ioremap
(
macio_resource_start
(
mdev
,
1
),
0x1000
);
ioremap
(
macio_resource_start
(
mdev
,
1
),
0x1000
);
if
(
mp
->
tx_dma
==
NULL
)
{
if
(
mp
->
tx_dma
==
NULL
)
{
printk
(
KERN_ERR
"MACE: can't map TX DMA resources !
\n
"
);
printk
(
KERN_ERR
"MACE: can't map TX DMA resources !
\n
"
);
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
...
@@ -192,8 +191,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
...
@@ -192,8 +191,7 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
}
}
mp
->
tx_dma_intr
=
macio_irq
(
mdev
,
1
);
mp
->
tx_dma_intr
=
macio_irq
(
mdev
,
1
);
mp
->
rx_dma
=
(
volatile
struct
dbdma_regs
*
)
mp
->
rx_dma
=
ioremap
(
macio_resource_start
(
mdev
,
2
),
0x1000
);
ioremap
(
macio_resource_start
(
mdev
,
2
),
0x1000
);
if
(
mp
->
rx_dma
==
NULL
)
{
if
(
mp
->
rx_dma
==
NULL
)
{
printk
(
KERN_ERR
"MACE: can't map RX DMA resources !
\n
"
);
printk
(
KERN_ERR
"MACE: can't map RX DMA resources !
\n
"
);
rc
=
-
ENOMEM
;
rc
=
-
ENOMEM
;
...
@@ -275,11 +273,11 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
...
@@ -275,11 +273,11 @@ static int __devinit mace_probe(struct macio_dev *mdev, const struct of_match *m
err_free_irq:
err_free_irq:
free_irq
(
macio_irq
(
mdev
,
0
),
dev
);
free_irq
(
macio_irq
(
mdev
,
0
),
dev
);
err_unmap_rx_dma:
err_unmap_rx_dma:
iounmap
(
(
void
*
)
mp
->
rx_dma
);
iounmap
(
mp
->
rx_dma
);
err_unmap_tx_dma:
err_unmap_tx_dma:
iounmap
(
(
void
*
)
mp
->
tx_dma
);
iounmap
(
mp
->
tx_dma
);
err_unmap_io:
err_unmap_io:
iounmap
(
(
void
*
)
mp
->
mace
);
iounmap
(
mp
->
mace
);
err_free:
err_free:
free_netdev
(
dev
);
free_netdev
(
dev
);
err_release:
err_release:
...
@@ -305,9 +303,9 @@ static int __devexit mace_remove(struct macio_dev *mdev)
...
@@ -305,9 +303,9 @@ static int __devexit mace_remove(struct macio_dev *mdev)
free_irq
(
mp
->
tx_dma_intr
,
dev
);
free_irq
(
mp
->
tx_dma_intr
,
dev
);
free_irq
(
mp
->
rx_dma_intr
,
dev
);
free_irq
(
mp
->
rx_dma_intr
,
dev
);
iounmap
(
(
void
*
)
mp
->
rx_dma
);
iounmap
(
mp
->
rx_dma
);
iounmap
(
(
void
*
)
mp
->
tx_dma
);
iounmap
(
mp
->
tx_dma
);
iounmap
(
(
void
*
)
mp
->
mace
);
iounmap
(
mp
->
mace
);
free_netdev
(
dev
);
free_netdev
(
dev
);
...
@@ -316,7 +314,7 @@ static int __devexit mace_remove(struct macio_dev *mdev)
...
@@ -316,7 +314,7 @@ static int __devexit mace_remove(struct macio_dev *mdev)
return
0
;
return
0
;
}
}
static
void
dbdma_reset
(
volatile
struct
dbdma_regs
*
dma
)
static
void
dbdma_reset
(
volatile
struct
dbdma_regs
__iomem
*
dma
)
{
{
int
i
;
int
i
;
...
@@ -334,7 +332,7 @@ static void dbdma_reset(volatile struct dbdma_regs *dma)
...
@@ -334,7 +332,7 @@ static void dbdma_reset(volatile struct dbdma_regs *dma)
static
void
mace_reset
(
struct
net_device
*
dev
)
static
void
mace_reset
(
struct
net_device
*
dev
)
{
{
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
int
i
;
int
i
;
/* soft-reset the chip */
/* soft-reset the chip */
...
@@ -389,7 +387,7 @@ static void mace_reset(struct net_device *dev)
...
@@ -389,7 +387,7 @@ static void mace_reset(struct net_device *dev)
static
void
__mace_set_address
(
struct
net_device
*
dev
,
void
*
addr
)
static
void
__mace_set_address
(
struct
net_device
*
dev
,
void
*
addr
)
{
{
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
unsigned
char
*
p
=
addr
;
unsigned
char
*
p
=
addr
;
int
i
;
int
i
;
...
@@ -410,7 +408,7 @@ static void __mace_set_address(struct net_device *dev, void *addr)
...
@@ -410,7 +408,7 @@ static void __mace_set_address(struct net_device *dev, void *addr)
static
int
mace_set_address
(
struct
net_device
*
dev
,
void
*
addr
)
static
int
mace_set_address
(
struct
net_device
*
dev
,
void
*
addr
)
{
{
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
mp
->
lock
,
flags
);
spin_lock_irqsave
(
&
mp
->
lock
,
flags
);
...
@@ -445,9 +443,9 @@ static inline void mace_clean_rings(struct mace_data *mp)
...
@@ -445,9 +443,9 @@ static inline void mace_clean_rings(struct mace_data *mp)
static
int
mace_open
(
struct
net_device
*
dev
)
static
int
mace_open
(
struct
net_device
*
dev
)
{
{
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
volatile
struct
dbdma_regs
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_regs
__iomem
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_regs
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_regs
__iomem
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_cmd
*
cp
;
volatile
struct
dbdma_cmd
*
cp
;
int
i
;
int
i
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
...
@@ -515,9 +513,9 @@ static int mace_open(struct net_device *dev)
...
@@ -515,9 +513,9 @@ static int mace_open(struct net_device *dev)
static
int
mace_close
(
struct
net_device
*
dev
)
static
int
mace_close
(
struct
net_device
*
dev
)
{
{
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
volatile
struct
dbdma_regs
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_regs
__iomem
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_regs
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_regs
__iomem
*
td
=
mp
->
tx_dma
;
/* disable rx and tx */
/* disable rx and tx */
out_8
(
&
mb
->
maccc
,
0
);
out_8
(
&
mb
->
maccc
,
0
);
...
@@ -548,7 +546,7 @@ static inline void mace_set_timeout(struct net_device *dev)
...
@@ -548,7 +546,7 @@ static inline void mace_set_timeout(struct net_device *dev)
static
int
mace_xmit_start
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
static
int
mace_xmit_start
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
{
{
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
dbdma_regs
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_regs
__iomem
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_cmd
*
cp
,
*
np
;
volatile
struct
dbdma_cmd
*
cp
,
*
np
;
unsigned
long
flags
;
unsigned
long
flags
;
int
fill
,
next
,
len
;
int
fill
,
next
,
len
;
...
@@ -610,7 +608,7 @@ static struct net_device_stats *mace_stats(struct net_device *dev)
...
@@ -610,7 +608,7 @@ static struct net_device_stats *mace_stats(struct net_device *dev)
static
void
mace_set_multicast
(
struct
net_device
*
dev
)
static
void
mace_set_multicast
(
struct
net_device
*
dev
)
{
{
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
int
i
,
j
;
int
i
,
j
;
u32
crc
;
u32
crc
;
unsigned
long
flags
;
unsigned
long
flags
;
...
@@ -662,7 +660,7 @@ static void mace_set_multicast(struct net_device *dev)
...
@@ -662,7 +660,7 @@ static void mace_set_multicast(struct net_device *dev)
static
void
mace_handle_misc_intrs
(
struct
mace_data
*
mp
,
int
intr
)
static
void
mace_handle_misc_intrs
(
struct
mace_data
*
mp
,
int
intr
)
{
{
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
static
int
mace_babbles
,
mace_jabbers
;
static
int
mace_babbles
,
mace_jabbers
;
if
(
intr
&
MPCO
)
if
(
intr
&
MPCO
)
...
@@ -685,8 +683,8 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id, struct pt_regs *regs)
...
@@ -685,8 +683,8 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
volatile
struct
dbdma_regs
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_regs
__iomem
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_cmd
*
cp
;
volatile
struct
dbdma_cmd
*
cp
;
int
intr
,
fs
,
i
,
stat
,
x
;
int
intr
,
fs
,
i
,
stat
,
x
;
int
xcount
,
dstat
;
int
xcount
,
dstat
;
...
@@ -831,9 +829,9 @@ static void mace_tx_timeout(unsigned long data)
...
@@ -831,9 +829,9 @@ static void mace_tx_timeout(unsigned long data)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
data
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
data
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
mace
*
mb
=
mp
->
mace
;
volatile
struct
mace
__iomem
*
mb
=
mp
->
mace
;
volatile
struct
dbdma_regs
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_regs
__iomem
*
td
=
mp
->
tx_dma
;
volatile
struct
dbdma_regs
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_regs
__iomem
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_cmd
*
cp
;
volatile
struct
dbdma_cmd
*
cp
;
unsigned
long
flags
;
unsigned
long
flags
;
int
i
;
int
i
;
...
@@ -902,7 +900,7 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs)
...
@@ -902,7 +900,7 @@ static irqreturn_t mace_rxdma_intr(int irq, void *dev_id, struct pt_regs *regs)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
struct
mace_data
*
mp
=
(
struct
mace_data
*
)
dev
->
priv
;
volatile
struct
dbdma_regs
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_regs
__iomem
*
rd
=
mp
->
rx_dma
;
volatile
struct
dbdma_cmd
*
cp
,
*
np
;
volatile
struct
dbdma_cmd
*
cp
,
*
np
;
int
i
,
nb
,
stat
,
next
;
int
i
,
nb
,
stat
,
next
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
...
...
drivers/net/skfp/h/fplustm.h
View file @
7bedd791
...
@@ -21,11 +21,7 @@
...
@@ -21,11 +21,7 @@
#define _FPLUS_
#define _FPLUS_
#ifndef HW_PTR
#ifndef HW_PTR
#ifdef MEM_MAPPED_IO
#define HW_PTR void __iomem *
#define HW_PTR u_long
#else
#define HW_PTR u_short
#endif
#endif
#endif
/*
/*
...
...
drivers/net/skfp/h/targethw.h
View file @
7bedd791
...
@@ -33,11 +33,7 @@
...
@@ -33,11 +33,7 @@
#endif
#endif
#ifndef HW_PTR
#ifndef HW_PTR
#ifdef MEM_MAPPED_IO
#define HW_PTR void __iomem *
#define HW_PTR u_long
#else
#define HW_PTR u_short
#endif
#endif
#endif
#ifdef MULT_OEM
#ifdef MULT_OEM
...
...
drivers/net/skfp/h/targetos.h
View file @
7bedd791
...
@@ -53,7 +53,7 @@
...
@@ -53,7 +53,7 @@
// is redefined by linux, but we need our definition
// is redefined by linux, but we need our definition
#undef ADDR
#undef ADDR
#ifdef MEM_MAPPED_IO
#ifdef MEM_MAPPED_IO
#define ADDR(a) (
char far *) smc->hw.iop+(a
)
#define ADDR(a) (
smc->hw.iop+(a)
)
#else
#else
#define ADDR(a) (((a)>>7) ? (outp(smc->hw.iop+B0_RAP,(a)>>7), (smc->hw.iop+( ((a)&0x7F) | ((a)>>7 ? 0x80:0)) )) : (smc->hw.iop+(((a)&0x7F)|((a)>>7 ? 0x80:0))))
#define ADDR(a) (((a)>>7) ? (outp(smc->hw.iop+B0_RAP,(a)>>7), (smc->hw.iop+( ((a)&0x7F) | ((a)>>7 ? 0x80:0)) )) : (smc->hw.iop+(((a)&0x7F)|((a)>>7 ? 0x80:0))))
#endif
#endif
...
...
drivers/net/skfp/h/types.h
View file @
7bedd791
...
@@ -29,20 +29,11 @@
...
@@ -29,20 +29,11 @@
#define _far
#define _far
#endif
#endif
#ifndef MEM_MAPPED_IO // "normal" IO
#define inp(p) ioread8(p)
#define inp(p) inb(p)
#define inpw(p) ioread16(p)
#define inpw(p) inw(p)
#define inpd(p) ioread32(p)
#define inpd(p) inl(p)
#define outp(p,c) iowrite8(c,p)
#define outp(p,c) outb(c,p)
#define outpw(p,s) iowrite16(s,p)
#define outpw(p,s) outw(s,p)
#define outpd(p,l) iowrite32(l,p)
#define outpd(p,l) outl(l,p)
#else // memory mapped io
#define inp(a) readb(a)
#define inpw(a) readw(a)
#define inpd(a) readl(a)
#define outp(a,v) writeb(v, a)
#define outpw(a,v) writew(v, a)
#define outpd(a,v) writel(v, a)
#endif
#endif
/* _TYPES_ */
#endif
/* _TYPES_ */
drivers/net/skfp/skfddi.c
View file @
7bedd791
...
@@ -206,6 +206,7 @@ static int skfp_init_one(struct pci_dev *pdev,
...
@@ -206,6 +206,7 @@ static int skfp_init_one(struct pci_dev *pdev,
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
s_smc
*
smc
;
/* board pointer */
struct
s_smc
*
smc
;
/* board pointer */
unsigned
long
port
,
len
;
unsigned
long
port
,
len
;
void
__iomem
*
mem
;
int
err
;
int
err
;
PRINTK
(
KERN_INFO
"entering skfp_init_one
\n
"
);
PRINTK
(
KERN_INFO
"entering skfp_init_one
\n
"
);
...
@@ -263,16 +264,16 @@ static int skfp_init_one(struct pci_dev *pdev,
...
@@ -263,16 +264,16 @@ static int skfp_init_one(struct pci_dev *pdev,
}
}
#ifdef MEM_MAPPED_IO
#ifdef MEM_MAPPED_IO
dev
->
base_addr
=
(
unsigned
long
)
ioremap
(
port
,
len
);
mem
=
ioremap
(
port
,
len
);
if
(
!
dev
->
base_addr
)
{
#else
printk
(
KERN_ERR
"skfp: Unable to map MEMORY register, "
mem
=
ioport_map
(
port
,
len
);
#endif
if
(
!
mem
)
{
printk
(
KERN_ERR
"skfp: Unable to map register, "
"FDDI adapter will be disabled.
\n
"
);
"FDDI adapter will be disabled.
\n
"
);
err
=
-
EIO
;
err
=
-
EIO
;
goto
err_out3
;
goto
err_out3
;
}
}
#else
dev
->
base_addr
=
port
;
#endif
dev
->
irq
=
pdev
->
irq
;
dev
->
irq
=
pdev
->
irq
;
dev
->
get_stats
=
&
skfp_ctl_get_stats
;
dev
->
get_stats
=
&
skfp_ctl_get_stats
;
...
@@ -296,9 +297,12 @@ static int skfp_init_one(struct pci_dev *pdev,
...
@@ -296,9 +297,12 @@ static int skfp_init_one(struct pci_dev *pdev,
smc
->
os
.
MaxFrameSize
=
MAX_FRAME_SIZE
;
smc
->
os
.
MaxFrameSize
=
MAX_FRAME_SIZE
;
smc
->
os
.
dev
=
dev
;
smc
->
os
.
dev
=
dev
;
smc
->
hw
.
slot
=
-
1
;
smc
->
hw
.
slot
=
-
1
;
smc
->
hw
.
iop
=
mem
;
smc
->
os
.
ResetRequested
=
FALSE
;
smc
->
os
.
ResetRequested
=
FALSE
;
skb_queue_head_init
(
&
smc
->
os
.
SendSkbQueue
);
skb_queue_head_init
(
&
smc
->
os
.
SendSkbQueue
);
dev
->
base_addr
=
(
unsigned
long
)
mem
;
err
=
skfp_driver_init
(
dev
);
err
=
skfp_driver_init
(
dev
);
if
(
err
)
if
(
err
)
goto
err_out4
;
goto
err_out4
;
...
@@ -328,7 +332,9 @@ static int skfp_init_one(struct pci_dev *pdev,
...
@@ -328,7 +332,9 @@ static int skfp_init_one(struct pci_dev *pdev,
smc
->
os
.
LocalRxBuffer
,
smc
->
os
.
LocalRxBufferDMA
);
smc
->
os
.
LocalRxBuffer
,
smc
->
os
.
LocalRxBufferDMA
);
err_out4:
err_out4:
#ifdef MEM_MAPPED_IO
#ifdef MEM_MAPPED_IO
iounmap
((
void
*
)
dev
->
base_addr
);
iounmap
(
smc
->
hw
.
iop
);
#else
ioport_unmap
(
smc
->
hw
.
iop
);
#endif
#endif
err_out3:
err_out3:
free_netdev
(
dev
);
free_netdev
(
dev
);
...
@@ -363,7 +369,9 @@ static void __devexit skfp_remove_one(struct pci_dev *pdev)
...
@@ -363,7 +369,9 @@ static void __devexit skfp_remove_one(struct pci_dev *pdev)
lp
->
os
.
LocalRxBuffer
=
NULL
;
lp
->
os
.
LocalRxBuffer
=
NULL
;
}
}
#ifdef MEM_MAPPED_IO
#ifdef MEM_MAPPED_IO
iounmap
((
void
*
)
p
->
base_addr
);
iounmap
(
lp
->
hw
.
iop
);
#else
ioport_unmap
(
lp
->
hw
.
iop
);
#endif
#endif
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
free_netdev
(
p
);
free_netdev
(
p
);
...
@@ -406,7 +414,6 @@ static int skfp_driver_init(struct net_device *dev)
...
@@ -406,7 +414,6 @@ static int skfp_driver_init(struct net_device *dev)
// set the io address in private structures
// set the io address in private structures
bp
->
base_addr
=
dev
->
base_addr
;
bp
->
base_addr
=
dev
->
base_addr
;
smc
->
hw
.
iop
=
dev
->
base_addr
;
// Get the interrupt level from the PCI Configuration Table
// Get the interrupt level from the PCI Configuration Table
smc
->
hw
.
irq
=
dev
->
irq
;
smc
->
hw
.
irq
=
dev
->
irq
;
...
...
drivers/net/starfire.c
View file @
7bedd791
...
@@ -776,6 +776,7 @@ struct netdev_private {
...
@@ -776,6 +776,7 @@ struct netdev_private {
struct
mii_if_info
mii_if
;
/* MII lib hooks/info */
struct
mii_if_info
mii_if
;
/* MII lib hooks/info */
int
phy_cnt
;
/* MII device addresses. */
int
phy_cnt
;
/* MII device addresses. */
unsigned
char
phys
[
PHY_CNT
];
/* MII device addresses. */
unsigned
char
phys
[
PHY_CNT
];
/* MII device addresses. */
void
__iomem
*
base
;
};
};
...
@@ -846,6 +847,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
...
@@ -846,6 +847,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
struct
net_device
*
dev
;
struct
net_device
*
dev
;
static
int
card_idx
=
-
1
;
static
int
card_idx
=
-
1
;
long
ioaddr
;
long
ioaddr
;
void
__iomem
*
base
;
int
drv_flags
,
io_size
;
int
drv_flags
,
io_size
;
int
boguscnt
;
int
boguscnt
;
...
@@ -884,14 +886,12 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
...
@@ -884,14 +886,12 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
}
}
/* ioremap is borken in Linux-2.2.x/sparc64 */
/* ioremap is borken in Linux-2.2.x/sparc64 */
#if !defined(CONFIG_SPARC64) || LINUX_VERSION_CODE > 0x20300
base
=
ioremap
(
ioaddr
,
io_size
);
ioaddr
=
(
long
)
ioremap
(
ioaddr
,
io_size
);
if
(
!
base
)
{
if
(
!
ioaddr
)
{
printk
(
KERN_ERR
DRV_NAME
" %d: cannot remap %#x @ %#lx, aborting
\n
"
,
printk
(
KERN_ERR
DRV_NAME
" %d: cannot remap %#x @ %#lx, aborting
\n
"
,
card_idx
,
io_size
,
ioaddr
);
card_idx
,
io_size
,
ioaddr
);
goto
err_out_free_res
;
goto
err_out_free_res
;
}
}
#endif
/* !CONFIG_SPARC64 || Linux 2.3.0+ */
pci_set_master
(
pdev
);
pci_set_master
(
pdev
);
...
@@ -918,27 +918,27 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
...
@@ -918,27 +918,27 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
/* Serial EEPROM reads are hidden by the hardware. */
/* Serial EEPROM reads are hidden by the hardware. */
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
dev
->
dev_addr
[
i
]
=
readb
(
ioaddr
+
EEPROMCtrl
+
20
-
i
);
dev
->
dev_addr
[
i
]
=
readb
(
base
+
EEPROMCtrl
+
20
-
i
);
#if ! defined(final_version)
/* Dump the EEPROM contents during development. */
#if ! defined(final_version)
/* Dump the EEPROM contents during development. */
if
(
debug
>
4
)
if
(
debug
>
4
)
for
(
i
=
0
;
i
<
0x20
;
i
++
)
for
(
i
=
0
;
i
<
0x20
;
i
++
)
printk
(
"%2.2x%s"
,
printk
(
"%2.2x%s"
,
(
unsigned
int
)
readb
(
ioaddr
+
EEPROMCtrl
+
i
),
(
unsigned
int
)
readb
(
base
+
EEPROMCtrl
+
i
),
i
%
16
!=
15
?
" "
:
"
\n
"
);
i
%
16
!=
15
?
" "
:
"
\n
"
);
#endif
#endif
/* Issue soft reset */
/* Issue soft reset */
writel
(
MiiSoftReset
,
ioaddr
+
TxMode
);
writel
(
MiiSoftReset
,
base
+
TxMode
);
udelay
(
1000
);
udelay
(
1000
);
writel
(
0
,
ioaddr
+
TxMode
);
writel
(
0
,
base
+
TxMode
);
/* Reset the chip to erase previous misconfiguration. */
/* Reset the chip to erase previous misconfiguration. */
writel
(
1
,
ioaddr
+
PCIDeviceConfig
);
writel
(
1
,
base
+
PCIDeviceConfig
);
boguscnt
=
1000
;
boguscnt
=
1000
;
while
(
--
boguscnt
>
0
)
{
while
(
--
boguscnt
>
0
)
{
udelay
(
10
);
udelay
(
10
);
if
((
readl
(
ioaddr
+
PCIDeviceConfig
)
&
1
)
==
0
)
if
((
readl
(
base
+
PCIDeviceConfig
)
&
1
)
==
0
)
break
;
break
;
}
}
if
(
boguscnt
==
0
)
if
(
boguscnt
==
0
)
...
@@ -946,10 +946,11 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
...
@@ -946,10 +946,11 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
/* wait a little longer */
/* wait a little longer */
udelay
(
1000
);
udelay
(
1000
);
dev
->
base_addr
=
ioaddr
;
dev
->
base_addr
=
(
unsigned
long
)
base
;
dev
->
irq
=
irq
;
dev
->
irq
=
irq
;
np
=
netdev_priv
(
dev
);
np
=
netdev_priv
(
dev
);
np
->
base
=
base
;
spin_lock_init
(
&
np
->
lock
);
spin_lock_init
(
&
np
->
lock
);
pci_set_drvdata
(
pdev
,
dev
);
pci_set_drvdata
(
pdev
,
dev
);
...
@@ -1021,8 +1022,8 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
...
@@ -1021,8 +1022,8 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
if
(
register_netdev
(
dev
))
if
(
register_netdev
(
dev
))
goto
err_out_cleardev
;
goto
err_out_cleardev
;
printk
(
KERN_INFO
"%s: %s at %
#lx
, "
,
printk
(
KERN_INFO
"%s: %s at %
p
, "
,
dev
->
name
,
netdrv_tbl
[
chip_idx
].
name
,
ioaddr
);
dev
->
name
,
netdrv_tbl
[
chip_idx
].
name
,
base
);
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
i
=
0
;
i
<
5
;
i
++
)
printk
(
"%2.2x:"
,
dev
->
dev_addr
[
i
]);
printk
(
"%2.2x:"
,
dev
->
dev_addr
[
i
]);
printk
(
"%2.2x, IRQ %d.
\n
"
,
dev
->
dev_addr
[
i
],
irq
);
printk
(
"%2.2x, IRQ %d.
\n
"
,
dev
->
dev_addr
[
i
],
irq
);
...
@@ -1065,7 +1066,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
...
@@ -1065,7 +1066,7 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
err_out_cleardev:
err_out_cleardev:
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
iounmap
(
(
void
*
)
ioaddr
);
iounmap
(
base
);
err_out_free_res:
err_out_free_res:
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
err_out_free_netdev:
err_out_free_netdev:
...
@@ -1077,7 +1078,8 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
...
@@ -1077,7 +1078,8 @@ static int __devinit starfire_init_one(struct pci_dev *pdev,
/* Read the MII Management Data I/O (MDIO) interfaces. */
/* Read the MII Management Data I/O (MDIO) interfaces. */
static
int
mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
)
static
int
mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
)
{
{
long
mdio_addr
=
dev
->
base_addr
+
MIICtrl
+
(
phy_id
<<
7
)
+
(
location
<<
2
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
mdio_addr
=
np
->
base
+
MIICtrl
+
(
phy_id
<<
7
)
+
(
location
<<
2
);
int
result
,
boguscnt
=
1000
;
int
result
,
boguscnt
=
1000
;
/* ??? Should we add a busy-wait here? */
/* ??? Should we add a busy-wait here? */
do
do
...
@@ -1093,7 +1095,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
...
@@ -1093,7 +1095,8 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
static
void
mdio_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
,
int
value
)
static
void
mdio_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
,
int
value
)
{
{
long
mdio_addr
=
dev
->
base_addr
+
MIICtrl
+
(
phy_id
<<
7
)
+
(
location
<<
2
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
mdio_addr
=
np
->
base
+
MIICtrl
+
(
phy_id
<<
7
)
+
(
location
<<
2
);
writel
(
value
,
mdio_addr
);
writel
(
value
,
mdio_addr
);
/* The busy-wait will occur before a read. */
/* The busy-wait will occur before a read. */
}
}
...
@@ -1102,7 +1105,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
...
@@ -1102,7 +1105,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
static
int
netdev_open
(
struct
net_device
*
dev
)
static
int
netdev_open
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
i
,
retval
;
int
i
,
retval
;
size_t
tx_done_q_size
,
rx_done_q_size
,
tx_ring_size
,
rx_ring_size
;
size_t
tx_done_q_size
,
rx_done_q_size
,
tx_ring_size
,
rx_ring_size
;
...
@@ -1191,7 +1194,7 @@ static int netdev_open(struct net_device *dev)
...
@@ -1191,7 +1194,7 @@ static int netdev_open(struct net_device *dev)
writew
(
0
,
ioaddr
+
PerfFilterTable
+
8
);
writew
(
0
,
ioaddr
+
PerfFilterTable
+
8
);
for
(
i
=
1
;
i
<
16
;
i
++
)
{
for
(
i
=
1
;
i
<
16
;
i
++
)
{
u16
*
eaddrs
=
(
u16
*
)
dev
->
dev_addr
;
u16
*
eaddrs
=
(
u16
*
)
dev
->
dev_addr
;
long
setup_frm
=
ioaddr
+
PerfFilterTable
+
i
*
16
;
void
__iomem
*
setup_frm
=
ioaddr
+
PerfFilterTable
+
i
*
16
;
writew
(
cpu_to_be16
(
eaddrs
[
2
]),
setup_frm
);
setup_frm
+=
4
;
writew
(
cpu_to_be16
(
eaddrs
[
2
]),
setup_frm
);
setup_frm
+=
4
;
writew
(
cpu_to_be16
(
eaddrs
[
1
]),
setup_frm
);
setup_frm
+=
4
;
writew
(
cpu_to_be16
(
eaddrs
[
1
]),
setup_frm
);
setup_frm
+=
4
;
writew
(
cpu_to_be16
(
eaddrs
[
0
]),
setup_frm
);
setup_frm
+=
8
;
writew
(
cpu_to_be16
(
eaddrs
[
0
]),
setup_frm
);
setup_frm
+=
8
;
...
@@ -1295,7 +1298,7 @@ static void check_duplex(struct net_device *dev)
...
@@ -1295,7 +1298,7 @@ static void check_duplex(struct net_device *dev)
static
void
tx_timeout
(
struct
net_device
*
dev
)
static
void
tx_timeout
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
old_debug
;
int
old_debug
;
printk
(
KERN_WARNING
"%s: Transmit timed out, status %#8.8x, "
printk
(
KERN_WARNING
"%s: Transmit timed out, status %#8.8x, "
...
@@ -1343,7 +1346,7 @@ static void init_ring(struct net_device *dev)
...
@@ -1343,7 +1346,7 @@ static void init_ring(struct net_device *dev)
/* Grrr, we cannot offset to correctly align the IP header. */
/* Grrr, we cannot offset to correctly align the IP header. */
np
->
rx_ring
[
i
].
rxaddr
=
cpu_to_dma
(
np
->
rx_info
[
i
].
mapping
|
RxDescValid
);
np
->
rx_ring
[
i
].
rxaddr
=
cpu_to_dma
(
np
->
rx_info
[
i
].
mapping
|
RxDescValid
);
}
}
writew
(
i
-
1
,
dev
->
base_addr
+
RxDescQIdx
);
writew
(
i
-
1
,
np
->
base
+
RxDescQIdx
);
np
->
dirty_rx
=
(
unsigned
int
)(
i
-
RX_RING_SIZE
);
np
->
dirty_rx
=
(
unsigned
int
)(
i
-
RX_RING_SIZE
);
/* Clear the remainder of the Rx buffer ring. */
/* Clear the remainder of the Rx buffer ring. */
...
@@ -1464,7 +1467,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
...
@@ -1464,7 +1467,7 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
wmb
();
wmb
();
/* Update the producer index. */
/* Update the producer index. */
writel
(
entry
*
(
sizeof
(
starfire_tx_desc
)
/
8
),
dev
->
base_addr
+
TxProducerIdx
);
writel
(
entry
*
(
sizeof
(
starfire_tx_desc
)
/
8
),
np
->
base
+
TxProducerIdx
);
/* 4 is arbitrary, but should be ok */
/* 4 is arbitrary, but should be ok */
if
((
np
->
cur_tx
-
np
->
dirty_tx
)
+
4
>
TX_RING_SIZE
)
if
((
np
->
cur_tx
-
np
->
dirty_tx
)
+
4
>
TX_RING_SIZE
)
...
@@ -1481,16 +1484,13 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
...
@@ -1481,16 +1484,13 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
static
irqreturn_t
intr_handler
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
rgs
)
static
irqreturn_t
intr_handler
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
rgs
)
{
{
struct
net_device
*
dev
=
dev_instance
;
struct
net_device
*
dev
=
dev_instance
;
struct
netdev_private
*
np
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
)
;
long
ioaddr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
boguscnt
=
max_interrupt_work
;
int
boguscnt
=
max_interrupt_work
;
int
consumer
;
int
consumer
;
int
tx_status
;
int
tx_status
;
int
handled
=
0
;
int
handled
=
0
;
ioaddr
=
dev
->
base_addr
;
np
=
netdev_priv
(
dev
);
do
{
do
{
u32
intr_status
=
readl
(
ioaddr
+
IntrClear
);
u32
intr_status
=
readl
(
ioaddr
+
IntrClear
);
...
@@ -1697,7 +1697,7 @@ static int __netdev_rx(struct net_device *dev, int *quota)
...
@@ -1697,7 +1697,7 @@ static int __netdev_rx(struct net_device *dev, int *quota)
desc
->
status
=
0
;
desc
->
status
=
0
;
np
->
rx_done
=
(
np
->
rx_done
+
1
)
%
DONE_Q_SIZE
;
np
->
rx_done
=
(
np
->
rx_done
+
1
)
%
DONE_Q_SIZE
;
}
}
writew
(
np
->
rx_done
,
dev
->
base_addr
+
CompletionQConsumerIdx
);
writew
(
np
->
rx_done
,
np
->
base
+
CompletionQConsumerIdx
);
out:
out:
refill_rx_ring
(
dev
);
refill_rx_ring
(
dev
);
...
@@ -1712,7 +1712,8 @@ static int __netdev_rx(struct net_device *dev, int *quota)
...
@@ -1712,7 +1712,8 @@ static int __netdev_rx(struct net_device *dev, int *quota)
static
int
netdev_poll
(
struct
net_device
*
dev
,
int
*
budget
)
static
int
netdev_poll
(
struct
net_device
*
dev
,
int
*
budget
)
{
{
u32
intr_status
;
u32
intr_status
;
long
ioaddr
=
dev
->
base_addr
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
int
retcode
=
0
,
quota
=
dev
->
quota
;
int
retcode
=
0
,
quota
=
dev
->
quota
;
do
{
do
{
...
@@ -1766,14 +1767,14 @@ static void refill_rx_ring(struct net_device *dev)
...
@@ -1766,14 +1767,14 @@ static void refill_rx_ring(struct net_device *dev)
np
->
rx_ring
[
entry
].
rxaddr
|=
cpu_to_dma
(
RxDescEndRing
);
np
->
rx_ring
[
entry
].
rxaddr
|=
cpu_to_dma
(
RxDescEndRing
);
}
}
if
(
entry
>=
0
)
if
(
entry
>=
0
)
writew
(
entry
,
dev
->
base_addr
+
RxDescQIdx
);
writew
(
entry
,
np
->
base
+
RxDescQIdx
);
}
}
static
void
netdev_media_change
(
struct
net_device
*
dev
)
static
void
netdev_media_change
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
u16
reg0
,
reg1
,
reg4
,
reg5
;
u16
reg0
,
reg1
,
reg4
,
reg5
;
u32
new_tx_mode
;
u32
new_tx_mode
;
u32
new_intr_timer_ctrl
;
u32
new_intr_timer_ctrl
;
...
@@ -1852,7 +1853,7 @@ static void netdev_error(struct net_device *dev, int intr_status)
...
@@ -1852,7 +1853,7 @@ static void netdev_error(struct net_device *dev, int intr_status)
/* Came close to underrunning the Tx FIFO, increase threshold. */
/* Came close to underrunning the Tx FIFO, increase threshold. */
if
(
intr_status
&
IntrTxDataLow
)
{
if
(
intr_status
&
IntrTxDataLow
)
{
if
(
np
->
tx_threshold
<=
PKT_BUF_SZ
/
16
)
{
if
(
np
->
tx_threshold
<=
PKT_BUF_SZ
/
16
)
{
writel
(
++
np
->
tx_threshold
,
dev
->
base_addr
+
TxThreshold
);
writel
(
++
np
->
tx_threshold
,
np
->
base
+
TxThreshold
);
printk
(
KERN_NOTICE
"%s: PCI bus congestion, increasing Tx FIFO threshold to %d bytes
\n
"
,
printk
(
KERN_NOTICE
"%s: PCI bus congestion, increasing Tx FIFO threshold to %d bytes
\n
"
,
dev
->
name
,
np
->
tx_threshold
*
16
);
dev
->
name
,
np
->
tx_threshold
*
16
);
}
else
}
else
...
@@ -1874,8 +1875,8 @@ static void netdev_error(struct net_device *dev, int intr_status)
...
@@ -1874,8 +1875,8 @@ static void netdev_error(struct net_device *dev, int intr_status)
static
struct
net_device_stats
*
get_stats
(
struct
net_device
*
dev
)
static
struct
net_device_stats
*
get_stats
(
struct
net_device
*
dev
)
{
{
long
ioaddr
=
dev
->
base_addr
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
/* This adapter architecture needs no SMP locks. */
/* This adapter architecture needs no SMP locks. */
np
->
stats
.
tx_bytes
=
readl
(
ioaddr
+
0x57010
);
np
->
stats
.
tx_bytes
=
readl
(
ioaddr
+
0x57010
);
...
@@ -1904,17 +1905,17 @@ static struct net_device_stats *get_stats(struct net_device *dev)
...
@@ -1904,17 +1905,17 @@ static struct net_device_stats *get_stats(struct net_device *dev)
*/
*/
static
void
set_rx_mode
(
struct
net_device
*
dev
)
static
void
set_rx_mode
(
struct
net_device
*
dev
)
{
{
long
ioaddr
=
dev
->
base_addr
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
u32
rx_mode
=
MinVLANPrio
;
u32
rx_mode
=
MinVLANPrio
;
struct
dev_mc_list
*
mclist
;
struct
dev_mc_list
*
mclist
;
int
i
;
int
i
;
#ifdef VLAN_SUPPORT
#ifdef VLAN_SUPPORT
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
rx_mode
|=
VlanMode
;
rx_mode
|=
VlanMode
;
if
(
np
->
vlgrp
)
{
if
(
np
->
vlgrp
)
{
int
vlan_count
=
0
;
int
vlan_count
=
0
;
long
filter_addr
=
ioaddr
+
HashTable
+
8
;
void
__iomem
*
filter_addr
=
ioaddr
+
HashTable
+
8
;
for
(
i
=
0
;
i
<
VLAN_VID_MASK
;
i
++
)
{
for
(
i
=
0
;
i
<
VLAN_VID_MASK
;
i
++
)
{
if
(
np
->
vlgrp
->
vlan_devices
[
i
])
{
if
(
np
->
vlgrp
->
vlan_devices
[
i
])
{
if
(
vlan_count
>=
32
)
if
(
vlan_count
>=
32
)
...
@@ -1943,7 +1944,7 @@ static void set_rx_mode(struct net_device *dev)
...
@@ -1943,7 +1944,7 @@ static void set_rx_mode(struct net_device *dev)
rx_mode
|=
AcceptBroadcast
|
AcceptAllMulticast
|
PerfectFilter
;
rx_mode
|=
AcceptBroadcast
|
AcceptAllMulticast
|
PerfectFilter
;
}
else
if
(
dev
->
mc_count
<=
14
)
{
}
else
if
(
dev
->
mc_count
<=
14
)
{
/* Use the 16 element perfect filter, skip first two entries. */
/* Use the 16 element perfect filter, skip first two entries. */
long
filter_addr
=
ioaddr
+
PerfFilterTable
+
2
*
16
;
void
__iomem
*
filter_addr
=
ioaddr
+
PerfFilterTable
+
2
*
16
;
u16
*
eaddrs
;
u16
*
eaddrs
;
for
(
i
=
2
,
mclist
=
dev
->
mc_list
;
mclist
&&
i
<
dev
->
mc_count
+
2
;
for
(
i
=
2
,
mclist
=
dev
->
mc_list
;
mclist
&&
i
<
dev
->
mc_count
+
2
;
i
++
,
mclist
=
mclist
->
next
)
{
i
++
,
mclist
=
mclist
->
next
)
{
...
@@ -1961,7 +1962,7 @@ static void set_rx_mode(struct net_device *dev)
...
@@ -1961,7 +1962,7 @@ static void set_rx_mode(struct net_device *dev)
rx_mode
|=
AcceptBroadcast
|
PerfectFilter
;
rx_mode
|=
AcceptBroadcast
|
PerfectFilter
;
}
else
{
}
else
{
/* Must use a multicast hash table. */
/* Must use a multicast hash table. */
long
filter_addr
;
void
__iomem
*
filter_addr
;
u16
*
eaddrs
;
u16
*
eaddrs
;
u16
mc_filter
[
32
]
__attribute__
((
aligned
(
sizeof
(
long
))));
/* Multicast hash filter */
u16
mc_filter
[
32
]
__attribute__
((
aligned
(
sizeof
(
long
))));
/* Multicast hash filter */
...
@@ -2077,8 +2078,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
...
@@ -2077,8 +2078,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static
int
netdev_close
(
struct
net_device
*
dev
)
static
int
netdev_close
(
struct
net_device
*
dev
)
{
{
long
ioaddr
=
dev
->
base_addr
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
int
i
;
int
i
;
netif_stop_queue
(
dev
);
netif_stop_queue
(
dev
);
...
@@ -2162,7 +2163,7 @@ static void __devexit starfire_remove_one (struct pci_dev *pdev)
...
@@ -2162,7 +2163,7 @@ static void __devexit starfire_remove_one (struct pci_dev *pdev)
pci_set_power_state
(
pdev
,
3
);
/* go to sleep in D3 mode */
pci_set_power_state
(
pdev
,
3
);
/* go to sleep in D3 mode */
pci_disable_device
(
pdev
);
pci_disable_device
(
pdev
);
iounmap
(
(
char
*
)
dev
->
base_addr
);
iounmap
(
np
->
base
);
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
...
...
drivers/net/sundance.c
View file @
7bedd791
...
@@ -305,20 +305,6 @@ static struct pci_id_info pci_id_tbl[] = {
...
@@ -305,20 +305,6 @@ static struct pci_id_info pci_id_tbl[] = {
/* This driver was written to use PCI memory space, however x86-oriented
/* This driver was written to use PCI memory space, however x86-oriented
hardware often uses I/O space accesses. */
hardware often uses I/O space accesses. */
#ifdef USE_IO_OPS
#undef readb
#undef readw
#undef readl
#undef writeb
#undef writew
#undef writel
#define readb inb
#define readw inw
#define readl inl
#define writeb outb
#define writew outw
#define writel outl
#endif
/* Offsets to the device registers.
/* Offsets to the device registers.
Unlike software-only systems, device drivers interact with complex hardware.
Unlike software-only systems, device drivers interact with complex hardware.
...
@@ -480,6 +466,7 @@ struct netdev_private {
...
@@ -480,6 +466,7 @@ struct netdev_private {
int
mii_preamble_required
;
int
mii_preamble_required
;
unsigned
char
phys
[
MII_CNT
];
/* MII device addresses, only first one used. */
unsigned
char
phys
[
MII_CNT
];
/* MII device addresses, only first one used. */
struct
pci_dev
*
pci_dev
;
struct
pci_dev
*
pci_dev
;
void
__iomem
*
base
;
unsigned
char
pci_rev_id
;
unsigned
char
pci_rev_id
;
};
};
...
@@ -490,7 +477,7 @@ struct netdev_private {
...
@@ -490,7 +477,7 @@ struct netdev_private {
LinkChange)
LinkChange)
static
int
change_mtu
(
struct
net_device
*
dev
,
int
new_mtu
);
static
int
change_mtu
(
struct
net_device
*
dev
,
int
new_mtu
);
static
int
eeprom_read
(
long
ioaddr
,
int
location
);
static
int
eeprom_read
(
void
__iomem
*
ioaddr
,
int
location
);
static
int
mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
);
static
int
mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
);
static
void
mdio_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
,
int
value
);
static
void
mdio_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
,
int
value
);
static
int
netdev_open
(
struct
net_device
*
dev
);
static
int
netdev_open
(
struct
net_device
*
dev
);
...
@@ -522,10 +509,15 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
...
@@ -522,10 +509,15 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
int
chip_idx
=
ent
->
driver_data
;
int
chip_idx
=
ent
->
driver_data
;
int
irq
;
int
irq
;
int
i
;
int
i
;
long
ioaddr
;
void
__iomem
*
ioaddr
;
u16
mii_ctl
;
u16
mii_ctl
;
void
*
ring_space
;
void
*
ring_space
;
dma_addr_t
ring_dma
;
dma_addr_t
ring_dma
;
#ifdef USE_IO_OPS
int
bar
=
0
;
#else
int
bar
=
1
;
#endif
/* when built into the kernel, we only print version if device is found */
/* when built into the kernel, we only print version if device is found */
...
@@ -550,23 +542,19 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
...
@@ -550,23 +542,19 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
if
(
pci_request_regions
(
pdev
,
DRV_NAME
))
if
(
pci_request_regions
(
pdev
,
DRV_NAME
))
goto
err_out_netdev
;
goto
err_out_netdev
;
#ifdef USE_IO_OPS
ioaddr
=
pci_iomap
(
pdev
,
bar
,
netdev_io_size
);
ioaddr
=
pci_resource_start
(
pdev
,
0
);
#else
ioaddr
=
pci_resource_start
(
pdev
,
1
);
ioaddr
=
(
long
)
ioremap
(
ioaddr
,
netdev_io_size
);
if
(
!
ioaddr
)
if
(
!
ioaddr
)
goto
err_out_res
;
goto
err_out_res
;
#endif
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
3
;
i
++
)
((
u16
*
)
dev
->
dev_addr
)[
i
]
=
((
u16
*
)
dev
->
dev_addr
)[
i
]
=
le16_to_cpu
(
eeprom_read
(
ioaddr
,
i
+
EEPROM_SA_OFFSET
));
le16_to_cpu
(
eeprom_read
(
ioaddr
,
i
+
EEPROM_SA_OFFSET
));
dev
->
base_addr
=
ioaddr
;
dev
->
base_addr
=
(
unsigned
long
)
ioaddr
;
dev
->
irq
=
irq
;
dev
->
irq
=
irq
;
np
=
netdev_priv
(
dev
);
np
=
netdev_priv
(
dev
);
np
->
base
=
ioaddr
;
np
->
pci_dev
=
pdev
;
np
->
pci_dev
=
pdev
;
np
->
chip_id
=
chip_idx
;
np
->
chip_id
=
chip_idx
;
np
->
msg_enable
=
(
1
<<
debug
)
-
1
;
np
->
msg_enable
=
(
1
<<
debug
)
-
1
;
...
@@ -611,7 +599,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
...
@@ -611,7 +599,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
if
(
i
)
if
(
i
)
goto
err_out_unmap_rx
;
goto
err_out_unmap_rx
;
printk
(
KERN_INFO
"%s: %s at
0x%lx
, "
,
printk
(
KERN_INFO
"%s: %s at
%p
, "
,
dev
->
name
,
pci_id_tbl
[
chip_idx
].
name
,
ioaddr
);
dev
->
name
,
pci_id_tbl
[
chip_idx
].
name
,
ioaddr
);
for
(
i
=
0
;
i
<
5
;
i
++
)
for
(
i
=
0
;
i
<
5
;
i
++
)
printk
(
"%2.2x:"
,
dev
->
dev_addr
[
i
]);
printk
(
"%2.2x:"
,
dev
->
dev_addr
[
i
]);
...
@@ -637,7 +625,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
...
@@ -637,7 +625,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
if
(
phy_idx
==
0
)
{
if
(
phy_idx
==
0
)
{
printk
(
KERN_INFO
"%s: No MII transceiver found, aborting. ASIC status %x
\n
"
,
printk
(
KERN_INFO
"%s: No MII transceiver found, aborting. ASIC status %x
\n
"
,
dev
->
name
,
readl
(
ioaddr
+
ASICCtrl
));
dev
->
name
,
ioread32
(
ioaddr
+
ASICCtrl
));
goto
err_out_unregister
;
goto
err_out_unregister
;
}
}
...
@@ -674,7 +662,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
...
@@ -674,7 +662,7 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
}
}
/* Fibre PHY? */
/* Fibre PHY? */
if
(
readl
(
ioaddr
+
ASICCtrl
)
&
0x80
)
{
if
(
ioread32
(
ioaddr
+
ASICCtrl
)
&
0x80
)
{
/* Default 100Mbps Full */
/* Default 100Mbps Full */
if
(
np
->
an_enable
)
{
if
(
np
->
an_enable
)
{
np
->
speed
=
100
;
np
->
speed
=
100
;
...
@@ -703,10 +691,10 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
...
@@ -703,10 +691,10 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
/* Perhaps move the reset here? */
/* Perhaps move the reset here? */
/* Reset the chip to erase previous misconfiguration. */
/* Reset the chip to erase previous misconfiguration. */
if
(
netif_msg_hw
(
np
))
if
(
netif_msg_hw
(
np
))
printk
(
"ASIC Control is %x.
\n
"
,
readl
(
ioaddr
+
ASICCtrl
));
printk
(
"ASIC Control is %x.
\n
"
,
ioread32
(
ioaddr
+
ASICCtrl
));
writew
(
0x007f
,
ioaddr
+
ASICCtrl
+
2
);
iowrite16
(
0x007f
,
ioaddr
+
ASICCtrl
+
2
);
if
(
netif_msg_hw
(
np
))
if
(
netif_msg_hw
(
np
))
printk
(
"ASIC Control is now %x.
\n
"
,
readl
(
ioaddr
+
ASICCtrl
));
printk
(
"ASIC Control is now %x.
\n
"
,
ioread32
(
ioaddr
+
ASICCtrl
));
card_idx
++
;
card_idx
++
;
return
0
;
return
0
;
...
@@ -719,10 +707,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
...
@@ -719,10 +707,8 @@ static int __devinit sundance_probe1 (struct pci_dev *pdev,
pci_free_consistent
(
pdev
,
TX_TOTAL_SIZE
,
np
->
tx_ring
,
np
->
tx_ring_dma
);
pci_free_consistent
(
pdev
,
TX_TOTAL_SIZE
,
np
->
tx_ring
,
np
->
tx_ring_dma
);
err_out_cleardev:
err_out_cleardev:
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
#ifndef USE_IO_OPS
pci_iounmap
(
pdev
,
ioaddr
);
iounmap
((
void
*
)
ioaddr
);
err_out_res:
err_out_res:
#endif
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
err_out_netdev:
err_out_netdev:
free_netdev
(
dev
);
free_netdev
(
dev
);
...
@@ -739,16 +725,16 @@ static int change_mtu(struct net_device *dev, int new_mtu)
...
@@ -739,16 +725,16 @@ static int change_mtu(struct net_device *dev, int new_mtu)
return
0
;
return
0
;
}
}
#define eeprom_delay(ee_addr)
readl
(ee_addr)
#define eeprom_delay(ee_addr)
ioread32
(ee_addr)
/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. */
/* Read the EEPROM and MII Management Data I/O (MDIO) interfaces. */
static
int
__devinit
eeprom_read
(
long
ioaddr
,
int
location
)
static
int
__devinit
eeprom_read
(
void
__iomem
*
ioaddr
,
int
location
)
{
{
int
boguscnt
=
10000
;
/* Typical 1900 ticks. */
int
boguscnt
=
10000
;
/* Typical 1900 ticks. */
writew
(
0x0200
|
(
location
&
0xff
),
ioaddr
+
EECtrl
);
iowrite16
(
0x0200
|
(
location
&
0xff
),
ioaddr
+
EECtrl
);
do
{
do
{
eeprom_delay
(
ioaddr
+
EECtrl
);
eeprom_delay
(
ioaddr
+
EECtrl
);
if
(
!
(
readw
(
ioaddr
+
EECtrl
)
&
0x8000
))
{
if
(
!
(
ioread16
(
ioaddr
+
EECtrl
)
&
0x8000
))
{
return
readw
(
ioaddr
+
EEData
);
return
ioread16
(
ioaddr
+
EEData
);
}
}
}
while
(
--
boguscnt
>
0
);
}
while
(
--
boguscnt
>
0
);
return
0
;
return
0
;
...
@@ -761,7 +747,7 @@ static int __devinit eeprom_read(long ioaddr, int location)
...
@@ -761,7 +747,7 @@ static int __devinit eeprom_read(long ioaddr, int location)
The maximum data clock rate is 2.5 Mhz. The minimum timing is usually
The maximum data clock rate is 2.5 Mhz. The minimum timing is usually
met by back-to-back 33Mhz PCI cycles. */
met by back-to-back 33Mhz PCI cycles. */
#define mdio_delay()
readb
(mdio_addr)
#define mdio_delay()
ioread8
(mdio_addr)
enum
mii_reg_bits
{
enum
mii_reg_bits
{
MDIO_ShiftClk
=
0x0001
,
MDIO_Data
=
0x0002
,
MDIO_EnbOutput
=
0x0004
,
MDIO_ShiftClk
=
0x0001
,
MDIO_Data
=
0x0002
,
MDIO_EnbOutput
=
0x0004
,
...
@@ -772,15 +758,15 @@ enum mii_reg_bits {
...
@@ -772,15 +758,15 @@ enum mii_reg_bits {
/* Generate the preamble required for initial synchronization and
/* Generate the preamble required for initial synchronization and
a few older transceivers. */
a few older transceivers. */
static
void
mdio_sync
(
long
mdio_addr
)
static
void
mdio_sync
(
void
__iomem
*
mdio_addr
)
{
{
int
bits
=
32
;
int
bits
=
32
;
/* Establish sync by sending at least 32 logic ones. */
/* Establish sync by sending at least 32 logic ones. */
while
(
--
bits
>=
0
)
{
while
(
--
bits
>=
0
)
{
writeb
(
MDIO_WRITE1
,
mdio_addr
);
iowrite8
(
MDIO_WRITE1
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
writeb
(
MDIO_WRITE1
|
MDIO_ShiftClk
,
mdio_addr
);
iowrite8
(
MDIO_WRITE1
|
MDIO_ShiftClk
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
}
}
}
}
...
@@ -788,7 +774,7 @@ static void mdio_sync(long mdio_addr)
...
@@ -788,7 +774,7 @@ static void mdio_sync(long mdio_addr)
static
int
mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
)
static
int
mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
mdio_addr
=
dev
->
base_addr
+
MIICtrl
;
void
__iomem
*
mdio_addr
=
np
->
base
+
MIICtrl
;
int
mii_cmd
=
(
0xf6
<<
10
)
|
(
phy_id
<<
5
)
|
location
;
int
mii_cmd
=
(
0xf6
<<
10
)
|
(
phy_id
<<
5
)
|
location
;
int
i
,
retval
=
0
;
int
i
,
retval
=
0
;
...
@@ -799,17 +785,17 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
...
@@ -799,17 +785,17 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
for
(
i
=
15
;
i
>=
0
;
i
--
)
{
for
(
i
=
15
;
i
>=
0
;
i
--
)
{
int
dataval
=
(
mii_cmd
&
(
1
<<
i
))
?
MDIO_WRITE1
:
MDIO_WRITE0
;
int
dataval
=
(
mii_cmd
&
(
1
<<
i
))
?
MDIO_WRITE1
:
MDIO_WRITE0
;
writeb
(
dataval
,
mdio_addr
);
iowrite8
(
dataval
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
writeb
(
dataval
|
MDIO_ShiftClk
,
mdio_addr
);
iowrite8
(
dataval
|
MDIO_ShiftClk
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
}
}
/* Read the two transition, 16 data, and wire-idle bits. */
/* Read the two transition, 16 data, and wire-idle bits. */
for
(
i
=
19
;
i
>
0
;
i
--
)
{
for
(
i
=
19
;
i
>
0
;
i
--
)
{
writeb
(
MDIO_EnbIn
,
mdio_addr
);
iowrite8
(
MDIO_EnbIn
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
retval
=
(
retval
<<
1
)
|
((
readb
(
mdio_addr
)
&
MDIO_Data
)
?
1
:
0
);
retval
=
(
retval
<<
1
)
|
((
ioread8
(
mdio_addr
)
&
MDIO_Data
)
?
1
:
0
);
writeb
(
MDIO_EnbIn
|
MDIO_ShiftClk
,
mdio_addr
);
iowrite8
(
MDIO_EnbIn
|
MDIO_ShiftClk
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
}
}
return
(
retval
>>
1
)
&
0xffff
;
return
(
retval
>>
1
)
&
0xffff
;
...
@@ -818,7 +804,7 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
...
@@ -818,7 +804,7 @@ static int mdio_read(struct net_device *dev, int phy_id, int location)
static
void
mdio_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
,
int
value
)
static
void
mdio_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
location
,
int
value
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
mdio_addr
=
dev
->
base_addr
+
MIICtrl
;
void
__iomem
*
mdio_addr
=
np
->
base
+
MIICtrl
;
int
mii_cmd
=
(
0x5002
<<
16
)
|
(
phy_id
<<
23
)
|
(
location
<<
18
)
|
value
;
int
mii_cmd
=
(
0x5002
<<
16
)
|
(
phy_id
<<
23
)
|
(
location
<<
18
)
|
value
;
int
i
;
int
i
;
...
@@ -829,16 +815,16 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
...
@@ -829,16 +815,16 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
for
(
i
=
31
;
i
>=
0
;
i
--
)
{
for
(
i
=
31
;
i
>=
0
;
i
--
)
{
int
dataval
=
(
mii_cmd
&
(
1
<<
i
))
?
MDIO_WRITE1
:
MDIO_WRITE0
;
int
dataval
=
(
mii_cmd
&
(
1
<<
i
))
?
MDIO_WRITE1
:
MDIO_WRITE0
;
writeb
(
dataval
,
mdio_addr
);
iowrite8
(
dataval
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
writeb
(
dataval
|
MDIO_ShiftClk
,
mdio_addr
);
iowrite8
(
dataval
|
MDIO_ShiftClk
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
}
}
/* Clear out extra bits. */
/* Clear out extra bits. */
for
(
i
=
2
;
i
>
0
;
i
--
)
{
for
(
i
=
2
;
i
>
0
;
i
--
)
{
writeb
(
MDIO_EnbIn
,
mdio_addr
);
iowrite8
(
MDIO_EnbIn
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
writeb
(
MDIO_EnbIn
|
MDIO_ShiftClk
,
mdio_addr
);
iowrite8
(
MDIO_EnbIn
|
MDIO_ShiftClk
,
mdio_addr
);
mdio_delay
();
mdio_delay
();
}
}
return
;
return
;
...
@@ -847,7 +833,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
...
@@ -847,7 +833,7 @@ static void mdio_write(struct net_device *dev, int phy_id, int location, int val
static
int
netdev_open
(
struct
net_device
*
dev
)
static
int
netdev_open
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
i
;
int
i
;
/* Do we need to reset the chip??? */
/* Do we need to reset the chip??? */
...
@@ -861,18 +847,18 @@ static int netdev_open(struct net_device *dev)
...
@@ -861,18 +847,18 @@ static int netdev_open(struct net_device *dev)
dev
->
name
,
dev
->
irq
);
dev
->
name
,
dev
->
irq
);
init_ring
(
dev
);
init_ring
(
dev
);
writel
(
np
->
rx_ring_dma
,
ioaddr
+
RxListPtr
);
iowrite32
(
np
->
rx_ring_dma
,
ioaddr
+
RxListPtr
);
/* The Tx list pointer is written as packets are queued. */
/* The Tx list pointer is written as packets are queued. */
/* Initialize other registers. */
/* Initialize other registers. */
__set_mac_addr
(
dev
);
__set_mac_addr
(
dev
);
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
writew
(
dev
->
mtu
+
18
,
ioaddr
+
MaxFrameSize
);
iowrite16
(
dev
->
mtu
+
18
,
ioaddr
+
MaxFrameSize
);
#else
#else
writew
(
dev
->
mtu
+
14
,
ioaddr
+
MaxFrameSize
);
iowrite16
(
dev
->
mtu
+
14
,
ioaddr
+
MaxFrameSize
);
#endif
#endif
if
(
dev
->
mtu
>
2047
)
if
(
dev
->
mtu
>
2047
)
writel
(
readl
(
ioaddr
+
ASICCtrl
)
|
0x0C
,
ioaddr
+
ASICCtrl
);
iowrite32
(
ioread32
(
ioaddr
+
ASICCtrl
)
|
0x0C
,
ioaddr
+
ASICCtrl
);
/* Configure the PCI bus bursts and FIFO thresholds. */
/* Configure the PCI bus bursts and FIFO thresholds. */
...
@@ -882,24 +868,24 @@ static int netdev_open(struct net_device *dev)
...
@@ -882,24 +868,24 @@ static int netdev_open(struct net_device *dev)
spin_lock_init
(
&
np
->
mcastlock
);
spin_lock_init
(
&
np
->
mcastlock
);
set_rx_mode
(
dev
);
set_rx_mode
(
dev
);
writew
(
0
,
ioaddr
+
IntrEnable
);
iowrite16
(
0
,
ioaddr
+
IntrEnable
);
writew
(
0
,
ioaddr
+
DownCounter
);
iowrite16
(
0
,
ioaddr
+
DownCounter
);
/* Set the chip to poll every N*320nsec. */
/* Set the chip to poll every N*320nsec. */
writeb
(
100
,
ioaddr
+
RxDMAPollPeriod
);
iowrite8
(
100
,
ioaddr
+
RxDMAPollPeriod
);
writeb
(
127
,
ioaddr
+
TxDMAPollPeriod
);
iowrite8
(
127
,
ioaddr
+
TxDMAPollPeriod
);
/* Fix DFE-580TX packet drop issue */
/* Fix DFE-580TX packet drop issue */
if
(
np
->
pci_rev_id
>=
0x14
)
if
(
np
->
pci_rev_id
>=
0x14
)
writeb
(
0x01
,
ioaddr
+
DebugCtrl1
);
iowrite8
(
0x01
,
ioaddr
+
DebugCtrl1
);
netif_start_queue
(
dev
);
netif_start_queue
(
dev
);
writew
(
StatsEnable
|
RxEnable
|
TxEnable
,
ioaddr
+
MACCtrl1
);
iowrite16
(
StatsEnable
|
RxEnable
|
TxEnable
,
ioaddr
+
MACCtrl1
);
if
(
netif_msg_ifup
(
np
))
if
(
netif_msg_ifup
(
np
))
printk
(
KERN_DEBUG
"%s: Done netdev_open(), status: Rx %x Tx %x "
printk
(
KERN_DEBUG
"%s: Done netdev_open(), status: Rx %x Tx %x "
"MAC Control %x, %4.4x %4.4x.
\n
"
,
"MAC Control %x, %4.4x %4.4x.
\n
"
,
dev
->
name
,
readl
(
ioaddr
+
RxStatus
),
readb
(
ioaddr
+
TxStatus
),
dev
->
name
,
ioread32
(
ioaddr
+
RxStatus
),
ioread8
(
ioaddr
+
TxStatus
),
readl
(
ioaddr
+
MACCtrl0
),
ioread32
(
ioaddr
+
MACCtrl0
),
readw
(
ioaddr
+
MACCtrl1
),
readw
(
ioaddr
+
MACCtrl0
));
ioread16
(
ioaddr
+
MACCtrl1
),
ioread16
(
ioaddr
+
MACCtrl0
));
/* Set the timer to check for link beat. */
/* Set the timer to check for link beat. */
init_timer
(
&
np
->
timer
);
init_timer
(
&
np
->
timer
);
...
@@ -909,7 +895,7 @@ static int netdev_open(struct net_device *dev)
...
@@ -909,7 +895,7 @@ static int netdev_open(struct net_device *dev)
add_timer
(
&
np
->
timer
);
add_timer
(
&
np
->
timer
);
/* Enable interrupts by setting the interrupt mask. */
/* Enable interrupts by setting the interrupt mask. */
writew
(
DEFAULT_INTR
,
ioaddr
+
IntrEnable
);
iowrite16
(
DEFAULT_INTR
,
ioaddr
+
IntrEnable
);
return
0
;
return
0
;
}
}
...
@@ -917,7 +903,7 @@ static int netdev_open(struct net_device *dev)
...
@@ -917,7 +903,7 @@ static int netdev_open(struct net_device *dev)
static
void
check_duplex
(
struct
net_device
*
dev
)
static
void
check_duplex
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
mii_lpa
=
mdio_read
(
dev
,
np
->
phys
[
0
],
MII_LPA
);
int
mii_lpa
=
mdio_read
(
dev
,
np
->
phys
[
0
],
MII_LPA
);
int
negotiated
=
mii_lpa
&
np
->
mii_if
.
advertising
;
int
negotiated
=
mii_lpa
&
np
->
mii_if
.
advertising
;
int
duplex
;
int
duplex
;
...
@@ -925,7 +911,7 @@ static void check_duplex(struct net_device *dev)
...
@@ -925,7 +911,7 @@ static void check_duplex(struct net_device *dev)
/* Force media */
/* Force media */
if
(
!
np
->
an_enable
||
mii_lpa
==
0xffff
)
{
if
(
!
np
->
an_enable
||
mii_lpa
==
0xffff
)
{
if
(
np
->
mii_if
.
full_duplex
)
if
(
np
->
mii_if
.
full_duplex
)
writew
(
readw
(
ioaddr
+
MACCtrl0
)
|
EnbFullDuplex
,
iowrite16
(
ioread16
(
ioaddr
+
MACCtrl0
)
|
EnbFullDuplex
,
ioaddr
+
MACCtrl0
);
ioaddr
+
MACCtrl0
);
return
;
return
;
}
}
...
@@ -938,7 +924,7 @@ static void check_duplex(struct net_device *dev)
...
@@ -938,7 +924,7 @@ static void check_duplex(struct net_device *dev)
printk
(
KERN_INFO
"%s: Setting %s-duplex based on MII #%d "
printk
(
KERN_INFO
"%s: Setting %s-duplex based on MII #%d "
"negotiated capability %4.4x.
\n
"
,
dev
->
name
,
"negotiated capability %4.4x.
\n
"
,
dev
->
name
,
duplex
?
"full"
:
"half"
,
np
->
phys
[
0
],
negotiated
);
duplex
?
"full"
:
"half"
,
np
->
phys
[
0
],
negotiated
);
writew
(
readw
(
ioaddr
+
MACCtrl0
)
|
duplex
?
0x20
:
0
,
ioaddr
+
MACCtrl0
);
iowrite16
(
ioread16
(
ioaddr
+
MACCtrl0
)
|
duplex
?
0x20
:
0
,
ioaddr
+
MACCtrl0
);
}
}
}
}
...
@@ -946,14 +932,14 @@ static void netdev_timer(unsigned long data)
...
@@ -946,14 +932,14 @@ static void netdev_timer(unsigned long data)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
data
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
data
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
next_tick
=
10
*
HZ
;
int
next_tick
=
10
*
HZ
;
if
(
netif_msg_timer
(
np
))
{
if
(
netif_msg_timer
(
np
))
{
printk
(
KERN_DEBUG
"%s: Media selection timer tick, intr status %4.4x, "
printk
(
KERN_DEBUG
"%s: Media selection timer tick, intr status %4.4x, "
"Tx %x Rx %x.
\n
"
,
"Tx %x Rx %x.
\n
"
,
dev
->
name
,
readw
(
ioaddr
+
IntrEnable
),
dev
->
name
,
ioread16
(
ioaddr
+
IntrEnable
),
readb
(
ioaddr
+
TxStatus
),
readl
(
ioaddr
+
RxStatus
));
ioread8
(
ioaddr
+
TxStatus
),
ioread32
(
ioaddr
+
RxStatus
));
}
}
check_duplex
(
dev
);
check_duplex
(
dev
);
np
->
timer
.
expires
=
jiffies
+
next_tick
;
np
->
timer
.
expires
=
jiffies
+
next_tick
;
...
@@ -963,16 +949,16 @@ static void netdev_timer(unsigned long data)
...
@@ -963,16 +949,16 @@ static void netdev_timer(unsigned long data)
static
void
tx_timeout
(
struct
net_device
*
dev
)
static
void
tx_timeout
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
unsigned
long
flag
;
unsigned
long
flag
;
netif_stop_queue
(
dev
);
netif_stop_queue
(
dev
);
tasklet_disable
(
&
np
->
tx_tasklet
);
tasklet_disable
(
&
np
->
tx_tasklet
);
writew
(
0
,
ioaddr
+
IntrEnable
);
iowrite16
(
0
,
ioaddr
+
IntrEnable
);
printk
(
KERN_WARNING
"%s: Transmit timed out, TxStatus %2.2x "
printk
(
KERN_WARNING
"%s: Transmit timed out, TxStatus %2.2x "
"TxFrameId %2.2x,"
"TxFrameId %2.2x,"
" resetting...
\n
"
,
dev
->
name
,
readb
(
ioaddr
+
TxStatus
),
" resetting...
\n
"
,
dev
->
name
,
ioread8
(
ioaddr
+
TxStatus
),
readb
(
ioaddr
+
TxFrameId
));
ioread8
(
ioaddr
+
TxFrameId
));
{
{
int
i
;
int
i
;
...
@@ -986,7 +972,7 @@ static void tx_timeout(struct net_device *dev)
...
@@ -986,7 +972,7 @@ static void tx_timeout(struct net_device *dev)
le32_to_cpu
(
np
->
tx_ring
[
i
].
frag
[
0
].
length
));
le32_to_cpu
(
np
->
tx_ring
[
i
].
frag
[
0
].
length
));
}
}
printk
(
KERN_DEBUG
"TxListPtr=%08x netif_queue_stopped=%d
\n
"
,
printk
(
KERN_DEBUG
"TxListPtr=%08x netif_queue_stopped=%d
\n
"
,
readl
(
dev
->
base_addr
+
TxListPtr
),
ioread32
(
np
->
base
+
TxListPtr
),
netif_queue_stopped
(
dev
));
netif_queue_stopped
(
dev
));
printk
(
KERN_DEBUG
"cur_tx=%d(%02x) dirty_tx=%d(%02x)
\n
"
,
printk
(
KERN_DEBUG
"cur_tx=%d(%02x) dirty_tx=%d(%02x)
\n
"
,
np
->
cur_tx
,
np
->
cur_tx
%
TX_RING_SIZE
,
np
->
cur_tx
,
np
->
cur_tx
%
TX_RING_SIZE
,
...
@@ -1007,7 +993,7 @@ static void tx_timeout(struct net_device *dev)
...
@@ -1007,7 +993,7 @@ static void tx_timeout(struct net_device *dev)
if
(
np
->
cur_tx
-
np
->
dirty_tx
<
TX_QUEUE_LEN
-
4
)
{
if
(
np
->
cur_tx
-
np
->
dirty_tx
<
TX_QUEUE_LEN
-
4
)
{
netif_wake_queue
(
dev
);
netif_wake_queue
(
dev
);
}
}
writew
(
DEFAULT_INTR
,
ioaddr
+
IntrEnable
);
iowrite16
(
DEFAULT_INTR
,
ioaddr
+
IntrEnable
);
tasklet_enable
(
&
np
->
tx_tasklet
);
tasklet_enable
(
&
np
->
tx_tasklet
);
}
}
...
@@ -1076,9 +1062,9 @@ static void tx_poll (unsigned long data)
...
@@ -1076,9 +1062,9 @@ static void tx_poll (unsigned long data)
/* Indicate the latest descriptor of tx ring */
/* Indicate the latest descriptor of tx ring */
txdesc
->
status
|=
cpu_to_le32
(
DescIntrOnTx
);
txdesc
->
status
|=
cpu_to_le32
(
DescIntrOnTx
);
if
(
readl
(
dev
->
base_addr
+
TxListPtr
)
==
0
)
if
(
ioread32
(
np
->
base
+
TxListPtr
)
==
0
)
writel
(
np
->
tx_ring_dma
+
head
*
sizeof
(
struct
netdev_desc
),
iowrite32
(
np
->
tx_ring_dma
+
head
*
sizeof
(
struct
netdev_desc
),
dev
->
base_addr
+
TxListPtr
);
np
->
base
+
TxListPtr
);
return
;
return
;
}
}
...
@@ -1128,17 +1114,17 @@ static int
...
@@ -1128,17 +1114,17 @@ static int
reset_tx
(
struct
net_device
*
dev
)
reset_tx
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
int
i
;
int
i
;
int
irq
=
in_interrupt
();
int
irq
=
in_interrupt
();
/* Reset tx logic, TxListPtr will be cleaned */
/* Reset tx logic, TxListPtr will be cleaned */
writew
(
TxDisable
,
ioaddr
+
MACCtrl1
);
iowrite16
(
TxDisable
,
ioaddr
+
MACCtrl1
);
writew
(
TxReset
|
DMAReset
|
FIFOReset
|
NetworkReset
,
iowrite16
(
TxReset
|
DMAReset
|
FIFOReset
|
NetworkReset
,
ioaddr
+
ASICCtrl
+
2
);
ioaddr
+
ASICCtrl
+
2
);
for
(
i
=
50
;
i
>
0
;
i
--
)
{
for
(
i
=
50
;
i
>
0
;
i
--
)
{
if
((
readw
(
ioaddr
+
ASICCtrl
+
2
)
&
ResetBusy
)
==
0
)
if
((
ioread16
(
ioaddr
+
ASICCtrl
+
2
)
&
ResetBusy
)
==
0
)
break
;
break
;
mdelay
(
1
);
mdelay
(
1
);
}
}
...
@@ -1159,7 +1145,7 @@ reset_tx (struct net_device *dev)
...
@@ -1159,7 +1145,7 @@ reset_tx (struct net_device *dev)
}
}
np
->
cur_tx
=
np
->
dirty_tx
=
0
;
np
->
cur_tx
=
np
->
dirty_tx
=
0
;
np
->
cur_task
=
0
;
np
->
cur_task
=
0
;
writew
(
StatsEnable
|
RxEnable
|
TxEnable
,
ioaddr
+
MACCtrl1
);
iowrite16
(
StatsEnable
|
RxEnable
|
TxEnable
,
ioaddr
+
MACCtrl1
);
return
0
;
return
0
;
}
}
...
@@ -1168,19 +1154,17 @@ reset_tx (struct net_device *dev)
...
@@ -1168,19 +1154,17 @@ reset_tx (struct net_device *dev)
static
irqreturn_t
intr_handler
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
rgs
)
static
irqreturn_t
intr_handler
(
int
irq
,
void
*
dev_instance
,
struct
pt_regs
*
rgs
)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_instance
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_instance
;
struct
netdev_private
*
np
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
)
;
long
ioaddr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
hw_frame_id
;
int
hw_frame_id
;
int
tx_cnt
;
int
tx_cnt
;
int
tx_status
;
int
tx_status
;
int
handled
=
0
;
int
handled
=
0
;
ioaddr
=
dev
->
base_addr
;
np
=
netdev_priv
(
dev
);
do
{
do
{
int
intr_status
=
readw
(
ioaddr
+
IntrStatus
);
int
intr_status
=
ioread16
(
ioaddr
+
IntrStatus
);
writew
(
intr_status
,
ioaddr
+
IntrStatus
);
iowrite16
(
intr_status
,
ioaddr
+
IntrStatus
);
if
(
netif_msg_intr
(
np
))
if
(
netif_msg_intr
(
np
))
printk
(
KERN_DEBUG
"%s: Interrupt, status %4.4x.
\n
"
,
printk
(
KERN_DEBUG
"%s: Interrupt, status %4.4x.
\n
"
,
...
@@ -1192,14 +1176,14 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
...
@@ -1192,14 +1176,14 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
handled
=
1
;
handled
=
1
;
if
(
intr_status
&
(
IntrRxDMADone
))
{
if
(
intr_status
&
(
IntrRxDMADone
))
{
writew
(
DEFAULT_INTR
&
~
(
IntrRxDone
|
IntrRxDMADone
),
iowrite16
(
DEFAULT_INTR
&
~
(
IntrRxDone
|
IntrRxDMADone
),
ioaddr
+
IntrEnable
);
ioaddr
+
IntrEnable
);
if
(
np
->
budget
<
0
)
if
(
np
->
budget
<
0
)
np
->
budget
=
RX_BUDGET
;
np
->
budget
=
RX_BUDGET
;
tasklet_schedule
(
&
np
->
rx_tasklet
);
tasklet_schedule
(
&
np
->
rx_tasklet
);
}
}
if
(
intr_status
&
(
IntrTxDone
|
IntrDrvRqst
))
{
if
(
intr_status
&
(
IntrTxDone
|
IntrDrvRqst
))
{
tx_status
=
readw
(
ioaddr
+
TxStatus
);
tx_status
=
ioread16
(
ioaddr
+
TxStatus
);
for
(
tx_cnt
=
32
;
tx_status
&
0x80
;
--
tx_cnt
)
{
for
(
tx_cnt
=
32
;
tx_status
&
0x80
;
--
tx_cnt
)
{
if
(
netif_msg_tx_done
(
np
))
if
(
netif_msg_tx_done
(
np
))
printk
printk
...
@@ -1221,18 +1205,18 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
...
@@ -1221,18 +1205,18 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
spin_unlock
(
&
np
->
lock
);
spin_unlock
(
&
np
->
lock
);
}
}
if
(
tx_status
&
0x1e
)
/* Restart the Tx. */
if
(
tx_status
&
0x1e
)
/* Restart the Tx. */
writew
(
TxEnable
,
iowrite16
(
TxEnable
,
ioaddr
+
MACCtrl1
);
ioaddr
+
MACCtrl1
);
}
}
/* Yup, this is a documentation bug. It cost me *hours*. */
/* Yup, this is a documentation bug. It cost me *hours*. */
writew
(
0
,
ioaddr
+
TxStatus
);
iowrite16
(
0
,
ioaddr
+
TxStatus
);
tx_status
=
readw
(
ioaddr
+
TxStatus
);
tx_status
=
ioread16
(
ioaddr
+
TxStatus
);
if
(
tx_cnt
<
0
)
if
(
tx_cnt
<
0
)
break
;
break
;
}
}
hw_frame_id
=
(
tx_status
>>
8
)
&
0xff
;
hw_frame_id
=
(
tx_status
>>
8
)
&
0xff
;
}
else
{
}
else
{
hw_frame_id
=
readb
(
ioaddr
+
TxFrameId
);
hw_frame_id
=
ioread8
(
ioaddr
+
TxFrameId
);
}
}
if
(
np
->
pci_rev_id
>=
0x14
)
{
if
(
np
->
pci_rev_id
>=
0x14
)
{
...
@@ -1293,8 +1277,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
...
@@ -1293,8 +1277,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance, struct pt_regs *rgs
}
while
(
0
);
}
while
(
0
);
if
(
netif_msg_intr
(
np
))
if
(
netif_msg_intr
(
np
))
printk
(
KERN_DEBUG
"%s: exiting interrupt, status=%#4.4x.
\n
"
,
printk
(
KERN_DEBUG
"%s: exiting interrupt, status=%#4.4x.
\n
"
,
dev
->
name
,
readw
(
ioaddr
+
IntrStatus
));
dev
->
name
,
ioread16
(
ioaddr
+
IntrStatus
));
writel
(
5000
,
ioaddr
+
DownCounter
);
iowrite32
(
5000
,
ioaddr
+
DownCounter
);
return
IRQ_RETVAL
(
handled
);
return
IRQ_RETVAL
(
handled
);
}
}
...
@@ -1304,7 +1288,7 @@ static void rx_poll(unsigned long data)
...
@@ -1304,7 +1288,7 @@ static void rx_poll(unsigned long data)
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
int
entry
=
np
->
cur_rx
%
RX_RING_SIZE
;
int
entry
=
np
->
cur_rx
%
RX_RING_SIZE
;
int
boguscnt
=
np
->
budget
;
int
boguscnt
=
np
->
budget
;
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
received
=
0
;
int
received
=
0
;
/* If EOP is set on the next entry, it's a new packet. Send it up. */
/* If EOP is set on the next entry, it's a new packet. Send it up. */
...
@@ -1381,7 +1365,7 @@ static void rx_poll(unsigned long data)
...
@@ -1381,7 +1365,7 @@ static void rx_poll(unsigned long data)
np
->
cur_rx
=
entry
;
np
->
cur_rx
=
entry
;
refill_rx
(
dev
);
refill_rx
(
dev
);
np
->
budget
-=
received
;
np
->
budget
-=
received
;
writew
(
DEFAULT_INTR
,
ioaddr
+
IntrEnable
);
iowrite16
(
DEFAULT_INTR
,
ioaddr
+
IntrEnable
);
return
;
return
;
not_done:
not_done:
...
@@ -1428,8 +1412,8 @@ static void refill_rx (struct net_device *dev)
...
@@ -1428,8 +1412,8 @@ static void refill_rx (struct net_device *dev)
}
}
static
void
netdev_error
(
struct
net_device
*
dev
,
int
intr_status
)
static
void
netdev_error
(
struct
net_device
*
dev
,
int
intr_status
)
{
{
long
ioaddr
=
dev
->
base_addr
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
u16
mii_ctl
,
mii_advertise
,
mii_lpa
;
u16
mii_ctl
,
mii_advertise
,
mii_lpa
;
int
speed
;
int
speed
;
...
@@ -1465,9 +1449,9 @@ static void netdev_error(struct net_device *dev, int intr_status)
...
@@ -1465,9 +1449,9 @@ static void netdev_error(struct net_device *dev, int intr_status)
}
}
check_duplex
(
dev
);
check_duplex
(
dev
);
if
(
np
->
flowctrl
&&
np
->
mii_if
.
full_duplex
)
{
if
(
np
->
flowctrl
&&
np
->
mii_if
.
full_duplex
)
{
writew
(
readw
(
ioaddr
+
MulticastFilter1
+
2
)
|
0x0200
,
iowrite16
(
ioread16
(
ioaddr
+
MulticastFilter1
+
2
)
|
0x0200
,
ioaddr
+
MulticastFilter1
+
2
);
ioaddr
+
MulticastFilter1
+
2
);
writew
(
readw
(
ioaddr
+
MACCtrl0
)
|
EnbFlowCtrl
,
iowrite16
(
ioread16
(
ioaddr
+
MACCtrl0
)
|
EnbFlowCtrl
,
ioaddr
+
MACCtrl0
);
ioaddr
+
MACCtrl0
);
}
}
}
}
...
@@ -1484,35 +1468,35 @@ static void netdev_error(struct net_device *dev, int intr_status)
...
@@ -1484,35 +1468,35 @@ static void netdev_error(struct net_device *dev, int intr_status)
static
struct
net_device_stats
*
get_stats
(
struct
net_device
*
dev
)
static
struct
net_device_stats
*
get_stats
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
long
ioaddr
=
dev
->
base_addr
;
void
__iomem
*
ioaddr
=
np
->
base
;
int
i
;
int
i
;
/* We should lock this segment of code for SMP eventually, although
/* We should lock this segment of code for SMP eventually, although
the vulnerability window is very small and statistics are
the vulnerability window is very small and statistics are
non-critical. */
non-critical. */
/* The chip only need report frame silently dropped. */
/* The chip only need report frame silently dropped. */
np
->
stats
.
rx_missed_errors
+=
readb
(
ioaddr
+
RxMissed
);
np
->
stats
.
rx_missed_errors
+=
ioread8
(
ioaddr
+
RxMissed
);
np
->
stats
.
tx_packets
+=
readw
(
ioaddr
+
TxFramesOK
);
np
->
stats
.
tx_packets
+=
ioread16
(
ioaddr
+
TxFramesOK
);
np
->
stats
.
rx_packets
+=
readw
(
ioaddr
+
RxFramesOK
);
np
->
stats
.
rx_packets
+=
ioread16
(
ioaddr
+
RxFramesOK
);
np
->
stats
.
collisions
+=
readb
(
ioaddr
+
StatsLateColl
);
np
->
stats
.
collisions
+=
ioread8
(
ioaddr
+
StatsLateColl
);
np
->
stats
.
collisions
+=
readb
(
ioaddr
+
StatsMultiColl
);
np
->
stats
.
collisions
+=
ioread8
(
ioaddr
+
StatsMultiColl
);
np
->
stats
.
collisions
+=
readb
(
ioaddr
+
StatsOneColl
);
np
->
stats
.
collisions
+=
ioread8
(
ioaddr
+
StatsOneColl
);
np
->
stats
.
tx_carrier_errors
+=
readb
(
ioaddr
+
StatsCarrierError
);
np
->
stats
.
tx_carrier_errors
+=
ioread8
(
ioaddr
+
StatsCarrierError
);
readb
(
ioaddr
+
StatsTxDefer
);
ioread8
(
ioaddr
+
StatsTxDefer
);
for
(
i
=
StatsTxDefer
;
i
<=
StatsMcastRx
;
i
++
)
for
(
i
=
StatsTxDefer
;
i
<=
StatsMcastRx
;
i
++
)
readb
(
ioaddr
+
i
);
ioread8
(
ioaddr
+
i
);
np
->
stats
.
tx_bytes
+=
readw
(
ioaddr
+
TxOctetsLow
);
np
->
stats
.
tx_bytes
+=
ioread16
(
ioaddr
+
TxOctetsLow
);
np
->
stats
.
tx_bytes
+=
readw
(
ioaddr
+
TxOctetsHigh
)
<<
16
;
np
->
stats
.
tx_bytes
+=
ioread16
(
ioaddr
+
TxOctetsHigh
)
<<
16
;
np
->
stats
.
rx_bytes
+=
readw
(
ioaddr
+
RxOctetsLow
);
np
->
stats
.
rx_bytes
+=
ioread16
(
ioaddr
+
RxOctetsLow
);
np
->
stats
.
rx_bytes
+=
readw
(
ioaddr
+
RxOctetsHigh
)
<<
16
;
np
->
stats
.
rx_bytes
+=
ioread16
(
ioaddr
+
RxOctetsHigh
)
<<
16
;
return
&
np
->
stats
;
return
&
np
->
stats
;
}
}
static
void
set_rx_mode
(
struct
net_device
*
dev
)
static
void
set_rx_mode
(
struct
net_device
*
dev
)
{
{
long
ioaddr
=
dev
->
base_addr
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
u16
mc_filter
[
4
];
/* Multicast hash filter */
u16
mc_filter
[
4
];
/* Multicast hash filter */
u32
rx_mode
;
u32
rx_mode
;
int
i
;
int
i
;
...
@@ -1542,27 +1526,28 @@ static void set_rx_mode(struct net_device *dev)
...
@@ -1542,27 +1526,28 @@ static void set_rx_mode(struct net_device *dev)
}
}
rx_mode
=
AcceptBroadcast
|
AcceptMultiHash
|
AcceptMyPhys
;
rx_mode
=
AcceptBroadcast
|
AcceptMultiHash
|
AcceptMyPhys
;
}
else
{
}
else
{
writeb
(
AcceptBroadcast
|
AcceptMyPhys
,
ioaddr
+
RxMode
);
iowrite8
(
AcceptBroadcast
|
AcceptMyPhys
,
ioaddr
+
RxMode
);
return
;
return
;
}
}
if
(
np
->
mii_if
.
full_duplex
&&
np
->
flowctrl
)
if
(
np
->
mii_if
.
full_duplex
&&
np
->
flowctrl
)
mc_filter
[
3
]
|=
0x0200
;
mc_filter
[
3
]
|=
0x0200
;
for
(
i
=
0
;
i
<
4
;
i
++
)
for
(
i
=
0
;
i
<
4
;
i
++
)
writew
(
mc_filter
[
i
],
ioaddr
+
MulticastFilter0
+
i
*
2
);
iowrite16
(
mc_filter
[
i
],
ioaddr
+
MulticastFilter0
+
i
*
2
);
writeb
(
rx_mode
,
ioaddr
+
RxMode
);
iowrite8
(
rx_mode
,
ioaddr
+
RxMode
);
}
}
static
int
__set_mac_addr
(
struct
net_device
*
dev
)
static
int
__set_mac_addr
(
struct
net_device
*
dev
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
u16
addr16
;
u16
addr16
;
addr16
=
(
dev
->
dev_addr
[
0
]
|
(
dev
->
dev_addr
[
1
]
<<
8
));
addr16
=
(
dev
->
dev_addr
[
0
]
|
(
dev
->
dev_addr
[
1
]
<<
8
));
writew
(
addr16
,
dev
->
base_addr
+
StationAddr
);
iowrite16
(
addr16
,
np
->
base
+
StationAddr
);
addr16
=
(
dev
->
dev_addr
[
2
]
|
(
dev
->
dev_addr
[
3
]
<<
8
));
addr16
=
(
dev
->
dev_addr
[
2
]
|
(
dev
->
dev_addr
[
3
]
<<
8
));
writew
(
addr16
,
dev
->
base_addr
+
StationAddr
+
2
);
iowrite16
(
addr16
,
np
->
base
+
StationAddr
+
2
);
addr16
=
(
dev
->
dev_addr
[
4
]
|
(
dev
->
dev_addr
[
5
]
<<
8
));
addr16
=
(
dev
->
dev_addr
[
4
]
|
(
dev
->
dev_addr
[
5
]
<<
8
));
writew
(
addr16
,
dev
->
base_addr
+
StationAddr
+
4
);
iowrite16
(
addr16
,
np
->
base
+
StationAddr
+
4
);
return
0
;
return
0
;
}
}
...
@@ -1638,9 +1623,9 @@ static struct ethtool_ops ethtool_ops = {
...
@@ -1638,9 +1623,9 @@ static struct ethtool_ops ethtool_ops = {
static
int
netdev_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
int
cmd
)
static
int
netdev_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
int
cmd
)
{
{
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
int
rc
;
int
rc
;
int
i
;
int
i
;
long
ioaddr
=
dev
->
base_addr
;
if
(
!
netif_running
(
dev
))
if
(
!
netif_running
(
dev
))
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -1661,14 +1646,14 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
...
@@ -1661,14 +1646,14 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
le32_to_cpu
(
np
->
tx_ring
[
i
].
frag
[
0
].
length
));
le32_to_cpu
(
np
->
tx_ring
[
i
].
frag
[
0
].
length
));
}
}
printk
(
KERN_DEBUG
"TxListPtr=%08x netif_queue_stopped=%d
\n
"
,
printk
(
KERN_DEBUG
"TxListPtr=%08x netif_queue_stopped=%d
\n
"
,
readl
(
dev
->
base_addr
+
TxListPtr
),
ioread32
(
np
->
base
+
TxListPtr
),
netif_queue_stopped
(
dev
));
netif_queue_stopped
(
dev
));
printk
(
KERN_DEBUG
"cur_tx=%d(%02x) dirty_tx=%d(%02x)
\n
"
,
printk
(
KERN_DEBUG
"cur_tx=%d(%02x) dirty_tx=%d(%02x)
\n
"
,
np
->
cur_tx
,
np
->
cur_tx
%
TX_RING_SIZE
,
np
->
cur_tx
,
np
->
cur_tx
%
TX_RING_SIZE
,
np
->
dirty_tx
,
np
->
dirty_tx
%
TX_RING_SIZE
);
np
->
dirty_tx
,
np
->
dirty_tx
%
TX_RING_SIZE
);
printk
(
KERN_DEBUG
"cur_rx=%d dirty_rx=%d
\n
"
,
np
->
cur_rx
,
np
->
dirty_rx
);
printk
(
KERN_DEBUG
"cur_rx=%d dirty_rx=%d
\n
"
,
np
->
cur_rx
,
np
->
dirty_rx
);
printk
(
KERN_DEBUG
"cur_task=%d
\n
"
,
np
->
cur_task
);
printk
(
KERN_DEBUG
"cur_task=%d
\n
"
,
np
->
cur_task
);
printk
(
KERN_DEBUG
"TxStatus=%04x
\n
"
,
readw
(
ioaddr
+
TxStatus
));
printk
(
KERN_DEBUG
"TxStatus=%04x
\n
"
,
ioread16
(
ioaddr
+
TxStatus
));
return
0
;
return
0
;
}
}
...
@@ -1678,8 +1663,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
...
@@ -1678,8 +1663,8 @@ static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static
int
netdev_close
(
struct
net_device
*
dev
)
static
int
netdev_close
(
struct
net_device
*
dev
)
{
{
long
ioaddr
=
dev
->
base_addr
;
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
struct
netdev_private
*
np
=
netdev_priv
(
dev
);
void
__iomem
*
ioaddr
=
np
->
base
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
int
i
;
int
i
;
...
@@ -1688,17 +1673,17 @@ static int netdev_close(struct net_device *dev)
...
@@ -1688,17 +1673,17 @@ static int netdev_close(struct net_device *dev)
if
(
netif_msg_ifdown
(
np
))
{
if
(
netif_msg_ifdown
(
np
))
{
printk
(
KERN_DEBUG
"%s: Shutting down ethercard, status was Tx %2.2x "
printk
(
KERN_DEBUG
"%s: Shutting down ethercard, status was Tx %2.2x "
"Rx %4.4x Int %2.2x.
\n
"
,
"Rx %4.4x Int %2.2x.
\n
"
,
dev
->
name
,
readb
(
ioaddr
+
TxStatus
),
dev
->
name
,
ioread8
(
ioaddr
+
TxStatus
),
readl
(
ioaddr
+
RxStatus
),
readw
(
ioaddr
+
IntrStatus
));
ioread32
(
ioaddr
+
RxStatus
),
ioread16
(
ioaddr
+
IntrStatus
));
printk
(
KERN_DEBUG
"%s: Queue pointers were Tx %d / %d, Rx %d / %d.
\n
"
,
printk
(
KERN_DEBUG
"%s: Queue pointers were Tx %d / %d, Rx %d / %d.
\n
"
,
dev
->
name
,
np
->
cur_tx
,
np
->
dirty_tx
,
np
->
cur_rx
,
np
->
dirty_rx
);
dev
->
name
,
np
->
cur_tx
,
np
->
dirty_tx
,
np
->
cur_rx
,
np
->
dirty_rx
);
}
}
/* Disable interrupts by clearing the interrupt mask. */
/* Disable interrupts by clearing the interrupt mask. */
writew
(
0x0000
,
ioaddr
+
IntrEnable
);
iowrite16
(
0x0000
,
ioaddr
+
IntrEnable
);
/* Stop the chip's Tx and Rx processes. */
/* Stop the chip's Tx and Rx processes. */
writew
(
TxDisable
|
RxDisable
|
StatsDisable
,
ioaddr
+
MACCtrl1
);
iowrite16
(
TxDisable
|
RxDisable
|
StatsDisable
,
ioaddr
+
MACCtrl1
);
/* Wait and kill tasklet */
/* Wait and kill tasklet */
tasklet_kill
(
&
np
->
rx_tasklet
);
tasklet_kill
(
&
np
->
rx_tasklet
);
...
@@ -1765,10 +1750,8 @@ static void __devexit sundance_remove1 (struct pci_dev *pdev)
...
@@ -1765,10 +1750,8 @@ static void __devexit sundance_remove1 (struct pci_dev *pdev)
np
->
rx_ring_dma
);
np
->
rx_ring_dma
);
pci_free_consistent
(
pdev
,
TX_TOTAL_SIZE
,
np
->
tx_ring
,
pci_free_consistent
(
pdev
,
TX_TOTAL_SIZE
,
np
->
tx_ring
,
np
->
tx_ring_dma
);
np
->
tx_ring_dma
);
pci_iounmap
(
pdev
,
np
->
base
);
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
#ifndef USE_IO_OPS
iounmap
((
char
*
)(
dev
->
base_addr
));
#endif
free_netdev
(
dev
);
free_netdev
(
dev
);
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
}
}
...
...
drivers/net/tokenring/lanstreamer.c
View file @
7bedd791
...
@@ -443,7 +443,7 @@ static void __devexit streamer_remove_one(struct pci_dev *pdev)
...
@@ -443,7 +443,7 @@ static void __devexit streamer_remove_one(struct pci_dev *pdev)
static
int
streamer_reset
(
struct
net_device
*
dev
)
static
int
streamer_reset
(
struct
net_device
*
dev
)
{
{
struct
streamer_private
*
streamer_priv
;
struct
streamer_private
*
streamer_priv
;
__u8
*
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
;
unsigned
long
t
;
unsigned
long
t
;
unsigned
int
uaa_addr
;
unsigned
int
uaa_addr
;
struct
sk_buff
*
skb
=
NULL
;
struct
sk_buff
*
skb
=
NULL
;
...
@@ -591,7 +591,7 @@ static int streamer_reset(struct net_device *dev)
...
@@ -591,7 +591,7 @@ static int streamer_reset(struct net_device *dev)
static
int
streamer_open
(
struct
net_device
*
dev
)
static
int
streamer_open
(
struct
net_device
*
dev
)
{
{
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
unsigned
long
flags
;
unsigned
long
flags
;
char
open_error
[
255
];
char
open_error
[
255
];
int
i
,
open_finished
=
1
;
int
i
,
open_finished
=
1
;
...
@@ -908,7 +908,7 @@ static void streamer_rx(struct net_device *dev)
...
@@ -908,7 +908,7 @@ static void streamer_rx(struct net_device *dev)
{
{
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
struct
streamer_rx_desc
*
rx_desc
;
struct
streamer_rx_desc
*
rx_desc
;
int
rx_ring_last_received
,
length
,
frame_length
,
buffer_cnt
=
0
;
int
rx_ring_last_received
,
length
,
frame_length
,
buffer_cnt
=
0
;
struct
sk_buff
*
skb
,
*
skb2
;
struct
sk_buff
*
skb
,
*
skb2
;
...
@@ -1035,7 +1035,7 @@ static irqreturn_t streamer_interrupt(int irq, void *dev_id, struct pt_regs *reg
...
@@ -1035,7 +1035,7 @@ static irqreturn_t streamer_interrupt(int irq, void *dev_id, struct pt_regs *reg
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u16
sisr
;
__u16
sisr
;
__u16
misr
;
__u16
misr
;
u8
max_intr
=
MAX_INTR
;
u8
max_intr
=
MAX_INTR
;
...
@@ -1158,7 +1158,7 @@ static int streamer_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -1158,7 +1158,7 @@ static int streamer_xmit(struct sk_buff *skb, struct net_device *dev)
{
{
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
streamer_priv
->
streamer_lock
,
flags
);
spin_lock_irqsave
(
&
streamer_priv
->
streamer_lock
,
flags
);
...
@@ -1209,7 +1209,7 @@ static int streamer_close(struct net_device *dev)
...
@@ -1209,7 +1209,7 @@ static int streamer_close(struct net_device *dev)
{
{
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
unsigned
long
flags
;
unsigned
long
flags
;
int
i
;
int
i
;
...
@@ -1275,7 +1275,7 @@ static void streamer_set_rx_mode(struct net_device *dev)
...
@@ -1275,7 +1275,7 @@ static void streamer_set_rx_mode(struct net_device *dev)
{
{
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
options
=
0
;
__u8
options
=
0
;
struct
dev_mc_list
*
dmi
;
struct
dev_mc_list
*
dmi
;
unsigned
char
dev_mc_address
[
5
];
unsigned
char
dev_mc_address
[
5
];
...
@@ -1334,7 +1334,7 @@ static void streamer_set_rx_mode(struct net_device *dev)
...
@@ -1334,7 +1334,7 @@ static void streamer_set_rx_mode(struct net_device *dev)
static
void
streamer_srb_bh
(
struct
net_device
*
dev
)
static
void
streamer_srb_bh
(
struct
net_device
*
dev
)
{
{
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u16
srb_word
;
__u16
srb_word
;
writew
(
streamer_priv
->
srb
,
streamer_mmio
+
LAPA
);
writew
(
streamer_priv
->
srb
,
streamer_mmio
+
LAPA
);
...
@@ -1531,7 +1531,7 @@ static void streamer_arb_cmd(struct net_device *dev)
...
@@ -1531,7 +1531,7 @@ static void streamer_arb_cmd(struct net_device *dev)
{
{
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
header_len
;
__u8
header_len
;
__u16
frame_len
,
buffer_len
;
__u16
frame_len
,
buffer_len
;
struct
sk_buff
*
mac_frame
;
struct
sk_buff
*
mac_frame
;
...
@@ -1747,7 +1747,7 @@ static void streamer_asb_bh(struct net_device *dev)
...
@@ -1747,7 +1747,7 @@ static void streamer_asb_bh(struct net_device *dev)
{
{
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
if
(
streamer_priv
->
asb_queued
==
1
)
if
(
streamer_priv
->
asb_queued
==
1
)
{
{
...
@@ -1855,7 +1855,7 @@ static int sprintf_info(char *buffer, struct net_device *dev)
...
@@ -1855,7 +1855,7 @@ static int sprintf_info(char *buffer, struct net_device *dev)
{
{
struct
streamer_private
*
streamer_priv
=
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
(
struct
streamer_private
*
)
dev
->
priv
;
__u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
struct
streamer_adapter_addr_table
sat
;
struct
streamer_adapter_addr_table
sat
;
struct
streamer_parameters_table
spt
;
struct
streamer_parameters_table
spt
;
int
size
=
0
;
int
size
=
0
;
...
@@ -1939,7 +1939,7 @@ static int streamer_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -1939,7 +1939,7 @@ static int streamer_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
{
int
i
;
int
i
;
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
struct
streamer_private
*
streamer_priv
=
(
struct
streamer_private
*
)
dev
->
priv
;
u8
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
u8
__iomem
*
streamer_mmio
=
streamer_priv
->
streamer_mmio
;
switch
(
cmd
)
{
switch
(
cmd
)
{
case
IOCTL_SISR_MASK
:
case
IOCTL_SISR_MASK
:
...
...
drivers/net/tokenring/lanstreamer.h
View file @
7bedd791
...
@@ -293,7 +293,7 @@ struct streamer_private {
...
@@ -293,7 +293,7 @@ struct streamer_private {
struct
streamer_private
*
next
;
struct
streamer_private
*
next
;
struct
pci_dev
*
pci_dev
;
struct
pci_dev
*
pci_dev
;
__u8
*
streamer_mmio
;
__u8
__iomem
*
streamer_mmio
;
char
*
streamer_card_name
;
char
*
streamer_card_name
;
spinlock_t
streamer_lock
;
spinlock_t
streamer_lock
;
...
...
drivers/net/tokenring/olympic.c
View file @
7bedd791
...
@@ -438,8 +438,8 @@ static int olympic_open(struct net_device *dev)
...
@@ -438,8 +438,8 @@ static int olympic_open(struct net_device *dev)
struct
olympic_private
*
olympic_priv
=
(
struct
olympic_private
*
)
dev
->
priv
;
struct
olympic_private
*
olympic_priv
=
(
struct
olympic_private
*
)
dev
->
priv
;
u8
__iomem
*
olympic_mmio
=
olympic_priv
->
olympic_mmio
,
*
init_srb
;
u8
__iomem
*
olympic_mmio
=
olympic_priv
->
olympic_mmio
,
*
init_srb
;
unsigned
long
flags
,
t
;
unsigned
long
flags
,
t
;
char
open_error
[
255
]
;
int
i
,
open_finished
=
1
;
int
i
,
open_finished
=
1
;
u8
resp
,
err
;
DECLARE_WAITQUEUE
(
wait
,
current
)
;
DECLARE_WAITQUEUE
(
wait
,
current
)
;
...
@@ -540,35 +540,33 @@ static int olympic_open(struct net_device *dev)
...
@@ -540,35 +540,33 @@ static int olympic_open(struct net_device *dev)
* timed out.
* timed out.
*/
*/
if
(
readb
(
init_srb
+
2
)
==
OLYMPIC_CLEAR_RET_CODE
)
{
switch
(
resp
=
readb
(
init_srb
+
2
))
{
case
OLYMPIC_CLEAR_RET_CODE
:
printk
(
KERN_WARNING
"%s: Adapter Open time out or error.
\n
"
,
dev
->
name
)
;
printk
(
KERN_WARNING
"%s: Adapter Open time out or error.
\n
"
,
dev
->
name
)
;
return
-
EIO
;
goto
out
;
}
case
0
:
open_finished
=
1
;
if
(
readb
(
init_srb
+
2
)
!=
0
)
{
break
;
if
(
readb
(
init_srb
+
2
)
==
0x07
)
{
case
0x07
:
if
(
!
olympic_priv
->
olympic_ring_speed
&&
open_finished
)
{
/* Autosense , first time around */
if
(
!
olympic_priv
->
olympic_ring_speed
&&
open_finished
)
{
/* Autosense , first time around */
printk
(
KERN_WARNING
"%s: Retrying at different ring speed
\n
"
,
dev
->
name
);
printk
(
KERN_WARNING
"%s: Retrying at different ring speed
\n
"
,
dev
->
name
);
open_finished
=
0
;
open_finished
=
0
;
}
else
{
continue
;
}
strcpy
(
open_error
,
open_maj_error
[(
readb
(
init_srb
+
7
)
&
0xf0
)
>>
4
])
;
err
=
readb
(
init_srb
+
7
);
strcat
(
open_error
,
" - "
)
;
strcat
(
open_error
,
open_min_error
[(
readb
(
init_srb
+
7
)
&
0x0f
)])
;
if
(
!
olympic_priv
->
olympic_ring_speed
&&
((
readb
(
init_srb
+
7
)
&
0x0f
)
==
0x0d
))
{
if
(
!
olympic_priv
->
olympic_ring_speed
&&
((
err
&
0x0f
)
==
0x0d
))
{
printk
(
KERN_WARNING
"%s: Tried to autosense ring speed with no monitors present
\n
"
,
dev
->
name
);
printk
(
KERN_WARNING
"%s: Tried to autosense ring speed with no monitors present
\n
"
,
dev
->
name
);
printk
(
KERN_WARNING
"%s: Please try again with a specified ring speed
\n
"
,
dev
->
name
);
printk
(
KERN_WARNING
"%s: Please try again with a specified ring speed
\n
"
,
dev
->
name
);
free_irq
(
dev
->
irq
,
dev
);
}
else
{
return
-
EIO
;
printk
(
KERN_WARNING
"%s: %s - %s
\n
"
,
dev
->
name
,
open_maj_error
[(
err
&
0xf0
)
>>
4
],
open_min_error
[(
err
&
0x0f
)]);
}
}
goto
out
;
printk
(
KERN_WARNING
"%s: %s
\n
"
,
dev
->
name
,
open_error
);
case
0x32
:
free_irq
(
dev
->
irq
,
dev
)
;
return
-
EIO
;
}
/* if autosense && open_finished */
}
else
if
(
init_srb
[
2
]
==
0x32
)
{
printk
(
KERN_WARNING
"%s: Invalid LAA: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
printk
(
KERN_WARNING
"%s: Invalid LAA: %02x:%02x:%02x:%02x:%02x:%02x
\n
"
,
dev
->
name
,
dev
->
name
,
olympic_priv
->
olympic_laa
[
0
],
olympic_priv
->
olympic_laa
[
0
],
...
@@ -577,15 +575,13 @@ static int olympic_open(struct net_device *dev)
...
@@ -577,15 +575,13 @@ static int olympic_open(struct net_device *dev)
olympic_priv
->
olympic_laa
[
3
],
olympic_priv
->
olympic_laa
[
3
],
olympic_priv
->
olympic_laa
[
4
],
olympic_priv
->
olympic_laa
[
4
],
olympic_priv
->
olympic_laa
[
5
])
;
olympic_priv
->
olympic_laa
[
5
])
;
free_irq
(
dev
->
irq
,
dev
)
;
goto
out
;
return
-
EIO
;
}
else
{
default:
printk
(
KERN_WARNING
"%s: Bad OPEN response: %x
\n
"
,
dev
->
name
,
init_srb
[
2
]
);
printk
(
KERN_WARNING
"%s: Bad OPEN response: %x
\n
"
,
dev
->
name
,
resp
);
free_irq
(
dev
->
irq
,
dev
)
;
goto
out
;
return
-
EIO
;
}
}
}
else
open_finished
=
1
;
}
while
(
!
(
open_finished
))
;
/* Will only loop if ring speed mismatch re-open attempted && autosense is on */
}
while
(
!
(
open_finished
))
;
/* Will only loop if ring speed mismatch re-open attempted && autosense is on */
if
(
readb
(
init_srb
+
18
)
&
(
1
<<
3
))
if
(
readb
(
init_srb
+
18
)
&
(
1
<<
3
))
...
@@ -634,8 +630,7 @@ static int olympic_open(struct net_device *dev)
...
@@ -634,8 +630,7 @@ static int olympic_open(struct net_device *dev)
if
(
i
==
0
)
{
if
(
i
==
0
)
{
printk
(
KERN_WARNING
"%s: Not enough memory to allocate rx buffers. Adapter disabled
\n
"
,
dev
->
name
);
printk
(
KERN_WARNING
"%s: Not enough memory to allocate rx buffers. Adapter disabled
\n
"
,
dev
->
name
);
free_irq
(
dev
->
irq
,
dev
);
goto
out
;
return
-
EIO
;
}
}
olympic_priv
->
rx_ring_dma_addr
=
pci_map_single
(
olympic_priv
->
pdev
,
olympic_priv
->
olympic_rx_ring
,
olympic_priv
->
rx_ring_dma_addr
=
pci_map_single
(
olympic_priv
->
pdev
,
olympic_priv
->
olympic_rx_ring
,
...
@@ -738,6 +733,9 @@ static int olympic_open(struct net_device *dev)
...
@@ -738,6 +733,9 @@ static int olympic_open(struct net_device *dev)
netif_start_queue
(
dev
);
netif_start_queue
(
dev
);
return
0
;
return
0
;
out:
free_irq
(
dev
->
irq
,
dev
);
return
-
EIO
;
}
}
/*
/*
...
...
drivers/net/wireless/airo.c
View file @
7bedd791
...
@@ -970,7 +970,7 @@ typedef struct {
...
@@ -970,7 +970,7 @@ typedef struct {
* Host receive descriptor
* Host receive descriptor
*/
*/
typedef
struct
{
typedef
struct
{
unsigned
char
*
card_ram_off
;
/* offset into card memory of the
unsigned
char
__iomem
*
card_ram_off
;
/* offset into card memory of the
desc */
desc */
RxFid
rx_desc
;
/* card receive descriptor */
RxFid
rx_desc
;
/* card receive descriptor */
char
*
virtual_host_addr
;
/* virtual address of host receive
char
*
virtual_host_addr
;
/* virtual address of host receive
...
@@ -982,7 +982,7 @@ typedef struct {
...
@@ -982,7 +982,7 @@ typedef struct {
* Host transmit descriptor
* Host transmit descriptor
*/
*/
typedef
struct
{
typedef
struct
{
unsigned
char
*
card_ram_off
;
/* offset into card memory of the
unsigned
char
__iomem
*
card_ram_off
;
/* offset into card memory of the
desc */
desc */
TxFid
tx_desc
;
/* card transmit descriptor */
TxFid
tx_desc
;
/* card transmit descriptor */
char
*
virtual_host_addr
;
/* virtual address of host receive
char
*
virtual_host_addr
;
/* virtual address of host receive
...
@@ -994,7 +994,7 @@ typedef struct {
...
@@ -994,7 +994,7 @@ typedef struct {
* Host RID descriptor
* Host RID descriptor
*/
*/
typedef
struct
{
typedef
struct
{
unsigned
char
*
card_ram_off
;
/* offset into card memory of the
unsigned
char
__iomem
*
card_ram_off
;
/* offset into card memory of the
descriptor */
descriptor */
Rid
rid_desc
;
/* card RID descriptor */
Rid
rid_desc
;
/* card RID descriptor */
char
*
virtual_host_addr
;
/* virtual address of host receive
char
*
virtual_host_addr
;
/* virtual address of host receive
...
@@ -1203,8 +1203,8 @@ struct airo_info {
...
@@ -1203,8 +1203,8 @@ struct airo_info {
unsigned
long
ridbus
;
// phys addr of config_desc
unsigned
long
ridbus
;
// phys addr of config_desc
struct
sk_buff_head
txq
;
// tx queue used by mpi350 code
struct
sk_buff_head
txq
;
// tx queue used by mpi350 code
struct
pci_dev
*
pci
;
struct
pci_dev
*
pci
;
unsigned
char
*
pcimem
;
unsigned
char
__iomem
*
pcimem
;
unsigned
char
*
pciaux
;
unsigned
char
__iomem
*
pciaux
;
unsigned
char
*
shared
;
unsigned
char
*
shared
;
dma_addr_t
shared_dma
;
dma_addr_t
shared_dma
;
int
power
;
int
power
;
...
@@ -2029,8 +2029,8 @@ static int mpi_send_packet (struct net_device *dev)
...
@@ -2029,8 +2029,8 @@ static int mpi_send_packet (struct net_device *dev)
memcpy
(
sendbuf
,
buffer
,
len
);
memcpy
(
sendbuf
,
buffer
,
len
);
}
}
memcpy
((
char
*
)
ai
->
txfids
[
0
].
card_ram_off
,
memcpy
_toio
(
ai
->
txfids
[
0
].
card_ram_off
,
(
char
*
)
&
ai
->
txfids
[
0
].
tx_desc
,
sizeof
(
TxFid
));
&
ai
->
txfids
[
0
].
tx_desc
,
sizeof
(
TxFid
));
OUT4500
(
ai
,
EVACK
,
8
);
OUT4500
(
ai
,
EVACK
,
8
);
...
@@ -2460,7 +2460,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
...
@@ -2460,7 +2460,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
}
}
for
(
i
=
0
;
i
<
MPI_MAX_FIDS
;
i
++
)
{
for
(
i
=
0
;
i
<
MPI_MAX_FIDS
;
i
++
)
{
memcpy
(
ai
->
rxfids
[
i
].
card_ram_off
,
memcpy
_toio
(
ai
->
rxfids
[
i
].
card_ram_off
,
&
ai
->
rxfids
[
i
].
rx_desc
,
sizeof
(
RxFid
));
&
ai
->
rxfids
[
i
].
rx_desc
,
sizeof
(
RxFid
));
}
}
...
@@ -2476,7 +2476,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
...
@@ -2476,7 +2476,7 @@ static int mpi_init_descriptors (struct airo_info *ai)
for
(
i
=
0
;
i
<
MPI_MAX_FIDS
;
i
++
)
{
for
(
i
=
0
;
i
<
MPI_MAX_FIDS
;
i
++
)
{
ai
->
txfids
[
i
].
tx_desc
.
valid
=
1
;
ai
->
txfids
[
i
].
tx_desc
.
valid
=
1
;
memcpy
((
char
*
)
ai
->
txfids
[
i
].
card_ram_off
,
memcpy
_toio
(
ai
->
txfids
[
i
].
card_ram_off
,
&
ai
->
txfids
[
i
].
tx_desc
,
sizeof
(
TxFid
));
&
ai
->
txfids
[
i
].
tx_desc
,
sizeof
(
TxFid
));
}
}
ai
->
txfids
[
i
-
1
].
tx_desc
.
eoc
=
1
;
/* Last descriptor has EOC set */
ai
->
txfids
[
i
-
1
].
tx_desc
.
eoc
=
1
;
/* Last descriptor has EOC set */
...
@@ -2501,8 +2501,8 @@ static int mpi_init_descriptors (struct airo_info *ai)
...
@@ -2501,8 +2501,8 @@ static int mpi_init_descriptors (struct airo_info *ai)
return
rc
;
return
rc
;
}
}
memcpy
((
char
*
)
ai
->
config_desc
.
card_ram_off
,
memcpy
_toio
(
ai
->
config_desc
.
card_ram_off
,
(
char
*
)
&
ai
->
config_desc
.
rid_desc
,
sizeof
(
Rid
));
&
ai
->
config_desc
.
rid_desc
,
sizeof
(
Rid
));
return
rc
;
return
rc
;
}
}
...
@@ -2520,7 +2520,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci,
...
@@ -2520,7 +2520,7 @@ static int mpi_map_card(struct airo_info *ai, struct pci_dev *pci,
int
rc
=
-
1
;
int
rc
=
-
1
;
int
i
;
int
i
;
unsigned
char
*
busaddroff
,
*
vpackoff
;
unsigned
char
*
busaddroff
,
*
vpackoff
;
unsigned
char
*
pciaddroff
;
unsigned
char
__iomem
*
pciaddroff
;
mem_start
=
pci_resource_start
(
pci
,
1
);
mem_start
=
pci_resource_start
(
pci
,
1
);
mem_len
=
pci_resource_len
(
pci
,
1
);
mem_len
=
pci_resource_len
(
pci
,
1
);
...
@@ -3441,7 +3441,7 @@ static void mpi_receive_802_3(struct airo_info *ai)
...
@@ -3441,7 +3441,7 @@ static void mpi_receive_802_3(struct airo_info *ai)
MICBuffer
micbuf
;
MICBuffer
micbuf
;
#endif
#endif
memcpy
((
char
*
)
&
rxd
,
ai
->
rxfids
[
0
].
card_ram_off
,
sizeof
(
rxd
));
memcpy
_fromio
(
&
rxd
,
ai
->
rxfids
[
0
].
card_ram_off
,
sizeof
(
rxd
));
/* Make sure we got something */
/* Make sure we got something */
if
(
rxd
.
rdy
&&
rxd
.
valid
==
0
)
{
if
(
rxd
.
rdy
&&
rxd
.
valid
==
0
)
{
len
=
rxd
.
len
+
12
;
len
=
rxd
.
len
+
12
;
...
@@ -3504,7 +3504,7 @@ static void mpi_receive_802_3(struct airo_info *ai)
...
@@ -3504,7 +3504,7 @@ static void mpi_receive_802_3(struct airo_info *ai)
rxd
.
valid
=
1
;
rxd
.
valid
=
1
;
rxd
.
rdy
=
0
;
rxd
.
rdy
=
0
;
rxd
.
len
=
PKTSIZE
;
rxd
.
len
=
PKTSIZE
;
memcpy
(
ai
->
rxfids
[
0
].
card_ram_off
,
(
char
*
)
&
rxd
,
sizeof
(
rxd
));
memcpy
_toio
(
ai
->
rxfids
[
0
].
card_ram_off
,
&
rxd
,
sizeof
(
rxd
));
}
}
}
}
...
@@ -3526,7 +3526,7 @@ void mpi_receive_802_11 (struct airo_info *ai)
...
@@ -3526,7 +3526,7 @@ void mpi_receive_802_11 (struct airo_info *ai)
u16
*
buffer
;
u16
*
buffer
;
char
*
ptr
=
ai
->
rxfids
[
0
].
virtual_host_addr
+
4
;
char
*
ptr
=
ai
->
rxfids
[
0
].
virtual_host_addr
+
4
;
memcpy
((
char
*
)
&
rxd
,
ai
->
rxfids
[
0
].
card_ram_off
,
sizeof
(
rxd
));
memcpy
_fromio
(
&
rxd
,
ai
->
rxfids
[
0
].
card_ram_off
,
sizeof
(
rxd
));
memcpy
((
char
*
)
&
hdr
,
ptr
,
sizeof
(
hdr
));
memcpy
((
char
*
)
&
hdr
,
ptr
,
sizeof
(
hdr
));
ptr
+=
sizeof
(
hdr
);
ptr
+=
sizeof
(
hdr
);
/* Bad CRC. Ignore packet */
/* Bad CRC. Ignore packet */
...
@@ -3610,7 +3610,7 @@ void mpi_receive_802_11 (struct airo_info *ai)
...
@@ -3610,7 +3610,7 @@ void mpi_receive_802_11 (struct airo_info *ai)
rxd
.
valid
=
1
;
rxd
.
valid
=
1
;
rxd
.
rdy
=
0
;
rxd
.
rdy
=
0
;
rxd
.
len
=
PKTSIZE
;
rxd
.
len
=
PKTSIZE
;
memcpy
(
ai
->
rxfids
[
0
].
card_ram_off
,
(
char
*
)
&
rxd
,
sizeof
(
rxd
));
memcpy
_toio
(
ai
->
rxfids
[
0
].
card_ram_off
,
&
rxd
,
sizeof
(
rxd
));
}
}
}
}
...
@@ -3990,8 +3990,8 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, in
...
@@ -3990,8 +3990,8 @@ static int PC4500_readrid(struct airo_info *ai, u16 rid, void *pBuf, int len, in
cmd
.
cmd
=
CMD_ACCESS
;
cmd
.
cmd
=
CMD_ACCESS
;
cmd
.
parm0
=
rid
;
cmd
.
parm0
=
rid
;
memcpy
((
char
*
)
ai
->
config_desc
.
card_ram_off
,
memcpy
_toio
(
ai
->
config_desc
.
card_ram_off
,
(
char
*
)
&
ai
->
config_desc
.
rid_desc
,
sizeof
(
Rid
));
&
ai
->
config_desc
.
rid_desc
,
sizeof
(
Rid
));
rc
=
issuecommand
(
ai
,
&
cmd
,
&
rsp
);
rc
=
issuecommand
(
ai
,
&
cmd
,
&
rsp
);
...
@@ -4062,8 +4062,8 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
...
@@ -4062,8 +4062,8 @@ static int PC4500_writerid(struct airo_info *ai, u16 rid,
cmd
.
cmd
=
CMD_WRITERID
;
cmd
.
cmd
=
CMD_WRITERID
;
cmd
.
parm0
=
rid
;
cmd
.
parm0
=
rid
;
memcpy
((
char
*
)
ai
->
config_desc
.
card_ram_off
,
memcpy
_toio
(
ai
->
config_desc
.
card_ram_off
,
(
char
*
)
&
ai
->
config_desc
.
rid_desc
,
sizeof
(
Rid
));
&
ai
->
config_desc
.
rid_desc
,
sizeof
(
Rid
));
if
(
len
<
4
||
len
>
2047
)
{
if
(
len
<
4
||
len
>
2047
)
{
printk
(
KERN_ERR
"%s: len=%d
\n
"
,
__FUNCTION__
,
len
);
printk
(
KERN_ERR
"%s: len=%d
\n
"
,
__FUNCTION__
,
len
);
...
@@ -7591,7 +7591,7 @@ int flashputbuf(struct airo_info *ai){
...
@@ -7591,7 +7591,7 @@ int flashputbuf(struct airo_info *ai){
/* Write stuff */
/* Write stuff */
if
(
test_bit
(
FLAG_MPI
,
&
ai
->
flags
))
if
(
test_bit
(
FLAG_MPI
,
&
ai
->
flags
))
memcpy
(
ai
->
pciaux
+
0x8000
,
ai
->
flash
,
FLASHSIZE
);
memcpy
_toio
(
ai
->
pciaux
+
0x8000
,
ai
->
flash
,
FLASHSIZE
);
else
{
else
{
OUT4500
(
ai
,
AUXPAGE
,
0x100
);
OUT4500
(
ai
,
AUXPAGE
,
0x100
);
OUT4500
(
ai
,
AUXOFF
,
0
);
OUT4500
(
ai
,
AUXOFF
,
0
);
...
...
drivers/net/wireless/arlan-main.c
View file @
7bedd791
...
@@ -129,7 +129,7 @@ static inline long us2ticks(int us)
...
@@ -129,7 +129,7 @@ static inline long us2ticks(int us)
static
inline
int
arlan_drop_tx
(
struct
net_device
*
dev
)
static
inline
int
arlan_drop_tx
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
priv
->
stats
.
tx_errors
++
;
priv
->
stats
.
tx_errors
++
;
if
(
priv
->
Conf
->
tx_delay_ms
)
if
(
priv
->
Conf
->
tx_delay_ms
)
...
@@ -152,8 +152,8 @@ static inline int arlan_drop_tx(struct net_device *dev)
...
@@ -152,8 +152,8 @@ static inline int arlan_drop_tx(struct net_device *dev)
int
arlan_command
(
struct
net_device
*
dev
,
int
command_p
)
int
arlan_command
(
struct
net_device
*
dev
,
int
command_p
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
int
udelayed
=
0
;
int
udelayed
=
0
;
int
i
=
0
;
int
i
=
0
;
...
@@ -368,7 +368,7 @@ int arlan_command(struct net_device *dev, int command_p)
...
@@ -368,7 +368,7 @@ int arlan_command(struct net_device *dev, int command_p)
if
(
!
registrationBad
(
dev
))
if
(
!
registrationBad
(
dev
))
{
{
setInterruptEnable
(
dev
);
setInterruptEnable
(
dev
);
memset_io
(
(
void
*
)
arlan
->
commandParameter
,
0
,
0xf
);
memset_io
(
arlan
->
commandParameter
,
0
,
0xf
);
WRITESHMB
(
arlan
->
commandByte
,
ARLAN_COM_INT
|
ARLAN_COM_RX_ENABLE
);
WRITESHMB
(
arlan
->
commandByte
,
ARLAN_COM_INT
|
ARLAN_COM_RX_ENABLE
);
WRITESHMB
(
arlan
->
commandParameter
[
0
],
conf
->
rxParameter
);
WRITESHMB
(
arlan
->
commandParameter
[
0
],
conf
->
rxParameter
);
arlan_interrupt_lancpu
(
dev
);
arlan_interrupt_lancpu
(
dev
);
...
@@ -398,9 +398,9 @@ int arlan_command(struct net_device *dev, int command_p)
...
@@ -398,9 +398,9 @@ int arlan_command(struct net_device *dev, int command_p)
priv
->
last_rx_int_ack_time
+
us2ticks
(
conf
->
rx_tweak2
)))
priv
->
last_rx_int_ack_time
+
us2ticks
(
conf
->
rx_tweak2
)))
{
{
setInterruptEnable
(
dev
);
setInterruptEnable
(
dev
);
memset_io
(
(
void
*
)
arlan
->
commandParameter
,
0
,
0xf
);
memset_io
(
arlan
->
commandParameter
,
0
,
0xf
);
WRITESHMB
(
arlan
->
commandByte
,
ARLAN_COM_TX_ENABLE
|
ARLAN_COM_INT
);
WRITESHMB
(
arlan
->
commandByte
,
ARLAN_COM_TX_ENABLE
|
ARLAN_COM_INT
);
memcpy_toio
(
(
void
*
)
arlan
->
commandParameter
,
&
TXLAST
(
dev
),
14
);
memcpy_toio
(
arlan
->
commandParameter
,
&
TXLAST
(
dev
),
14
);
// for ( i=1 ; i < 15 ; i++) printk("%02x:",READSHMB(arlan->commandParameter[i]));
// for ( i=1 ; i < 15 ; i++) printk("%02x:",READSHMB(arlan->commandParameter[i]));
priv
->
tx_last_sent
=
jiffies
;
priv
->
tx_last_sent
=
jiffies
;
arlan_interrupt_lancpu
(
dev
);
arlan_interrupt_lancpu
(
dev
);
...
@@ -481,7 +481,7 @@ int arlan_command(struct net_device *dev, int command_p)
...
@@ -481,7 +481,7 @@ int arlan_command(struct net_device *dev, int command_p)
static
inline
void
arlan_command_process
(
struct
net_device
*
dev
)
static
inline
void
arlan_command_process
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
int
times
=
0
;
int
times
=
0
;
while
(
priv
->
waiting_command_mask
&&
times
<
8
)
while
(
priv
->
waiting_command_mask
&&
times
<
8
)
...
@@ -502,7 +502,7 @@ static inline void arlan_command_process(struct net_device *dev)
...
@@ -502,7 +502,7 @@ static inline void arlan_command_process(struct net_device *dev)
static
inline
void
arlan_retransmit_now
(
struct
net_device
*
dev
)
static
inline
void
arlan_retransmit_now
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
ARLAN_DEBUG_ENTRY
(
"arlan_retransmit_now"
);
ARLAN_DEBUG_ENTRY
(
"arlan_retransmit_now"
);
...
@@ -540,7 +540,7 @@ static inline void arlan_retransmit_now(struct net_device *dev)
...
@@ -540,7 +540,7 @@ static inline void arlan_retransmit_now(struct net_device *dev)
static
void
arlan_registration_timer
(
unsigned
long
data
)
static
void
arlan_registration_timer
(
unsigned
long
data
)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
data
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
data
;
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
int
bh_mark_needed
=
0
;
int
bh_mark_needed
=
0
;
int
next_tick
=
1
;
int
next_tick
=
1
;
long
lostTime
=
((
long
)
jiffies
-
(
long
)
priv
->
registrationLastSeen
)
long
lostTime
=
((
long
)
jiffies
-
(
long
)
priv
->
registrationLastSeen
)
...
@@ -633,7 +633,7 @@ static void arlan_registration_timer(unsigned long data)
...
@@ -633,7 +633,7 @@ static void arlan_registration_timer(unsigned long data)
static
void
arlan_print_registers
(
struct
net_device
*
dev
,
int
line
)
static
void
arlan_print_registers
(
struct
net_device
*
dev
,
int
line
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
u_char
hostcpuLock
,
lancpuLock
,
controlRegister
,
cntrlRegImage
,
u_char
hostcpuLock
,
lancpuLock
,
controlRegister
,
cntrlRegImage
,
...
@@ -663,8 +663,8 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
...
@@ -663,8 +663,8 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
{
{
int
i
;
int
i
;
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
int
tailStarts
=
0x800
;
int
tailStarts
=
0x800
;
...
@@ -673,9 +673,9 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
...
@@ -673,9 +673,9 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
ARLAN_DEBUG_ENTRY
(
"arlan_hw_tx"
);
ARLAN_DEBUG_ENTRY
(
"arlan_hw_tx"
);
if
(
TXHEAD
(
dev
).
offset
)
if
(
TXHEAD
(
dev
).
offset
)
headEnds
=
(((
TXHEAD
(
dev
).
offset
+
TXHEAD
(
dev
).
length
-
(((
int
)
arlan
->
txBuffer
)
-
((
int
)
arlan
)
))
/
64
)
+
1
)
*
64
;
headEnds
=
(((
TXHEAD
(
dev
).
offset
+
TXHEAD
(
dev
).
length
-
offsetof
(
struct
arlan_shmem
,
txBuffer
))
/
64
)
+
1
)
*
64
;
if
(
TXTAIL
(
dev
).
offset
)
if
(
TXTAIL
(
dev
).
offset
)
tailStarts
=
0x800
-
(((
TXTAIL
(
dev
).
offset
-
(((
int
)
arlan
->
txBuffer
)
-
((
int
)
arlan
)
))
/
64
)
+
2
)
*
64
;
tailStarts
=
0x800
-
(((
TXTAIL
(
dev
).
offset
-
offsetof
(
struct
arlan_shmem
,
txBuffer
))
/
64
)
+
2
)
*
64
;
if
(
!
TXHEAD
(
dev
).
offset
&&
length
<
tailStarts
)
if
(
!
TXHEAD
(
dev
).
offset
&&
length
<
tailStarts
)
...
@@ -684,7 +684,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
...
@@ -684,7 +684,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
printk
(
KERN_ERR
"TXHEAD insert, tailStart %d
\n
"
,
tailStarts
);
printk
(
KERN_ERR
"TXHEAD insert, tailStart %d
\n
"
,
tailStarts
);
TXHEAD
(
dev
).
offset
=
TXHEAD
(
dev
).
offset
=
(((
int
)
arlan
->
txBuffer
)
-
((
int
)
arlan
)
);
offsetof
(
struct
arlan_shmem
,
txBuffer
);
TXHEAD
(
dev
).
length
=
length
-
ARLAN_FAKE_HDR_LEN
;
TXHEAD
(
dev
).
length
=
length
-
ARLAN_FAKE_HDR_LEN
;
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
TXHEAD
(
dev
).
dest
[
i
]
=
buf
[
i
];
TXHEAD
(
dev
).
dest
[
i
]
=
buf
[
i
];
...
@@ -692,7 +692,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
...
@@ -692,7 +692,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
TXHEAD
(
dev
).
retries
=
conf
->
txRetries
;
/* 0 is use default */
TXHEAD
(
dev
).
retries
=
conf
->
txRetries
;
/* 0 is use default */
TXHEAD
(
dev
).
routing
=
conf
->
txRouting
;
TXHEAD
(
dev
).
routing
=
conf
->
txRouting
;
TXHEAD
(
dev
).
scrambled
=
conf
->
txScrambled
;
TXHEAD
(
dev
).
scrambled
=
conf
->
txScrambled
;
memcpy_toio
((
(
char
*
)
arlan
+
TXHEAD
(
dev
).
offset
)
,
buf
+
ARLAN_FAKE_HDR_LEN
,
TXHEAD
(
dev
).
length
);
memcpy_toio
((
char
__iomem
*
)
arlan
+
TXHEAD
(
dev
).
offset
,
buf
+
ARLAN_FAKE_HDR_LEN
,
TXHEAD
(
dev
).
length
);
}
}
else
if
(
!
TXTAIL
(
dev
).
offset
&&
length
<
(
0x800
-
headEnds
))
else
if
(
!
TXTAIL
(
dev
).
offset
&&
length
<
(
0x800
-
headEnds
))
{
{
...
@@ -700,7 +700,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
...
@@ -700,7 +700,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
printk
(
KERN_ERR
"TXTAIL insert, headEnd %d
\n
"
,
headEnds
);
printk
(
KERN_ERR
"TXTAIL insert, headEnd %d
\n
"
,
headEnds
);
TXTAIL
(
dev
).
offset
=
TXTAIL
(
dev
).
offset
=
(((
int
)
arlan
->
txBuffer
)
-
((
int
)
arlan
)
)
+
0x800
-
(
length
/
64
+
2
)
*
64
;
offsetof
(
struct
arlan_shmem
,
txBuffer
)
+
0x800
-
(
length
/
64
+
2
)
*
64
;
TXTAIL
(
dev
).
length
=
length
-
ARLAN_FAKE_HDR_LEN
;
TXTAIL
(
dev
).
length
=
length
-
ARLAN_FAKE_HDR_LEN
;
for
(
i
=
0
;
i
<
6
;
i
++
)
for
(
i
=
0
;
i
<
6
;
i
++
)
TXTAIL
(
dev
).
dest
[
i
]
=
buf
[
i
];
TXTAIL
(
dev
).
dest
[
i
]
=
buf
[
i
];
...
@@ -708,7 +708,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
...
@@ -708,7 +708,7 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
TXTAIL
(
dev
).
retries
=
conf
->
txRetries
;
TXTAIL
(
dev
).
retries
=
conf
->
txRetries
;
TXTAIL
(
dev
).
routing
=
conf
->
txRouting
;
TXTAIL
(
dev
).
routing
=
conf
->
txRouting
;
TXTAIL
(
dev
).
scrambled
=
conf
->
txScrambled
;
TXTAIL
(
dev
).
scrambled
=
conf
->
txScrambled
;
memcpy_toio
(((
char
*
)
arlan
+
TXTAIL
(
dev
).
offset
),
buf
+
ARLAN_FAKE_HDR_LEN
,
TXTAIL
(
dev
).
length
);
memcpy_toio
(((
char
__iomem
*
)
arlan
+
TXTAIL
(
dev
).
offset
),
buf
+
ARLAN_FAKE_HDR_LEN
,
TXTAIL
(
dev
).
length
);
}
}
else
else
{
{
...
@@ -764,8 +764,8 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
...
@@ -764,8 +764,8 @@ static int arlan_hw_tx(struct net_device *dev, char *buf, int length)
static
int
arlan_hw_config
(
struct
net_device
*
dev
)
static
int
arlan_hw_config
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
ARLAN_DEBUG_ENTRY
(
"arlan_hw_config"
);
ARLAN_DEBUG_ENTRY
(
"arlan_hw_config"
);
...
@@ -847,8 +847,8 @@ static int arlan_hw_config(struct net_device *dev)
...
@@ -847,8 +847,8 @@ static int arlan_hw_config(struct net_device *dev)
static
int
arlan_read_card_configuration
(
struct
net_device
*
dev
)
static
int
arlan_read_card_configuration
(
struct
net_device
*
dev
)
{
{
u_char
tlx415
;
u_char
tlx415
;
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
ARLAN_DEBUG_ENTRY
(
"arlan_read_card_configuration"
);
ARLAN_DEBUG_ENTRY
(
"arlan_read_card_configuration"
);
...
@@ -972,7 +972,7 @@ static int lastFoundAt = 0xbe000;
...
@@ -972,7 +972,7 @@ static int lastFoundAt = 0xbe000;
static
int
__init
arlan_check_fingerprint
(
unsigned
long
memaddr
)
static
int
__init
arlan_check_fingerprint
(
unsigned
long
memaddr
)
{
{
static
const
char
probeText
[]
=
"TELESYSTEM SLW INC. ARLAN
\0
"
;
static
const
char
probeText
[]
=
"TELESYSTEM SLW INC. ARLAN
\0
"
;
volatile
struct
arlan_shmem
*
arlan
=
(
struct
arlan_shmem
*
)
memaddr
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
(
struct
arlan_shmem
*
)
memaddr
;
unsigned
long
paddr
=
virt_to_phys
((
void
*
)
memaddr
);
unsigned
long
paddr
=
virt_to_phys
((
void
*
)
memaddr
);
char
tempBuf
[
49
];
char
tempBuf
[
49
];
...
@@ -1000,7 +1000,7 @@ static int __init arlan_check_fingerprint(unsigned long memaddr)
...
@@ -1000,7 +1000,7 @@ static int __init arlan_check_fingerprint(unsigned long memaddr)
static
int
arlan_change_mtu
(
struct
net_device
*
dev
,
int
new_mtu
)
static
int
arlan_change_mtu
(
struct
net_device
*
dev
,
int
new_mtu
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
ARLAN_DEBUG_ENTRY
(
"arlan_change_mtu"
);
ARLAN_DEBUG_ENTRY
(
"arlan_change_mtu"
);
...
@@ -1040,7 +1040,7 @@ static int arlan_mac_addr(struct net_device *dev, void *p)
...
@@ -1040,7 +1040,7 @@ static int arlan_mac_addr(struct net_device *dev, void *p)
static
int
__init
arlan_setup_device
(
struct
net_device
*
dev
,
int
num
)
static
int
__init
arlan_setup_device
(
struct
net_device
*
dev
,
int
num
)
{
{
struct
arlan_private
*
ap
=
dev
->
priv
;
struct
arlan_private
*
ap
=
netdev_priv
(
dev
)
;
int
err
;
int
err
;
ARLAN_DEBUG_ENTRY
(
"arlan_setup_device"
);
ARLAN_DEBUG_ENTRY
(
"arlan_setup_device"
);
...
@@ -1081,7 +1081,7 @@ static int __init arlan_setup_device(struct net_device *dev, int num)
...
@@ -1081,7 +1081,7 @@ static int __init arlan_setup_device(struct net_device *dev, int num)
static
int
__init
arlan_probe_here
(
struct
net_device
*
dev
,
static
int
__init
arlan_probe_here
(
struct
net_device
*
dev
,
unsigned
long
memaddr
)
unsigned
long
memaddr
)
{
{
struct
arlan_private
*
ap
=
dev
->
priv
;
struct
arlan_private
*
ap
=
netdev_priv
(
dev
)
;
ARLAN_DEBUG_ENTRY
(
"arlan_probe_here"
);
ARLAN_DEBUG_ENTRY
(
"arlan_probe_here"
);
...
@@ -1110,8 +1110,8 @@ static int __init arlan_probe_here(struct net_device *dev,
...
@@ -1110,8 +1110,8 @@ static int __init arlan_probe_here(struct net_device *dev,
static
int
arlan_open
(
struct
net_device
*
dev
)
static
int
arlan_open
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
int
ret
=
0
;
int
ret
=
0
;
ARLAN_DEBUG_ENTRY
(
"arlan_open"
);
ARLAN_DEBUG_ENTRY
(
"arlan_open"
);
...
@@ -1208,7 +1208,7 @@ static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
...
@@ -1208,7 +1208,7 @@ static int arlan_tx(struct sk_buff *skb, struct net_device *dev)
static
inline
int
DoNotReTransmitCrap
(
struct
net_device
*
dev
)
static
inline
int
DoNotReTransmitCrap
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
if
(
TXLAST
(
dev
).
length
<
priv
->
Conf
->
ReTransmitPacketMaxSize
)
if
(
TXLAST
(
dev
).
length
<
priv
->
Conf
->
ReTransmitPacketMaxSize
)
return
1
;
return
1
;
...
@@ -1218,7 +1218,7 @@ static inline int DoNotReTransmitCrap(struct net_device *dev)
...
@@ -1218,7 +1218,7 @@ static inline int DoNotReTransmitCrap(struct net_device *dev)
static
inline
int
DoNotWaitReTransmitCrap
(
struct
net_device
*
dev
)
static
inline
int
DoNotWaitReTransmitCrap
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
if
(
TXLAST
(
dev
).
length
<
priv
->
Conf
->
waitReTransmitPacketMaxSize
)
if
(
TXLAST
(
dev
).
length
<
priv
->
Conf
->
waitReTransmitPacketMaxSize
)
return
1
;
return
1
;
...
@@ -1227,7 +1227,7 @@ static inline int DoNotWaitReTransmitCrap(struct net_device *dev)
...
@@ -1227,7 +1227,7 @@ static inline int DoNotWaitReTransmitCrap(struct net_device *dev)
static
inline
void
arlan_queue_retransmit
(
struct
net_device
*
dev
)
static
inline
void
arlan_queue_retransmit
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
ARLAN_DEBUG_ENTRY
(
"arlan_queue_retransmit"
);
ARLAN_DEBUG_ENTRY
(
"arlan_queue_retransmit"
);
...
@@ -1242,7 +1242,7 @@ static inline void arlan_queue_retransmit(struct net_device *dev)
...
@@ -1242,7 +1242,7 @@ static inline void arlan_queue_retransmit(struct net_device *dev)
static
inline
void
RetryOrFail
(
struct
net_device
*
dev
)
static
inline
void
RetryOrFail
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
ARLAN_DEBUG_ENTRY
(
"RetryOrFail"
);
ARLAN_DEBUG_ENTRY
(
"RetryOrFail"
);
...
@@ -1263,7 +1263,7 @@ static inline void RetryOrFail(struct net_device *dev)
...
@@ -1263,7 +1263,7 @@ static inline void RetryOrFail(struct net_device *dev)
static
void
arlan_tx_done_interrupt
(
struct
net_device
*
dev
,
int
status
)
static
void
arlan_tx_done_interrupt
(
struct
net_device
*
dev
,
int
status
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
ARLAN_DEBUG_ENTRY
(
"arlan_tx_done_interrupt"
);
ARLAN_DEBUG_ENTRY
(
"arlan_tx_done_interrupt"
);
...
@@ -1405,8 +1405,8 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
...
@@ -1405,8 +1405,8 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
char
*
skbtmp
;
char
*
skbtmp
;
int
i
=
0
;
int
i
=
0
;
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
...
@@ -1509,7 +1509,7 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
...
@@ -1509,7 +1509,7 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
skb
->
dev
=
dev
;
skb
->
dev
=
dev
;
skbtmp
=
skb_put
(
skb
,
pkt_len
);
skbtmp
=
skb_put
(
skb
,
pkt_len
);
memcpy_fromio
(
skbtmp
+
ARLAN_FAKE_HDR_LEN
,
((
char
*
)
arlan
)
+
rxOffset
,
pkt_len
-
ARLAN_FAKE_HDR_LEN
);
memcpy_fromio
(
skbtmp
+
ARLAN_FAKE_HDR_LEN
,
((
char
__iomem
*
)
arlan
)
+
rxOffset
,
pkt_len
-
ARLAN_FAKE_HDR_LEN
);
memcpy_fromio
(
skbtmp
,
arlan
->
ultimateDestAddress
,
6
);
memcpy_fromio
(
skbtmp
,
arlan
->
ultimateDestAddress
,
6
);
memcpy_fromio
(
skbtmp
+
6
,
arlan
->
rxSrc
,
6
);
memcpy_fromio
(
skbtmp
+
6
,
arlan
->
rxSrc
,
6
);
WRITESHMB
(
arlan
->
rxStatus
,
0x00
);
WRITESHMB
(
arlan
->
rxStatus
,
0x00
);
...
@@ -1557,8 +1557,8 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
...
@@ -1557,8 +1557,8 @@ static void arlan_rx_interrupt(struct net_device *dev, u_char rxStatus, u_short
static
void
arlan_process_interrupt
(
struct
net_device
*
dev
)
static
void
arlan_process_interrupt
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
u_char
rxStatus
=
READSHMB
(
arlan
->
rxStatus
);
u_char
rxStatus
=
READSHMB
(
arlan
->
rxStatus
);
u_char
txStatus
=
READSHMB
(
arlan
->
txStatus
);
u_char
txStatus
=
READSHMB
(
arlan
->
txStatus
);
u_short
rxOffset
=
READSHMS
(
arlan
->
rxOffset
);
u_short
rxOffset
=
READSHMS
(
arlan
->
rxOffset
);
...
@@ -1660,8 +1660,8 @@ static void arlan_process_interrupt(struct net_device *dev)
...
@@ -1660,8 +1660,8 @@ static void arlan_process_interrupt(struct net_device *dev)
static
irqreturn_t
arlan_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
static
irqreturn_t
arlan_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
{
struct
net_device
*
dev
=
dev_id
;
struct
net_device
*
dev
=
dev_id
;
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
u_char
rxStatus
=
READSHMB
(
arlan
->
rxStatus
);
u_char
rxStatus
=
READSHMB
(
arlan
->
rxStatus
);
u_char
txStatus
=
READSHMB
(
arlan
->
txStatus
);
u_char
txStatus
=
READSHMB
(
arlan
->
txStatus
);
...
@@ -1683,7 +1683,7 @@ static irqreturn_t arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs)
...
@@ -1683,7 +1683,7 @@ static irqreturn_t arlan_interrupt(int irq, void *dev_id, struct pt_regs *regs)
static
int
arlan_close
(
struct
net_device
*
dev
)
static
int
arlan_close
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
ARLAN_DEBUG_ENTRY
(
"arlan_close"
);
ARLAN_DEBUG_ENTRY
(
"arlan_close"
);
...
@@ -1717,8 +1717,8 @@ static long alignLong(volatile u_char * ptr)
...
@@ -1717,8 +1717,8 @@ static long alignLong(volatile u_char * ptr)
static
struct
net_device_stats
*
arlan_statistics
(
struct
net_device
*
dev
)
static
struct
net_device_stats
*
arlan_statistics
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
ARLAN_DEBUG_ENTRY
(
"arlan_statistics"
);
ARLAN_DEBUG_ENTRY
(
"arlan_statistics"
);
...
@@ -1747,8 +1747,8 @@ static struct net_device_stats *arlan_statistics(struct net_device *dev)
...
@@ -1747,8 +1747,8 @@ static struct net_device_stats *arlan_statistics(struct net_device *dev)
static
void
arlan_set_multicast
(
struct
net_device
*
dev
)
static
void
arlan_set_multicast
(
struct
net_device
*
dev
)
{
{
struct
arlan_private
*
priv
=
dev
->
priv
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
)
;
volatile
struct
arlan_shmem
*
arlan
=
priv
->
card
;
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
struct
arlan_conf_stru
*
conf
=
priv
->
Conf
;
int
board_conf_needed
=
0
;
int
board_conf_needed
=
0
;
...
...
drivers/net/wireless/arlan-proc.c
View file @
7bedd791
...
@@ -58,7 +58,8 @@
...
@@ -58,7 +58,8 @@
static
const
char
*
arlan_diagnostic_info_string
(
struct
net_device
*
dev
)
static
const
char
*
arlan_diagnostic_info_string
(
struct
net_device
*
dev
)
{
{
volatile
struct
arlan_shmem
*
arlan
=
((
struct
arlan_private
*
)
dev
->
priv
)
->
card
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
);
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
u_char
diagnosticInfo
;
u_char
diagnosticInfo
;
READSHM
(
diagnosticInfo
,
arlan
->
diagnosticInfo
,
u_char
);
READSHM
(
diagnosticInfo
,
arlan
->
diagnosticInfo
,
u_char
);
...
@@ -113,7 +114,8 @@ static const char *arlan_diagnostic_info_string(struct net_device *dev)
...
@@ -113,7 +114,8 @@ static const char *arlan_diagnostic_info_string(struct net_device *dev)
static
const
char
*
arlan_hardware_type_string
(
struct
net_device
*
dev
)
static
const
char
*
arlan_hardware_type_string
(
struct
net_device
*
dev
)
{
{
u_char
hardwareType
;
u_char
hardwareType
;
volatile
struct
arlan_shmem
*
arlan
=
((
struct
arlan_private
*
)
dev
->
priv
)
->
card
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
);
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
READSHM
(
hardwareType
,
arlan
->
hardwareType
,
u_char
);
READSHM
(
hardwareType
,
arlan
->
hardwareType
,
u_char
);
switch
(
hardwareType
)
switch
(
hardwareType
)
...
@@ -189,7 +191,8 @@ static void arlan_print_diagnostic_info(struct net_device *dev)
...
@@ -189,7 +191,8 @@ static void arlan_print_diagnostic_info(struct net_device *dev)
u_char
diagnosticInfo
;
u_char
diagnosticInfo
;
u_short
diagnosticOffset
;
u_short
diagnosticOffset
;
u_char
hardwareType
;
u_char
hardwareType
;
volatile
struct
arlan_shmem
*
arlan
=
((
struct
arlan_private
*
)
dev
->
priv
)
->
card
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
);
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
// ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
// ARLAN_DEBUG_ENTRY("arlan_print_diagnostic_info");
...
@@ -254,7 +257,8 @@ static int arlan_hw_test_memory(struct net_device *dev)
...
@@ -254,7 +257,8 @@ static int arlan_hw_test_memory(struct net_device *dev)
int
i
;
int
i
;
int
memlen
=
sizeof
(
struct
arlan_shmem
)
-
0xF
;
/* avoid control register */
int
memlen
=
sizeof
(
struct
arlan_shmem
)
-
0xF
;
/* avoid control register */
volatile
char
*
arlan_mem
=
(
char
*
)
(
dev
->
mem_start
);
volatile
char
*
arlan_mem
=
(
char
*
)
(
dev
->
mem_start
);
volatile
struct
arlan_shmem
*
arlan
=
((
struct
arlan_private
*
)
dev
->
priv
)
->
card
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
);
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
char
pattern
;
char
pattern
;
ptr
=
NULL
;
ptr
=
NULL
;
...
@@ -319,7 +323,8 @@ static int arlan_hw_test_memory(struct net_device *dev)
...
@@ -319,7 +323,8 @@ static int arlan_hw_test_memory(struct net_device *dev)
static
int
arlan_setup_card_by_book
(
struct
net_device
*
dev
)
static
int
arlan_setup_card_by_book
(
struct
net_device
*
dev
)
{
{
u_char
irqLevel
,
configuredStatusFlag
;
u_char
irqLevel
,
configuredStatusFlag
;
volatile
struct
arlan_shmem
*
arlan
=
((
struct
arlan_private
*
)
dev
->
priv
)
->
card
;
struct
arlan_private
*
priv
=
netdev_priv
(
dev
);
volatile
struct
arlan_shmem
__iomem
*
arlan
=
priv
->
card
;
// ARLAN_DEBUG_ENTRY("arlan_setup_card");
// ARLAN_DEBUG_ENTRY("arlan_setup_card");
...
...
drivers/net/wireless/arlan.h
View file @
7bedd791
...
@@ -332,7 +332,7 @@ struct TxParam
...
@@ -332,7 +332,7 @@ struct TxParam
/* Information that need to be kept for each board. */
/* Information that need to be kept for each board. */
struct
arlan_private
{
struct
arlan_private
{
struct
net_device_stats
stats
;
struct
net_device_stats
stats
;
struct
arlan_shmem
*
card
;
struct
arlan_shmem
__iomem
*
card
;
struct
arlan_shmem
*
conf
;
struct
arlan_shmem
*
conf
;
struct
arlan_conf_stru
*
Conf
;
struct
arlan_conf_stru
*
Conf
;
...
@@ -403,14 +403,12 @@ struct arlan_private {
...
@@ -403,14 +403,12 @@ struct arlan_private {
#define ARLAN_COM_INT 0x80
#define ARLAN_COM_INT 0x80
#define TXLAST(dev) (((struct arlan_private *)
dev->priv)->txRing[((struct arlan_private *)dev->priv
)->txLast])
#define TXLAST(dev) (((struct arlan_private *)
netdev_priv(dev))->txRing[((struct arlan_private *)netdev_priv(dev)
)->txLast])
#define TXHEAD(dev) (((struct arlan_private *)
dev->priv
)->txRing[0])
#define TXHEAD(dev) (((struct arlan_private *)
netdev_priv(dev)
)->txRing[0])
#define TXTAIL(dev) (((struct arlan_private *)
dev->priv
)->txRing[1])
#define TXTAIL(dev) (((struct arlan_private *)
netdev_priv(dev)
)->txRing[1])
#define TXBuffStart(dev) \
#define TXBuffStart(dev) offsetof(struct arlan_shmem, txBuffer)
((int)(((struct arlan_private *)dev->priv)->card)->txBuffer) - ((int)(((struct arlan_private *)dev->priv)->card) )
#define TXBuffEnd(dev) offsetof(struct arlan_shmem, xxBuffer)
#define TXBuffEnd(dev) \
((int)(((struct arlan_private *)dev->priv)->card)->rxBuffer) - ((int)(((struct arlan_private *)dev->priv)->card)
#define READSHM(to,from,atype) {\
#define READSHM(to,from,atype) {\
atype tmp;\
atype tmp;\
...
@@ -451,16 +449,16 @@ struct arlan_private {
...
@@ -451,16 +449,16 @@ struct arlan_private {
#define registrationBad(dev)\
#define registrationBad(dev)\
( ( READSHMB(((struct arlan_private *)
dev->priv
)->card->registrationMode) > 0) && \
( ( READSHMB(((struct arlan_private *)
netdev_priv(dev)
)->card->registrationMode) > 0) && \
( READSHMB(((struct arlan_private *)
dev->priv
)->card->registrationStatus) == 0) )
( READSHMB(((struct arlan_private *)
netdev_priv(dev)
)->card->registrationStatus) == 0) )
#define readControlRegister(dev)\
#define readControlRegister(dev)\
READSHMB(((struct arlan_private *)
dev->priv
)->card->cntrlRegImage)
READSHMB(((struct arlan_private *)
netdev_priv(dev)
)->card->cntrlRegImage)
#define writeControlRegister(dev, v){\
#define writeControlRegister(dev, v){\
WRITESHMB(((struct arlan_private *)
dev->priv
)->card->cntrlRegImage ,((v) &0xF) );\
WRITESHMB(((struct arlan_private *)
netdev_priv(dev)
)->card->cntrlRegImage ,((v) &0xF) );\
WRITESHMB(((struct arlan_private *)
dev->priv
)->card->controlRegister ,(v) );}
WRITESHMB(((struct arlan_private *)
netdev_priv(dev)
)->card->controlRegister ,(v) );}
#define arlan_interrupt_lancpu(dev) {\
#define arlan_interrupt_lancpu(dev) {\
...
...
drivers/net/wireless/netwave_cs.c
View file @
7bedd791
...
@@ -213,7 +213,7 @@ static dev_link_t *netwave_attach(void); /* Create instance */
...
@@ -213,7 +213,7 @@ static dev_link_t *netwave_attach(void); /* Create instance */
static
void
netwave_detach
(
dev_link_t
*
);
/* Destroy instance */
static
void
netwave_detach
(
dev_link_t
*
);
/* Destroy instance */
/* Hardware configuration */
/* Hardware configuration */
static
void
netwave_doreset
(
ioaddr_t
iobase
,
u_char
*
ramBase
);
static
void
netwave_doreset
(
ioaddr_t
iobase
,
u_char
__iomem
*
ramBase
);
static
void
netwave_reset
(
struct
net_device
*
dev
);
static
void
netwave_reset
(
struct
net_device
*
dev
);
/* Misc device stuff */
/* Misc device stuff */
...
@@ -321,7 +321,7 @@ typedef struct netwave_private {
...
@@ -321,7 +321,7 @@ typedef struct netwave_private {
dev_link_t
link
;
dev_link_t
link
;
spinlock_t
spinlock
;
/* Serialize access to the hardware (SMP) */
spinlock_t
spinlock
;
/* Serialize access to the hardware (SMP) */
dev_node_t
node
;
dev_node_t
node
;
u_char
*
ramBase
;
u_char
__iomem
*
ramBase
;
int
timeoutCounter
;
int
timeoutCounter
;
int
lastExec
;
int
lastExec
;
struct
timer_list
watchdog
;
/* To avoid blocking state */
struct
timer_list
watchdog
;
/* To avoid blocking state */
...
@@ -340,12 +340,12 @@ static struct net_device_stats *netwave_get_stats(struct net_device *dev);
...
@@ -340,12 +340,12 @@ static struct net_device_stats *netwave_get_stats(struct net_device *dev);
* The Netwave card is little-endian, so won't work for big endian
* The Netwave card is little-endian, so won't work for big endian
* systems.
* systems.
*/
*/
static
inline
unsigned
short
get_uint16
(
u_char
*
staddr
)
static
inline
unsigned
short
get_uint16
(
u_char
__iomem
*
staddr
)
{
{
return
readw
(
staddr
);
/* Return only 16 bits */
return
readw
(
staddr
);
/* Return only 16 bits */
}
}
static
inline
short
get_int16
(
u_char
*
staddr
)
static
inline
short
get_int16
(
u_char
__iomem
*
staddr
)
{
{
return
readw
(
staddr
);
return
readw
(
staddr
);
}
}
...
@@ -362,7 +362,7 @@ static inline void wait_WOC(unsigned int iobase)
...
@@ -362,7 +362,7 @@ static inline void wait_WOC(unsigned int iobase)
}
}
#ifdef WIRELESS_EXT
#ifdef WIRELESS_EXT
static
void
netwave_snapshot
(
netwave_private
*
priv
,
u_char
*
ramBase
,
static
void
netwave_snapshot
(
netwave_private
*
priv
,
u_char
__iomem
*
ramBase
,
ioaddr_t
iobase
)
{
ioaddr_t
iobase
)
{
u_short
resultBuffer
;
u_short
resultBuffer
;
...
@@ -397,8 +397,8 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
...
@@ -397,8 +397,8 @@ static struct iw_statistics *netwave_get_wireless_stats(struct net_device *dev)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
u_char
*
ramBase
=
priv
->
ramBase
;
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
struct
iw_statistics
*
wstats
;
struct
iw_statistics
*
wstats
;
wstats
=
&
priv
->
iw_stats
;
wstats
=
&
priv
->
iw_stats
;
...
@@ -446,7 +446,7 @@ static dev_link_t *netwave_attach(void)
...
@@ -446,7 +446,7 @@ static dev_link_t *netwave_attach(void)
dev
=
alloc_etherdev
(
sizeof
(
netwave_private
));
dev
=
alloc_etherdev
(
sizeof
(
netwave_private
));
if
(
!
dev
)
if
(
!
dev
)
return
NULL
;
return
NULL
;
priv
=
dev
->
priv
;
priv
=
netdev_priv
(
dev
)
;
link
=
&
priv
->
link
;
link
=
&
priv
->
link
;
link
->
priv
=
dev
;
link
->
priv
=
dev
;
...
@@ -589,8 +589,8 @@ static int netwave_set_nwid(struct net_device *dev,
...
@@ -589,8 +589,8 @@ static int netwave_set_nwid(struct net_device *dev,
{
{
unsigned
long
flags
;
unsigned
long
flags
;
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
u_char
*
ramBase
=
priv
->
ramBase
;
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
/* Disable interrupts & save flags */
/* Disable interrupts & save flags */
spin_lock_irqsave
(
&
priv
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
priv
->
spinlock
,
flags
);
...
@@ -647,8 +647,8 @@ static int netwave_set_scramble(struct net_device *dev,
...
@@ -647,8 +647,8 @@ static int netwave_set_scramble(struct net_device *dev,
{
{
unsigned
long
flags
;
unsigned
long
flags
;
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
u_char
*
ramBase
=
priv
->
ramBase
;
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
/* Disable interrupts & save flags */
/* Disable interrupts & save flags */
spin_lock_irqsave
(
&
priv
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
priv
->
spinlock
,
flags
);
...
@@ -763,8 +763,8 @@ static int netwave_get_snap(struct net_device *dev,
...
@@ -763,8 +763,8 @@ static int netwave_get_snap(struct net_device *dev,
{
{
unsigned
long
flags
;
unsigned
long
flags
;
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
u_char
*
ramBase
=
priv
->
ramBase
;
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
/* Disable interrupts & save flags */
/* Disable interrupts & save flags */
spin_lock_irqsave
(
&
priv
->
spinlock
,
flags
);
spin_lock_irqsave
(
&
priv
->
spinlock
,
flags
);
...
@@ -996,14 +996,14 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
...
@@ -996,14 +996,14 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static
void
netwave_pcmcia_config
(
dev_link_t
*
link
)
{
static
void
netwave_pcmcia_config
(
dev_link_t
*
link
)
{
client_handle_t
handle
=
link
->
handle
;
client_handle_t
handle
=
link
->
handle
;
struct
net_device
*
dev
=
link
->
priv
;
struct
net_device
*
dev
=
link
->
priv
;
netwave_private
*
priv
=
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
tuple_t
tuple
;
tuple_t
tuple
;
cisparse_t
parse
;
cisparse_t
parse
;
int
i
,
j
,
last_ret
,
last_fn
;
int
i
,
j
,
last_ret
,
last_fn
;
u_char
buf
[
64
];
u_char
buf
[
64
];
win_req_t
req
;
win_req_t
req
;
memreq_t
mem
;
memreq_t
mem
;
u_char
*
ramBase
=
NULL
;
u_char
__iomem
*
ramBase
=
NULL
;
DEBUG
(
0
,
"netwave_pcmcia_config(0x%p)
\n
"
,
link
);
DEBUG
(
0
,
"netwave_pcmcia_config(0x%p)
\n
"
,
link
);
...
@@ -1069,7 +1069,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
...
@@ -1069,7 +1069,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
/* Store base address of the common window frame */
/* Store base address of the common window frame */
ramBase
=
ioremap
(
req
.
Base
,
0x8000
);
ramBase
=
ioremap
(
req
.
Base
,
0x8000
);
((
netwave_private
*
)
dev
->
priv
)
->
ramBase
=
ramBase
;
priv
->
ramBase
=
ramBase
;
dev
->
irq
=
link
->
irq
.
AssignedIRQ
;
dev
->
irq
=
link
->
irq
.
AssignedIRQ
;
dev
->
base_addr
=
link
->
io
.
BasePort1
;
dev
->
base_addr
=
link
->
io
.
BasePort1
;
...
@@ -1118,7 +1118,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
...
@@ -1118,7 +1118,7 @@ static void netwave_pcmcia_config(dev_link_t *link) {
static
void
netwave_release
(
dev_link_t
*
link
)
static
void
netwave_release
(
dev_link_t
*
link
)
{
{
struct
net_device
*
dev
=
link
->
priv
;
struct
net_device
*
dev
=
link
->
priv
;
netwave_private
*
priv
=
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
DEBUG
(
0
,
"netwave_release(0x%p)
\n
"
,
link
);
DEBUG
(
0
,
"netwave_release(0x%p)
\n
"
,
link
);
...
@@ -1149,7 +1149,8 @@ static void netwave_release(dev_link_t *link)
...
@@ -1149,7 +1149,8 @@ static void netwave_release(dev_link_t *link)
*
*
*/
*/
static
int
netwave_event
(
event_t
event
,
int
priority
,
static
int
netwave_event
(
event_t
event
,
int
priority
,
event_callback_args_t
*
args
)
{
event_callback_args_t
*
args
)
{
dev_link_t
*
link
=
args
->
client_data
;
dev_link_t
*
link
=
args
->
client_data
;
struct
net_device
*
dev
=
link
->
priv
;
struct
net_device
*
dev
=
link
->
priv
;
...
@@ -1202,7 +1203,8 @@ static int netwave_event(event_t event, int priority,
...
@@ -1202,7 +1203,8 @@ static int netwave_event(event_t event, int priority,
*
*
* Proper hardware reset of the card.
* Proper hardware reset of the card.
*/
*/
static
void
netwave_doreset
(
ioaddr_t
ioBase
,
u_char
*
ramBase
)
{
static
void
netwave_doreset
(
ioaddr_t
ioBase
,
u_char
__iomem
*
ramBase
)
{
/* Reset card */
/* Reset card */
wait_WOC
(
ioBase
);
wait_WOC
(
ioBase
);
outb
(
0x80
,
ioBase
+
NETWAVE_REG_PMR
);
outb
(
0x80
,
ioBase
+
NETWAVE_REG_PMR
);
...
@@ -1217,8 +1219,8 @@ static void netwave_doreset(ioaddr_t ioBase, u_char* ramBase) {
...
@@ -1217,8 +1219,8 @@ static void netwave_doreset(ioaddr_t ioBase, u_char* ramBase) {
*/
*/
static
void
netwave_reset
(
struct
net_device
*
dev
)
{
static
void
netwave_reset
(
struct
net_device
*
dev
)
{
/* u_char state; */
/* u_char state; */
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
u_char
*
ramBase
=
priv
->
ramBase
;
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
DEBUG
(
0
,
"netwave_reset: Done with hardware reset
\n
"
);
DEBUG
(
0
,
"netwave_reset: Done with hardware reset
\n
"
);
...
@@ -1298,8 +1300,8 @@ static int netwave_hw_xmit(unsigned char* data, int len,
...
@@ -1298,8 +1300,8 @@ static int netwave_hw_xmit(unsigned char* data, int len,
DataOffset
;
DataOffset
;
int
tmpcount
;
int
tmpcount
;
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
u_char
*
ramBase
=
priv
->
ramBase
;
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
/* Disable interrupts & save flags */
/* Disable interrupts & save flags */
...
@@ -1390,11 +1392,12 @@ static int netwave_start_xmit(struct sk_buff *skb, struct net_device *dev) {
...
@@ -1390,11 +1392,12 @@ static int netwave_start_xmit(struct sk_buff *skb, struct net_device *dev) {
* ready to transmit another packet.
* ready to transmit another packet.
* 3. A command has completed execution.
* 3. A command has completed execution.
*/
*/
static
irqreturn_t
netwave_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
static
irqreturn_t
netwave_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
ioaddr_t
iobase
;
ioaddr_t
iobase
;
u_char
*
ramBase
;
u_char
__iomem
*
ramBase
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
dev_id
;
struct
netwave_private
*
priv
=
dev
->
priv
;
struct
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
dev_link_t
*
link
=
&
priv
->
link
;
dev_link_t
*
link
=
&
priv
->
link
;
int
i
;
int
i
;
...
@@ -1524,7 +1527,7 @@ static void netwave_watchdog(struct net_device *dev) {
...
@@ -1524,7 +1527,7 @@ static void netwave_watchdog(struct net_device *dev) {
}
/* netwave_watchdog */
}
/* netwave_watchdog */
static
struct
net_device_stats
*
netwave_get_stats
(
struct
net_device
*
dev
)
{
static
struct
net_device_stats
*
netwave_get_stats
(
struct
net_device
*
dev
)
{
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
update_stats
(
dev
);
update_stats
(
dev
);
...
@@ -1547,7 +1550,7 @@ static struct net_device_stats *netwave_get_stats(struct net_device *dev) {
...
@@ -1547,7 +1550,7 @@ static struct net_device_stats *netwave_get_stats(struct net_device *dev) {
static
void
update_stats
(
struct
net_device
*
dev
)
{
static
void
update_stats
(
struct
net_device
*
dev
)
{
//unsigned long flags;
//unsigned long flags;
/* netwave_private *priv =
(netwave_private*) dev->priv
; */
/* netwave_private *priv =
netdev_priv(dev)
; */
//spin_lock_irqsave(&priv->spinlock, flags);
//spin_lock_irqsave(&priv->spinlock, flags);
...
@@ -1557,9 +1560,10 @@ static void update_stats(struct net_device *dev) {
...
@@ -1557,9 +1560,10 @@ static void update_stats(struct net_device *dev) {
//spin_unlock_irqrestore(&priv->spinlock, flags);
//spin_unlock_irqrestore(&priv->spinlock, flags);
}
}
static
int
netwave_rx
(
struct
net_device
*
dev
)
{
static
int
netwave_rx
(
struct
net_device
*
dev
)
netwave_private
*
priv
=
(
netwave_private
*
)(
dev
->
priv
);
{
u_char
*
ramBase
=
priv
->
ramBase
;
netwave_private
*
priv
=
netdev_priv
(
dev
);
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
u_char
rxStatus
;
u_char
rxStatus
;
struct
sk_buff
*
skb
=
NULL
;
struct
sk_buff
*
skb
=
NULL
;
...
@@ -1647,7 +1651,7 @@ static int netwave_rx(struct net_device *dev) {
...
@@ -1647,7 +1651,7 @@ static int netwave_rx(struct net_device *dev) {
}
}
static
int
netwave_open
(
struct
net_device
*
dev
)
{
static
int
netwave_open
(
struct
net_device
*
dev
)
{
netwave_private
*
priv
=
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
dev_link_t
*
link
=
&
priv
->
link
;
dev_link_t
*
link
=
&
priv
->
link
;
DEBUG
(
1
,
"netwave_open: starting.
\n
"
);
DEBUG
(
1
,
"netwave_open: starting.
\n
"
);
...
@@ -1664,7 +1668,7 @@ static int netwave_open(struct net_device *dev) {
...
@@ -1664,7 +1668,7 @@ static int netwave_open(struct net_device *dev) {
}
}
static
int
netwave_close
(
struct
net_device
*
dev
)
{
static
int
netwave_close
(
struct
net_device
*
dev
)
{
netwave_private
*
priv
=
(
netwave_private
*
)
dev
->
priv
;
netwave_private
*
priv
=
netdev_priv
(
dev
)
;
dev_link_t
*
link
=
&
priv
->
link
;
dev_link_t
*
link
=
&
priv
->
link
;
DEBUG
(
1
,
"netwave_close: finishing.
\n
"
);
DEBUG
(
1
,
"netwave_close: finishing.
\n
"
);
...
@@ -1709,7 +1713,8 @@ module_exit(exit_netwave_cs);
...
@@ -1709,7 +1713,8 @@ module_exit(exit_netwave_cs);
static
void
set_multicast_list
(
struct
net_device
*
dev
)
static
void
set_multicast_list
(
struct
net_device
*
dev
)
{
{
ioaddr_t
iobase
=
dev
->
base_addr
;
ioaddr_t
iobase
=
dev
->
base_addr
;
u_char
*
ramBase
=
((
netwave_private
*
)
dev
->
priv
)
->
ramBase
;
netwave_private
*
priv
=
netdev_priv
(
dev
);
u_char
__iomem
*
ramBase
=
priv
->
ramBase
;
u_char
rcvMode
=
0
;
u_char
rcvMode
=
0
;
#ifdef PCMCIA_DEBUG
#ifdef PCMCIA_DEBUG
...
...
drivers/net/wireless/wavelan_cs.c
View file @
7bedd791
...
@@ -136,7 +136,8 @@ psa_read(struct net_device * dev,
...
@@ -136,7 +136,8 @@ psa_read(struct net_device * dev,
u_char
*
b
,
/* buffer to fill */
u_char
*
b
,
/* buffer to fill */
int
n
)
/* size to read */
int
n
)
/* size to read */
{
{
u_char
*
ptr
=
((
u_char
*
)
dev
->
mem_start
)
+
PSA_ADDR
+
(
o
<<
1
);
net_local
*
lp
=
netdev_priv
(
dev
);
u_char
__iomem
*
ptr
=
lp
->
mem
+
PSA_ADDR
+
(
o
<<
1
);
while
(
n
--
>
0
)
while
(
n
--
>
0
)
{
{
...
@@ -160,12 +161,13 @@ psa_write(struct net_device * dev,
...
@@ -160,12 +161,13 @@ psa_write(struct net_device * dev,
u_char
*
b
,
/* Buffer in memory */
u_char
*
b
,
/* Buffer in memory */
int
n
)
/* Length of buffer */
int
n
)
/* Length of buffer */
{
{
u_char
*
ptr
=
((
u_char
*
)
dev
->
mem_start
)
+
PSA_ADDR
+
(
o
<<
1
);
net_local
*
lp
=
netdev_priv
(
dev
);
u_char
__iomem
*
ptr
=
lp
->
mem
+
PSA_ADDR
+
(
o
<<
1
);
int
count
=
0
;
int
count
=
0
;
ioaddr_t
base
=
dev
->
base_addr
;
ioaddr_t
base
=
dev
->
base_addr
;
/* As there seem to have no flag PSA_BUSY as in the ISA model, we are
/* As there seem to have no flag PSA_BUSY as in the ISA model, we are
* oblige to verify this address to know when the PSA is ready... */
* oblige to verify this address to know when the PSA is ready... */
volatile
u_char
*
verify
=
((
u_char
*
)
dev
->
mem_start
)
+
PSA_ADDR
+
volatile
u_char
__iomem
*
verify
=
lp
->
mem
+
PSA_ADDR
+
(
psaoff
(
0
,
psa_comp_number
)
<<
1
);
(
psaoff
(
0
,
psa_comp_number
)
<<
1
);
/* Authorize writting to PSA */
/* Authorize writting to PSA */
...
@@ -3948,17 +3950,16 @@ wv_hw_reset(struct net_device * dev)
...
@@ -3948,17 +3950,16 @@ wv_hw_reset(struct net_device * dev)
static
inline
int
static
inline
int
wv_pcmcia_config
(
dev_link_t
*
link
)
wv_pcmcia_config
(
dev_link_t
*
link
)
{
{
client_handle_t
handle
;
client_handle_t
handle
=
link
->
handle
;
tuple_t
tuple
;
tuple_t
tuple
;
cisparse_t
parse
;
cisparse_t
parse
;
struct
net_device
*
dev
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
link
->
priv
;
int
i
;
int
i
;
u_char
buf
[
64
];
u_char
buf
[
64
];
win_req_t
req
;
win_req_t
req
;
memreq_t
mem
;
memreq_t
mem
;
net_local
*
lp
=
netdev_priv
(
dev
);
handle
=
link
->
handle
;
dev
=
(
struct
net_device
*
)
link
->
priv
;
#ifdef DEBUG_CONFIG_TRACE
#ifdef DEBUG_CONFIG_TRACE
printk
(
KERN_DEBUG
"->wv_pcmcia_config(0x%p)
\n
"
,
link
);
printk
(
KERN_DEBUG
"->wv_pcmcia_config(0x%p)
\n
"
,
link
);
...
@@ -4045,7 +4046,8 @@ wv_pcmcia_config(dev_link_t * link)
...
@@ -4045,7 +4046,8 @@ wv_pcmcia_config(dev_link_t * link)
break
;
break
;
}
}
dev
->
mem_start
=
(
u_long
)
ioremap
(
req
.
Base
,
req
.
Size
);
lp
->
mem
=
ioremap
(
req
.
Base
,
req
.
Size
);
dev
->
mem_start
=
(
u_long
)
lp
->
mem
;
dev
->
mem_end
=
dev
->
mem_start
+
req
.
Size
;
dev
->
mem_end
=
dev
->
mem_start
+
req
.
Size
;
mem
.
CardOffset
=
0
;
mem
.
Page
=
0
;
mem
.
CardOffset
=
0
;
mem
.
Page
=
0
;
...
@@ -4062,8 +4064,8 @@ wv_pcmcia_config(dev_link_t * link)
...
@@ -4062,8 +4064,8 @@ wv_pcmcia_config(dev_link_t * link)
netif_start_queue
(
dev
);
netif_start_queue
(
dev
);
#ifdef DEBUG_CONFIG_INFO
#ifdef DEBUG_CONFIG_INFO
printk
(
KERN_DEBUG
"wv_pcmcia_config: MEMSTART
0x%x
IRQ %d IOPORT 0x%x
\n
"
,
printk
(
KERN_DEBUG
"wv_pcmcia_config: MEMSTART
%p
IRQ %d IOPORT 0x%x
\n
"
,
(
u_int
)
dev
->
mem_start
,
dev
->
irq
,
(
u_int
)
dev
->
base_addr
);
lp
->
mem
,
dev
->
irq
,
(
u_int
)
dev
->
base_addr
);
#endif
#endif
i
=
register_netdev
(
dev
);
i
=
register_netdev
(
dev
);
...
@@ -4104,13 +4106,14 @@ static void
...
@@ -4104,13 +4106,14 @@ static void
wv_pcmcia_release
(
dev_link_t
*
link
)
wv_pcmcia_release
(
dev_link_t
*
link
)
{
{
struct
net_device
*
dev
=
(
struct
net_device
*
)
link
->
priv
;
struct
net_device
*
dev
=
(
struct
net_device
*
)
link
->
priv
;
net_local
*
lp
=
netdev_priv
(
dev
);
#ifdef DEBUG_CONFIG_TRACE
#ifdef DEBUG_CONFIG_TRACE
printk
(
KERN_DEBUG
"%s: -> wv_pcmcia_release(0x%p)
\n
"
,
dev
->
name
,
link
);
printk
(
KERN_DEBUG
"%s: -> wv_pcmcia_release(0x%p)
\n
"
,
dev
->
name
,
link
);
#endif
#endif
/* Don't bother checking to see if these succeed or not */
/* Don't bother checking to see if these succeed or not */
iounmap
(
(
u_char
*
)
dev
->
mem_start
);
iounmap
(
lp
->
mem
);
pcmcia_release_window
(
link
->
win
);
pcmcia_release_window
(
link
->
win
);
pcmcia_release_configuration
(
link
->
handle
);
pcmcia_release_configuration
(
link
->
handle
);
pcmcia_release_io
(
link
->
handle
,
&
link
->
io
);
pcmcia_release_io
(
link
->
handle
,
&
link
->
io
);
...
...
drivers/net/wireless/wavelan_cs.p.h
View file @
7bedd791
...
@@ -645,6 +645,7 @@ struct net_local
...
@@ -645,6 +645,7 @@ struct net_local
int
cell_search
;
/* Searching for new cell? */
int
cell_search
;
/* Searching for new cell? */
struct
timer_list
cell_timer
;
/* Garbage collection */
struct
timer_list
cell_timer
;
/* Garbage collection */
#endif
/* WAVELAN_ROAMING */
#endif
/* WAVELAN_ROAMING */
void
__iomem
*
mem
;
};
};
/**************************** PROTOTYPES ****************************/
/**************************** PROTOTYPES ****************************/
...
...
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