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
f8df510e
Commit
f8df510e
authored
Jan 13, 2004
by
Chas Williams
Committed by
Stephen Hemminger
Jan 13, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ATM]: [nicstar] convert to new style pci module (by "Jorge Boncompte [DTI2]" <jorge@dti2.net>)
parent
8bc49a7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
129 additions
and
130 deletions
+129
-130
drivers/atm/atmdev_init.c
drivers/atm/atmdev_init.c
+0
-6
drivers/atm/nicstar.c
drivers/atm/nicstar.c
+129
-124
No files found.
drivers/atm/atmdev_init.c
View file @
f8df510e
...
...
@@ -10,9 +10,6 @@
#ifdef CONFIG_ATM_ZATM
extern
int
zatm_detect
(
void
);
#endif
#ifdef CONFIG_ATM_NICSTAR
extern
int
nicstar_detect
(
void
);
#endif
#ifdef CONFIG_ATM_AMBASSADOR
extern
int
amb_detect
(
void
);
#endif
...
...
@@ -41,9 +38,6 @@ int __init atmdev_init(void)
#ifdef CONFIG_ATM_ZATM
devs
+=
zatm_detect
();
#endif
#ifdef CONFIG_ATM_NICSTAR
devs
+=
nicstar_detect
();
#endif
#ifdef CONFIG_ATM_AMBASSADOR
devs
+=
amb_detect
();
#endif
...
...
drivers/atm/nicstar.c
View file @
f8df510e
...
...
@@ -214,8 +214,8 @@
static
u32
ns_read_sram
(
ns_dev
*
card
,
u32
sram_address
);
static
void
ns_write_sram
(
ns_dev
*
card
,
u32
sram_address
,
u32
*
value
,
int
count
);
static
int
__init
ns_init_card
(
int
i
,
struct
pci_dev
*
pcidev
);
static
void
__init
ns_init_card_error
(
ns_dev
*
card
,
int
error
);
static
int
__
dev
init
ns_init_card
(
int
i
,
struct
pci_dev
*
pcidev
);
static
void
__
dev
init
ns_init_card_error
(
ns_dev
*
card
,
int
error
);
static
scq_info
*
get_scq
(
int
size
,
u32
scd
);
static
void
free_scq
(
scq_info
*
scq
,
struct
atm_vcc
*
vcc
);
static
void
push_rxbufs
(
ns_dev
*
card
,
u32
type
,
u32
handle1
,
u32
addr1
,
...
...
@@ -276,78 +276,41 @@ MODULE_LICENSE("GPL");
/* Functions*******************************************************************/
static
int
__init
nicstar_module_init
(
void
)
static
int
__devinit
nicstar_init_one
(
struct
pci_dev
*
pcidev
,
const
struct
pci_device_id
*
ent
)
{
int
i
;
unsigned
error
=
0
;
/* Initialized to remove compile warning */
struct
pci_dev
*
pcidev
;
XPRINTK
(
"nicstar: nicstar_module_init() called.
\n
"
);
static
int
index
=
-
1
;
unsigned
int
error
;
for
(
i
=
0
;
i
<
NS_MAX_CARDS
;
i
++
)
cards
[
i
]
=
NULL
;
pcidev
=
NULL
;
for
(
i
=
0
;
i
<
NS_MAX_CARDS
;
i
++
)
{
if
((
pcidev
=
pci_find_device
(
PCI_VENDOR_ID_IDT
,
PCI_DEVICE_ID_IDT_IDT77201
,
pcidev
))
==
NULL
)
break
;
index
++
;
cards
[
index
]
=
NULL
;
error
=
ns_init_card
(
i
,
pcidev
);
if
(
error
)
cards
[
i
--
]
=
NULL
;
/* Try to find another card but don't increment index */
error
=
ns_init_card
(
index
,
pcidev
);
if
(
error
)
{
cards
[
index
--
]
=
NULL
;
/* don't increment index */
goto
err_out
;
}
if
(
i
==
0
)
{
if
(
!
error
)
{
printk
(
"nicstar: no cards found.
\n
"
);
return
-
ENXIO
;
}
else
return
-
EIO
;
}
TXPRINTK
(
"nicstar: TX debug enabled.
\n
"
);
RXPRINTK
(
"nicstar: RX debug enabled.
\n
"
);
PRINTK
(
"nicstar: General debug enabled.
\n
"
);
#ifdef PHY_LOOPBACK
printk
(
"nicstar: using PHY loopback.
\n
"
);
#endif
/* PHY_LOOPBACK */
XPRINTK
(
"nicstar: nicstar_module_init() returned.
\n
"
);
init_timer
(
&
ns_timer
);
ns_timer
.
expires
=
jiffies
+
NS_POLL_PERIOD
;
ns_timer
.
data
=
0UL
;
ns_timer
.
function
=
ns_poll
;
add_timer
(
&
ns_timer
);
return
0
;
err_out:
return
-
ENODEV
;
}
static
void
__
exit
nicstar_module_exit
(
void
)
static
void
__
devexit
nicstar_remove_one
(
struct
pci_dev
*
pcidev
)
{
int
i
,
j
;
unsigned
short
pci_command
;
ns_dev
*
card
;
ns_dev
*
card
=
pci_get_drvdata
(
pcidev
);
struct
sk_buff
*
hb
;
struct
sk_buff
*
iovb
;
struct
sk_buff
*
lb
;
struct
sk_buff
*
sb
;
XPRINTK
(
"nicstar: cleanup_module() called.
\n
"
);
del_timer
(
&
ns_timer
);
i
=
card
->
index
;
for
(
i
=
0
;
i
<
NS_MAX_CARDS
;
i
++
)
{
if
(
cards
[
i
]
==
NULL
)
continue
;
card
=
cards
[
i
];
return
;
if
(
card
->
atmdev
->
phy
&&
card
->
atmdev
->
phy
->
stop
)
card
->
atmdev
->
phy
->
stop
(
card
->
atmdev
);
...
...
@@ -358,16 +321,8 @@ static void __exit nicstar_module_exit(void)
/* De-register device */
atm_dev_deregister
(
card
->
atmdev
);
/* Disable memory mapping and busmastering */
if
(
pci_read_config_word
(
card
->
pcidev
,
PCI_COMMAND
,
&
pci_command
)
!=
0
)
{
printk
(
"nicstar%d: can't read PCI_COMMAND.
\n
"
,
i
);
}
pci_command
&=
~
(
PCI_COMMAND_MEMORY
|
PCI_COMMAND_MASTER
);
if
(
pci_write_config_word
(
card
->
pcidev
,
PCI_COMMAND
,
pci_command
)
!=
0
)
{
printk
(
"nicstar%d: can't write PCI_COMMAND.
\n
"
,
i
);
}
/* Disable PCI device */
pci_disable_device
(
pcidev
);
/* Free up resources */
j
=
0
;
...
...
@@ -401,11 +356,71 @@ static void __exit nicstar_module_exit(void)
free_irq
(
card
->
pcidev
->
irq
,
card
);
iounmap
((
void
*
)
card
->
membase
);
kfree
(
card
);
}
static
struct
pci_device_id
nicstar_pci_tbl
[]
__devinitdata
=
{
{
PCI_VENDOR_ID_IDT
,
PCI_DEVICE_ID_IDT_IDT77201
,
PCI_ANY_ID
,
PCI_ANY_ID
,
0
,
0
,
0
},
{
0
,}
/* terminate list */
};
MODULE_DEVICE_TABLE
(
pci
,
nicstar_pci_tbl
);
static
struct
pci_driver
nicstar_driver
=
{
.
name
=
"nicstar"
,
.
id_table
=
nicstar_pci_tbl
,
.
probe
=
nicstar_init_one
,
.
remove
=
__devexit_p
(
nicstar_remove_one
),
};
static
int
__init
nicstar_init
(
void
)
{
unsigned
error
=
0
;
/* Initialized to remove compile warning */
XPRINTK
(
"nicstar: nicstar_init() called.
\n
"
);
error
=
pci_module_init
(
&
nicstar_driver
);
TXPRINTK
(
"nicstar: TX debug enabled.
\n
"
);
RXPRINTK
(
"nicstar: RX debug enabled.
\n
"
);
PRINTK
(
"nicstar: General debug enabled.
\n
"
);
#ifdef PHY_LOOPBACK
printk
(
"nicstar: using PHY loopback.
\n
"
);
#endif
/* PHY_LOOPBACK */
XPRINTK
(
"nicstar: nicstar_init() returned.
\n
"
);
if
(
!
error
)
{
init_timer
(
&
ns_timer
);
ns_timer
.
expires
=
jiffies
+
NS_POLL_PERIOD
;
ns_timer
.
data
=
0UL
;
ns_timer
.
function
=
ns_poll
;
add_timer
(
&
ns_timer
);
}
XPRINTK
(
"nicstar: cleanup_module() returned.
\n
"
);
return
error
;
}
static
void
__exit
nicstar_cleanup
(
void
)
{
XPRINTK
(
"nicstar: nicstar_cleanup() called.
\n
"
);
del_timer
(
&
ns_timer
);
pci_unregister_driver
(
&
nicstar_driver
);
XPRINTK
(
"nicstar: nicstar_cleanup() returned.
\n
"
);
}
static
u32
ns_read_sram
(
ns_dev
*
card
,
u32
sram_address
)
{
unsigned
long
flags
;
...
...
@@ -445,11 +460,10 @@ static void ns_write_sram(ns_dev *card, u32 sram_address, u32 *value, int count)
}
static
int
__init
ns_init_card
(
int
i
,
struct
pci_dev
*
pcidev
)
static
int
__
dev
init
ns_init_card
(
int
i
,
struct
pci_dev
*
pcidev
)
{
int
j
;
struct
ns_dev
*
card
=
NULL
;
unsigned
short
pci_command
;
unsigned
char
pci_latency
;
unsigned
error
;
u32
data
;
...
...
@@ -478,6 +492,8 @@ static int __init ns_init_card(int i, struct pci_dev *pcidev)
spin_lock_init
(
&
card
->
int_lock
);
spin_lock_init
(
&
card
->
res_lock
);
pci_set_drvdata
(
pcidev
,
card
);
card
->
index
=
i
;
card
->
atmdev
=
NULL
;
card
->
pcidev
=
pcidev
;
...
...
@@ -492,21 +508,7 @@ static int __init ns_init_card(int i, struct pci_dev *pcidev)
}
PRINTK
(
"nicstar%d: membase at 0x%x.
\n
"
,
i
,
card
->
membase
);
if
(
pci_read_config_word
(
pcidev
,
PCI_COMMAND
,
&
pci_command
)
!=
0
)
{
printk
(
"nicstar%d: can't read PCI_COMMAND.
\n
"
,
i
);
error
=
4
;
ns_init_card_error
(
card
,
error
);
return
error
;
}
pci_command
|=
(
PCI_COMMAND_MEMORY
|
PCI_COMMAND_MASTER
);
if
(
pci_write_config_word
(
pcidev
,
PCI_COMMAND
,
pci_command
)
!=
0
)
{
printk
(
"nicstar%d: can't write PCI_COMMAND.
\n
"
,
i
);
error
=
5
;
ns_init_card_error
(
card
,
error
);
return
error
;
}
pci_set_master
(
pcidev
);
if
(
pci_read_config_byte
(
pcidev
,
PCI_LATENCY_TIMER
,
&
pci_latency
)
!=
0
)
{
...
...
@@ -932,7 +934,7 @@ static int __init ns_init_card(int i, struct pci_dev *pcidev)
static
void
__init
ns_init_card_error
(
ns_dev
*
card
,
int
error
)
static
void
__
dev
init
ns_init_card_error
(
ns_dev
*
card
,
int
error
)
{
if
(
error
>=
17
)
{
...
...
@@ -981,6 +983,7 @@ static void __init ns_init_card_error(ns_dev *card, int error)
}
if
(
error
>=
3
)
{
pci_disable_device
(
card
->
pcidev
);
kfree
(
card
);
}
}
...
...
@@ -3099,5 +3102,7 @@ static unsigned char ns_phy_get(struct atm_dev *dev, unsigned long addr)
return
(
unsigned
char
)
data
;
}
module_init
(
nicstar_module_init
);
module_exit
(
nicstar_module_exit
);
module_init
(
nicstar_init
);
module_exit
(
nicstar_cleanup
);
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