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
ae2b1120
Commit
ae2b1120
authored
Jan 10, 2004
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] (4/6) skisa -- probe2
Convert the SK-NET TMS380 ISA card to the new probe2 format.
parent
b6091b87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
101 deletions
+89
-101
drivers/net/Space.c
drivers/net/Space.c
+4
-4
drivers/net/tokenring/skisa.c
drivers/net/tokenring/skisa.c
+85
-97
No files found.
drivers/net/Space.c
View file @
ae2b1120
...
@@ -410,11 +410,14 @@ static void __init ethif_probe2(int unit)
...
@@ -410,11 +410,14 @@ static void __init ethif_probe2(int unit)
#ifdef CONFIG_TR
#ifdef CONFIG_TR
/* 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
struct
net_device
*
sk_isa_probe
(
int
unit
);
extern
struct
net_device
*
proteon_probe
(
int
unit
);
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_SKISA
{
sk_isa_probe
,
0
},
#endif
#ifdef CONFIG_PROTEON
#ifdef CONFIG_PROTEON
{
proteon_probe
,
0
},
{
proteon_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)
if
(
if
(
#ifdef CONFIG_IBMTR
#ifdef CONFIG_IBMTR
ibmtr_probe
(
dev
)
==
0
||
ibmtr_probe
(
dev
)
==
0
||
#endif
#ifdef CONFIG_SKISA
sk_isa_probe
(
dev
)
==
0
||
#endif
#endif
0
)
0
)
err
=
register_netdev
(
dev
);
err
=
register_netdev
(
dev
);
...
...
drivers/net/tokenring/skisa.c
View file @
ae2b1120
...
@@ -56,7 +56,7 @@ static unsigned int portlist[] __initdata = {
...
@@ -56,7 +56,7 @@ static unsigned int portlist[] __initdata = {
/* A zero-terminated list of IRQs to be probed.
/* A zero-terminated list of IRQs to be probed.
* Used again after initial probe for sktr_chipset_init, called from sktr_open.
* Used again after initial probe for sktr_chipset_init, called from sktr_open.
*/
*/
static
unsigned
short
irqlist
[]
=
{
static
const
unsigned
short
irqlist
[]
=
{
3
,
5
,
9
,
10
,
11
,
12
,
15
,
3
,
5
,
9
,
10
,
11
,
12
,
15
,
0
0
};
};
...
@@ -69,7 +69,6 @@ static int dmalist[] __initdata = {
...
@@ -69,7 +69,6 @@ static int dmalist[] __initdata = {
static
char
isa_cardname
[]
=
"SK NET TR 4/16 ISA
\0
"
;
static
char
isa_cardname
[]
=
"SK NET TR 4/16 ISA
\0
"
;
int
sk_isa_probe
(
struct
net_device
*
dev
);
static
int
sk_isa_open
(
struct
net_device
*
dev
);
static
int
sk_isa_open
(
struct
net_device
*
dev
);
static
int
sk_isa_close
(
struct
net_device
*
dev
);
static
int
sk_isa_close
(
struct
net_device
*
dev
);
static
void
sk_isa_read_eeprom
(
struct
net_device
*
dev
);
static
void
sk_isa_read_eeprom
(
struct
net_device
*
dev
);
...
@@ -95,17 +94,14 @@ static void sk_isa_sifwritew(struct net_device *dev, unsigned short val, unsigne
...
@@ -95,17 +94,14 @@ static void sk_isa_sifwritew(struct net_device *dev, unsigned short val, unsigne
outw
(
val
,
dev
->
base_addr
+
reg
);
outw
(
val
,
dev
->
base_addr
+
reg
);
}
}
struct
sk_isa_card
{
struct
net_device
*
dev
;
struct
sk_isa_card
*
next
;
};
static
struct
sk_isa_card
*
sk_isa_card_list
;
static
int
__init
sk_isa_probe1
(
int
ioaddr
)
static
int
__init
sk_isa_probe1
(
struct
net_device
*
dev
,
int
ioaddr
)
{
{
unsigned
char
old
,
chk1
,
chk2
;
unsigned
char
old
,
chk1
,
chk2
;
if
(
!
request_region
(
ioaddr
,
SK_ISA_IO_EXTENT
,
isa_cardname
))
return
-
ENODEV
;
old
=
inb
(
ioaddr
+
SIFADR
);
/* Get the old SIFADR value */
old
=
inb
(
ioaddr
+
SIFADR
);
/* Get the old SIFADR value */
chk1
=
0
;
/* Begin with check value 0 */
chk1
=
0
;
/* Begin with check value 0 */
...
@@ -122,8 +118,10 @@ static int __init sk_isa_probe1(int ioaddr)
...
@@ -122,8 +118,10 @@ static int __init sk_isa_probe1(int ioaddr)
chk2
=
inb
(
ioaddr
+
SIFADD
);
chk2
=
inb
(
ioaddr
+
SIFADD
);
chk2
^=
0x0FE
;
chk2
^=
0x0FE
;
if
(
chk1
!=
chk2
)
if
(
chk1
!=
chk2
)
{
return
(
-
1
);
/* No adapter */
release_region
(
ioaddr
,
SK_ISA_IO_EXTENT
);
return
-
ENODEV
;
}
chk1
-=
2
;
chk1
-=
2
;
}
while
(
chk1
!=
0
);
/* Repeat 128 times (all byte values) */
}
while
(
chk1
!=
0
);
/* Repeat 128 times (all byte values) */
...
@@ -131,58 +129,45 @@ static int __init sk_isa_probe1(int ioaddr)
...
@@ -131,58 +129,45 @@ static int __init sk_isa_probe1(int ioaddr)
/* Restore the SIFADR value */
/* Restore the SIFADR value */
outb
(
old
,
ioaddr
+
SIFADR
);
outb
(
old
,
ioaddr
+
SIFADR
);
return
(
0
);
dev
->
base_addr
=
ioaddr
;
return
0
;
}
}
int
__init
sk_isa_probe
(
struct
net_device
*
dev
)
struct
net_device
*
__init
sk_isa_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
sk_isa_card
*
card
;
const
unsigned
*
port
;
int
j
,
err
=
0
;
#ifndef MODULE
if
(
!
dev
)
netdev_boot_setup_check
(
dev
);
return
ERR_PTR
(
-
ENOMEM
);
tr_setup
(
dev
);
#endif
SET_MODULE_OWNER
(
dev
);
if
(
unit
>=
0
)
{
if
(
!
dev
->
base_addr
)
sprintf
(
dev
->
name
,
"tr%d"
,
unit
);
{
netdev_boot_setup_check
(
dev
);
for
(
i
=
0
;
portlist
[
i
];
i
++
)
}
{
if
(
!
request_region
(
portlist
[
i
],
SK_ISA_IO_EXTENT
,
isa_cardname
))
continue
;
if
(
sk_isa_probe1
(
portlist
[
i
]))
{
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
continue
;
}
dev
->
base_addr
=
portlist
[
i
];
SET_MODULE_OWNER
(
dev
);
break
;
if
(
dev
->
base_addr
)
/* probe specific location */
err
=
sk_isa_probe1
(
dev
,
dev
->
base_addr
);
else
{
for
(
port
=
portlist
;
*
port
;
port
++
)
{
err
=
sk_isa_probe1
(
dev
,
*
port
);
if
(
!
err
)
break
;
}
}
if
(
!
dev
->
base_addr
)
return
-
1
;
}
}
else
if
(
err
)
{
goto
out4
;
if
(
!
request_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
,
isa_cardname
))
return
-
1
;
if
(
sk_isa_probe1
(
dev
->
base_addr
))
{
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
return
-
1
;
}
}
/* 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
;
...
@@ -284,14 +269,11 @@ int __init sk_isa_probe(struct net_device *dev)
...
@@ -284,14 +269,11 @@ int __init sk_isa_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
sk_isa_card
),
GFP_KERNEL
);
if
(
err
)
if
(
!
card
)
goto
out
;
goto
out
;
card
->
next
=
sk_isa_card_list
;
sk_isa_card_list
=
card
;
return
dev
;
card
->
dev
=
dev
;
return
0
;
out:
out:
free_dma
(
dev
->
dma
);
free_dma
(
dev
->
dma
);
out2:
out2:
...
@@ -300,7 +282,8 @@ int __init sk_isa_probe(struct net_device *dev)
...
@@ -300,7 +282,8 @@ int __init sk_isa_probe(struct net_device *dev)
tmsdev_term
(
dev
);
tmsdev_term
(
dev
);
out4:
out4:
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
return
-
1
;
free_netdev
(
dev
);
return
ERR_PTR
(
err
);
}
}
/*
/*
...
@@ -373,6 +356,8 @@ static int sk_isa_close(struct net_device *dev)
...
@@ -373,6 +356,8 @@ static int sk_isa_close(struct net_device *dev)
#define ISATR_MAX_ADAPTERS 3
#define ISATR_MAX_ADAPTERS 3
static
struct
net_device
*
sk_isa_dev
[
ISATR_MAX_ADAPTERS
];
static
int
io
[
ISATR_MAX_ADAPTERS
];
static
int
io
[
ISATR_MAX_ADAPTERS
];
static
int
irq
[
ISATR_MAX_ADAPTERS
];
static
int
irq
[
ISATR_MAX_ADAPTERS
];
static
int
dma
[
ISATR_MAX_ADAPTERS
];
static
int
dma
[
ISATR_MAX_ADAPTERS
];
...
@@ -383,50 +368,54 @@ MODULE_PARM(io, "1-" __MODULE_STRING(ISATR_MAX_ADAPTERS) "i");
...
@@ -383,50 +368,54 @@ 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
*
__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
sk_isa_card
*
this_card
;
int
err
;
struct
net_device
*
dev
=
alloc_trdev
(
0
);
if
(
!
dev
)
if
(
dev
)
{
return
ERR_PTR
(
-
ENOMEM
);
dev
->
base_addr
=
io
;
dev
->
irq
=
irq
;
dev
->
base_addr
=
io
;
dev
->
dma
=
dma
;
dev
->
irq
=
irq
;
res
=
-
ENODEV
;
dev
->
dma
=
dma
;
if
(
sk_isa_probe
(
dev
)
==
0
)
{
res
=
register_netdev
(
dev
);
err
=
sk_isa_probe1
(
dev
,
io
);
if
(
!
res
)
if
(
err
)
return
0
;
goto
out
;
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
free_irq
(
dev
->
irq
,
dev
);
err
=
register_netdev
(
dev
);
free_dma
(
dev
->
dma
);
if
(
err
)
tmsdev_term
(
dev
);
goto
out1
;
this_card
=
sk_isa_card_list
;
return
dev
;
sk_isa_card_list
=
this_card
->
next
;
kfree
(
this_card
);
out1:
}
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
kfree
(
dev
);
free_irq
(
dev
->
irq
,
dev
);
}
free_dma
(
dev
->
dma
);
return
res
;
tmsdev_term
(
dev
);
out:
free_netdev
(
dev
);
return
ERR_PTR
(
err
);
}
}
int
init_module
(
void
)
int
init_module
(
void
)
{
{
struct
net_device
*
dev
;
int
i
,
num
;
int
i
,
num
;
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
[
0
])
/* Only probe addresses from command line */
if
(
io
[
i
]
&&
setup_card
(
io
[
i
],
irq
[
i
],
dma
[
i
])
==
0
)
dev
=
setup_card
(
io
[
i
],
irq
[
i
],
dma
[
i
]);
num
++
;
else
}
dev
=
sk_isa_probe
(
-
1
);
}
else
{
if
(
!
IS_ERR
(
dev
))
{
for
(
i
=
0
;
num
<
ISATR_MAX_ADAPTERS
&&
portlist
[
i
];
i
++
)
{
sk_isa_dev
[
i
]
=
dev
;
if
(
setup_card
(
portlist
[
i
],
irq
[
num
],
dma
[
num
])
==
0
)
++
num
;
num
++
;
}
}
}
}
printk
(
KERN_NOTICE
"skisa.c: %d cards found.
\n
"
,
num
);
printk
(
KERN_NOTICE
"skisa.c: %d cards found.
\n
"
,
num
);
/* Probe for cards. */
/* Probe for cards. */
if
(
num
==
0
)
{
if
(
num
==
0
)
{
...
@@ -438,11 +427,13 @@ int init_module(void)
...
@@ -438,11 +427,13 @@ int init_module(void)
void
cleanup_module
(
void
)
void
cleanup_module
(
void
)
{
{
struct
net_device
*
dev
;
int
i
;
struct
sk_isa_card
*
this_card
;
for
(
i
=
0
;
i
<
ISATR_MAX_ADAPTERS
;
i
++
)
{
struct
net_device
*
dev
=
sk_isa_dev
[
i
];
while
(
sk_isa_card_list
)
{
if
(
!
dev
)
dev
=
sk_isa_card_list
->
dev
;
continue
;
unregister_netdev
(
dev
);
unregister_netdev
(
dev
);
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
release_region
(
dev
->
base_addr
,
SK_ISA_IO_EXTENT
);
...
@@ -450,9 +441,6 @@ void cleanup_module(void)
...
@@ -450,9 +441,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
=
sk_isa_card_list
;
sk_isa_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