Commit 4cecf071 authored by Linus Torvalds's avatar Linus Torvalds

Merge http://linux-isdn.bkbits.net/linux-2.5.isdn

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents 62737480 4a9bb1fd
...@@ -11,11 +11,6 @@ ...@@ -11,11 +11,6 @@
#ifndef PC_H_INCLUDED #ifndef PC_H_INCLUDED
#define PC_H_INCLUDED #define PC_H_INCLUDED
#define byte unsigned char
#define word unsigned short
#define dword unsigned long
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
/* buffer definition */ /* buffer definition */
/*------------------------------------------------------------------*/ /*------------------------------------------------------------------*/
......
...@@ -148,7 +148,7 @@ static dev_link_t *avmcs_attach(void) ...@@ -148,7 +148,7 @@ static dev_link_t *avmcs_attach(void)
/* Initialize the dev_link_t structure */ /* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL); link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link) if (!link)
return NULL; goto err;
memset(link, 0, sizeof(struct dev_link_t)); memset(link, 0, sizeof(struct dev_link_t));
link->release.function = &avmcs_release; link->release.function = &avmcs_release;
link->release.data = (u_long)link; link->release.data = (u_long)link;
...@@ -181,7 +181,7 @@ static dev_link_t *avmcs_attach(void) ...@@ -181,7 +181,7 @@ static dev_link_t *avmcs_attach(void)
/* Allocate space for private device-specific data */ /* Allocate space for private device-specific data */
local = kmalloc(sizeof(local_info_t), GFP_KERNEL); local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local) if (!local)
return NULL; goto err_kfree;
memset(local, 0, sizeof(local_info_t)); memset(local, 0, sizeof(local_info_t));
link->priv = local; link->priv = local;
...@@ -201,10 +201,14 @@ static dev_link_t *avmcs_attach(void) ...@@ -201,10 +201,14 @@ static dev_link_t *avmcs_attach(void)
if (ret != 0) { if (ret != 0) {
cs_error(link->handle, RegisterClient, ret); cs_error(link->handle, RegisterClient, ret);
avmcs_detach(link); avmcs_detach(link);
return NULL; goto err;
} }
return link; return link;
err_kfree:
kfree(link);
err:
return NULL;
} /* avmcs_attach */ } /* avmcs_attach */
/*====================================================================== /*======================================================================
......
...@@ -50,12 +50,12 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then ...@@ -50,12 +50,12 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then
fi fi
bool ' HiSax debugging' CONFIG_HISAX_DEBUG bool ' HiSax debugging' CONFIG_HISAX_DEBUG
dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_DRV_ISDN_HISAX $CONFIG_PCMCIA dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_DRV_ISDN_HISAX $CONFIG_PCMCIA dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_ISDN_DRV_HISAX $CONFIG_PCMCIA
dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_DRV_ISDN_HISAX $CONFIG_USB $CONFIG_EXPERIMENTAL dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_ISDN_DRV_HISAX $CONFIG_USB $CONFIG_EXPERIMENTAL
dep_tristate 'AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_DRV_ISDN_HISAX $CONFIG_EXPERIMENTAL dep_tristate 'AVM Fritz!Card PCI/PCIv2/PnP support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_PCIPNP $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
dep_tristate 'AVM Fritz!Card classic support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_CLASSIC $CONFIG_DRV_ISDN_HISAX $CONFIG_EXPERIMENTAL dep_tristate 'AVM Fritz!Card classic support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_CLASSIC $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
dep_tristate 'HFC PCI support (EXPERIMENTAL)' CONFIG_HISAX_HFCPCI $CONFIG_DRV_ISDN_HISAX $CONFIG_EXPERIMENTAL dep_tristate 'HFC PCI support (EXPERIMENTAL)' CONFIG_HISAX_HFCPCI $CONFIG_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
fi fi
endmenu endmenu
...@@ -63,19 +63,42 @@ ...@@ -63,19 +63,42 @@
static void Amd7930_new_ph(struct IsdnCardState *cs); static void Amd7930_new_ph(struct IsdnCardState *cs);
static inline u8
HIBYTE(u16 w)
{
return (w >> 8) & 0xff;
}
static inline u8
LOBYTE(u16 w)
{
return w & 0xff;
}
void /* macro wWordAMD */ static inline u8
WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val) rByteAMD(struct IsdnCardState *cs, u8 reg)
{
return cs->readisac(cs, reg);
}
static inline void
wByteAMD(struct IsdnCardState *cs, u8 reg, u8 val)
{
cs->writeisac(cs, reg, val);
}
static void
wWordAMD(struct IsdnCardState *cs, u8 reg, u16 val)
{ {
wByteAMD(cs, 0x00, reg); wByteAMD(cs, 0x00, reg);
wByteAMD(cs, 0x01, LOBYTE(val)); wByteAMD(cs, 0x01, LOBYTE(val));
wByteAMD(cs, 0x01, HIBYTE(val)); wByteAMD(cs, 0x01, HIBYTE(val));
} }
WORD /* macro rWordAMD */ static u16
ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg) rWordAMD(struct IsdnCardState *cs, u8 reg)
{ {
WORD res; u16 res;
/* direct access register */ /* direct access register */
if(reg < 8) { if(reg < 8) {
res = rByteAMD(cs, reg); res = rByteAMD(cs, reg);
...@@ -90,6 +113,17 @@ ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg) ...@@ -90,6 +113,17 @@ ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg)
return (res); return (res);
} }
static inline void
AmdIrqOff(struct IsdnCardState *cs)
{
cs->dc.amd7930.setIrqMask(cs, 0);
}
static inline void
AmdIrqOn(struct IsdnCardState *cs)
{
cs->dc.amd7930.setIrqMask(cs, 1);
}
static void static void
Amd7930_ph_command(struct IsdnCardState *cs, u_char command, char *s) Amd7930_ph_command(struct IsdnCardState *cs, u_char command, char *s)
...@@ -103,7 +137,7 @@ Amd7930_ph_command(struct IsdnCardState *cs, u_char command, char *s) ...@@ -103,7 +137,7 @@ Amd7930_ph_command(struct IsdnCardState *cs, u_char command, char *s)
static BYTE i430States[] = { static u8 i430States[] = {
// to reset F3 F4 F5 F6 F7 F8 AR from // to reset F3 F4 F5 F6 F7 F8 AR from
0x01, 0x02, 0x00, 0x00, 0x00, 0x07, 0x05, 0x00, // init 0x01, 0x02, 0x00, 0x00, 0x00, 0x07, 0x05, 0x00, // init
0x01, 0x02, 0x00, 0x00, 0x00, 0x07, 0x05, 0x00, // reset 0x01, 0x02, 0x00, 0x00, 0x00, 0x07, 0x05, 0x00, // reset
...@@ -117,14 +151,14 @@ static BYTE i430States[] = { ...@@ -117,14 +151,14 @@ static BYTE i430States[] = {
/* Row init - reset F3 F4 F5 F6 F7 F8 AR */ /* Row init - reset F3 F4 F5 F6 F7 F8 AR */
static BYTE stateHelper[] = { 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 }; static u8 stateHelper[] = { 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08 };
static void static void
Amd7930_get_state(struct IsdnCardState *cs) { Amd7930_get_state(struct IsdnCardState *cs) {
BYTE lsr = rByteAMD(cs, 0xA1); u8 lsr = rByteAMD(cs, 0xA1);
cs->dc.amd7930.ph_state = (lsr & 0x7) + 2; cs->dc.amd7930.ph_state = (lsr & 0x7) + 2;
Amd7930_new_ph(cs); Amd7930_new_ph(cs);
} }
...@@ -252,8 +286,8 @@ static void ...@@ -252,8 +286,8 @@ static void
Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag) Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag)
{ {
BYTE stat, der; u8 stat, der;
BYTE *ptr; u8 *ptr;
struct sk_buff *skb; struct sk_buff *skb;
...@@ -326,9 +360,9 @@ static void ...@@ -326,9 +360,9 @@ static void
Amd7930_fill_Dfifo(struct IsdnCardState *cs) Amd7930_fill_Dfifo(struct IsdnCardState *cs)
{ {
WORD dtcrr, dtcrw, len, count; u16 dtcrr, dtcrw, len, count;
BYTE txstat, dmr3; u8 txstat, dmr3;
BYTE *ptr, *deb_ptr; u8 *ptr, *deb_ptr;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO)) if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "Amd7930: fill_Dfifo"); debugl1(cs, "Amd7930: fill_Dfifo");
...@@ -394,10 +428,10 @@ Amd7930_fill_Dfifo(struct IsdnCardState *cs) ...@@ -394,10 +428,10 @@ Amd7930_fill_Dfifo(struct IsdnCardState *cs)
} }
void Amd7930_interrupt(struct IsdnCardState *cs, BYTE irflags) void Amd7930_interrupt(struct IsdnCardState *cs, u8 irflags)
{ {
BYTE dsr1, dsr2, lsr; u8 dsr1, dsr2, lsr;
WORD der; u16 der;
while (irflags) while (irflags)
{ {
...@@ -661,8 +695,8 @@ static void ...@@ -661,8 +695,8 @@ static void
dbusy_timer_handler(struct IsdnCardState *cs) dbusy_timer_handler(struct IsdnCardState *cs)
{ {
struct PStack *stptr; struct PStack *stptr;
WORD dtcr, der; u16 dtcr, der;
BYTE dsr1, dsr2; u8 dsr1, dsr2;
if (cs->debug & L1_DEB_ISAC) if (cs->debug & L1_DEB_ISAC)
...@@ -711,13 +745,45 @@ dbusy_timer_handler(struct IsdnCardState *cs) ...@@ -711,13 +745,45 @@ dbusy_timer_handler(struct IsdnCardState *cs)
} }
} }
static u16 initAMD[] = {
0x0100,
0x00A5, 3, 0x01, 0x40, 0x58, // LPR, LMR1, LMR2
0x0086, 1, 0x0B, // DMR1 (D-Buffer TH-Interrupts on)
0x0087, 1, 0xFF, // DMR2
0x0092, 1, 0x03, // EFCR (extended mode d-channel-fifo on)
0x0090, 4, 0xFE, 0xFF, 0x02, 0x0F, // FRAR4, SRAR4, DMR3, DMR4 (address recognition )
0x0084, 2, 0x80, 0x00, // DRLR
0x00C0, 1, 0x47, // PPCR1
0x00C8, 1, 0x01, // PPCR2
0x0102,
0x0107,
0x01A1, 1,
0x0121, 1,
0x0189, 2,
0x0045, 4, 0x61, 0x72, 0x00, 0x00, // MCR1, MCR2, MCR3, MCR4
0x0063, 2, 0x08, 0x08, // GX
0x0064, 2, 0x08, 0x08, // GR
0x0065, 2, 0x99, 0x00, // GER
0x0066, 2, 0x7C, 0x8B, // STG
0x0067, 2, 0x00, 0x00, // FTGR1, FTGR2
0x0068, 2, 0x20, 0x20, // ATGR1, ATGR2
0x0069, 1, 0x4F, // MMR1
0x006A, 1, 0x00, // MMR2
0x006C, 1, 0x40, // MMR3
0x0021, 1, 0x02, // INIT
0x00A3, 1, 0x40, // LMR1
0xFFFF};
void __devinit void __devinit
Amd7930_init(struct IsdnCardState *cs) Amd7930_init(struct IsdnCardState *cs)
{ {
WORD *ptr; u16 *ptr;
BYTE cmd, cnt; u8 cmd, cnt;
if (cs->debug & L1_DEB_ISAC) if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "Amd7930: initamd called"); debugl1(cs, "Amd7930: initamd called");
......
...@@ -12,58 +12,11 @@ ...@@ -12,58 +12,11 @@
*/ */
#define BYTE unsigned char
#define WORD unsigned int
#define rByteAMD(cs, reg) cs->readisac(cs, reg)
#define wByteAMD(cs, reg, val) cs->writeisac(cs, reg, val)
#define rWordAMD(cs, reg) ReadWordAmd7930(cs, reg)
#define wWordAMD(cs, reg, val) WriteWordAmd7930(cs, reg, val)
#define HIBYTE(w) ((unsigned char)((w & 0xff00) / 256))
#define LOBYTE(w) ((unsigned char)(w & 0x00ff))
#define AmdIrqOff(cs) cs->dc.amd7930.setIrqMask(cs, 0)
#define AmdIrqOn(cs) cs->dc.amd7930.setIrqMask(cs, 1)
#define AMD_CR 0x00 #define AMD_CR 0x00
#define AMD_DR 0x01 #define AMD_DR 0x01
#define DBUSY_TIMER_VALUE 80 #define DBUSY_TIMER_VALUE 80
static WORD initAMD[] = {
0x0100,
0x00A5, 3, 0x01, 0x40, 0x58, // LPR, LMR1, LMR2
0x0086, 1, 0x0B, // DMR1 (D-Buffer TH-Interrupts on)
0x0087, 1, 0xFF, // DMR2
0x0092, 1, 0x03, // EFCR (extended mode d-channel-fifo on)
0x0090, 4, 0xFE, 0xFF, 0x02, 0x0F, // FRAR4, SRAR4, DMR3, DMR4 (address recognition )
0x0084, 2, 0x80, 0x00, // DRLR
0x00C0, 1, 0x47, // PPCR1
0x00C8, 1, 0x01, // PPCR2
0x0102,
0x0107,
0x01A1, 1,
0x0121, 1,
0x0189, 2,
0x0045, 4, 0x61, 0x72, 0x00, 0x00, // MCR1, MCR2, MCR3, MCR4
0x0063, 2, 0x08, 0x08, // GX
0x0064, 2, 0x08, 0x08, // GR
0x0065, 2, 0x99, 0x00, // GER
0x0066, 2, 0x7C, 0x8B, // STG
0x0067, 2, 0x00, 0x00, // FTGR1, FTGR2
0x0068, 2, 0x20, 0x20, // ATGR1, ATGR2
0x0069, 1, 0x4F, // MMR1
0x006A, 1, 0x00, // MMR2
0x006C, 1, 0x40, // MMR3
0x0021, 1, 0x02, // INIT
0x00A3, 1, 0x40, // LMR1
0xFFFF};
extern void Amd7930_interrupt(struct IsdnCardState *cs, unsigned char irflags); extern void Amd7930_interrupt(struct IsdnCardState *cs, unsigned char irflags);
extern void Amd7930_init(struct IsdnCardState *cs); extern void Amd7930_init(struct IsdnCardState *cs);
...@@ -819,34 +819,34 @@ icn_loadboot(u_char * buffer, icn_card * card) ...@@ -819,34 +819,34 @@ icn_loadboot(u_char * buffer, icn_card * card)
#endif #endif
if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) { if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
printk(KERN_WARNING "icn: Could not allocate code buffer\n"); printk(KERN_WARNING "icn: Could not allocate code buffer\n");
return -ENOMEM; ret = -ENOMEM;
goto out;
} }
if (copy_from_user(codebuf, buffer, ICN_CODE_STAGE1)) { if (copy_from_user(codebuf, buffer, ICN_CODE_STAGE1)) {
kfree(codebuf); ret = -EFAULT;
return -EFAULT; goto out_kfree;
} }
if (!card->rvalid) { if (!card->rvalid) {
if (check_region(card->port, ICN_PORTLEN)) { if (!request_region(card->port, ICN_PORTLEN, card->regname)) {
printk(KERN_WARNING printk(KERN_WARNING
"icn: (%s) ports 0x%03x-0x%03x in use.\n", "icn: (%s) ports 0x%03x-0x%03x in use.\n",
CID, CID,
card->port, card->port,
card->port + ICN_PORTLEN); card->port + ICN_PORTLEN);
kfree(codebuf); ret = -EBUSY;
return -EBUSY; goto out_kfree;
} }
request_region(card->port, ICN_PORTLEN, card->regname);
card->rvalid = 1; card->rvalid = 1;
if (card->doubleS0) if (card->doubleS0)
card->other->rvalid = 1; card->other->rvalid = 1;
} }
if (!dev.mvalid) { if (!dev.mvalid) {
if (check_mem_region(dev.memaddr, 0x4000)) { if (!request_mem_region(dev.memaddr, 0x4000, "icn-isdn (all cards)")) {
printk(KERN_WARNING printk(KERN_WARNING
"icn: memory at 0x%08lx in use.\n", dev.memaddr); "icn: memory at 0x%08lx in use.\n", dev.memaddr);
return -EBUSY; ret = -EBUSY;
goto out_kfree;
} }
request_mem_region(dev.memaddr, 0x4000, "icn-isdn (all cards)");
dev.shmem = ioremap(dev.memaddr, 0x4000); dev.shmem = ioremap(dev.memaddr, 0x4000);
dev.mvalid = 1; dev.mvalid = 1;
} }
...@@ -888,13 +888,15 @@ icn_loadboot(u_char * buffer, icn_card * card) ...@@ -888,13 +888,15 @@ icn_loadboot(u_char * buffer, icn_card * card)
printk(KERN_DEBUG "Bootloader transferred\n"); printk(KERN_DEBUG "Bootloader transferred\n");
#endif #endif
} }
kfree(codebuf);
SLEEP(1); SLEEP(1);
OUTB_P(0xff, ICN_RUN); /* Start Boot-Code */ OUTB_P(0xff, ICN_RUN); /* Start Boot-Code */
if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) {
return ret; goto out_kfree;
if (!card->doubleS0) }
return 0; if (!card->doubleS0) {
ret = 0;
goto out_kfree;
}
/* reached only, if we have a Double-S0-Card */ /* reached only, if we have a Double-S0-Card */
#ifdef BOOT_DEBUG #ifdef BOOT_DEBUG
printk(KERN_DEBUG "Map Bank 0\n"); printk(KERN_DEBUG "Map Bank 0\n");
...@@ -905,7 +907,12 @@ icn_loadboot(u_char * buffer, icn_card * card) ...@@ -905,7 +907,12 @@ icn_loadboot(u_char * buffer, icn_card * card)
icn_lock_channel(card, 0); /* Lock Bank 0 */ icn_lock_channel(card, 0); /* Lock Bank 0 */
restore_flags(flags); restore_flags(flags);
SLEEP(1); SLEEP(1);
return (icn_check_loader(1)); ret = (icn_check_loader(1));
out_kfree:
kfree(codebuf);
out:
return ret;
} }
static int static int
......
...@@ -261,39 +261,6 @@ static int __init sc_init(void) ...@@ -261,39 +261,6 @@ static int __init sc_init(void)
} }
pr_debug("current IRQ: %d b: %d\n",irq[b],b); pr_debug("current IRQ: %d b: %d\n",irq[b],b);
/*
* See if we should probe for an irq
*/
if(irq[b]) {
/*
* No we were given one
* See that it is supported and free
*/
pr_debug("Trying for IRQ: %d\n",irq[b]);
if (irq_supported(irq[b])) {
if(REQUEST_IRQ(irq[b], interrupt_handler,
SA_PROBE, "sc_probe", NULL)) {
pr_debug("IRQ %d is already in use\n",
irq[b]);
continue;
}
FREE_IRQ(irq[b], NULL);
}
}
else {
/*
* Yes, we need to probe for an IRQ
*/
pr_debug("Probing for IRQ...\n");
for (i = 0; i < MAX_IRQS ; i++) {
if(!REQUEST_IRQ(sup_irq[i], interrupt_handler, SA_PROBE, "sc_probe", NULL)) {
pr_debug("Probed for and found IRQ %d\n", sup_irq[i]);
FREE_IRQ(sup_irq[i], NULL);
irq[b] = sup_irq[i];
break;
}
}
}
/* /*
* Make sure we got an IRQ * Make sure we got an IRQ
...@@ -379,8 +346,16 @@ static int __init sc_init(void) ...@@ -379,8 +346,16 @@ static int __init sc_init(void)
* Lock down the hardware resources * Lock down the hardware resources
*/ */
adapter[cinst]->interrupt = irq[b]; adapter[cinst]->interrupt = irq[b];
REQUEST_IRQ(adapter[cinst]->interrupt, interrupt_handler, SA_INTERRUPT, if (request_irq(adapter[cinst]->interrupt, interrupt_handler, SA_INTERRUPT,
interface->id, NULL); interface->id, NULL))
{
kfree(adapter[cinst]->channel);
indicate_status(cinst, ISDN_STAT_UNLOAD, 0, NULL); /* Fix me */
kfree(interface);
kfree(adapter[cinst]);
continue;
}
adapter[cinst]->iobase = io[b]; adapter[cinst]->iobase = io[b];
for(i = 0 ; i < MAX_IO_REGS - 1 ; i++) { for(i = 0 ; i < MAX_IO_REGS - 1 ; i++) {
adapter[cinst]->ioport[i] = io[b] + i * 0x400; adapter[cinst]->ioport[i] = io[b] + i * 0x400;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment