Commit 4a9bb1fd authored by Kai Germaschewski's avatar Kai Germaschewski

Merge tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5

into tp1.ruhr-uni-bochum.de:/home/kai/kernel/v2.5/linux-2.5.isdn
parents b533e812 98c74837
......@@ -11,11 +11,6 @@
#ifndef PC_H_INCLUDED
#define PC_H_INCLUDED
#define byte unsigned char
#define word unsigned short
#define dword unsigned long
/*------------------------------------------------------------------*/
/* buffer definition */
/*------------------------------------------------------------------*/
......
......@@ -148,7 +148,7 @@ static dev_link_t *avmcs_attach(void)
/* Initialize the dev_link_t structure */
link = kmalloc(sizeof(struct dev_link_t), GFP_KERNEL);
if (!link)
return NULL;
goto err;
memset(link, 0, sizeof(struct dev_link_t));
link->release.function = &avmcs_release;
link->release.data = (u_long)link;
......@@ -181,7 +181,7 @@ static dev_link_t *avmcs_attach(void)
/* Allocate space for private device-specific data */
local = kmalloc(sizeof(local_info_t), GFP_KERNEL);
if (!local)
return NULL;
goto err_kfree;
memset(local, 0, sizeof(local_info_t));
link->priv = local;
......@@ -201,10 +201,14 @@ static dev_link_t *avmcs_attach(void)
if (ret != 0) {
cs_error(link->handle, RegisterClient, ret);
avmcs_detach(link);
return NULL;
goto err;
}
return link;
err_kfree:
kfree(link);
err:
return NULL;
} /* avmcs_attach */
/*======================================================================
......
......@@ -50,12 +50,12 @@ if [ "$CONFIG_ISDN_DRV_HISAX" != "n" ]; then
fi
bool ' HiSax debugging' CONFIG_HISAX_DEBUG
dep_tristate 'Sedlbauer PCMCIA cards' CONFIG_HISAX_SEDLBAUER_CS $CONFIG_DRV_ISDN_HISAX $CONFIG_PCMCIA
dep_tristate 'ELSA PCMCIA MicroLink cards' CONFIG_HISAX_ELSA_CS $CONFIG_DRV_ISDN_HISAX $CONFIG_PCMCIA
dep_tristate 'ST5481 USB ISDN modem (EXPERIMENTAL)' CONFIG_HISAX_ST5481 $CONFIG_DRV_ISDN_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 classic support (EXPERIMENTAL)' CONFIG_HISAX_FRITZ_CLASSIC $CONFIG_DRV_ISDN_HISAX $CONFIG_EXPERIMENTAL
dep_tristate 'HFC PCI support (EXPERIMENTAL)' CONFIG_HISAX_HFCPCI $CONFIG_DRV_ISDN_HISAX $CONFIG_EXPERIMENTAL
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_ISDN_DRV_HISAX $CONFIG_PCMCIA
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_ISDN_DRV_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_ISDN_DRV_HISAX $CONFIG_EXPERIMENTAL
fi
endmenu
......@@ -63,19 +63,42 @@
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 */
WriteWordAmd7930(struct IsdnCardState *cs, BYTE reg, WORD val)
static inline u8
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, 0x01, LOBYTE(val));
wByteAMD(cs, 0x01, HIBYTE(val));
}
WORD /* macro rWordAMD */
ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg)
static u16
rWordAMD(struct IsdnCardState *cs, u8 reg)
{
WORD res;
u16 res;
/* direct access register */
if(reg < 8) {
res = rByteAMD(cs, reg);
......@@ -90,6 +113,17 @@ ReadWordAmd7930(struct IsdnCardState *cs, BYTE reg)
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
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
0x01, 0x02, 0x00, 0x00, 0x00, 0x07, 0x05, 0x00, // init
0x01, 0x02, 0x00, 0x00, 0x00, 0x07, 0x05, 0x00, // reset
......@@ -117,14 +151,14 @@ static BYTE i430States[] = {
/* 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
Amd7930_get_state(struct IsdnCardState *cs) {
BYTE lsr = rByteAMD(cs, 0xA1);
u8 lsr = rByteAMD(cs, 0xA1);
cs->dc.amd7930.ph_state = (lsr & 0x7) + 2;
Amd7930_new_ph(cs);
}
......@@ -252,8 +286,8 @@ static void
Amd7930_empty_Dfifo(struct IsdnCardState *cs, int flag)
{
BYTE stat, der;
BYTE *ptr;
u8 stat, der;
u8 *ptr;
struct sk_buff *skb;
......@@ -326,9 +360,9 @@ static void
Amd7930_fill_Dfifo(struct IsdnCardState *cs)
{
WORD dtcrr, dtcrw, len, count;
BYTE txstat, dmr3;
BYTE *ptr, *deb_ptr;
u16 dtcrr, dtcrw, len, count;
u8 txstat, dmr3;
u8 *ptr, *deb_ptr;
if ((cs->debug & L1_DEB_ISAC) && !(cs->debug & L1_DEB_ISAC_FIFO))
debugl1(cs, "Amd7930: fill_Dfifo");
......@@ -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;
WORD der;
u8 dsr1, dsr2, lsr;
u16 der;
while (irflags)
{
......@@ -661,8 +695,8 @@ static void
dbusy_timer_handler(struct IsdnCardState *cs)
{
struct PStack *stptr;
WORD dtcr, der;
BYTE dsr1, dsr2;
u16 dtcr, der;
u8 dsr1, dsr2;
if (cs->debug & L1_DEB_ISAC)
......@@ -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
Amd7930_init(struct IsdnCardState *cs)
{
WORD *ptr;
BYTE cmd, cnt;
u16 *ptr;
u8 cmd, cnt;
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "Amd7930: initamd called");
......
......@@ -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_DR 0x01
#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_init(struct IsdnCardState *cs);
......@@ -819,34 +819,34 @@ icn_loadboot(u_char * buffer, icn_card * card)
#endif
if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
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)) {
kfree(codebuf);
return -EFAULT;
ret = -EFAULT;
goto out_kfree;
}
if (!card->rvalid) {
if (check_region(card->port, ICN_PORTLEN)) {
if (!request_region(card->port, ICN_PORTLEN, card->regname)) {
printk(KERN_WARNING
"icn: (%s) ports 0x%03x-0x%03x in use.\n",
CID,
card->port,
card->port + ICN_PORTLEN);
kfree(codebuf);
return -EBUSY;
ret = -EBUSY;
goto out_kfree;
}
request_region(card->port, ICN_PORTLEN, card->regname);
card->rvalid = 1;
if (card->doubleS0)
card->other->rvalid = 1;
}
if (!dev.mvalid) {
if (check_mem_region(dev.memaddr, 0x4000)) {
if (!request_mem_region(dev.memaddr, 0x4000, "icn-isdn (all cards)")) {
printk(KERN_WARNING
"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.mvalid = 1;
}
......@@ -888,13 +888,15 @@ icn_loadboot(u_char * buffer, icn_card * card)
printk(KERN_DEBUG "Bootloader transferred\n");
#endif
}
kfree(codebuf);
SLEEP(1);
OUTB_P(0xff, ICN_RUN); /* Start Boot-Code */
if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1)))
return ret;
if (!card->doubleS0)
return 0;
if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) {
goto out_kfree;
}
if (!card->doubleS0) {
ret = 0;
goto out_kfree;
}
/* reached only, if we have a Double-S0-Card */
#ifdef BOOT_DEBUG
printk(KERN_DEBUG "Map Bank 0\n");
......@@ -905,7 +907,12 @@ icn_loadboot(u_char * buffer, icn_card * card)
icn_lock_channel(card, 0); /* Lock Bank 0 */
restore_flags(flags);
SLEEP(1);
return (icn_check_loader(1));
ret = (icn_check_loader(1));
out_kfree:
kfree(codebuf);
out:
return ret;
}
static int
......
......@@ -261,39 +261,6 @@ static int __init sc_init(void)
}
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
......@@ -379,8 +346,16 @@ static int __init sc_init(void)
* Lock down the hardware resources
*/
adapter[cinst]->interrupt = irq[b];
REQUEST_IRQ(adapter[cinst]->interrupt, interrupt_handler, SA_INTERRUPT,
interface->id, NULL);
if (request_irq(adapter[cinst]->interrupt, interrupt_handler, SA_INTERRUPT,
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];
for(i = 0 ; i < MAX_IO_REGS - 1 ; i++) {
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