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
2b8fd805
Commit
2b8fd805
authored
May 25, 2002
by
Kai Germaschewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ISDN/CAPI: Remove struct capi_driver
We rather keep it simple, everything we need is in struct capi_ctr.
parent
5120022f
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
178 additions
and
525 deletions
+178
-525
drivers/isdn/capi/kcapi.c
drivers/isdn/capi/kcapi.c
+1
-66
drivers/isdn/capi/kcapi_proc.c
drivers/isdn/capi/kcapi_proc.c
+1
-39
drivers/isdn/hardware/avm/avmcard.h
drivers/isdn/hardware/avm/avmcard.h
+2
-1
drivers/isdn/hardware/avm/b1.c
drivers/isdn/hardware/avm/b1.c
+0
-16
drivers/isdn/hardware/avm/b1isa.c
drivers/isdn/hardware/avm/b1isa.c
+15
-32
drivers/isdn/hardware/avm/b1pci.c
drivers/isdn/hardware/avm/b1pci.c
+42
-109
drivers/isdn/hardware/avm/b1pcmcia.c
drivers/isdn/hardware/avm/b1pcmcia.c
+20
-50
drivers/isdn/hardware/avm/c4.c
drivers/isdn/hardware/avm/c4.c
+23
-68
drivers/isdn/hardware/avm/t1isa.c
drivers/isdn/hardware/avm/t1isa.c
+26
-46
drivers/isdn/hardware/avm/t1pci.c
drivers/isdn/hardware/avm/t1pci.c
+24
-60
include/linux/isdn/capilli.h
include/linux/isdn/capilli.h
+24
-38
No files found.
drivers/isdn/capi/kcapi.c
View file @
2b8fd805
...
...
@@ -464,8 +464,6 @@ attach_capi_ctr(struct capi_ctr *card)
card
->
resume_output
=
controllercb_resume_output
;
card
->
handle_capimsg
=
controllercb_handle_capimsg
;
list_add_tail
(
&
card
->
driver_list
,
&
card
->
driver
->
contr_head
);
card
->
driver
->
ncontroller
++
;
sprintf
(
card
->
procfn
,
"capi/controllers/%d"
,
card
->
cnr
);
card
->
procent
=
create_proc_entry
(
card
->
procfn
,
0
,
0
);
if
(
card
->
procent
)
{
...
...
@@ -485,13 +483,10 @@ EXPORT_SYMBOL(attach_capi_ctr);
int
detach_capi_ctr
(
struct
capi_ctr
*
card
)
{
struct
capi_driver
*
driver
=
card
->
driver
;
if
(
card
->
cardstate
!=
CARD_DETECTED
)
controllercb_reseted
(
card
);
list_del
(
&
card
->
driver_list
);
driver
->
ncontroller
--
;
ncards
--
;
if
(
card
->
procent
)
{
...
...
@@ -508,32 +503,6 @@ int detach_capi_ctr(struct capi_ctr *card)
EXPORT_SYMBOL
(
detach_capi_ctr
);
/* ------------------------------------------------------------- */
void
attach_capi_driver
(
struct
capi_driver
*
driver
)
{
INIT_LIST_HEAD
(
&
driver
->
contr_head
);
spin_lock
(
&
capi_drivers_lock
);
list_add_tail
(
&
driver
->
driver_list
,
&
capi_drivers
);
spin_unlock
(
&
capi_drivers_lock
);
printk
(
KERN_NOTICE
"kcapi: driver %s attached
\n
"
,
driver
->
name
);
}
EXPORT_SYMBOL
(
attach_capi_driver
);
void
detach_capi_driver
(
struct
capi_driver
*
driver
)
{
spin_lock
(
&
capi_drivers_lock
);
list_del
(
&
driver
->
driver_list
);
spin_unlock
(
&
capi_drivers_lock
);
printk
(
KERN_NOTICE
"kcapi: driver %s detached
\n
"
,
driver
->
name
);
}
EXPORT_SYMBOL
(
detach_capi_driver
);
/* ------------------------------------------------------------- */
/* -------- CAPI2.0 Interface ---------------------------------- */
/* ------------------------------------------------------------- */
...
...
@@ -737,28 +706,11 @@ u16 capi20_get_profile(u32 contr, struct capi_profile *profp)
EXPORT_SYMBOL
(
capi20_get_profile
);
static
struct
capi_driver
*
find_driver
(
char
*
name
)
{
struct
list_head
*
l
;
struct
capi_driver
*
dp
;
spin_lock
(
&
capi_drivers_lock
);
list_for_each
(
l
,
&
capi_drivers
)
{
dp
=
list_entry
(
l
,
struct
capi_driver
,
driver_list
);
if
(
strcmp
(
dp
->
name
,
name
)
==
0
)
goto
found
;
}
dp
=
NULL
;
found:
spin_unlock
(
&
capi_drivers_lock
);
return
dp
;
}
#ifdef CONFIG_AVMB1_COMPAT
static
int
old_capi_manufacturer
(
unsigned
int
cmd
,
void
*
data
)
{
avmb1_loadandconfigdef
ldef
;
avmb1_resetdef
rdef
;
avmb1_getdef
gdef
;
struct
capi_ctr
*
card
;
capiloaddata
ldata
;
int
retval
;
...
...
@@ -783,7 +735,7 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
if
(
!
card
)
return
-
ESRCH
;
if
(
card
->
load_firmware
==
0
)
{
printk
(
KERN_DEBUG
"kcapi: load:
driver \%s
\"
has no load function
\n
"
,
card
->
driver
->
name
);
printk
(
KERN_DEBUG
"kcapi: load:
no load function
\n
"
);
return
-
ESRCH
;
}
...
...
@@ -852,23 +804,6 @@ static int old_capi_manufacturer(unsigned int cmd, void *data)
}
return
0
;
case
AVMB1_GET_CARDINFO
:
if
(
copy_from_user
((
void
*
)
&
gdef
,
data
,
sizeof
(
avmb1_getdef
)))
return
-
EFAULT
;
card
=
get_capi_ctr_by_nr
(
gdef
.
contr
);
if
(
!
card
)
return
-
ESRCH
;
gdef
.
cardstate
=
card
->
cardstate
;
if
(
card
->
driver
==
find_driver
(
"t1isa"
))
gdef
.
cardtype
=
AVM_CARDTYPE_T1
;
else
gdef
.
cardtype
=
AVM_CARDTYPE_B1
;
if
(
copy_to_user
(
data
,
(
void
*
)
&
gdef
,
sizeof
(
avmb1_getdef
)))
return
-
EFAULT
;
return
0
;
}
return
-
EINVAL
;
}
...
...
drivers/isdn/capi/kcapi_proc.c
View file @
2b8fd805
...
...
@@ -29,43 +29,6 @@ cardstate2str(unsigned short cardstate)
// /proc/capi
// ===========================================================================
// /proc/capi/driver:
// driver ncontroller
// ---------------------------------------------------------------------------
static
int
proc_driver_read_proc
(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
void
*
data
)
{
struct
list_head
*
l
;
struct
capi_driver
*
driver
;
int
len
=
0
;
spin_lock
(
&
capi_drivers_lock
);
list_for_each
(
l
,
&
capi_drivers
)
{
driver
=
list_entry
(
l
,
struct
capi_driver
,
driver_list
);
len
+=
sprintf
(
page
+
len
,
"%-32s %d %s
\n
"
,
driver
->
name
,
driver
->
ncontroller
,
driver
->
revision
);
if
(
len
<=
off
)
{
off
-=
len
;
len
=
0
;
}
else
{
if
(
len
-
off
>
count
)
goto
endloop
;
}
}
endloop:
spin_unlock
(
&
capi_drivers_lock
);
*
start
=
page
+
off
;
if
(
len
<
count
)
*
eof
=
1
;
if
(
len
>
count
)
len
=
count
;
if
(
len
<
0
)
len
=
0
;
return
len
;
}
// /proc/capi/controller:
// cnr driver cardstate name driverinfo
// /proc/capi/contrstats:
...
...
@@ -101,7 +64,7 @@ static int controller_show(struct seq_file *seq, void *v)
return
0
;
seq_printf
(
seq
,
"%d %-10s %-8s %-16s %s
\n
"
,
ctr
->
cnr
,
ctr
->
driver
->
name
,
ctr
->
cnr
,
ctr
->
driver
_
name
,
cardstate2str
(
ctr
->
cardstate
),
ctr
->
name
,
ctr
->
procinfo
?
ctr
->
procinfo
(
ctr
)
:
""
);
...
...
@@ -286,7 +249,6 @@ kcapi_proc_init(void)
proc_mkdir
(
"capi"
,
NULL
);
proc_mkdir
(
"capi/controllers"
,
NULL
);
proc_mkdir
(
"capi/drivers"
,
NULL
);
create_proc_read_entry
(
"capi/driver"
,
0
,
NULL
,
proc_driver_read_proc
,
NULL
);
create_seq_entry
(
"capi/controller"
,
0
,
&
proc_controller_ops
);
create_seq_entry
(
"capi/contrstats"
,
0
,
&
proc_contrstats_ops
);
create_seq_entry
(
"capi/applications"
,
0
,
&
proc_applications_ops
);
...
...
drivers/isdn/hardware/avm/avmcard.h
View file @
2b8fd805
...
...
@@ -11,6 +11,7 @@
#define _AVMCARD_H_
#include <linux/spinlock.h>
#include <linux/list.h>
#define AVMB1_PORTLEN 0x1f
#define AVM_MAXVERSION 8
...
...
@@ -95,6 +96,7 @@ typedef struct avmcard {
int
nr_controllers
;
int
nlogcontr
;
struct
list_head
list
;
}
avmcard
;
extern
int
b1_irq_table
[
16
];
...
...
@@ -538,7 +540,6 @@ static inline void b1_setinterrupt(unsigned int base, unsigned irq,
}
/* b1.c */
void
b1_set_revision
(
struct
capi_driver
*
driver
,
char
*
rev
);
avmcard
*
b1_alloc_card
(
int
nr_controllers
);
void
b1_free_card
(
avmcard
*
card
);
int
b1_detect
(
unsigned
int
base
,
enum
avmcardtype
cardtype
);
...
...
drivers/isdn/hardware/avm/b1.c
View file @
2b8fd805
...
...
@@ -59,21 +59,6 @@ int b1_irq_table[16] =
/* ------------------------------------------------------------- */
void
b1_set_revision
(
struct
capi_driver
*
driver
,
char
*
rev
)
{
char
*
p
;
if
((
p
=
strchr
(
rev
,
':'
))
!=
0
&&
p
[
1
])
{
strncpy
(
driver
->
revision
,
p
+
2
,
sizeof
(
driver
->
revision
));
driver
->
revision
[
sizeof
(
driver
->
revision
)
-
1
]
=
0
;
if
((
p
=
strchr
(
driver
->
revision
,
'$'
))
!=
0
&&
p
>
driver
->
revision
)
*
(
p
-
1
)
=
0
;
}
printk
(
KERN_INFO
"%s: revision %s
\n
"
,
driver
->
name
,
driver
->
revision
);
}
/* ------------------------------------------------------------- */
avmcard
*
b1_alloc_card
(
int
nr_controllers
)
{
avmcard
*
card
;
...
...
@@ -775,7 +760,6 @@ EXPORT_SYMBOL(avmcard_dma_free);
EXPORT_SYMBOL
(
b1_irq_table
);
EXPORT_SYMBOL
(
b1_set_revision
);
EXPORT_SYMBOL
(
b1_alloc_card
);
EXPORT_SYMBOL
(
b1_free_card
);
EXPORT_SYMBOL
(
b1_detect
);
...
...
drivers/isdn/hardware/avm/b1isa.c
View file @
2b8fd805
...
...
@@ -25,8 +25,6 @@
#include <linux/isdn/capilli.h>
#include "avmcard.h"
static
char
*
revision
=
"$Revision: 1.10.6.6 $"
;
/* ------------------------------------------------------------- */
MODULE_DESCRIPTION
(
"CAPI4Linux: Driver for AVM B1 ISA card"
);
...
...
@@ -35,16 +33,18 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */
static
struct
capi_driver
b1isa_driver
;
static
void
b1isa_remove
(
struct
pci_dev
*
pdev
)
{
avmctrl_info
*
cinfo
=
pci_get_drvdata
(
pdev
);
avmcard
*
card
=
cinfo
->
card
;
unsigned
int
port
=
cinfo
->
card
->
port
;
avmcard
*
card
;
if
(
!
cinfo
)
return
;
b1_reset
(
port
);
b1_reset
(
port
);
card
=
cinfo
->
card
;
b1_reset
(
card
->
port
);
b1_reset
(
card
->
port
);
detach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
free_irq
(
card
->
irq
,
card
);
...
...
@@ -108,7 +108,7 @@ static int __init b1isa_probe(struct pci_dev *pdev)
b1_reset
(
card
->
port
);
b1_getrevision
(
card
);
cinfo
->
capi_ctrl
.
driver
=
&
b1isa_driver
;
cinfo
->
capi_ctrl
.
driver
_name
=
"b1isa"
;
cinfo
->
capi_ctrl
.
driverdata
=
cinfo
;
cinfo
->
capi_ctrl
.
register_appl
=
b1_register_appl
;
cinfo
->
capi_ctrl
.
release_appl
=
b1_release_appl
;
...
...
@@ -126,9 +126,8 @@ static int __init b1isa_probe(struct pci_dev *pdev)
goto
err_free_irq
;
}
printk
(
KERN_INFO
"%s: AVM B1 ISA at i/o %#x, irq %d, revision %d
\n
"
,
b1isa_driver
.
name
,
card
->
port
,
card
->
irq
,
card
->
revision
);
printk
(
KERN_INFO
"b1isa: AVM B1 ISA at i/o %#x, irq %d, revision %d
\n
"
,
card
->
port
,
card
->
irq
,
card
->
revision
);
pci_set_drvdata
(
pdev
,
cinfo
);
return
0
;
...
...
@@ -161,11 +160,6 @@ static char *b1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static
struct
capi_driver
b1isa_driver
=
{
name:
"b1isa"
,
revision:
"0.0"
,
};
#define MAX_CARDS 4
static
struct
pci_dev
isa_dev
[
MAX_CARDS
];
static
int
io
[
MAX_CARDS
];
...
...
@@ -178,12 +172,9 @@ MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
static
int
__init
b1isa_init
(
void
)
{
int
i
,
retval
;
int
i
;
int
found
=
0
;
b1_set_revision
(
&
b1isa_driver
,
revision
);
attach_capi_driver
(
&
b1isa_driver
);
for
(
i
=
0
;
i
<
MAX_CARDS
;
i
++
)
{
if
(
!
io
[
i
])
break
;
...
...
@@ -194,17 +185,10 @@ static int __init b1isa_init(void)
if
(
b1isa_probe
(
&
isa_dev
[
i
])
==
0
)
found
++
;
}
if
(
found
==
0
)
{
retval
=
-
ENODEV
;
goto
err
;
}
retval
=
0
;
goto
out
;
if
(
found
==
0
)
return
-
ENODEV
;
err:
detach_capi_driver
(
&
b1isa_driver
);
out:
return
retval
;
return
0
;
}
static
void
__exit
b1isa_exit
(
void
)
...
...
@@ -217,7 +201,6 @@ static void __exit b1isa_exit(void)
b1isa_remove
(
&
isa_dev
[
i
]);
}
detach_capi_driver
(
&
b1isa_driver
);
}
module_init
(
b1isa_init
);
...
...
drivers/isdn/hardware/avm/b1pci.c
View file @
2b8fd805
...
...
@@ -26,8 +26,6 @@
#include <linux/isdn/capilli.h>
#include "avmcard.h"
static
char
*
revision
=
"$Revision: 1.1.4.1.2.1 $"
;
/* ------------------------------------------------------------- */
static
struct
pci_device_id
b1pci_pci_tbl
[]
__devinitdata
=
{
...
...
@@ -60,9 +58,7 @@ static char *b1pci_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static
int
b1pci_probe
(
struct
capi_driver
*
driver
,
struct
capicardparams
*
p
,
struct
pci_dev
*
pdev
)
static
int
b1pci_probe
(
struct
capicardparams
*
p
,
struct
pci_dev
*
pdev
)
{
avmcard
*
card
;
avmctrl_info
*
cinfo
;
...
...
@@ -70,7 +66,7 @@ static int b1pci_probe(struct capi_driver *driver,
card
=
b1_alloc_card
(
1
);
if
(
!
card
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
b1pci: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err
;
}
...
...
@@ -82,17 +78,16 @@ static int b1pci_probe(struct capi_driver *driver,
card
->
cardtype
=
avm_b1pci
;
if
(
!
request_region
(
card
->
port
,
AVMB1_PORTLEN
,
card
->
name
))
{
printk
(
KERN_WARNING
"%s: ports 0x%03x-0x%03x in use.
\n
"
,
driver
->
name
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
printk
(
KERN_WARNING
"b1pci: ports 0x%03x-0x%03x in use.
\n
"
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
retval
=
-
EBUSY
;
goto
err_free
;
}
b1_reset
(
card
->
port
);
retval
=
b1_detect
(
card
->
port
,
card
->
cardtype
);
if
(
retval
)
{
printk
(
KERN_NOTICE
"
%s
: NO card at 0x%x (%d)
\n
"
,
driver
->
name
,
card
->
port
,
retval
);
printk
(
KERN_NOTICE
"
b1pci
: NO card at 0x%x (%d)
\n
"
,
card
->
port
,
retval
);
retval
=
-
ENODEV
;
goto
err_release_region
;
}
...
...
@@ -101,13 +96,12 @@ static int b1pci_probe(struct capi_driver *driver,
retval
=
request_irq
(
card
->
irq
,
b1_interrupt
,
SA_SHIRQ
,
card
->
name
,
card
);
if
(
retval
)
{
printk
(
KERN_ERR
"%s: unable to get IRQ %d.
\n
"
,
driver
->
name
,
card
->
irq
);
printk
(
KERN_ERR
"b1pci: unable to get IRQ %d.
\n
"
,
card
->
irq
);
retval
=
-
EBUSY
;
goto
err_release_region
;
}
cinfo
->
capi_ctrl
.
driver
=
driver
;
cinfo
->
capi_ctrl
.
driver
_name
=
"b1pci"
;
cinfo
->
capi_ctrl
.
driverdata
=
cinfo
;
cinfo
->
capi_ctrl
.
register_appl
=
b1_register_appl
;
cinfo
->
capi_ctrl
.
release_appl
=
b1_release_appl
;
...
...
@@ -121,19 +115,16 @@ static int b1pci_probe(struct capi_driver *driver,
retval
=
attach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
if
(
retval
)
{
printk
(
KERN_ERR
"%s: attach controller failed.
\n
"
,
driver
->
name
);
printk
(
KERN_ERR
"b1pci: attach controller failed.
\n
"
);
goto
err_free_irq
;
}
if
(
card
->
revision
>=
4
)
{
printk
(
KERN_INFO
"%s: AVM B1 PCI V4 at i/o %#x, irq %d, revision %d (no dma)
\n
"
,
driver
->
name
,
card
->
port
,
card
->
irq
,
card
->
revision
);
printk
(
KERN_INFO
"b1pci: AVM B1 PCI V4 at i/o %#x, irq %d, revision %d (no dma)
\n
"
,
card
->
port
,
card
->
irq
,
card
->
revision
);
}
else
{
printk
(
KERN_INFO
"%s: AVM B1 PCI at i/o %#x, irq %d, revision %d
\n
"
,
driver
->
name
,
card
->
port
,
card
->
irq
,
card
->
revision
);
printk
(
KERN_INFO
"b1pci: AVM B1 PCI at i/o %#x, irq %d, revision %d
\n
"
,
card
->
port
,
card
->
irq
,
card
->
revision
);
}
pci_set_drvdata
(
pdev
,
card
);
...
...
@@ -164,13 +155,6 @@ static void b1pci_remove(struct pci_dev *pdev)
b1_free_card
(
card
);
}
/* ------------------------------------------------------------- */
static
struct
capi_driver
b1pci_driver
=
{
name:
"b1pci"
,
revision:
"0.0"
,
};
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
/* ------------------------------------------------------------- */
...
...
@@ -193,9 +177,7 @@ static char *b1pciv4_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static
int
b1pciv4_probe
(
struct
capi_driver
*
driver
,
struct
capicardparams
*
p
,
struct
pci_dev
*
pdev
)
static
int
b1pciv4_probe
(
struct
capicardparams
*
p
,
struct
pci_dev
*
pdev
)
{
avmcard
*
card
;
avmctrl_info
*
cinfo
;
...
...
@@ -203,14 +185,14 @@ static int b1pciv4_probe(struct capi_driver *driver,
card
=
b1_alloc_card
(
1
);
if
(
!
card
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
b1pci: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err
;
}
card
->
dma
=
avmcard_dma_alloc
(
driver
->
name
,
pdev
,
2048
+
128
,
2048
+
128
);
card
->
dma
=
avmcard_dma_alloc
(
"b1pci"
,
pdev
,
2048
+
128
,
2048
+
128
);
if
(
!
card
->
dma
)
{
printk
(
KERN_WARNING
"
%s: dma alloc.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
b1pci: dma alloc.
\n
"
);
retval
=
-
ENOMEM
;
goto
err_free
;
}
...
...
@@ -223,17 +205,16 @@ static int b1pciv4_probe(struct capi_driver *driver,
card
->
cardtype
=
avm_b1pci
;
if
(
!
request_region
(
card
->
port
,
AVMB1_PORTLEN
,
card
->
name
))
{
printk
(
KERN_WARNING
"%s: ports 0x%03x-0x%03x in use.
\n
"
,
driver
->
name
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
printk
(
KERN_WARNING
"b1pci: ports 0x%03x-0x%03x in use.
\n
"
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
retval
=
-
EBUSY
;
goto
err_free_dma
;
}
card
->
mbase
=
ioremap_nocache
(
card
->
membase
,
64
);
if
(
!
card
->
mbase
)
{
printk
(
KERN_NOTICE
"
%s
: can't remap memory at 0x%lx
\n
"
,
driver
->
name
,
card
->
membase
);
printk
(
KERN_NOTICE
"
b1pci
: can't remap memory at 0x%lx
\n
"
,
card
->
membase
);
retval
=
-
ENOMEM
;
goto
err_release_region
;
}
...
...
@@ -242,8 +223,8 @@ static int b1pciv4_probe(struct capi_driver *driver,
retval
=
b1pciv4_detect
(
card
);
if
(
retval
)
{
printk
(
KERN_NOTICE
"
%s
: NO card at 0x%x (%d)
\n
"
,
driver
->
name
,
card
->
port
,
retval
);
printk
(
KERN_NOTICE
"
b1pci
: NO card at 0x%x (%d)
\n
"
,
card
->
port
,
retval
);
retval
=
-
ENODEV
;
goto
err_unmap
;
}
...
...
@@ -252,13 +233,13 @@ static int b1pciv4_probe(struct capi_driver *driver,
retval
=
request_irq
(
card
->
irq
,
b1dma_interrupt
,
SA_SHIRQ
,
card
->
name
,
card
);
if
(
retval
)
{
printk
(
KERN_ERR
"
%s
: unable to get IRQ %d.
\n
"
,
driver
->
name
,
card
->
irq
);
printk
(
KERN_ERR
"
b1pci
: unable to get IRQ %d.
\n
"
,
card
->
irq
);
retval
=
-
EBUSY
;
goto
err_unmap
;
}
cinfo
->
capi_ctrl
.
driver
=
driver
;
cinfo
->
capi_ctrl
.
driver
_name
=
"b1pciv4"
;
cinfo
->
capi_ctrl
.
driverdata
=
cinfo
;
cinfo
->
capi_ctrl
.
register_appl
=
b1dma_register_appl
;
cinfo
->
capi_ctrl
.
release_appl
=
b1dma_release_appl
;
...
...
@@ -272,15 +253,13 @@ static int b1pciv4_probe(struct capi_driver *driver,
retval
=
attach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
if
(
retval
)
{
printk
(
KERN_ERR
"
%s: attach controller failed.
\n
"
,
driver
->
name
);
printk
(
KERN_ERR
"
b1pci: attach controller failed.
\n
"
);
goto
err_free_irq
;
}
card
->
cardnr
=
cinfo
->
capi_ctrl
.
cnr
;
printk
(
KERN_INFO
"%s: AVM B1 PCI V4 at i/o %#x, irq %d, mem %#lx, revision %d (dma)
\n
"
,
driver
->
name
,
card
->
port
,
card
->
irq
,
card
->
membase
,
card
->
revision
);
printk
(
KERN_INFO
"b1pci: AVM B1 PCI V4 at i/o %#x, irq %d, mem %#lx, revision %d (dma)
\n
"
,
card
->
port
,
card
->
irq
,
card
->
membase
,
card
->
revision
);
pci_set_drvdata
(
pdev
,
card
);
return
0
;
...
...
@@ -315,64 +294,48 @@ static void b1pciv4_remove(struct pci_dev *pdev)
b1_free_card
(
card
);
}
/* ------------------------------------------------------------- */
static
struct
capi_driver
b1pciv4_driver
=
{
name:
"b1pciv4"
,
revision:
"0.0"
,
};
#endif
/* CONFIG_ISDN_DRV_AVMB1_B1PCIV4 */
static
int
__devinit
b1pci_pci_probe
(
struct
pci_dev
*
pdev
,
const
struct
pci_device_id
*
ent
)
{
struct
capi_driver
*
driver
=
&
b1pci_driver
;
struct
capicardparams
param
;
int
retval
;
if
(
pci_enable_device
(
pdev
)
<
0
)
{
printk
(
KERN_ERR
"%s: failed to enable AVM-B1
\n
"
,
driver
->
name
);
printk
(
KERN_ERR
"b1pci: failed to enable AVM-B1
\n
"
);
return
-
ENODEV
;
}
param
.
irq
=
pdev
->
irq
;
if
(
pci_resource_start
(
pdev
,
2
))
{
/* B1 PCI V4 */
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
driver
=
&
b1pciv4_driver
;
pci_set_master
(
pdev
);
#endif
param
.
membase
=
pci_resource_start
(
pdev
,
0
);
param
.
port
=
pci_resource_start
(
pdev
,
2
);
printk
(
KERN_INFO
"%s: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x
\n
"
,
driver
->
name
,
param
.
port
,
param
.
irq
,
param
.
membase
);
printk
(
KERN_INFO
"b1pci: PCI BIOS reports AVM-B1 V4 at i/o %#x, irq %d, mem %#x
\n
"
,
param
.
port
,
param
.
irq
,
param
.
membase
);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
retval
=
b1pciv4_probe
(
driver
,
&
param
,
pdev
);
retval
=
b1pciv4_probe
(
&
param
,
pdev
);
#else
retval
=
b1pci_probe
(
driver
,
&
param
,
pdev
);
retval
=
b1pci_probe
(
&
param
,
pdev
);
#endif
if
(
retval
!=
0
)
{
printk
(
KERN_ERR
"%s: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected
\n
"
,
driver
->
name
,
param
.
port
,
param
.
irq
,
param
.
membase
);
printk
(
KERN_ERR
"b1pci: no AVM-B1 V4 at i/o %#x, irq %d, mem %#x detected
\n
"
,
param
.
port
,
param
.
irq
,
param
.
membase
);
}
}
else
{
param
.
membase
=
0
;
param
.
port
=
pci_resource_start
(
pdev
,
1
);
printk
(
KERN_INFO
"%s: PCI BIOS reports AVM-B1 at i/o %#x, irq %d
\n
"
,
driver
->
name
,
param
.
port
,
param
.
irq
);
retval
=
b1pci_probe
(
driver
,
&
param
,
pdev
);
printk
(
KERN_INFO
"b1pci: PCI BIOS reports AVM-B1 at i/o %#x, irq %d
\n
"
,
param
.
port
,
param
.
irq
);
retval
=
b1pci_probe
(
&
param
,
pdev
);
if
(
retval
!=
0
)
{
printk
(
KERN_ERR
"%s: no AVM-B1 at i/o %#x, irq %d detected
\n
"
,
driver
->
name
,
param
.
port
,
param
.
irq
);
printk
(
KERN_ERR
"b1pci: no AVM-B1 at i/o %#x, irq %d detected
\n
"
,
param
.
port
,
param
.
irq
);
}
}
return
retval
;
...
...
@@ -397,42 +360,12 @@ static struct pci_driver b1pci_pci_driver = {
static
int
__init
b1pci_init
(
void
)
{
int
retval
;
b1_set_revision
(
&
b1pci_driver
,
revision
);
attach_capi_driver
(
&
b1pci_driver
);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
b1_set_revision
(
&
b1pciv4_driver
,
revision
);
attach_capi_driver
(
&
b1pciv4_driver
);
#endif
retval
=
pci_module_init
(
&
b1pci_pci_driver
);
if
(
retval
<
0
)
goto
err
;
printk
(
KERN_INFO
"%s: %d B1-PCI card(s) detected
\n
"
,
b1pci_driver
.
name
,
retval
);
retval
=
0
;
goto
out
;
err:
detach_capi_driver
(
&
b1pci_driver
);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
detach_capi_driver
(
&
b1pciv4_driver
);
#endif
out:
return
retval
;
return
pci_module_init
(
&
b1pci_pci_driver
);
}
static
void
__exit
b1pci_exit
(
void
)
{
pci_unregister_driver
(
&
b1pci_pci_driver
);
detach_capi_driver
(
&
b1pci_driver
);
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
detach_capi_driver
(
&
b1pciv4_driver
);
#endif
}
module_init
(
b1pci_init
);
...
...
drivers/isdn/hardware/avm/b1pcmcia.c
View file @
2b8fd805
...
...
@@ -25,8 +25,6 @@
#include <linux/isdn/capilli.h>
#include "avmcard.h"
static
char
*
revision
=
"$Revision: 1.12.6.5 $"
;
/* ------------------------------------------------------------- */
MODULE_DESCRIPTION
(
"CAPI4Linux: Driver for AVM PCMCIA cards"
);
...
...
@@ -51,12 +49,12 @@ static void b1pcmcia_remove_ctr(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static
LIST_HEAD
(
cards
);
static
char
*
b1pcmcia_procinfo
(
struct
capi_ctr
*
ctrl
);
static
int
b1pcmcia_add_card
(
struct
capi_driver
*
driver
,
unsigned
int
port
,
unsigned
irq
,
enum
avmcardtype
cardtype
)
static
int
b1pcmcia_add_card
(
unsigned
int
port
,
unsigned
irq
,
enum
avmcardtype
cardtype
)
{
avmctrl_info
*
cinfo
;
avmcard
*
card
;
...
...
@@ -65,7 +63,7 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
card
=
b1_alloc_card
(
1
);
if
(
!
card
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
b1pcmcia: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err
;
}
...
...
@@ -82,22 +80,22 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
retval
=
request_irq
(
card
->
irq
,
b1_interrupt
,
0
,
card
->
name
,
card
);
if
(
retval
)
{
printk
(
KERN_ERR
"
%s
: unable to get IRQ %d.
\n
"
,
driver
->
name
,
card
->
irq
);
printk
(
KERN_ERR
"
b1pcmcia
: unable to get IRQ %d.
\n
"
,
card
->
irq
);
retval
=
-
EBUSY
;
goto
err_free
;
}
b1_reset
(
card
->
port
);
if
((
retval
=
b1_detect
(
card
->
port
,
card
->
cardtype
))
!=
0
)
{
printk
(
KERN_NOTICE
"
%s
: NO card at 0x%x (%d)
\n
"
,
driver
->
name
,
card
->
port
,
retval
);
printk
(
KERN_NOTICE
"
b1pcmcia
: NO card at 0x%x (%d)
\n
"
,
card
->
port
,
retval
);
retval
=
-
ENODEV
;
goto
err_free_irq
;
}
b1_reset
(
card
->
port
);
b1_getrevision
(
card
);
cinfo
->
capi_ctrl
.
driver
=
driver
;
cinfo
->
capi_ctrl
.
driver
_name
=
"b1pcmcia"
;
cinfo
->
capi_ctrl
.
driverdata
=
cinfo
;
cinfo
->
capi_ctrl
.
register_appl
=
b1_register_appl
;
cinfo
->
capi_ctrl
.
release_appl
=
b1_release_appl
;
...
...
@@ -111,8 +109,7 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
retval
=
attach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
if
(
retval
)
{
printk
(
KERN_ERR
"%s: attach controller failed.
\n
"
,
driver
->
name
);
printk
(
KERN_ERR
"b1pcmcia: attach controller failed.
\n
"
);
goto
err_free_irq
;
}
switch
(
cardtype
)
{
...
...
@@ -121,10 +118,10 @@ static int b1pcmcia_add_card(struct capi_driver *driver,
default
:
cardname
=
"B1 PCMCIA"
;
break
;
}
printk
(
KERN_INFO
"%s: AVM %s at i/o %#x, irq %d, revision %d
\n
"
,
driver
->
name
,
cardname
,
card
->
port
,
card
->
irq
,
card
->
revision
);
printk
(
KERN_INFO
"b1pcmcia: AVM %s at i/o %#x, irq %d, revision %d
\n
"
,
cardname
,
card
->
port
,
card
->
irq
,
card
->
revision
);
list_add
(
&
card
->
list
,
&
cards
);
return
cinfo
->
capi_ctrl
.
cnr
;
err_free_irq:
...
...
@@ -155,39 +152,30 @@ static char *b1pcmcia_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static
struct
capi_driver
b1pcmcia_driver
=
{
name:
"b1pcmcia"
,
revision:
"0.0"
,
};
/* ------------------------------------------------------------- */
int
b1pcmcia_addcard_b1
(
unsigned
int
port
,
unsigned
irq
)
{
return
b1pcmcia_add_card
(
&
b1pcmcia_driver
,
port
,
irq
,
avm_b1pcmcia
);
return
b1pcmcia_add_card
(
port
,
irq
,
avm_b1pcmcia
);
}
int
b1pcmcia_addcard_m1
(
unsigned
int
port
,
unsigned
irq
)
{
return
b1pcmcia_add_card
(
&
b1pcmcia_driver
,
port
,
irq
,
avm_m1
);
return
b1pcmcia_add_card
(
port
,
irq
,
avm_m1
);
}
int
b1pcmcia_addcard_m2
(
unsigned
int
port
,
unsigned
irq
)
{
return
b1pcmcia_add_card
(
&
b1pcmcia_driver
,
port
,
irq
,
avm_m2
);
return
b1pcmcia_add_card
(
port
,
irq
,
avm_m2
);
}
int
b1pcmcia_delcard
(
unsigned
int
port
,
unsigned
irq
)
{
struct
list_head
*
l
;
struct
capi_ctr
*
ctrl
;
avmcard
*
card
;
list_for_each
(
l
,
&
b1pcmcia_driver
.
contr_head
)
{
ctrl
=
list_entry
(
l
,
struct
capi_ctr
,
driver_list
);
card
=
((
avmctrl_info
*
)(
ctrl
->
driverdata
))
->
card
;
list_for_each
(
l
,
&
cards
)
{
card
=
list_entry
(
l
,
avmcard
,
list
);
if
(
card
->
port
==
port
&&
card
->
irq
==
irq
)
{
b1pcmcia_remove_ctr
(
ctrl
);
b1pcmcia_remove_ctr
(
&
card
->
ctrlinfo
[
0
].
capi_
ctrl
);
return
0
;
}
}
...
...
@@ -198,21 +186,3 @@ EXPORT_SYMBOL(b1pcmcia_addcard_b1);
EXPORT_SYMBOL
(
b1pcmcia_addcard_m1
);
EXPORT_SYMBOL
(
b1pcmcia_addcard_m2
);
EXPORT_SYMBOL
(
b1pcmcia_delcard
);
/* ------------------------------------------------------------- */
static
int
__init
b1pcmcia_init
(
void
)
{
b1_set_revision
(
&
b1pcmcia_driver
,
revision
);
attach_capi_driver
(
&
b1pcmcia_driver
);
return
0
;
}
static
void
__exit
b1pcmcia_exit
(
void
)
{
detach_capi_driver
(
&
b1pcmcia_driver
);
}
module_init
(
b1pcmcia_init
);
module_exit
(
b1pcmcia_exit
);
drivers/isdn/hardware/avm/c4.c
View file @
2b8fd805
...
...
@@ -29,8 +29,6 @@
#include <linux/isdn/capilli.h>
#include "avmcard.h"
static
char
*
revision
=
"$Revision: 1.1.4.1.2.1 $"
;
#undef CONFIG_C4_DEBUG
#undef CONFIG_C4_POLLDEBUG
...
...
@@ -1099,9 +1097,7 @@ static int c4_read_proc(char *page, char **start, off_t off,
/* ------------------------------------------------------------- */
static
int
c4_add_card
(
struct
capi_driver
*
driver
,
struct
capicardparams
*
p
,
struct
pci_dev
*
dev
,
static
int
c4_add_card
(
struct
capicardparams
*
p
,
struct
pci_dev
*
dev
,
int
nr_controllers
)
{
avmcard
*
card
;
...
...
@@ -1111,43 +1107,42 @@ static int c4_add_card(struct capi_driver *driver,
card
=
b1_alloc_card
(
nr_controllers
);
if
(
!
card
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
c4: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err
;
}
card
->
dma
=
avmcard_dma_alloc
(
driver
->
name
,
dev
,
2048
+
128
,
2048
+
128
);
card
->
dma
=
avmcard_dma_alloc
(
"c4"
,
dev
,
2048
+
128
,
2048
+
128
);
if
(
!
card
->
dma
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
c4: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err_free
;
}
sprintf
(
card
->
name
,
"
%s-%x"
,
driver
->
name
,
p
->
port
);
sprintf
(
card
->
name
,
"
c%d-%x"
,
nr_controllers
,
p
->
port
);
card
->
port
=
p
->
port
;
card
->
irq
=
p
->
irq
;
card
->
membase
=
p
->
membase
;
card
->
cardtype
=
(
nr_controllers
==
4
)
?
avm_c4
:
avm_c2
;
if
(
!
request_region
(
card
->
port
,
AVMB1_PORTLEN
,
card
->
name
))
{
printk
(
KERN_WARNING
"%s: ports 0x%03x-0x%03x in use.
\n
"
,
driver
->
name
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
printk
(
KERN_WARNING
"c4: ports 0x%03x-0x%03x in use.
\n
"
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
retval
=
-
EBUSY
;
goto
err_free_dma
;
}
card
->
mbase
=
ioremap_nocache
(
card
->
membase
,
128
);
if
(
card
->
mbase
==
0
)
{
printk
(
KERN_NOTICE
"
%s
: can't remap memory at 0x%lx
\n
"
,
driver
->
name
,
card
->
membase
);
printk
(
KERN_NOTICE
"
c4
: can't remap memory at 0x%lx
\n
"
,
card
->
membase
);
retval
=
-
EIO
;
goto
err_release_region
;
}
retval
=
c4_detect
(
card
);
if
(
retval
!=
0
)
{
printk
(
KERN_NOTICE
"
%s
: NO card at 0x%x (%d)
\n
"
,
driver
->
name
,
card
->
port
,
retval
);
printk
(
KERN_NOTICE
"
c4
: NO card at 0x%x (%d)
\n
"
,
card
->
port
,
retval
);
retval
=
-
EIO
;
goto
err_unmap
;
}
...
...
@@ -1155,15 +1150,14 @@ static int c4_add_card(struct capi_driver *driver,
retval
=
request_irq
(
card
->
irq
,
c4_interrupt
,
SA_SHIRQ
,
card
->
name
,
card
);
if
(
retval
)
{
printk
(
KERN_ERR
"%s: unable to get IRQ %d.
\n
"
,
driver
->
name
,
card
->
irq
);
printk
(
KERN_ERR
"c4: unable to get IRQ %d.
\n
"
,
card
->
irq
);
retval
=
-
EBUSY
;
goto
err_unmap
;
}
for
(
i
=
0
;
i
<
nr_controllers
;
i
++
)
{
cinfo
=
&
card
->
ctrlinfo
[
i
];
cinfo
->
capi_ctrl
.
driver
=
driver
;
cinfo
->
capi_ctrl
.
driver
_name
=
"c4"
;
cinfo
->
capi_ctrl
.
driverdata
=
cinfo
;
cinfo
->
capi_ctrl
.
register_appl
=
c4_register_appl
;
cinfo
->
capi_ctrl
.
release_appl
=
c4_release_appl
;
...
...
@@ -1177,8 +1171,7 @@ static int c4_add_card(struct capi_driver *driver,
retval
=
attach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
if
(
retval
)
{
printk
(
KERN_ERR
"%s: attach controller failed (%d).
\n
"
,
driver
->
name
,
i
);
printk
(
KERN_ERR
"c4: attach controller failed (%d).
\n
"
,
i
);
for
(
i
--
;
i
>=
0
;
i
--
)
{
cinfo
=
&
card
->
ctrlinfo
[
i
];
detach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
...
...
@@ -1189,8 +1182,8 @@ static int c4_add_card(struct capi_driver *driver,
card
->
cardnr
=
cinfo
->
capi_ctrl
.
cnr
;
}
printk
(
KERN_INFO
"
%s
: AVM C%d at i/o %#x, irq %d, mem %#lx
\n
"
,
driver
->
name
,
nr_controllers
,
card
->
port
,
card
->
irq
,
printk
(
KERN_INFO
"
c4
: AVM C%d at i/o %#x, irq %d, mem %#lx
\n
"
,
nr_controllers
,
card
->
port
,
card
->
irq
,
card
->
membase
);
return
0
;
...
...
@@ -1211,27 +1204,15 @@ static int c4_add_card(struct capi_driver *driver,
/* ------------------------------------------------------------- */
static
struct
capi_driver
c2_driver
=
{
name:
"c2"
,
revision:
"0.0"
,
};
static
struct
capi_driver
c4_driver
=
{
name:
"c4"
,
revision:
"0.0"
,
};
static
int
__devinit
c4_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
int
nr
=
ent
->
driver_data
;
struct
capi_driver
*
driver
=
(
nr
==
2
)
?
&
c2_driver
:
&
c4_driver
;
int
retval
=
0
;
struct
capicardparams
param
;
if
(
pci_enable_device
(
dev
)
<
0
)
{
printk
(
KERN_ERR
"%s: failed to enable AVM-C%d
\n
"
,
driver
->
name
,
nr
);
printk
(
KERN_ERR
"c4: failed to enable AVM-C%d
\n
"
,
nr
);
return
-
ENODEV
;
}
pci_set_master
(
dev
);
...
...
@@ -1240,15 +1221,13 @@ static int __devinit c4_probe(struct pci_dev *dev,
param
.
irq
=
dev
->
irq
;
param
.
membase
=
pci_resource_start
(
dev
,
0
);
printk
(
KERN_INFO
"%s: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x
\n
"
,
driver
->
name
,
nr
,
param
.
port
,
param
.
irq
,
param
.
membase
);
printk
(
KERN_INFO
"c4: PCI BIOS reports AVM-C%d at i/o %#x, irq %d, mem %#x
\n
"
,
nr
,
param
.
port
,
param
.
irq
,
param
.
membase
);
retval
=
c4_add_card
(
driver
,
&
param
,
dev
,
nr
);
retval
=
c4_add_card
(
&
param
,
dev
,
nr
);
if
(
retval
!=
0
)
{
printk
(
KERN_ERR
"%s: no AVM-C%d at i/o %#x, irq %d detected, mem %#x
\n
"
,
driver
->
name
,
nr
,
param
.
port
,
param
.
irq
,
param
.
membase
);
printk
(
KERN_ERR
"c4: no AVM-C%d at i/o %#x, irq %d detected, mem %#x
\n
"
,
nr
,
param
.
port
,
param
.
irq
,
param
.
membase
);
return
-
ENODEV
;
}
return
0
;
...
...
@@ -1263,36 +1242,12 @@ static struct pci_driver c4_pci_driver = {
static
int
__init
c4_init
(
void
)
{
int
retval
;
b1_set_revision
(
&
c2_driver
,
revision
);
attach_capi_driver
(
&
c2_driver
);
b1_set_revision
(
&
c4_driver
,
revision
);
attach_capi_driver
(
&
c4_driver
);
retval
=
pci_module_init
(
&
c4_pci_driver
);
if
(
retval
<
0
)
goto
err
;
printk
(
KERN_INFO
"%s: %d C4/C2 card(s) detected
\n
"
,
c4_driver
.
name
,
retval
);
retval
=
0
;
goto
out
;
err:
detach_capi_driver
(
&
c2_driver
);
detach_capi_driver
(
&
c4_driver
);
out:
return
retval
;
return
pci_module_init
(
&
c4_pci_driver
);
}
static
void
__exit
c4_exit
(
void
)
{
pci_unregister_driver
(
&
c4_pci_driver
);
detach_capi_driver
(
&
c2_driver
);
detach_capi_driver
(
&
c4_driver
);
}
module_init
(
c4_init
);
...
...
drivers/isdn/hardware/avm/t1isa.c
View file @
2b8fd805
...
...
@@ -27,8 +27,6 @@
#include <linux/isdn/capilli.h>
#include "avmcard.h"
static
char
*
revision
=
"$Revision: 1.16.6.7 $"
;
/* ------------------------------------------------------------- */
MODULE_DESCRIPTION
(
"CAPI4Linux: Driver for AVM T1 HEMA ISA card"
);
...
...
@@ -37,8 +35,6 @@ MODULE_LICENSE("GPL");
/* ------------------------------------------------------------- */
static
struct
capi_driver
t1isa_driver
;
static
int
hema_irq_table
[
16
]
=
{
0
,
0
,
...
...
@@ -329,13 +325,17 @@ void t1isa_reset_ctr(struct capi_ctr *ctrl)
static
void
t1isa_remove
(
struct
pci_dev
*
pdev
)
{
avmctrl_info
*
cinfo
=
pci_get_drvdata
(
pdev
);
avmcard
*
card
=
cinfo
->
card
;
unsigned
int
port
=
card
->
port
;
avmcard
*
card
;
if
(
!
cinfo
)
return
;
t1_disable_irq
(
port
);
b1_reset
(
port
);
b1_reset
(
port
);
t1_reset
(
port
);
card
=
cinfo
->
card
;
t1_disable_irq
(
card
->
port
);
b1_reset
(
card
->
port
);
b1_reset
(
card
->
port
);
t1_reset
(
card
->
port
);
detach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
free_irq
(
card
->
irq
,
card
);
...
...
@@ -356,7 +356,7 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
card
=
b1_alloc_card
(
1
);
if
(
!
card
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
t1isa_driver
.
name
);
printk
(
KERN_WARNING
"
t1isa: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err
;
}
...
...
@@ -369,41 +369,38 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
sprintf
(
card
->
name
,
"t1isa-%x"
,
card
->
port
);
if
(
!
(((
card
->
port
&
0x7
)
==
0
)
&&
((
card
->
port
&
0x30
)
!=
0x30
)))
{
printk
(
KERN_WARNING
"%s: illegal port 0x%x.
\n
"
,
t1isa_driver
.
name
,
card
->
port
);
printk
(
KERN_WARNING
"t1isa: illegal port 0x%x.
\n
"
,
card
->
port
);
retval
=
-
EINVAL
;
goto
err_free
;
}
if
(
hema_irq_table
[
card
->
irq
&
0xf
]
==
0
)
{
printk
(
KERN_WARNING
"%s: irq %d not valid.
\n
"
,
t1isa_driver
.
name
,
card
->
irq
);
printk
(
KERN_WARNING
"t1isa: irq %d not valid.
\n
"
,
card
->
irq
);
retval
=
-
EINVAL
;
goto
err_free
;
}
if
(
!
request_region
(
card
->
port
,
AVMB1_PORTLEN
,
card
->
name
))
{
printk
(
KERN_INFO
"
%s
: ports 0x%03x-0x%03x in use.
\n
"
,
t1isa_driver
.
name
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
printk
(
KERN_INFO
"
t1isa
: ports 0x%03x-0x%03x in use.
\n
"
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
retval
=
-
EBUSY
;
goto
err_free
;
}
retval
=
request_irq
(
card
->
irq
,
t1isa_interrupt
,
0
,
card
->
name
,
card
);
if
(
retval
)
{
printk
(
KERN_INFO
"%s: unable to get IRQ %d.
\n
"
,
t1isa_driver
.
name
,
card
->
irq
);
printk
(
KERN_INFO
"t1isa: unable to get IRQ %d.
\n
"
,
card
->
irq
);
retval
=
-
EBUSY
;
goto
err_release_region
;
}
if
((
retval
=
t1_detectandinit
(
card
->
port
,
card
->
irq
,
card
->
cardnr
))
!=
0
)
{
printk
(
KERN_INFO
"
%s
: NO card at 0x%x (%d)
\n
"
,
t1isa_driver
.
name
,
card
->
port
,
retval
);
printk
(
KERN_INFO
"
t1isa
: NO card at 0x%x (%d)
\n
"
,
card
->
port
,
retval
);
retval
=
-
ENODEV
;
goto
err_free_irq
;
}
t1_disable_irq
(
card
->
port
);
b1_reset
(
card
->
port
);
cinfo
->
capi_ctrl
.
driver
=
&
t1isa_driver
;
cinfo
->
capi_ctrl
.
driver
_name
=
"t1isa"
;
cinfo
->
capi_ctrl
.
driverdata
=
cinfo
;
cinfo
->
capi_ctrl
.
register_appl
=
b1_register_appl
;
cinfo
->
capi_ctrl
.
release_appl
=
b1_release_appl
;
...
...
@@ -417,13 +414,12 @@ static int __init t1isa_probe(struct pci_dev *pdev, int cardnr)
retval
=
attach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
if
(
retval
)
{
printk
(
KERN_INFO
"%s: attach controller failed.
\n
"
,
t1isa_driver
.
name
);
printk
(
KERN_INFO
"t1isa: attach controller failed.
\n
"
);
goto
err_free_irq
;
}
printk
(
KERN_INFO
"
%s
: AVM T1 ISA at i/o %#x, irq %d, card %d
\n
"
,
t1isa_driver
.
name
,
card
->
port
,
card
->
irq
,
card
->
cardnr
);
printk
(
KERN_INFO
"
t1isa
: AVM T1 ISA at i/o %#x, irq %d, card %d
\n
"
,
card
->
port
,
card
->
irq
,
card
->
cardnr
);
pci_set_drvdata
(
pdev
,
cinfo
);
return
0
;
...
...
@@ -499,11 +495,6 @@ static char *t1isa_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static
struct
capi_driver
t1isa_driver
=
{
name:
"t1isa"
,
revision:
"0.0"
,
};
#define MAX_CARDS 4
static
struct
pci_dev
isa_dev
[
MAX_CARDS
];
static
int
io
[
MAX_CARDS
];
...
...
@@ -519,12 +510,9 @@ MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)");
static
int
__init
t1isa_init
(
void
)
{
int
i
,
retval
;
int
i
;
int
found
=
0
;
b1_set_revision
(
&
t1isa_driver
,
revision
);
attach_capi_driver
(
&
t1isa_driver
);
for
(
i
=
0
;
i
<
MAX_CARDS
;
i
++
)
{
if
(
!
io
[
i
])
break
;
...
...
@@ -535,17 +523,10 @@ static int __init t1isa_init(void)
if
(
t1isa_probe
(
&
isa_dev
[
i
],
cardnr
[
i
])
==
0
)
found
++
;
}
if
(
found
==
0
)
{
retval
=
-
ENODEV
;
goto
err
;
}
retval
=
0
;
goto
out
;
if
(
found
==
0
)
return
-
ENODEV
;
err:
detach_capi_driver
(
&
t1isa_driver
);
out:
return
retval
;
return
0
;
}
static
void
__exit
t1isa_exit
(
void
)
...
...
@@ -558,7 +539,6 @@ static void __exit t1isa_exit(void)
t1isa_remove
(
&
isa_dev
[
i
]);
}
detach_capi_driver
(
&
t1isa_driver
);
}
module_init
(
t1isa_init
);
...
...
drivers/isdn/hardware/avm/t1pci.c
View file @
2b8fd805
...
...
@@ -26,8 +26,6 @@
#include <linux/isdn/capilli.h>
#include "avmcard.h"
static
char
*
revision
=
"$Revision: 1.1.4.1.2.1 $"
;
#undef CONFIG_T1PCI_DEBUG
#undef CONFIG_T1PCI_POLLDEBUG
...
...
@@ -47,9 +45,7 @@ MODULE_LICENSE("GPL");
static
char
*
t1pci_procinfo
(
struct
capi_ctr
*
ctrl
);
static
int
t1pci_add_card
(
struct
capi_driver
*
driver
,
struct
capicardparams
*
p
,
struct
pci_dev
*
pdev
)
static
int
t1pci_add_card
(
struct
capicardparams
*
p
,
struct
pci_dev
*
pdev
)
{
avmcard
*
card
;
avmctrl_info
*
cinfo
;
...
...
@@ -57,14 +53,14 @@ static int t1pci_add_card(struct capi_driver *driver,
card
=
b1_alloc_card
(
1
);
if
(
!
card
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
t1pci: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err
;
}
card
->
dma
=
avmcard_dma_alloc
(
driver
->
name
,
pdev
,
2048
+
128
,
2048
+
128
);
card
->
dma
=
avmcard_dma_alloc
(
"t1pci"
,
pdev
,
2048
+
128
,
2048
+
128
);
if
(
!
card
->
dma
)
{
printk
(
KERN_WARNING
"
%s: no memory.
\n
"
,
driver
->
name
);
printk
(
KERN_WARNING
"
t1pci: no memory.
\n
"
);
retval
=
-
ENOMEM
;
goto
err_free
;
}
...
...
@@ -77,17 +73,16 @@ static int t1pci_add_card(struct capi_driver *driver,
card
->
cardtype
=
avm_t1pci
;
if
(
!
request_region
(
card
->
port
,
AVMB1_PORTLEN
,
card
->
name
))
{
printk
(
KERN_WARNING
"%s: ports 0x%03x-0x%03x in use.
\n
"
,
driver
->
name
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
printk
(
KERN_WARNING
"t1pci: ports 0x%03x-0x%03x in use.
\n
"
,
card
->
port
,
card
->
port
+
AVMB1_PORTLEN
);
retval
=
-
EBUSY
;
goto
err_free_dma
;
}
card
->
mbase
=
ioremap_nocache
(
card
->
membase
,
64
);
if
(
!
card
->
mbase
)
{
printk
(
KERN_NOTICE
"
%s
: can't remap memory at 0x%lx
\n
"
,
driver
->
name
,
card
->
membase
);
printk
(
KERN_NOTICE
"
t1pci
: can't remap memory at 0x%lx
\n
"
,
card
->
membase
);
retval
=
-
EIO
;
goto
err_release_region
;
}
...
...
@@ -97,11 +92,11 @@ static int t1pci_add_card(struct capi_driver *driver,
retval
=
t1pci_detect
(
card
);
if
(
retval
!=
0
)
{
if
(
retval
<
6
)
printk
(
KERN_NOTICE
"
%s
: NO card at 0x%x (%d)
\n
"
,
driver
->
name
,
card
->
port
,
retval
);
printk
(
KERN_NOTICE
"
t1pci
: NO card at 0x%x (%d)
\n
"
,
card
->
port
,
retval
);
else
printk
(
KERN_NOTICE
"
%s: card at 0x%x, but cabel
not connected or T1 has no power (%d)
\n
"
,
driver
->
name
,
card
->
port
,
retval
);
printk
(
KERN_NOTICE
"
t1pci: card at 0x%x, but cable
not connected or T1 has no power (%d)
\n
"
,
card
->
port
,
retval
);
retval
=
-
EIO
;
goto
err_unmap
;
}
...
...
@@ -109,13 +104,12 @@ static int t1pci_add_card(struct capi_driver *driver,
retval
=
request_irq
(
card
->
irq
,
b1dma_interrupt
,
SA_SHIRQ
,
card
->
name
,
card
);
if
(
retval
)
{
printk
(
KERN_ERR
"%s: unable to get IRQ %d.
\n
"
,
driver
->
name
,
card
->
irq
);
printk
(
KERN_ERR
"t1pci: unable to get IRQ %d.
\n
"
,
card
->
irq
);
retval
=
-
EBUSY
;
goto
err_unmap
;
}
cinfo
->
capi_ctrl
.
driver
=
driver
;
cinfo
->
capi_ctrl
.
driver
_name
=
"t1pci"
;
cinfo
->
capi_ctrl
.
driverdata
=
cinfo
;
cinfo
->
capi_ctrl
.
register_appl
=
b1dma_register_appl
;
cinfo
->
capi_ctrl
.
release_appl
=
b1dma_release_appl
;
...
...
@@ -129,15 +123,14 @@ static int t1pci_add_card(struct capi_driver *driver,
retval
=
attach_capi_ctr
(
&
cinfo
->
capi_ctrl
);
if
(
retval
)
{
printk
(
KERN_ERR
"
%s: attach controller failed.
\n
"
,
driver
->
name
);
printk
(
KERN_ERR
"
t1pci: attach controller failed.
\n
"
);
retval
=
-
EBUSY
;
goto
err_free_irq
;
}
card
->
cardnr
=
cinfo
->
capi_ctrl
.
cnr
;
printk
(
KERN_INFO
"%s: AVM T1 PCI at i/o %#x, irq %d, mem %#lx
\n
"
,
driver
->
name
,
card
->
port
,
card
->
irq
,
card
->
membase
);
printk
(
KERN_INFO
"t1pci: AVM T1 PCI at i/o %#x, irq %d, mem %#lx
\n
"
,
card
->
port
,
card
->
irq
,
card
->
membase
);
pci_set_drvdata
(
pdev
,
card
);
return
0
;
...
...
@@ -193,23 +186,14 @@ static char *t1pci_procinfo(struct capi_ctr *ctrl)
/* ------------------------------------------------------------- */
static
struct
capi_driver
t1pci_driver
=
{
name:
"t1pci"
,
revision:
"0.0"
,
};
/* ------------------------------------------------------------- */
static
int
__devinit
t1pci_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
struct
capi_driver
*
driver
=
&
t1pci_driver
;
struct
capicardparams
param
;
int
retval
;
if
(
pci_enable_device
(
dev
)
<
0
)
{
printk
(
KERN_ERR
"%s: failed to enable AVM-T1-PCI
\n
"
,
driver
->
name
);
printk
(
KERN_ERR
"t1pci: failed to enable AVM-T1-PCI
\n
"
);
return
-
ENODEV
;
}
pci_set_master
(
dev
);
...
...
@@ -218,15 +202,13 @@ static int __devinit t1pci_probe(struct pci_dev *dev,
param
.
irq
=
dev
->
irq
;
param
.
membase
=
pci_resource_start
(
dev
,
0
);
printk
(
KERN_INFO
"%s: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x
\n
"
,
driver
->
name
,
param
.
port
,
param
.
irq
,
param
.
membase
);
printk
(
KERN_INFO
"t1pci: PCI BIOS reports AVM-T1-PCI at i/o %#x, irq %d, mem %#x
\n
"
,
param
.
port
,
param
.
irq
,
param
.
membase
);
retval
=
t1pci_add_card
(
driver
,
&
param
,
dev
);
retval
=
t1pci_add_card
(
&
param
,
dev
);
if
(
retval
!=
0
)
{
printk
(
KERN_ERR
"%s: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x
\n
"
,
driver
->
name
,
param
.
port
,
param
.
irq
,
param
.
membase
);
printk
(
KERN_ERR
"t1pci: no AVM-T1-PCI at i/o %#x, irq %d detected, mem %#x
\n
"
,
param
.
port
,
param
.
irq
,
param
.
membase
);
return
-
ENODEV
;
}
return
0
;
...
...
@@ -241,30 +223,12 @@ static struct pci_driver t1pci_pci_driver = {
static
int
__init
t1pci_init
(
void
)
{
int
retval
;
b1_set_revision
(
&
t1pci_driver
,
revision
);
attach_capi_driver
(
&
t1pci_driver
);
retval
=
pci_register_driver
(
&
t1pci_pci_driver
);
if
(
retval
<
0
)
goto
err
;
printk
(
KERN_INFO
"%s: %d T1-PCI card(s) detected
\n
"
,
t1pci_driver
.
name
,
retval
);
retval
=
0
;
goto
out
;
err:
detach_capi_driver
(
&
t1pci_driver
);
out:
return
retval
;
return
pci_module_init
(
&
t1pci_pci_driver
);
}
static
void
__exit
t1pci_exit
(
void
)
{
pci_unregister_driver
(
&
t1pci_pci_driver
);
detach_capi_driver
(
&
t1pci_driver
);
}
module_init
(
t1pci_init
);
...
...
include/linux/isdn/capilli.h
View file @
2b8fd805
...
...
@@ -36,24 +36,28 @@ typedef struct capicardparams {
unsigned
int
membase
;
}
capicardparams
;
struct
capi_driver
;
struct
capi_ctr
{
struct
list_head
driver_list
;
/* contrs by driver */
struct
capi_driver
*
driver
;
int
cnr
;
/* controller number */
char
name
[
32
];
/* name of controller */
volatile
unsigned
short
cardstate
;
/* controller state */
volatile
int
blocked
;
/* output blocked */
int
traceflag
;
/* capi trace */
/* filled in before calling attach_capi_ctr */
struct
module
*
owner
;
void
*
driverdata
;
/* driver specific */
char
name
[
32
];
/* name of controller */
char
*
driver_name
;
/* name of driver */
int
(
*
load_firmware
)(
struct
capi_ctr
*
,
capiloaddata
*
);
void
(
*
reset_ctr
)(
struct
capi_ctr
*
);
void
(
*
register_appl
)(
struct
capi_ctr
*
,
u16
appl
,
capi_register_params
*
);
void
(
*
release_appl
)(
struct
capi_ctr
*
,
u16
appl
);
u16
(
*
send_message
)(
struct
capi_ctr
*
,
struct
sk_buff
*
skb
);
char
*
(
*
procinfo
)(
struct
capi_ctr
*
);
int
(
*
ctr_read_proc
)(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
struct
capi_ctr
*
card
);
/* filled before calling ready callback */
__
u8
manu
[
CAPI_MANUFACTURER_LEN
];
/* CAPI_GET_MANUFACTURER */
/* filled
in
before calling ready callback */
u8
manu
[
CAPI_MANUFACTURER_LEN
];
/* CAPI_GET_MANUFACTURER */
capi_version
version
;
/* CAPI_GET_VERSION */
capi_profile
profile
;
/* CAPI_GET_PROFILE */
__
u8
serial
[
CAPI_SERIAL_LEN
];
/* CAPI_GET_SERIAL */
u8
serial
[
CAPI_SERIAL_LEN
];
/* CAPI_GET_SERIAL */
/* functions */
void
(
*
ready
)(
struct
capi_ctr
*
card
);
...
...
@@ -61,7 +65,7 @@ struct capi_ctr {
void
(
*
suspend_output
)(
struct
capi_ctr
*
card
);
void
(
*
resume_output
)(
struct
capi_ctr
*
card
);
void
(
*
handle_capimsg
)(
struct
capi_ctr
*
card
,
__
u16
appl
,
struct
sk_buff
*
skb
);
u16
appl
,
struct
sk_buff
*
skb
);
/* management information for kcapi */
...
...
@@ -70,34 +74,16 @@ struct capi_ctr {
unsigned
long
nsentctlpkt
;
unsigned
long
nsentdatapkt
;
struct
list_head
driver_list
;
/* contrs by driver */
int
cnr
;
/* controller number */
volatile
unsigned
short
cardstate
;
/* controller state */
volatile
int
blocked
;
/* output blocked */
int
traceflag
;
/* capi trace */
struct
proc_dir_entry
*
procent
;
char
procfn
[
128
];
};
struct
capi_driver
{
struct
module
*
owner
;
char
name
[
32
];
/* driver name */
char
revision
[
32
];
int
(
*
load_firmware
)(
struct
capi_ctr
*
,
capiloaddata
*
);
void
(
*
reset_ctr
)(
struct
capi_ctr
*
);
void
(
*
register_appl
)(
struct
capi_ctr
*
,
__u16
appl
,
capi_register_params
*
);
void
(
*
release_appl
)(
struct
capi_ctr
*
,
__u16
appl
);
u16
(
*
send_message
)(
struct
capi_ctr
*
,
struct
sk_buff
*
skb
);
char
*
(
*
procinfo
)(
struct
capi_ctr
*
);
int
(
*
ctr_read_proc
)(
char
*
page
,
char
**
start
,
off_t
off
,
int
count
,
int
*
eof
,
struct
capi_ctr
*
card
);
/* intitialized by kcapi */
struct
list_head
contr_head
;
/* list of controllers */
struct
list_head
driver_list
;
int
ncontroller
;
};
void
attach_capi_driver
(
struct
capi_driver
*
driver
);
void
detach_capi_driver
(
struct
capi_driver
*
driver
);
int
attach_capi_ctr
(
struct
capi_ctr
*
);
int
detach_capi_ctr
(
struct
capi_ctr
*
);
...
...
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