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
61e0a6a2
Commit
61e0a6a2
authored
Jul 09, 2008
by
Krzysztof Hałasa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WAN: Simplify HD64572 drivers.
Signed-off-by:
Krzysztof Hałasa
<
khc@pm.waw.pl
>
parent
96783436
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
135 deletions
+110
-135
drivers/net/wan/hd64572.c
drivers/net/wan/hd64572.c
+70
-69
drivers/net/wan/pc300too.c
drivers/net/wan/pc300too.c
+19
-32
drivers/net/wan/pci200syn.c
drivers/net/wan/pci200syn.c
+21
-34
No files found.
drivers/net/wan/hd64572.c
View file @
61e0a6a2
...
@@ -11,13 +11,13 @@
...
@@ -11,13 +11,13 @@
*
*
* We use the following SCA memory map:
* We use the following SCA memory map:
*
*
* Packet buffer descriptor rings - starting from
winbase or win0
base:
* Packet buffer descriptor rings - starting from
card->ram
base:
* rx_ring_buffers * sizeof(pkt_desc) = logical channel #0 RX ring
* rx_ring_buffers * sizeof(pkt_desc) = logical channel #0 RX ring
* tx_ring_buffers * sizeof(pkt_desc) = logical channel #0 TX ring
* tx_ring_buffers * sizeof(pkt_desc) = logical channel #0 TX ring
* rx_ring_buffers * sizeof(pkt_desc) = logical channel #1 RX ring (if used)
* rx_ring_buffers * sizeof(pkt_desc) = logical channel #1 RX ring (if used)
* tx_ring_buffers * sizeof(pkt_desc) = logical channel #1 TX ring (if used)
* tx_ring_buffers * sizeof(pkt_desc) = logical channel #1 TX ring (if used)
*
*
* Packet data buffers - starting from
win
base + buff_offset:
* Packet data buffers - starting from
card->ram
base + buff_offset:
* rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers
* rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers
* tx_ring_buffers * HDLC_MAX_MRU = logical channel #0 TX buffers
* tx_ring_buffers * HDLC_MAX_MRU = logical channel #0 TX buffers
* rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers (if used)
* rx_ring_buffers * HDLC_MAX_MRU = logical channel #0 RX buffers (if used)
...
@@ -47,16 +47,18 @@
...
@@ -47,16 +47,18 @@
#define NAPI_WEIGHT 16
#define NAPI_WEIGHT 16
#define get_msci(port) (p
hy_node(port)
? MSCI1_OFFSET : MSCI0_OFFSET)
#define get_msci(port) (p
ort->chan
? MSCI1_OFFSET : MSCI0_OFFSET)
#define get_dmac_rx(port) (p
hy_node(port)
? DMAC1RX_OFFSET : DMAC0RX_OFFSET)
#define get_dmac_rx(port) (p
ort->chan
? DMAC1RX_OFFSET : DMAC0RX_OFFSET)
#define get_dmac_tx(port) (p
hy_node(port)
? DMAC1TX_OFFSET : DMAC0TX_OFFSET)
#define get_dmac_tx(port) (p
ort->chan
? DMAC1TX_OFFSET : DMAC0TX_OFFSET)
static
int
sca_poll
(
struct
napi_struct
*
napi
,
int
budget
);
#define sca_in(reg, card) readb(card->scabase + (reg))
#define sca_out(value, reg, card) writeb(value, card->scabase + (reg))
#define sca_inw(reg, card) readw(card->scabase + (reg))
#define sca_outw(value, reg, card) writew(value, card->scabase + (reg))
#define sca_inl(reg, card) readl(card->scabase + (reg))
#define sca_outl(value, reg, card) writel(value, card->scabase + (reg))
static
inline
struct
net_device
*
port_to_dev
(
port_t
*
port
)
static
int
sca_poll
(
struct
napi_struct
*
napi
,
int
budget
);
{
return
port
->
dev
;
}
static
inline
port_t
*
dev_to_port
(
struct
net_device
*
dev
)
static
inline
port_t
*
dev_to_port
(
struct
net_device
*
dev
)
{
{
...
@@ -67,30 +69,29 @@ static inline void enable_intr(port_t *port)
...
@@ -67,30 +69,29 @@ static inline void enable_intr(port_t *port)
{
{
/* enable DMIB and MSCI RXINTA interrupts */
/* enable DMIB and MSCI RXINTA interrupts */
sca_outl
(
sca_inl
(
IER0
,
port
->
card
)
|
sca_outl
(
sca_inl
(
IER0
,
port
->
card
)
|
(
p
hy_node
(
port
)
?
0x08002200
:
0x00080022
),
IER0
,
port
->
card
);
(
p
ort
->
chan
?
0x08002200
:
0x00080022
),
IER0
,
port
->
card
);
}
}
static
inline
void
disable_intr
(
port_t
*
port
)
static
inline
void
disable_intr
(
port_t
*
port
)
{
{
sca_outl
(
sca_inl
(
IER0
,
port
->
card
)
&
sca_outl
(
sca_inl
(
IER0
,
port
->
card
)
&
(
p
hy_node
(
port
)
?
0x00FF00FF
:
0xFF00FF00
),
IER0
,
port
->
card
);
(
p
ort
->
chan
?
0x00FF00FF
:
0xFF00FF00
),
IER0
,
port
->
card
);
}
}
static
inline
u16
next_desc
(
port_t
*
port
,
u16
desc
,
int
transmit
)
static
inline
u16
next_desc
(
port_t
*
port
,
u16
desc
,
int
transmit
)
{
{
return
(
desc
+
1
)
%
(
transmit
?
port
_to_card
(
port
)
->
tx_ring_buffers
return
(
desc
+
1
)
%
(
transmit
?
port
->
card
->
tx_ring_buffers
:
port
_to_card
(
port
)
->
rx_ring_buffers
);
:
port
->
card
->
rx_ring_buffers
);
}
}
static
inline
u16
desc_abs_number
(
port_t
*
port
,
u16
desc
,
int
transmit
)
static
inline
u16
desc_abs_number
(
port_t
*
port
,
u16
desc
,
int
transmit
)
{
{
u16
rx_buffs
=
port
_to_card
(
port
)
->
rx_ring_buffers
;
u16
rx_buffs
=
port
->
card
->
rx_ring_buffers
;
u16
tx_buffs
=
port
_to_card
(
port
)
->
tx_ring_buffers
;
u16
tx_buffs
=
port
->
card
->
tx_ring_buffers
;
desc
%=
(
transmit
?
tx_buffs
:
rx_buffs
);
// called with "X + 1" etc.
desc
%=
(
transmit
?
tx_buffs
:
rx_buffs
);
// called with "X + 1" etc.
return
log_node
(
port
)
*
(
rx_buffs
+
tx_buffs
)
+
return
port
->
chan
*
(
rx_buffs
+
tx_buffs
)
+
transmit
*
rx_buffs
+
desc
;
transmit
*
rx_buffs
+
desc
;
}
}
...
@@ -104,39 +105,39 @@ static inline u16 desc_offset(port_t *port, u16 desc, int transmit)
...
@@ -104,39 +105,39 @@ static inline u16 desc_offset(port_t *port, u16 desc, int transmit)
static
inline
pkt_desc
__iomem
*
desc_address
(
port_t
*
port
,
u16
desc
,
static
inline
pkt_desc
__iomem
*
desc_address
(
port_t
*
port
,
u16
desc
,
int
transmit
)
int
transmit
)
{
{
return
(
pkt_desc
__iomem
*
)(
winbase
(
port_to_card
(
port
))
return
(
pkt_desc
__iomem
*
)(
port
->
card
->
rambase
+
+
desc_offset
(
port
,
desc
,
transmit
));
desc_offset
(
port
,
desc
,
transmit
));
}
}
static
inline
u32
buffer_offset
(
port_t
*
port
,
u16
desc
,
int
transmit
)
static
inline
u32
buffer_offset
(
port_t
*
port
,
u16
desc
,
int
transmit
)
{
{
return
port
_to_card
(
port
)
->
buff_offset
+
return
port
->
card
->
buff_offset
+
desc_abs_number
(
port
,
desc
,
transmit
)
*
(
u32
)
HDLC_MAX_MRU
;
desc_abs_number
(
port
,
desc
,
transmit
)
*
(
u32
)
HDLC_MAX_MRU
;
}
}
static
inline
void
sca_set_carrier
(
port_t
*
port
)
static
inline
void
sca_set_carrier
(
port_t
*
port
)
{
{
if
(
!
(
sca_in
(
get_msci
(
port
)
+
ST3
,
port
_to_card
(
port
)
)
&
ST3_DCD
))
{
if
(
!
(
sca_in
(
get_msci
(
port
)
+
ST3
,
port
->
card
)
&
ST3_DCD
))
{
#ifdef DEBUG_LINK
#ifdef DEBUG_LINK
printk
(
KERN_DEBUG
"%s: sca_set_carrier on
\n
"
,
printk
(
KERN_DEBUG
"%s: sca_set_carrier on
\n
"
,
port
_to_dev
(
port
)
->
name
);
port
->
netdev
.
name
);
#endif
#endif
netif_carrier_on
(
port
_to_dev
(
port
)
);
netif_carrier_on
(
port
->
netdev
);
}
else
{
}
else
{
#ifdef DEBUG_LINK
#ifdef DEBUG_LINK
printk
(
KERN_DEBUG
"%s: sca_set_carrier off
\n
"
,
printk
(
KERN_DEBUG
"%s: sca_set_carrier off
\n
"
,
port
_to_dev
(
port
)
->
name
);
port
->
netdev
.
name
);
#endif
#endif
netif_carrier_off
(
port
_to_dev
(
port
)
);
netif_carrier_off
(
port
->
netdev
);
}
}
}
}
static
void
sca_init_port
(
port_t
*
port
)
static
void
sca_init_port
(
port_t
*
port
)
{
{
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
int
transmit
,
i
;
int
transmit
,
i
;
port
->
rxin
=
0
;
port
->
rxin
=
0
;
...
@@ -160,11 +161,11 @@ static void sca_init_port(port_t *port)
...
@@ -160,11 +161,11 @@ static void sca_init_port(port_t *port)
}
}
/* DMA disable - to halt state */
/* DMA disable - to halt state */
sca_out
(
0
,
transmit
?
DSR_TX
(
p
hy_node
(
port
)
)
:
sca_out
(
0
,
transmit
?
DSR_TX
(
p
ort
->
chan
)
:
DSR_RX
(
p
hy_node
(
port
)
),
card
);
DSR_RX
(
p
ort
->
chan
),
card
);
/* software ABORT - to initial state */
/* software ABORT - to initial state */
sca_out
(
DCR_ABORT
,
transmit
?
DCR_TX
(
p
hy_node
(
port
)
)
:
sca_out
(
DCR_ABORT
,
transmit
?
DCR_TX
(
p
ort
->
chan
)
:
DCR_RX
(
p
hy_node
(
port
)
),
card
);
DCR_RX
(
p
ort
->
chan
),
card
);
/* current desc addr */
/* current desc addr */
sca_outl
(
desc_offset
(
port
,
0
,
transmit
),
dmac
+
CDAL
,
card
);
sca_outl
(
desc_offset
(
port
,
0
,
transmit
),
dmac
+
CDAL
,
card
);
...
@@ -176,26 +177,26 @@ static void sca_init_port(port_t *port)
...
@@ -176,26 +177,26 @@ static void sca_init_port(port_t *port)
card
);
card
);
/* clear frame end interrupt counter */
/* clear frame end interrupt counter */
sca_out
(
DCR_CLEAR_EOF
,
transmit
?
DCR_TX
(
p
hy_node
(
port
)
)
:
sca_out
(
DCR_CLEAR_EOF
,
transmit
?
DCR_TX
(
p
ort
->
chan
)
:
DCR_RX
(
p
hy_node
(
port
)
),
card
);
DCR_RX
(
p
ort
->
chan
),
card
);
if
(
!
transmit
)
{
/* Receive */
if
(
!
transmit
)
{
/* Receive */
/* set buffer length */
/* set buffer length */
sca_outw
(
HDLC_MAX_MRU
,
dmac
+
BFLL
,
card
);
sca_outw
(
HDLC_MAX_MRU
,
dmac
+
BFLL
,
card
);
/* Chain mode, Multi-frame */
/* Chain mode, Multi-frame */
sca_out
(
0x14
,
DMR_RX
(
p
hy_node
(
port
)
),
card
);
sca_out
(
0x14
,
DMR_RX
(
p
ort
->
chan
),
card
);
sca_out
(
DIR_EOME
,
DIR_RX
(
p
hy_node
(
port
)
),
card
);
sca_out
(
DIR_EOME
,
DIR_RX
(
p
ort
->
chan
),
card
);
/* DMA enable */
/* DMA enable */
sca_out
(
DSR_DE
,
DSR_RX
(
p
hy_node
(
port
)
),
card
);
sca_out
(
DSR_DE
,
DSR_RX
(
p
ort
->
chan
),
card
);
}
else
{
/* Transmit */
}
else
{
/* Transmit */
/* Chain mode, Multi-frame */
/* Chain mode, Multi-frame */
sca_out
(
0x14
,
DMR_TX
(
p
hy_node
(
port
)
),
card
);
sca_out
(
0x14
,
DMR_TX
(
p
ort
->
chan
),
card
);
/* enable underflow interrupts */
/* enable underflow interrupts */
sca_out
(
DIR_EOME
,
DIR_TX
(
p
hy_node
(
port
)
),
card
);
sca_out
(
DIR_EOME
,
DIR_TX
(
p
ort
->
chan
),
card
);
}
}
}
}
sca_set_carrier
(
port
);
sca_set_carrier
(
port
);
netif_napi_add
(
port
_to_dev
(
port
)
,
&
port
->
napi
,
sca_poll
,
NAPI_WEIGHT
);
netif_napi_add
(
port
->
netdev
,
&
port
->
napi
,
sca_poll
,
NAPI_WEIGHT
);
}
}
...
@@ -203,7 +204,7 @@ static void sca_init_port(port_t *port)
...
@@ -203,7 +204,7 @@ static void sca_init_port(port_t *port)
static
inline
void
sca_msci_intr
(
port_t
*
port
)
static
inline
void
sca_msci_intr
(
port_t
*
port
)
{
{
u16
msci
=
get_msci
(
port
);
u16
msci
=
get_msci
(
port
);
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
if
(
sca_in
(
msci
+
ST1
,
card
)
&
ST1_CDCD
)
{
if
(
sca_in
(
msci
+
ST1
,
card
)
&
ST1_CDCD
)
{
/* Reset MSCI CDCD status bit */
/* Reset MSCI CDCD status bit */
...
@@ -216,7 +217,7 @@ static inline void sca_msci_intr(port_t *port)
...
@@ -216,7 +217,7 @@ static inline void sca_msci_intr(port_t *port)
static
inline
void
sca_rx
(
card_t
*
card
,
port_t
*
port
,
pkt_desc
__iomem
*
desc
,
static
inline
void
sca_rx
(
card_t
*
card
,
port_t
*
port
,
pkt_desc
__iomem
*
desc
,
u16
rxin
)
u16
rxin
)
{
{
struct
net_device
*
dev
=
port
_to_dev
(
port
)
;
struct
net_device
*
dev
=
port
->
netdev
;
struct
sk_buff
*
skb
;
struct
sk_buff
*
skb
;
u16
len
;
u16
len
;
u32
buff
;
u32
buff
;
...
@@ -229,7 +230,7 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc,
...
@@ -229,7 +230,7 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc,
}
}
buff
=
buffer_offset
(
port
,
rxin
,
0
);
buff
=
buffer_offset
(
port
,
rxin
,
0
);
memcpy_fromio
(
skb
->
data
,
winbase
(
card
)
+
buff
,
len
);
memcpy_fromio
(
skb
->
data
,
card
->
rambase
+
buff
,
len
);
skb_put
(
skb
,
len
);
skb_put
(
skb
,
len
);
#ifdef DEBUG_PKT
#ifdef DEBUG_PKT
...
@@ -246,15 +247,15 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc,
...
@@ -246,15 +247,15 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc,
/* Receive DMA service */
/* Receive DMA service */
static
inline
int
sca_rx_done
(
port_t
*
port
,
int
budget
)
static
inline
int
sca_rx_done
(
port_t
*
port
,
int
budget
)
{
{
struct
net_device
*
dev
=
port
_to_dev
(
port
)
;
struct
net_device
*
dev
=
port
->
netdev
;
u16
dmac
=
get_dmac_rx
(
port
);
u16
dmac
=
get_dmac_rx
(
port
);
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
u8
stat
=
sca_in
(
DSR_RX
(
p
hy_node
(
port
)
),
card
);
/* read DMA Status */
u8
stat
=
sca_in
(
DSR_RX
(
p
ort
->
chan
),
card
);
/* read DMA Status */
int
received
=
0
;
int
received
=
0
;
/* Reset DSR status bits */
/* Reset DSR status bits */
sca_out
((
stat
&
(
DSR_EOT
|
DSR_EOM
|
DSR_BOF
|
DSR_COF
))
|
DSR_DWE
,
sca_out
((
stat
&
(
DSR_EOT
|
DSR_EOM
|
DSR_BOF
|
DSR_COF
))
|
DSR_DWE
,
DSR_RX
(
p
hy_node
(
port
)
),
card
);
DSR_RX
(
p
ort
->
chan
),
card
);
if
(
stat
&
DSR_BOF
)
if
(
stat
&
DSR_BOF
)
/* Dropped one or more frames */
/* Dropped one or more frames */
...
@@ -294,7 +295,7 @@ static inline int sca_rx_done(port_t *port, int budget)
...
@@ -294,7 +295,7 @@ static inline int sca_rx_done(port_t *port, int budget)
}
}
/* make sure RX DMA is enabled */
/* make sure RX DMA is enabled */
sca_out
(
DSR_DE
,
DSR_RX
(
p
hy_node
(
port
)
),
card
);
sca_out
(
DSR_DE
,
DSR_RX
(
p
ort
->
chan
),
card
);
return
received
;
return
received
;
}
}
...
@@ -302,17 +303,17 @@ static inline int sca_rx_done(port_t *port, int budget)
...
@@ -302,17 +303,17 @@ static inline int sca_rx_done(port_t *port, int budget)
/* Transmit DMA service */
/* Transmit DMA service */
static
inline
void
sca_tx_done
(
port_t
*
port
)
static
inline
void
sca_tx_done
(
port_t
*
port
)
{
{
struct
net_device
*
dev
=
port
_to_dev
(
port
)
;
struct
net_device
*
dev
=
port
->
netdev
;
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
u8
stat
;
u8
stat
;
spin_lock
(
&
port
->
lock
);
spin_lock
(
&
port
->
lock
);
stat
=
sca_in
(
DSR_TX
(
p
hy_node
(
port
)
),
card
);
/* read DMA Status */
stat
=
sca_in
(
DSR_TX
(
p
ort
->
chan
),
card
);
/* read DMA Status */
/* Reset DSR status bits */
/* Reset DSR status bits */
sca_out
((
stat
&
(
DSR_EOT
|
DSR_EOM
|
DSR_BOF
|
DSR_COF
))
|
DSR_DWE
,
sca_out
((
stat
&
(
DSR_EOT
|
DSR_EOM
|
DSR_BOF
|
DSR_COF
))
|
DSR_DWE
,
DSR_TX
(
p
hy_node
(
port
)
),
card
);
DSR_TX
(
p
ort
->
chan
),
card
);
while
(
1
)
{
while
(
1
)
{
pkt_desc
__iomem
*
desc
=
desc_address
(
port
,
port
->
txlast
,
1
);
pkt_desc
__iomem
*
desc
=
desc_address
(
port
,
port
->
txlast
,
1
);
...
@@ -342,17 +343,17 @@ static int sca_poll(struct napi_struct *napi, int budget)
...
@@ -342,17 +343,17 @@ static int sca_poll(struct napi_struct *napi, int budget)
u32
isr0
=
sca_inl
(
ISR0
,
port
->
card
);
u32
isr0
=
sca_inl
(
ISR0
,
port
->
card
);
int
received
=
0
;
int
received
=
0
;
if
(
isr0
&
(
port
->
phy_node
?
0x08000000
:
0x00080000
))
if
(
isr0
&
(
port
->
chan
?
0x08000000
:
0x00080000
))
sca_msci_intr
(
port
);
sca_msci_intr
(
port
);
if
(
isr0
&
(
port
->
phy_node
?
0x00002000
:
0x00000020
))
if
(
isr0
&
(
port
->
chan
?
0x00002000
:
0x00000020
))
sca_tx_done
(
port
);
sca_tx_done
(
port
);
if
(
isr0
&
(
port
->
phy_node
?
0x00000200
:
0x00000002
))
if
(
isr0
&
(
port
->
chan
?
0x00000200
:
0x00000002
))
received
=
sca_rx_done
(
port
,
budget
);
received
=
sca_rx_done
(
port
,
budget
);
if
(
received
<
budget
)
{
if
(
received
<
budget
)
{
netif_rx_complete
(
port
->
dev
,
napi
);
netif_rx_complete
(
port
->
net
dev
,
napi
);
enable_intr
(
port
);
enable_intr
(
port
);
}
}
...
@@ -370,7 +371,7 @@ static irqreturn_t sca_intr(int irq, void *dev_id)
...
@@ -370,7 +371,7 @@ static irqreturn_t sca_intr(int irq, void *dev_id)
if
(
port
&&
(
isr0
&
(
i
?
0x08002200
:
0x00080022
)))
{
if
(
port
&&
(
isr0
&
(
i
?
0x08002200
:
0x00080022
)))
{
handled
=
1
;
handled
=
1
;
disable_intr
(
port
);
disable_intr
(
port
);
netif_rx_schedule
(
port
->
dev
,
&
port
->
napi
);
netif_rx_schedule
(
port
->
net
dev
,
&
port
->
napi
);
}
}
}
}
...
@@ -380,7 +381,7 @@ static irqreturn_t sca_intr(int irq, void *dev_id)
...
@@ -380,7 +381,7 @@ static irqreturn_t sca_intr(int irq, void *dev_id)
static
void
sca_set_port
(
port_t
*
port
)
static
void
sca_set_port
(
port_t
*
port
)
{
{
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
u16
msci
=
get_msci
(
port
);
u16
msci
=
get_msci
(
port
);
u8
md2
=
sca_in
(
msci
+
MD2
,
card
);
u8
md2
=
sca_in
(
msci
+
MD2
,
card
);
unsigned
int
tmc
,
br
=
10
,
brv
=
1024
;
unsigned
int
tmc
,
br
=
10
,
brv
=
1024
;
...
@@ -435,7 +436,7 @@ static void sca_set_port(port_t *port)
...
@@ -435,7 +436,7 @@ static void sca_set_port(port_t *port)
static
void
sca_open
(
struct
net_device
*
dev
)
static
void
sca_open
(
struct
net_device
*
dev
)
{
{
port_t
*
port
=
dev_to_port
(
dev
);
port_t
*
port
=
dev_to_port
(
dev
);
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
u16
msci
=
get_msci
(
port
);
u16
msci
=
get_msci
(
port
);
u8
md0
,
md2
;
u8
md0
,
md2
;
...
@@ -496,7 +497,7 @@ static void sca_close(struct net_device *dev)
...
@@ -496,7 +497,7 @@ static void sca_close(struct net_device *dev)
port_t
*
port
=
dev_to_port
(
dev
);
port_t
*
port
=
dev_to_port
(
dev
);
/* reset channel */
/* reset channel */
sca_out
(
CMD_RESET
,
get_msci
(
port
)
+
CMD
,
port
_to_card
(
port
)
);
sca_out
(
CMD_RESET
,
get_msci
(
port
)
+
CMD
,
port
->
card
);
disable_intr
(
port
);
disable_intr
(
port
);
napi_disable
(
&
port
->
napi
);
napi_disable
(
&
port
->
napi
);
netif_stop_queue
(
dev
);
netif_stop_queue
(
dev
);
...
@@ -530,25 +531,25 @@ static int sca_attach(struct net_device *dev, unsigned short encoding,
...
@@ -530,25 +531,25 @@ static int sca_attach(struct net_device *dev, unsigned short encoding,
static
void
sca_dump_rings
(
struct
net_device
*
dev
)
static
void
sca_dump_rings
(
struct
net_device
*
dev
)
{
{
port_t
*
port
=
dev_to_port
(
dev
);
port_t
*
port
=
dev_to_port
(
dev
);
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
u16
cnt
;
u16
cnt
;
printk
(
KERN_DEBUG
"RX ring: CDA=%u EDA=%u DSR=%02X in=%u %sactive"
,
printk
(
KERN_DEBUG
"RX ring: CDA=%u EDA=%u DSR=%02X in=%u %sactive"
,
sca_inl
(
get_dmac_rx
(
port
)
+
CDAL
,
card
),
sca_inl
(
get_dmac_rx
(
port
)
+
CDAL
,
card
),
sca_inl
(
get_dmac_rx
(
port
)
+
EDAL
,
card
),
sca_inl
(
get_dmac_rx
(
port
)
+
EDAL
,
card
),
sca_in
(
DSR_RX
(
p
hy_node
(
port
)
),
card
),
port
->
rxin
,
sca_in
(
DSR_RX
(
p
ort
->
chan
),
card
),
port
->
rxin
,
sca_in
(
DSR_RX
(
p
hy_node
(
port
)
),
card
)
&
DSR_DE
?
""
:
"in"
);
sca_in
(
DSR_RX
(
p
ort
->
chan
),
card
)
&
DSR_DE
?
""
:
"in"
);
for
(
cnt
=
0
;
cnt
<
port
_to_card
(
port
)
->
rx_ring_buffers
;
cnt
++
)
for
(
cnt
=
0
;
cnt
<
port
->
card
->
rx_ring_buffers
;
cnt
++
)
printk
(
" %02X"
,
readb
(
&
(
desc_address
(
port
,
cnt
,
0
)
->
stat
)));
printk
(
" %02X"
,
readb
(
&
(
desc_address
(
port
,
cnt
,
0
)
->
stat
)));
printk
(
"
\n
"
KERN_DEBUG
"TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
printk
(
"
\n
"
KERN_DEBUG
"TX ring: CDA=%u EDA=%u DSR=%02X in=%u "
"last=%u %sactive"
,
"last=%u %sactive"
,
sca_inl
(
get_dmac_tx
(
port
)
+
CDAL
,
card
),
sca_inl
(
get_dmac_tx
(
port
)
+
CDAL
,
card
),
sca_inl
(
get_dmac_tx
(
port
)
+
EDAL
,
card
),
sca_inl
(
get_dmac_tx
(
port
)
+
EDAL
,
card
),
sca_in
(
DSR_TX
(
p
hy_node
(
port
)
),
card
),
port
->
txin
,
port
->
txlast
,
sca_in
(
DSR_TX
(
p
ort
->
chan
),
card
),
port
->
txin
,
port
->
txlast
,
sca_in
(
DSR_TX
(
p
hy_node
(
port
)
),
card
)
&
DSR_DE
?
""
:
"in"
);
sca_in
(
DSR_TX
(
p
ort
->
chan
),
card
)
&
DSR_DE
?
""
:
"in"
);
for
(
cnt
=
0
;
cnt
<
port
_to_card
(
port
)
->
tx_ring_buffers
;
cnt
++
)
for
(
cnt
=
0
;
cnt
<
port
->
card
->
tx_ring_buffers
;
cnt
++
)
printk
(
" %02X"
,
readb
(
&
(
desc_address
(
port
,
cnt
,
1
)
->
stat
)));
printk
(
" %02X"
,
readb
(
&
(
desc_address
(
port
,
cnt
,
1
)
->
stat
)));
printk
(
"
\n
"
);
printk
(
"
\n
"
);
...
@@ -575,7 +576,7 @@ static void sca_dump_rings(struct net_device *dev)
...
@@ -575,7 +576,7 @@ static void sca_dump_rings(struct net_device *dev)
static
int
sca_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
static
int
sca_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
{
{
port_t
*
port
=
dev_to_port
(
dev
);
port_t
*
port
=
dev_to_port
(
dev
);
card_t
*
card
=
port
_to_card
(
port
)
;
card_t
*
card
=
port
->
card
;
pkt_desc
__iomem
*
desc
;
pkt_desc
__iomem
*
desc
;
u32
buff
,
len
;
u32
buff
,
len
;
...
@@ -592,7 +593,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -592,7 +593,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
desc
=
desc_address
(
port
,
port
->
txin
,
1
);
desc
=
desc_address
(
port
,
port
->
txin
,
1
);
buff
=
buffer_offset
(
port
,
port
->
txin
,
1
);
buff
=
buffer_offset
(
port
,
port
->
txin
,
1
);
len
=
skb
->
len
;
len
=
skb
->
len
;
memcpy_toio
(
winbase
(
card
)
+
buff
,
skb
->
data
,
len
);
memcpy_toio
(
card
->
rambase
+
buff
,
skb
->
data
,
len
);
writew
(
len
,
&
desc
->
len
);
writew
(
len
,
&
desc
->
len
);
writeb
(
ST_TX_EOM
,
&
desc
->
stat
);
writeb
(
ST_TX_EOM
,
&
desc
->
stat
);
...
@@ -602,7 +603,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -602,7 +603,7 @@ static int sca_xmit(struct sk_buff *skb, struct net_device *dev)
sca_outl
(
desc_offset
(
port
,
port
->
txin
,
1
),
sca_outl
(
desc_offset
(
port
,
port
->
txin
,
1
),
get_dmac_tx
(
port
)
+
EDAL
,
card
);
get_dmac_tx
(
port
)
+
EDAL
,
card
);
sca_out
(
DSR_DE
,
DSR_TX
(
p
hy_node
(
port
)
),
card
);
/* Enable TX DMA */
sca_out
(
DSR_DE
,
DSR_TX
(
p
ort
->
chan
),
card
);
/* Enable TX DMA */
desc
=
desc_address
(
port
,
port
->
txin
+
1
,
1
);
desc
=
desc_address
(
port
,
port
->
txin
+
1
,
1
);
if
(
readb
(
&
desc
->
stat
))
/* allow 1 packet gap */
if
(
readb
(
&
desc
->
stat
))
/* allow 1 packet gap */
...
...
drivers/net/wan/pc300too.c
View file @
61e0a6a2
/*
/*
* Cyclades PC300 synchronous serial card driver for Linux
* Cyclades PC300 synchronous serial card driver for Linux
*
*
* Copyright (C) 2000-200
7
Krzysztof Halasa <khc@pm.waw.pl>
* Copyright (C) 2000-200
8
Krzysztof Halasa <khc@pm.waw.pl>
*
*
* This program is free software; you can redistribute it and/or modify it
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
* under the terms of version 2 of the GNU General Public License
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
*
*
* Sources of information:
* Sources of information:
* Hitachi HD64572 SCA-II User's Manual
* Hitachi HD64572 SCA-II User's Manual
* Cyclades PC300 Linux driver
*
Original
Cyclades PC300 Linux driver
*
*
* This driver currently supports only PC300/RSV (V.24/V.35) and
* This driver currently supports only PC300/RSV (V.24/V.35) and
* PC300/X21 cards.
* PC300/X21 cards.
...
@@ -76,7 +76,7 @@ typedef struct {
...
@@ -76,7 +76,7 @@ typedef struct {
typedef
struct
port_s
{
typedef
struct
port_s
{
struct
napi_struct
napi
;
struct
napi_struct
napi
;
struct
net_device
*
dev
;
struct
net_device
*
net
dev
;
struct
card_s
*
card
;
struct
card_s
*
card
;
spinlock_t
lock
;
/* TX lock */
spinlock_t
lock
;
/* TX lock */
sync_serial_settings
settings
;
sync_serial_settings
settings
;
...
@@ -88,7 +88,7 @@ typedef struct port_s {
...
@@ -88,7 +88,7 @@ typedef struct port_s {
u16
txin
;
/* tx ring buffer 'in' and 'last' pointers */
u16
txin
;
/* tx ring buffer 'in' and 'last' pointers */
u16
txlast
;
u16
txlast
;
u8
rxs
,
txs
,
tmc
;
/* SCA registers */
u8
rxs
,
txs
,
tmc
;
/* SCA registers */
u8
phy_node
;
/* physical port # - 0 or 1 */
u8
chan
;
/* physical port # - 0 or 1 */
}
port_t
;
}
port_t
;
...
@@ -109,17 +109,6 @@ typedef struct card_s {
...
@@ -109,17 +109,6 @@ typedef struct card_s {
}
card_t
;
}
card_t
;
#define sca_in(reg, card) readb(card->scabase + (reg))
#define sca_out(value, reg, card) writeb(value, card->scabase + (reg))
#define sca_inw(reg, card) readw(card->scabase + (reg))
#define sca_outw(value, reg, card) writew(value, card->scabase + (reg))
#define sca_inl(reg, card) readl(card->scabase + (reg))
#define sca_outl(value, reg, card) writel(value, card->scabase + (reg))
#define port_to_card(port) (port->card)
#define log_node(port) (port->phy_node)
#define phy_node(port) (port->phy_node)
#define winbase(card) (card->rambase)
#define get_port(card, port) ((port) < (card)->n_ports ? \
#define get_port(card, port) ((port) < (card)->n_ports ? \
(&(card)->ports[port]) : (NULL))
(&(card)->ports[port]) : (NULL))
...
@@ -134,8 +123,8 @@ static void pc300_set_iface(port_t *port)
...
@@ -134,8 +123,8 @@ static void pc300_set_iface(port_t *port)
u8
rxs
=
port
->
rxs
&
CLK_BRG_MASK
;
u8
rxs
=
port
->
rxs
&
CLK_BRG_MASK
;
u8
txs
=
port
->
txs
&
CLK_BRG_MASK
;
u8
txs
=
port
->
txs
&
CLK_BRG_MASK
;
sca_out
(
EXS_TES1
,
(
p
hy_node
(
port
)
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
sca_out
(
EXS_TES1
,
(
p
ort
->
chan
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
port
_to_card
(
port
)
);
port
->
card
);
switch
(
port
->
settings
.
clock_type
)
{
switch
(
port
->
settings
.
clock_type
)
{
case
CLOCK_INT
:
case
CLOCK_INT
:
rxs
|=
CLK_BRG
;
/* BRG output */
rxs
|=
CLK_BRG
;
/* BRG output */
...
@@ -167,10 +156,10 @@ static void pc300_set_iface(port_t *port)
...
@@ -167,10 +156,10 @@ static void pc300_set_iface(port_t *port)
if
(
port
->
card
->
type
==
PC300_RSV
)
{
if
(
port
->
card
->
type
==
PC300_RSV
)
{
if
(
port
->
iface
==
IF_IFACE_V35
)
if
(
port
->
iface
==
IF_IFACE_V35
)
writel
(
card
->
init_ctrl_value
|
writel
(
card
->
init_ctrl_value
|
PC300_CHMEDIA_MASK
(
port
->
phy_node
),
init_ctrl
);
PC300_CHMEDIA_MASK
(
port
->
chan
),
init_ctrl
);
else
else
writel
(
card
->
init_ctrl_value
&
writel
(
card
->
init_ctrl_value
&
~
PC300_CHMEDIA_MASK
(
port
->
phy_node
),
init_ctrl
);
~
PC300_CHMEDIA_MASK
(
port
->
chan
),
init_ctrl
);
}
}
}
}
...
@@ -275,10 +264,8 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
...
@@ -275,10 +264,8 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
card_t
*
card
=
pci_get_drvdata
(
pdev
);
card_t
*
card
=
pci_get_drvdata
(
pdev
);
for
(
i
=
0
;
i
<
2
;
i
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
if
(
card
->
ports
[
i
].
card
)
{
if
(
card
->
ports
[
i
].
card
)
struct
net_device
*
dev
=
port_to_dev
(
&
card
->
ports
[
i
]);
unregister_hdlc_device
(
card
->
ports
[
i
].
netdev
);
unregister_hdlc_device
(
dev
);
}
if
(
card
->
irq
)
if
(
card
->
irq
)
free_irq
(
card
->
irq
,
card
);
free_irq
(
card
->
irq
,
card
);
...
@@ -293,10 +280,10 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
...
@@ -293,10 +280,10 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
pci_disable_device
(
pdev
);
pci_disable_device
(
pdev
);
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
if
(
card
->
ports
[
0
].
dev
)
if
(
card
->
ports
[
0
].
net
dev
)
free_netdev
(
card
->
ports
[
0
].
dev
);
free_netdev
(
card
->
ports
[
0
].
net
dev
);
if
(
card
->
ports
[
1
].
dev
)
if
(
card
->
ports
[
1
].
net
dev
)
free_netdev
(
card
->
ports
[
1
].
dev
);
free_netdev
(
card
->
ports
[
1
].
net
dev
);
kfree
(
card
);
kfree
(
card
);
}
}
...
@@ -347,7 +334,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
...
@@ -347,7 +334,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
card
->
n_ports
=
2
;
card
->
n_ports
=
2
;
for
(
i
=
0
;
i
<
card
->
n_ports
;
i
++
)
for
(
i
=
0
;
i
<
card
->
n_ports
;
i
++
)
if
(
!
(
card
->
ports
[
i
].
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
i
])))
{
if
(
!
(
card
->
ports
[
i
].
net
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
i
])))
{
printk
(
KERN_ERR
"pc300: unable to allocate memory
\n
"
);
printk
(
KERN_ERR
"pc300: unable to allocate memory
\n
"
);
pc300_pci_remove_one
(
pdev
);
pc300_pci_remove_one
(
pdev
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -452,9 +439,9 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
...
@@ -452,9 +439,9 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
for
(
i
=
0
;
i
<
card
->
n_ports
;
i
++
)
{
for
(
i
=
0
;
i
<
card
->
n_ports
;
i
++
)
{
port_t
*
port
=
&
card
->
ports
[
i
];
port_t
*
port
=
&
card
->
ports
[
i
];
struct
net_device
*
dev
=
port
_to_dev
(
port
)
;
struct
net_device
*
dev
=
port
->
netdev
;
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
port
->
phy_node
=
i
;
port
->
chan
=
i
;
spin_lock_init
(
&
port
->
lock
);
spin_lock_init
(
&
port
->
lock
);
dev
->
irq
=
card
->
irq
;
dev
->
irq
=
card
->
irq
;
...
@@ -482,8 +469,8 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
...
@@ -482,8 +469,8 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
return
-
ENOBUFS
;
return
-
ENOBUFS
;
}
}
printk
(
KERN_INFO
"%s: PC300
node
%d
\n
"
,
printk
(
KERN_INFO
"%s: PC300
channel
%d
\n
"
,
dev
->
name
,
port
->
phy_node
);
dev
->
name
,
port
->
chan
);
}
}
return
0
;
return
0
;
}
}
...
...
drivers/net/wan/pci200syn.c
View file @
61e0a6a2
/*
/*
* Goramo PCI200SYN synchronous serial card driver for Linux
* Goramo PCI200SYN synchronous serial card driver for Linux
*
*
* Copyright (C) 2002-200
3
Krzysztof Halasa <khc@pm.waw.pl>
* Copyright (C) 2002-200
8
Krzysztof Halasa <khc@pm.waw.pl>
*
*
* This program is free software; you can redistribute it and/or modify it
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License
* under the terms of version 2 of the GNU General Public License
...
@@ -63,7 +63,7 @@ typedef struct {
...
@@ -63,7 +63,7 @@ typedef struct {
typedef
struct
port_s
{
typedef
struct
port_s
{
struct
napi_struct
napi
;
struct
napi_struct
napi
;
struct
net_device
*
dev
;
struct
net_device
*
net
dev
;
struct
card_s
*
card
;
struct
card_s
*
card
;
spinlock_t
lock
;
/* TX lock */
spinlock_t
lock
;
/* TX lock */
sync_serial_settings
settings
;
sync_serial_settings
settings
;
...
@@ -74,7 +74,7 @@ typedef struct port_s {
...
@@ -74,7 +74,7 @@ typedef struct port_s {
u16
txin
;
/* tx ring buffer 'in' and 'last' pointers */
u16
txin
;
/* tx ring buffer 'in' and 'last' pointers */
u16
txlast
;
u16
txlast
;
u8
rxs
,
txs
,
tmc
;
/* SCA registers */
u8
rxs
,
txs
,
tmc
;
/* SCA registers */
u8
phy_node
;
/* physical port # - 0 or 1 */
u8
chan
;
/* physical port # - 0 or 1 */
}
port_t
;
}
port_t
;
...
@@ -92,17 +92,6 @@ typedef struct card_s {
...
@@ -92,17 +92,6 @@ typedef struct card_s {
}
card_t
;
}
card_t
;
#define sca_in(reg, card) readb(card->scabase + (reg))
#define sca_out(value, reg, card) writeb(value, card->scabase + (reg))
#define sca_inw(reg, card) readw(card->scabase + (reg))
#define sca_outw(value, reg, card) writew(value, card->scabase + (reg))
#define sca_inl(reg, card) readl(card->scabase + (reg))
#define sca_outl(value, reg, card) writel(value, card->scabase + (reg))
#define port_to_card(port) (port->card)
#define log_node(port) (port->phy_node)
#define phy_node(port) (port->phy_node)
#define winbase(card) (card->rambase)
#define get_port(card, port) (&card->ports[port])
#define get_port(card, port) (&card->ports[port])
#define sca_flush(card) (sca_in(IER0, card));
#define sca_flush(card) (sca_in(IER0, card));
...
@@ -132,8 +121,8 @@ static void pci200_set_iface(port_t *port)
...
@@ -132,8 +121,8 @@ static void pci200_set_iface(port_t *port)
u8
rxs
=
port
->
rxs
&
CLK_BRG_MASK
;
u8
rxs
=
port
->
rxs
&
CLK_BRG_MASK
;
u8
txs
=
port
->
txs
&
CLK_BRG_MASK
;
u8
txs
=
port
->
txs
&
CLK_BRG_MASK
;
sca_out
(
EXS_TES1
,
(
p
hy_node
(
port
)
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
sca_out
(
EXS_TES1
,
(
p
ort
->
chan
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
port
_to_card
(
port
)
);
port
->
card
);
switch
(
port
->
settings
.
clock_type
)
{
switch
(
port
->
settings
.
clock_type
)
{
case
CLOCK_INT
:
case
CLOCK_INT
:
rxs
|=
CLK_BRG
;
/* BRG output */
rxs
|=
CLK_BRG
;
/* BRG output */
...
@@ -175,7 +164,7 @@ static int pci200_open(struct net_device *dev)
...
@@ -175,7 +164,7 @@ static int pci200_open(struct net_device *dev)
sca_open
(
dev
);
sca_open
(
dev
);
pci200_set_iface
(
port
);
pci200_set_iface
(
port
);
sca_flush
(
port
_to_card
(
port
)
);
sca_flush
(
port
->
card
);
return
0
;
return
0
;
}
}
...
@@ -184,7 +173,7 @@ static int pci200_open(struct net_device *dev)
...
@@ -184,7 +173,7 @@ static int pci200_open(struct net_device *dev)
static
int
pci200_close
(
struct
net_device
*
dev
)
static
int
pci200_close
(
struct
net_device
*
dev
)
{
{
sca_close
(
dev
);
sca_close
(
dev
);
sca_flush
(
port_to_card
(
dev_to_port
(
dev
))
);
sca_flush
(
dev_to_port
(
dev
)
->
card
);
hdlc_close
(
dev
);
hdlc_close
(
dev
);
return
0
;
return
0
;
}
}
...
@@ -237,7 +226,7 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
...
@@ -237,7 +226,7 @@ static int pci200_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
memcpy
(
&
port
->
settings
,
&
new_line
,
size
);
/* Update settings */
memcpy
(
&
port
->
settings
,
&
new_line
,
size
);
/* Update settings */
pci200_set_iface
(
port
);
pci200_set_iface
(
port
);
sca_flush
(
port
_to_card
(
port
)
);
sca_flush
(
port
->
card
);
return
0
;
return
0
;
default:
default:
...
@@ -253,10 +242,8 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
...
@@ -253,10 +242,8 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
card_t
*
card
=
pci_get_drvdata
(
pdev
);
card_t
*
card
=
pci_get_drvdata
(
pdev
);
for
(
i
=
0
;
i
<
2
;
i
++
)
for
(
i
=
0
;
i
<
2
;
i
++
)
if
(
card
->
ports
[
i
].
card
)
{
if
(
card
->
ports
[
i
].
card
)
struct
net_device
*
dev
=
port_to_dev
(
&
card
->
ports
[
i
]);
unregister_hdlc_device
(
card
->
ports
[
i
].
netdev
);
unregister_hdlc_device
(
dev
);
}
if
(
card
->
irq
)
if
(
card
->
irq
)
free_irq
(
card
->
irq
,
card
);
free_irq
(
card
->
irq
,
card
);
...
@@ -271,10 +258,10 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
...
@@ -271,10 +258,10 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
pci_release_regions
(
pdev
);
pci_release_regions
(
pdev
);
pci_disable_device
(
pdev
);
pci_disable_device
(
pdev
);
pci_set_drvdata
(
pdev
,
NULL
);
pci_set_drvdata
(
pdev
,
NULL
);
if
(
card
->
ports
[
0
].
dev
)
if
(
card
->
ports
[
0
].
net
dev
)
free_netdev
(
card
->
ports
[
0
].
dev
);
free_netdev
(
card
->
ports
[
0
].
net
dev
);
if
(
card
->
ports
[
1
].
dev
)
if
(
card
->
ports
[
1
].
net
dev
)
free_netdev
(
card
->
ports
[
1
].
dev
);
free_netdev
(
card
->
ports
[
1
].
net
dev
);
kfree
(
card
);
kfree
(
card
);
}
}
...
@@ -309,9 +296,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
...
@@ -309,9 +296,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
return
-
ENOBUFS
;
return
-
ENOBUFS
;
}
}
pci_set_drvdata
(
pdev
,
card
);
pci_set_drvdata
(
pdev
,
card
);
card
->
ports
[
0
].
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
0
]);
card
->
ports
[
0
].
net
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
0
]);
card
->
ports
[
1
].
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
1
]);
card
->
ports
[
1
].
net
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
1
]);
if
(
!
card
->
ports
[
0
].
dev
||
!
card
->
ports
[
1
].
dev
)
{
if
(
!
card
->
ports
[
0
].
netdev
||
!
card
->
ports
[
1
].
net
dev
)
{
printk
(
KERN_ERR
"pci200syn: unable to allocate memory
\n
"
);
printk
(
KERN_ERR
"pci200syn: unable to allocate memory
\n
"
);
pci200_pci_remove_one
(
pdev
);
pci200_pci_remove_one
(
pdev
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -399,9 +386,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
...
@@ -399,9 +386,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
for
(
i
=
0
;
i
<
2
;
i
++
)
{
for
(
i
=
0
;
i
<
2
;
i
++
)
{
port_t
*
port
=
&
card
->
ports
[
i
];
port_t
*
port
=
&
card
->
ports
[
i
];
struct
net_device
*
dev
=
port
_to_dev
(
port
)
;
struct
net_device
*
dev
=
port
->
netdev
;
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
port
->
phy_node
=
i
;
port
->
chan
=
i
;
spin_lock_init
(
&
port
->
lock
);
spin_lock_init
(
&
port
->
lock
);
dev
->
irq
=
card
->
irq
;
dev
->
irq
=
card
->
irq
;
...
@@ -424,8 +411,8 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
...
@@ -424,8 +411,8 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
return
-
ENOBUFS
;
return
-
ENOBUFS
;
}
}
printk
(
KERN_INFO
"%s: PCI200SYN
node
%d
\n
"
,
printk
(
KERN_INFO
"%s: PCI200SYN
channel
%d
\n
"
,
dev
->
name
,
port
->
phy_node
);
dev
->
name
,
port
->
chan
);
}
}
sca_flush
(
card
);
sca_flush
(
card
);
...
...
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