Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
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
Expand all
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
This diff is collapsed.
Click to expand it.
drivers/net/wan/pc300too.c
View file @
61e0a6a2
/*
* 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
* under the terms of version 2 of the GNU General Public License
...
...
@@ -11,7 +11,7 @@
*
* Sources of information:
* 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
* PC300/X21 cards.
...
...
@@ -76,7 +76,7 @@ typedef struct {
typedef
struct
port_s
{
struct
napi_struct
napi
;
struct
net_device
*
dev
;
struct
net_device
*
net
dev
;
struct
card_s
*
card
;
spinlock_t
lock
;
/* TX lock */
sync_serial_settings
settings
;
...
...
@@ -88,7 +88,7 @@ typedef struct port_s {
u16
txin
;
/* tx ring buffer 'in' and 'last' pointers */
u16
txlast
;
u8
rxs
,
txs
,
tmc
;
/* SCA registers */
u8
phy_node
;
/* physical port # - 0 or 1 */
u8
chan
;
/* physical port # - 0 or 1 */
}
port_t
;
...
...
@@ -109,17 +109,6 @@ typedef struct card_s {
}
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 ? \
(&(card)->ports[port]) : (NULL))
...
...
@@ -134,8 +123,8 @@ static void pc300_set_iface(port_t *port)
u8
rxs
=
port
->
rxs
&
CLK_BRG_MASK
;
u8
txs
=
port
->
txs
&
CLK_BRG_MASK
;
sca_out
(
EXS_TES1
,
(
p
hy_node
(
port
)
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
port
_to_card
(
port
)
);
sca_out
(
EXS_TES1
,
(
p
ort
->
chan
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
port
->
card
);
switch
(
port
->
settings
.
clock_type
)
{
case
CLOCK_INT
:
rxs
|=
CLK_BRG
;
/* BRG output */
...
...
@@ -167,10 +156,10 @@ static void pc300_set_iface(port_t *port)
if
(
port
->
card
->
type
==
PC300_RSV
)
{
if
(
port
->
iface
==
IF_IFACE_V35
)
writel
(
card
->
init_ctrl_value
|
PC300_CHMEDIA_MASK
(
port
->
phy_node
),
init_ctrl
);
PC300_CHMEDIA_MASK
(
port
->
chan
),
init_ctrl
);
else
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)
card_t
*
card
=
pci_get_drvdata
(
pdev
);
for
(
i
=
0
;
i
<
2
;
i
++
)
if
(
card
->
ports
[
i
].
card
)
{
struct
net_device
*
dev
=
port_to_dev
(
&
card
->
ports
[
i
]);
unregister_hdlc_device
(
dev
);
}
if
(
card
->
ports
[
i
].
card
)
unregister_hdlc_device
(
card
->
ports
[
i
].
netdev
);
if
(
card
->
irq
)
free_irq
(
card
->
irq
,
card
);
...
...
@@ -293,10 +280,10 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
pci_release_regions
(
pdev
);
pci_disable_device
(
pdev
);
pci_set_drvdata
(
pdev
,
NULL
);
if
(
card
->
ports
[
0
].
dev
)
free_netdev
(
card
->
ports
[
0
].
dev
);
if
(
card
->
ports
[
1
].
dev
)
free_netdev
(
card
->
ports
[
1
].
dev
);
if
(
card
->
ports
[
0
].
net
dev
)
free_netdev
(
card
->
ports
[
0
].
net
dev
);
if
(
card
->
ports
[
1
].
net
dev
)
free_netdev
(
card
->
ports
[
1
].
net
dev
);
kfree
(
card
);
}
...
...
@@ -347,7 +334,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
card
->
n_ports
=
2
;
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
"
);
pc300_pci_remove_one
(
pdev
);
return
-
ENOMEM
;
...
...
@@ -452,9 +439,9 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
for
(
i
=
0
;
i
<
card
->
n_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
);
port
->
phy_node
=
i
;
port
->
chan
=
i
;
spin_lock_init
(
&
port
->
lock
);
dev
->
irq
=
card
->
irq
;
...
...
@@ -482,8 +469,8 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
return
-
ENOBUFS
;
}
printk
(
KERN_INFO
"%s: PC300
node
%d
\n
"
,
dev
->
name
,
port
->
phy_node
);
printk
(
KERN_INFO
"%s: PC300
channel
%d
\n
"
,
dev
->
name
,
port
->
chan
);
}
return
0
;
}
...
...
drivers/net/wan/pci200syn.c
View file @
61e0a6a2
/*
* 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
* under the terms of version 2 of the GNU General Public License
...
...
@@ -63,7 +63,7 @@ typedef struct {
typedef
struct
port_s
{
struct
napi_struct
napi
;
struct
net_device
*
dev
;
struct
net_device
*
net
dev
;
struct
card_s
*
card
;
spinlock_t
lock
;
/* TX lock */
sync_serial_settings
settings
;
...
...
@@ -74,7 +74,7 @@ typedef struct port_s {
u16
txin
;
/* tx ring buffer 'in' and 'last' pointers */
u16
txlast
;
u8
rxs
,
txs
,
tmc
;
/* SCA registers */
u8
phy_node
;
/* physical port # - 0 or 1 */
u8
chan
;
/* physical port # - 0 or 1 */
}
port_t
;
...
...
@@ -92,17 +92,6 @@ typedef struct card_s {
}
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 sca_flush(card) (sca_in(IER0, card));
...
...
@@ -132,8 +121,8 @@ static void pci200_set_iface(port_t *port)
u8
rxs
=
port
->
rxs
&
CLK_BRG_MASK
;
u8
txs
=
port
->
txs
&
CLK_BRG_MASK
;
sca_out
(
EXS_TES1
,
(
p
hy_node
(
port
)
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
port
_to_card
(
port
)
);
sca_out
(
EXS_TES1
,
(
p
ort
->
chan
?
MSCI1_OFFSET
:
MSCI0_OFFSET
)
+
EXS
,
port
->
card
);
switch
(
port
->
settings
.
clock_type
)
{
case
CLOCK_INT
:
rxs
|=
CLK_BRG
;
/* BRG output */
...
...
@@ -175,7 +164,7 @@ static int pci200_open(struct net_device *dev)
sca_open
(
dev
);
pci200_set_iface
(
port
);
sca_flush
(
port
_to_card
(
port
)
);
sca_flush
(
port
->
card
);
return
0
;
}
...
...
@@ -184,7 +173,7 @@ static int pci200_open(struct net_device *dev)
static
int
pci200_close
(
struct
net_device
*
dev
)
{
sca_close
(
dev
);
sca_flush
(
port_to_card
(
dev_to_port
(
dev
))
);
sca_flush
(
dev_to_port
(
dev
)
->
card
);
hdlc_close
(
dev
);
return
0
;
}
...
...
@@ -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 */
pci200_set_iface
(
port
);
sca_flush
(
port
_to_card
(
port
)
);
sca_flush
(
port
->
card
);
return
0
;
default:
...
...
@@ -253,10 +242,8 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
card_t
*
card
=
pci_get_drvdata
(
pdev
);
for
(
i
=
0
;
i
<
2
;
i
++
)
if
(
card
->
ports
[
i
].
card
)
{
struct
net_device
*
dev
=
port_to_dev
(
&
card
->
ports
[
i
]);
unregister_hdlc_device
(
dev
);
}
if
(
card
->
ports
[
i
].
card
)
unregister_hdlc_device
(
card
->
ports
[
i
].
netdev
);
if
(
card
->
irq
)
free_irq
(
card
->
irq
,
card
);
...
...
@@ -271,10 +258,10 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
pci_release_regions
(
pdev
);
pci_disable_device
(
pdev
);
pci_set_drvdata
(
pdev
,
NULL
);
if
(
card
->
ports
[
0
].
dev
)
free_netdev
(
card
->
ports
[
0
].
dev
);
if
(
card
->
ports
[
1
].
dev
)
free_netdev
(
card
->
ports
[
1
].
dev
);
if
(
card
->
ports
[
0
].
net
dev
)
free_netdev
(
card
->
ports
[
0
].
net
dev
);
if
(
card
->
ports
[
1
].
net
dev
)
free_netdev
(
card
->
ports
[
1
].
net
dev
);
kfree
(
card
);
}
...
...
@@ -309,9 +296,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
return
-
ENOBUFS
;
}
pci_set_drvdata
(
pdev
,
card
);
card
->
ports
[
0
].
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
0
]);
card
->
ports
[
1
].
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
1
]);
if
(
!
card
->
ports
[
0
].
dev
||
!
card
->
ports
[
1
].
dev
)
{
card
->
ports
[
0
].
net
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
0
]);
card
->
ports
[
1
].
net
dev
=
alloc_hdlcdev
(
&
card
->
ports
[
1
]);
if
(
!
card
->
ports
[
0
].
netdev
||
!
card
->
ports
[
1
].
net
dev
)
{
printk
(
KERN_ERR
"pci200syn: unable to allocate memory
\n
"
);
pci200_pci_remove_one
(
pdev
);
return
-
ENOMEM
;
...
...
@@ -399,9 +386,9 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
for
(
i
=
0
;
i
<
2
;
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
);
port
->
phy_node
=
i
;
port
->
chan
=
i
;
spin_lock_init
(
&
port
->
lock
);
dev
->
irq
=
card
->
irq
;
...
...
@@ -424,8 +411,8 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
return
-
ENOBUFS
;
}
printk
(
KERN_INFO
"%s: PCI200SYN
node
%d
\n
"
,
dev
->
name
,
port
->
phy_node
);
printk
(
KERN_INFO
"%s: PCI200SYN
channel
%d
\n
"
,
dev
->
name
,
port
->
chan
);
}
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