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
b6091b87
Commit
b6091b87
authored
Jan 10, 2004
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] (3/6) proteon -- probe2
Convert proteon token ring driver to new probing.
parent
edf697a0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
104 deletions
+90
-104
drivers/net/Space.c
drivers/net/Space.c
+4
-4
drivers/net/tokenring/proteon.c
drivers/net/tokenring/proteon.c
+86
-100
No files found.
drivers/net/Space.c
View file @
b6091b87
...
@@ -411,10 +411,13 @@ static void __init ethif_probe2(int unit)
...
@@ -411,10 +411,13 @@ static void __init ethif_probe2(int unit)
/* Token-ring device probe */
/* Token-ring device probe */
extern
int
ibmtr_probe
(
struct
net_device
*
);
extern
int
ibmtr_probe
(
struct
net_device
*
);
extern
int
sk_isa_probe
(
struct
net_device
*
);
extern
int
sk_isa_probe
(
struct
net_device
*
);
extern
int
proteon_probe
(
struct
net_device
*
);
extern
struct
net_device
*
proteon_probe
(
int
unit
);
extern
struct
net_device
*
smctr_probe
(
int
unit
);
extern
struct
net_device
*
smctr_probe
(
int
unit
);
static
struct
devprobe2
tr_probes2
[]
__initdata
=
{
static
struct
devprobe2
tr_probes2
[]
__initdata
=
{
#ifdef CONFIG_PROTEON
{
proteon_probe
,
0
},
#endif
#ifdef CONFIG_SMCTR
#ifdef CONFIG_SMCTR
{
smctr_probe
,
0
},
{
smctr_probe
,
0
},
#endif
#endif
...
@@ -438,9 +441,6 @@ static __init int trif_probe(int unit)
...
@@ -438,9 +441,6 @@ static __init int trif_probe(int unit)
#endif
#endif
#ifdef CONFIG_SKISA
#ifdef CONFIG_SKISA
sk_isa_probe
(
dev
)
==
0
||
sk_isa_probe
(
dev
)
==
0
||
#endif
#ifdef CONFIG_PROTEON
proteon_probe
(
dev
)
==
0
||
#endif
#endif
0
)
0
)
err
=
register_netdev
(
dev
);
err
=
register_netdev
(
dev
);
...
...
drivers/net/tokenring/proteon.c
View file @
b6091b87
...
@@ -63,7 +63,7 @@ static int dmalist[] __initdata = {
...
@@ -63,7 +63,7 @@ static int dmalist[] __initdata = {
static
char
cardname
[]
=
"Proteon 1392
\0
"
;
static
char
cardname
[]
=
"Proteon 1392
\0
"
;
int
proteon_probe
(
struct
net_device
*
dev
);
struct
net_device
*
proteon_probe
(
int
unit
);
static
int
proteon_open
(
struct
net_device
*
dev
);
static
int
proteon_open
(
struct
net_device
*
dev
);
static
int
proteon_close
(
struct
net_device
*
dev
);
static
int
proteon_close
(
struct
net_device
*
dev
);
static
void
proteon_read_eeprom
(
struct
net_device
*
dev
);
static
void
proteon_read_eeprom
(
struct
net_device
*
dev
);
...
@@ -89,80 +89,69 @@ static void proteon_sifwritew(struct net_device *dev, unsigned short val, unsign
...
@@ -89,80 +89,69 @@ static void proteon_sifwritew(struct net_device *dev, unsigned short val, unsign
outw
(
val
,
dev
->
base_addr
+
reg
);
outw
(
val
,
dev
->
base_addr
+
reg
);
}
}
struct
proteon_card
{
static
int
__init
proteon_probe1
(
struct
net_device
*
dev
,
int
ioaddr
)
struct
net_device
*
dev
;
struct
proteon_card
*
next
;
};
static
struct
proteon_card
*
proteon_card_list
;
static
int
__init
proteon_probe1
(
int
ioaddr
)
{
{
unsigned
char
chk1
,
chk2
;
unsigned
char
chk1
,
chk2
;
int
i
;
int
i
;
if
(
!
request_region
(
ioaddr
,
PROTEON_IO_EXTENT
,
cardname
))
return
-
ENODEV
;
chk1
=
inb
(
ioaddr
+
0x1f
);
/* Get Proteon ID reg 1 */
chk1
=
inb
(
ioaddr
+
0x1f
);
/* Get Proteon ID reg 1 */
if
(
chk1
!=
0x1f
)
if
(
chk1
!=
0x1f
)
return
(
-
1
);
goto
nodev
;
chk1
=
inb
(
ioaddr
+
0x1e
)
&
0x07
;
/* Get Proteon ID reg 0 */
chk1
=
inb
(
ioaddr
+
0x1e
)
&
0x07
;
/* Get Proteon ID reg 0 */
for
(
i
=
0
;
i
<
16
;
i
++
)
{
for
(
i
=
0
;
i
<
16
;
i
++
)
{
chk2
=
inb
(
ioaddr
+
0x1e
)
&
0x07
;
chk2
=
inb
(
ioaddr
+
0x1e
)
&
0x07
;
if
(((
chk1
+
1
)
&
0x07
)
!=
chk2
)
if
(((
chk1
+
1
)
&
0x07
)
!=
chk2
)
return
(
-
1
)
;
goto
nodev
;
chk1
=
chk2
;
chk1
=
chk2
;
}
}
dev
->
base_addr
=
ioaddr
;
return
(
0
);
return
(
0
);
nodev:
release_region
(
ioaddr
,
PROTEON_IO_EXTENT
);
return
-
ENODEV
;
}
}
int
__init
proteon_probe
(
struct
net_device
*
dev
)
struct
net_device
*
__init
proteon_probe
(
int
unit
)
{
{
static
int
versionprinted
;
struct
net_device
*
dev
=
alloc_trdev
(
sizeof
(
struct
net_local
))
;
struct
net_local
*
tp
;
struct
net_local
*
tp
;
int
i
,
j
;
static
int
versionprinted
;
struct
proteon_card
*
card
;
const
unsigned
*
port
;
int
j
,
err
=
0
;
#ifndef MODULE
netdev_boot_setup_check
(
dev
);
tr_setup
(
dev
);
#endif
SET_MODULE_OWNER
(
dev
);
if
(
!
dev
)
if
(
!
dev
->
base_addr
)
return
ERR_PTR
(
-
ENOMEM
);
{
for
(
i
=
0
;
portlist
[
i
];
i
++
)
{
if
(
!
request_region
(
portlist
[
i
],
PROTEON_IO_EXTENT
,
cardname
))
continue
;
if
(
proteon_probe1
(
portlist
[
i
]))
if
(
unit
>=
0
)
{
{
sprintf
(
dev
->
name
,
"tr%d"
,
unit
);
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
netdev_boot_setup_check
(
dev
);
continue
;
}
}
dev
->
base_addr
=
portlist
[
i
];
SET_MODULE_OWNER
(
dev
);
if
(
dev
->
base_addr
)
/* probe specific location */
err
=
proteon_probe1
(
dev
,
dev
->
base_addr
);
else
{
for
(
port
=
portlist
;
*
port
;
port
++
)
{
err
=
proteon_probe1
(
dev
,
*
port
);
if
(
!
err
)
break
;
break
;
}
}
if
(
!
dev
->
base_addr
)
return
-
1
;
}
else
{
if
(
!
request_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
,
cardname
))
return
-
1
;
if
(
proteon_probe1
(
dev
->
base_addr
))
{
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
return
-
1
;
}
}
}
if
(
err
)
goto
out4
;
/* At this point we have found a valid card. */
/* At this point we have found a valid card. */
if
(
versionprinted
++
==
0
)
if
(
versionprinted
++
==
0
)
printk
(
KERN_DEBUG
"%s"
,
version
);
printk
(
KERN_DEBUG
"%s"
,
version
);
err
=
-
EIO
;
if
(
tmsdev_init
(
dev
,
ISA_MAX_ADDRESS
,
NULL
))
if
(
tmsdev_init
(
dev
,
ISA_MAX_ADDRESS
,
NULL
))
goto
out4
;
goto
out4
;
...
@@ -264,14 +253,11 @@ int __init proteon_probe(struct net_device *dev)
...
@@ -264,14 +253,11 @@ int __init proteon_probe(struct net_device *dev)
printk
(
KERN_DEBUG
"%s: IO: %#4lx IRQ: %d DMA: %d
\n
"
,
printk
(
KERN_DEBUG
"%s: IO: %#4lx IRQ: %d DMA: %d
\n
"
,
dev
->
name
,
dev
->
base_addr
,
dev
->
irq
,
dev
->
dma
);
dev
->
name
,
dev
->
base_addr
,
dev
->
irq
,
dev
->
dma
);
/* Enlist in the card list */
err
=
register_netdev
(
dev
);
card
=
kmalloc
(
sizeof
(
struct
proteon_card
),
GFP_KERNEL
);
if
(
err
)
if
(
!
card
)
goto
out
;
goto
out
;
card
->
next
=
proteon_card_list
;
proteon_card_list
=
card
;
return
dev
;
card
->
dev
=
dev
;
return
0
;
out:
out:
free_dma
(
dev
->
dma
);
free_dma
(
dev
->
dma
);
out2:
out2:
...
@@ -280,7 +266,8 @@ int __init proteon_probe(struct net_device *dev)
...
@@ -280,7 +266,8 @@ int __init proteon_probe(struct net_device *dev)
tmsdev_term
(
dev
);
tmsdev_term
(
dev
);
out4:
out4:
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
return
-
1
;
free_netdev
(
dev
);
return
ERR_PTR
(
err
);
}
}
/*
/*
...
@@ -370,50 +357,50 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
...
@@ -370,50 +357,50 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
MODULE_PARM
(
irq
,
"1-"
__MODULE_STRING
(
ISATR_MAX_ADAPTERS
)
"i"
);
MODULE_PARM
(
irq
,
"1-"
__MODULE_STRING
(
ISATR_MAX_ADAPTERS
)
"i"
);
MODULE_PARM
(
dma
,
"1-"
__MODULE_STRING
(
ISATR_MAX_ADAPTERS
)
"i"
);
MODULE_PARM
(
dma
,
"1-"
__MODULE_STRING
(
ISATR_MAX_ADAPTERS
)
"i"
);
static
int
__init
setup_card
(
unsigned
long
io
,
unsigned
irq
,
unsigned
char
dma
)
static
struct
net_device
*
proteon_dev
[
ISATR_MAX_ADAPTERS
];
static
struct
net_device
*
__init
setup_card
(
unsigned
long
io
,
unsigned
irq
,
unsigned
char
dma
)
{
{
int
res
=
-
ENOMEM
;
struct
net_device
*
dev
=
alloc_trdev
(
sizeof
(
struct
net_local
));
struct
proteon_card
*
this_card
;
int
err
;
struct
net_device
*
dev
=
alloc_trdev
(
0
);
if
(
!
dev
)
return
ERR_PTR
(
-
ENOMEM
);
if
(
dev
)
{
dev
->
base_addr
=
io
;
dev
->
irq
=
irq
;
dev
->
irq
=
irq
;
dev
->
dma
=
dma
;
dev
->
dma
=
dma
;
res
=
-
ENODEV
;
err
=
proteon_probe1
(
dev
,
io
);
if
(
proteon_probe
(
dev
)
==
0
)
{
if
(
err
)
res
=
register_netdev
(
dev
);
goto
out
;
if
(
!
res
)
return
0
;
err
=
register_netdev
(
dev
);
if
(
err
)
goto
out1
;
return
dev
;
out1:
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
free_irq
(
dev
->
irq
,
dev
);
free_irq
(
dev
->
irq
,
dev
);
free_dma
(
dev
->
dma
);
free_dma
(
dev
->
dma
);
tmsdev_term
(
dev
);
tmsdev_term
(
dev
);
this_card
=
proteon_card_list
;
out:
proteon_card_list
=
this_card
->
next
;
free_netdev
(
dev
);
kfree
(
this_card
);
return
ERR_PTR
(
err
);
}
kfree
(
dev
);
}
return
res
;
}
}
int
init_module
(
void
)
int
init_module
(
void
)
{
{
int
i
,
num
;
struct
net_device
*
dev
;
int
i
,
num
=
0
;
num
=
0
;
if
(
io
[
0
])
{
/* Only probe addresses from command line */
for
(
i
=
0
;
i
<
ISATR_MAX_ADAPTERS
;
i
++
)
{
for
(
i
=
0
;
i
<
ISATR_MAX_ADAPTERS
;
i
++
)
{
if
(
io
[
i
]
&&
setup_card
(
io
[
i
],
irq
[
i
],
dma
[
i
])
==
0
)
dev
=
io
[
0
]
?
setup_card
(
io
[
i
],
irq
[
i
],
dma
[
i
])
num
++
;
:
proteon_probe
(
-
1
);
}
if
(
!
IS_ERR
(
dev
))
{
}
else
{
proteon_dev
[
i
]
=
dev
;
for
(
i
=
0
;
num
<
ISATR_MAX_ADAPTERS
&&
portlist
[
i
];
i
++
)
{
++
num
;
if
(
setup_card
(
portlist
[
i
],
irq
[
num
],
dma
[
num
])
==
0
)
num
++
;
}
}
}
}
printk
(
KERN_NOTICE
"proteon.c: %d cards found.
\n
"
,
num
);
printk
(
KERN_NOTICE
"proteon.c: %d cards found.
\n
"
,
num
);
/* Probe for cards. */
/* Probe for cards. */
if
(
num
==
0
)
{
if
(
num
==
0
)
{
...
@@ -425,11 +412,13 @@ int init_module(void)
...
@@ -425,11 +412,13 @@ int init_module(void)
void
cleanup_module
(
void
)
void
cleanup_module
(
void
)
{
{
struct
net_device
*
dev
;
int
i
;
struct
proteon_card
*
this_card
;
while
(
proteon_card_list
)
{
for
(
i
=
0
;
i
<
ISATR_MAX_ADAPTERS
;
i
++
)
{
dev
=
proteon_card_list
->
dev
;
struct
net_device
*
dev
=
proteon_dev
[
i
];
if
(
!
dev
)
continue
;
unregister_netdev
(
dev
);
unregister_netdev
(
dev
);
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
release_region
(
dev
->
base_addr
,
PROTEON_IO_EXTENT
);
...
@@ -437,9 +426,6 @@ void cleanup_module(void)
...
@@ -437,9 +426,6 @@ void cleanup_module(void)
free_dma
(
dev
->
dma
);
free_dma
(
dev
->
dma
);
tmsdev_term
(
dev
);
tmsdev_term
(
dev
);
free_netdev
(
dev
);
free_netdev
(
dev
);
this_card
=
proteon_card_list
;
proteon_card_list
=
this_card
->
next
;
kfree
(
this_card
);
}
}
}
}
#endif
/* MODULE */
#endif
/* MODULE */
...
...
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