new init code

This commit is contained in:
Karsten Keil 1998-04-15 16:46:53 +00:00
parent 3ce1cac14c
commit 2db2682946
13 changed files with 155 additions and 91 deletions

View File

@ -8,6 +8,9 @@
*
*
* $Log$
* Revision 1.2 1998/02/02 13:27:06 keil
* New
*
*
*/
@ -221,10 +224,7 @@ Asus_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(request_irq(cs->irq, &asuscom_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 3);
return(0);
case CARD_TEST:
return(0);

View File

@ -6,6 +6,9 @@
*
*
* $Log$
* Revision 2.7 1998/02/02 13:29:37 keil
* fast io
*
* Revision 2.6 1998/01/13 23:09:46 keil
* really disable timer
*
@ -214,10 +217,10 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(request_irq(cs->irq, &avm_a1_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 1);
byteout(cs->hw.avm.cfg_reg, 0x16);
byteout(cs->hw.avm.cfg_reg, 0x1E);
inithscxisac(cs, 2);
return(0);
case CARD_TEST:
return(0);
@ -345,7 +348,6 @@ setup_avm_a1(struct IsdnCard *card))
val = bytein(cs->hw.avm.cfg_reg + 2);
printk(KERN_INFO "AVM A1: Byte at %x is %x\n",
cs->hw.avm.cfg_reg + 2, val);
byteout(cs->hw.avm.cfg_reg, 0x1E);
val = bytein(cs->hw.avm.cfg_reg);
printk(KERN_INFO "AVM A1: Byte at %x is %x\n",
cs->hw.avm.cfg_reg, val);

View File

@ -6,6 +6,9 @@
*
*
* $Log$
* Revision 1.8 1998/03/19 13:16:24 keil
* fix the correct release of the hscx
*
* Revision 1.7 1998/02/12 23:07:36 keil
* change for 2.1.86 (removing FREE_READ/FREE_WRITE from [dev]_kfree_skb()
*
@ -30,6 +33,7 @@
#define __NO_VERSION__
#include "hisax.h"
#include "hscx.h"
#include "isac.h"
#include "isdnl1.h"
#include <linux/interrupt.h>
@ -238,19 +242,20 @@ setstack_hscx(struct PStack *st, struct BCState *bcs)
HISAX_INITFUNC(void
clear_pending_hscx_ints(struct IsdnCardState *cs))
{
int val;
int val, eval;
char tmp[64];
val = cs->BC_Read_Reg(cs, 1, HSCX_ISTA);
sprintf(tmp, "HSCX B ISTA %x", val);
debugl1(cs, tmp);
if (val & 0x01) {
val = cs->BC_Read_Reg(cs, 1, HSCX_EXIR);
sprintf(tmp, "HSCX B EXIR %x", val);
eval = cs->BC_Read_Reg(cs, 1, HSCX_EXIR);
sprintf(tmp, "HSCX B EXIR %x", eval);
debugl1(cs, tmp);
} else if (val & 0x02) {
val = cs->BC_Read_Reg(cs, 0, HSCX_EXIR);
sprintf(tmp, "HSCX A EXIR %x", val);
}
if (val & 0x02) {
eval = cs->BC_Read_Reg(cs, 0, HSCX_EXIR);
sprintf(tmp, "HSCX A EXIR %x", eval);
debugl1(cs, tmp);
}
val = cs->BC_Read_Reg(cs, 0, HSCX_ISTA);
@ -262,10 +267,9 @@ clear_pending_hscx_ints(struct IsdnCardState *cs))
val = cs->BC_Read_Reg(cs, 0, HSCX_STAR);
sprintf(tmp, "HSCX A STAR %x", val);
debugl1(cs, tmp);
/* disable all IRQ */
cs->BC_Write_Reg(cs, 0, HSCX_MASK, 0xFF);
cs->BC_Write_Reg(cs, 1, HSCX_MASK, 0xFF);
cs->BC_Write_Reg(cs, 0, HSCX_MASK, 0);
cs->BC_Write_Reg(cs, 1, HSCX_MASK, 0);
}
HISAX_INITFUNC(void
@ -278,3 +282,22 @@ inithscx(struct IsdnCardState *cs))
modehscx(cs->bcs, 0, 0);
modehscx(cs->bcs + 1, 0, 0);
}
HISAX_INITFUNC(void
inithscxisac(struct IsdnCardState *cs, int part))
{
if (part & 1) {
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
}
if (part & 2) {
/* Reenable all IRQ */
cs->writeisac(cs, ISAC_MASK, 0);
cs->BC_Write_Reg(cs, 0, HSCX_MASK, 0);
cs->BC_Write_Reg(cs, 1, HSCX_MASK, 0);
/* RESET Receiver and Transmitter */
cs->writeisac(cs, ISAC_CMDR, 0x41);
}
}

View File

@ -6,6 +6,9 @@
*
*
* $Log$
* Revision 1.3 1997/07/27 21:38:35 keil
* new B-channel interface
*
* Revision 1.2 1997/06/26 11:16:18 keil
* first version
*
@ -41,3 +44,4 @@ extern void hscx_sched_event(struct BCState *bcs, int event);
extern void modehscx(struct BCState *bcs, int mode, int bc);
extern void clear_pending_hscx_ints(struct IsdnCardState *cs);
extern void inithscx(struct IsdnCardState *cs);
extern void inithscxisac(struct IsdnCardState *cs, int part);

View File

@ -6,6 +6,9 @@
*
*
* $Log$
* Revision 1.14 1998/04/10 10:35:26 paul
* fixed (silly?) warnings from egcs on Alpha.
*
* Revision 1.13 1998/03/07 22:57:01 tsbogend
* made HiSax working on Linux/Alpha
*
@ -66,7 +69,7 @@ ISACVersion(struct IsdnCardState *cs, char *s)
int val;
val = cs->readisac(cs, ISAC_RBCH);
printk(KERN_INFO "%s ISAC version : %s\n", s, ISACVer[(val >> 5) & 3]);
printk(KERN_INFO "%s ISAC version (%x): %s\n", s, val, ISACVer[(val >> 5) & 3]);
}
static void
@ -651,7 +654,7 @@ initisac(struct IsdnCardState *cs))
HISAX_INITFUNC(void
clear_pending_isac_ints(struct IsdnCardState *cs))
{
int val;
int val, eval;
char tmp[64];
val = cs->readisac(cs, ISAC_STAR);
@ -667,19 +670,15 @@ clear_pending_isac_ints(struct IsdnCardState *cs))
sprintf(tmp, "ISAC ISTA %x", val);
debugl1(cs, tmp);
if (val & 0x01) {
val = cs->readisac(cs, ISAC_EXIR);
sprintf(tmp, "ISAC EXIR %x", val);
eval = cs->readisac(cs, ISAC_EXIR);
sprintf(tmp, "ISAC EXIR %x", eval);
debugl1(cs, tmp);
} else if (val & 0x04) {
}
val = cs->readisac(cs, ISAC_CIR0);
sprintf(tmp, "ISAC CIR0 %x", val);
debugl1(cs, tmp);
cs->ph_state = (val >> 2) & 0xf;
} else {
cs->ph_state = (cs->readisac(cs, ISAC_CIX0) >> 2) & 0xf;
}
isac_sched_event(cs, D_L1STATECHANGE);
/* Disable all IRQ */
cs->writeisac(cs, ISAC_MASK, 0xFF);
cs->writeisac(cs, ISAC_MASK, 0);
cs->writeisac(cs, ISAC_CMDR, 0x41);
}

View File

@ -11,6 +11,9 @@
* Beat Doebeli
*
* $Log$
* Revision 2.6 1998/02/11 17:28:09 keil
* Niccy PnP/PCI support
*
* Revision 2.5 1998/02/02 13:29:42 keil
* fast io
*
@ -274,10 +277,7 @@ ix1_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(request_irq(cs->irq, &ix1micro_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 3);
return(0);
case CARD_TEST:
return(0);

View File

@ -8,6 +8,9 @@
*
*
* $Log$
* Revision 1.6 1998/02/17 15:39:57 keil
* fix reset problem
*
* Revision 1.5 1998/02/02 13:29:43 keil
* fast io
*
@ -217,10 +220,7 @@ mic_card_msg(struct IsdnCardState *cs, int mt, void *arg)
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
inithscx(cs); /* /RTSA := ISAC RST */
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 3);
return(0);
case CARD_TEST:
return(0);

View File

@ -8,7 +8,8 @@
* Thanks to Dr. Neuhaus and SAGEM for informations
*
* $Log$
*
* Revision 1.2 1998/02/11 17:31:04 keil
* new file
*
*/
@ -19,7 +20,6 @@
#include "hscx.h"
#include "isdnl1.h"
#include <linux/pci.h>
#include <linux/bios32.h>
extern const char *CardType[];
const char *niccy_revision = "$Revision$";
@ -41,6 +41,10 @@ const char *niccy_revision = "$Revision$";
/* PCI stuff */
#define PCI_VENDOR_DR_NEUHAUS 0x1267
#define PCI_NICCY_ID 0x1016
#define PCI_IRQ_CTRL_REG 0x38
#define PCI_IRQ_ENABLE 0x1f00
#define PCI_IRQ_DISABLE 0xff0000
#define PCI_IRQ_ASSERT 0x800000
static inline u_char
readreg(unsigned int ale, unsigned int adr, u_char off)
@ -149,6 +153,13 @@ niccy_interrupt(int intno, void *dev_id, struct pt_regs *regs)
printk(KERN_WARNING "Niccy: Spurious interrupt!\n");
return;
}
if (cs->subtyp == NICCY_PCI) {
int ival;
ival = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
if (!(ival & PCI_IRQ_ASSERT)) /* IRQ not for us (shared) */
return;
outl(ival, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
}
val = readreg(cs->hw.niccy.hscx_ale, cs->hw.niccy.hscx, HSCX_ISTA + 0x40);
Start_HSCX:
if (val) {
@ -188,9 +199,15 @@ niccy_interrupt(int intno, void *dev_id, struct pt_regs *regs)
void
release_io_niccy(struct IsdnCardState *cs)
{
if (cs->subtyp == NICCY_PCI)
if (cs->subtyp == NICCY_PCI) {
int val;
val = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
val &= PCI_IRQ_DISABLE;
outl(val, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
release_region(cs->hw.niccy.cfg_reg, 0x80);
release_region(cs->hw.niccy.isac, 4);
else {
} else {
release_region(cs->hw.niccy.isac, 2);
release_region(cs->hw.niccy.isac_ale, 2);
}
@ -199,12 +216,20 @@ release_io_niccy(struct IsdnCardState *cs)
static void
niccy_reset(struct IsdnCardState *cs)
{
// No reset procedure known
int val, nval;
val = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
nval = val | PCI_IRQ_ENABLE;
outl(nval, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
inithscxisac(cs, 3);
}
static int
niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
{
int imode;
switch (mt) {
case CARD_RESET:
niccy_reset(cs);
@ -213,13 +238,15 @@ niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
release_io_niccy(cs);
return(0);
case CARD_SETIRQ:
if (cs->subtyp == NICCY_PCI)
imode = I4L_IRQ_FLAG | SA_SHIRQ;
else
imode = I4L_IRQ_FLAG;
return(request_irq(cs->irq, &niccy_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
imode, "HiSax", cs));
break;
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
niccy_reset(cs);
return(0);
case CARD_TEST:
return(0);
@ -227,7 +254,7 @@ niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(0);
}
static int pci_index __initdata = 0;
static struct pci_dev *niccy_dev __initdata = NULL;
__initfunc(int
setup_niccy(struct IsdnCard *card))
@ -269,49 +296,41 @@ setup_niccy(struct IsdnCard *card))
request_region(cs->hw.niccy.isac_ale, 2, "niccy addr");
} else {
#if CONFIG_PCI
u_char pci_bus, pci_device_fn, pci_irq;
u_int pci_ioaddr;
if (!pci_present()) {
printk(KERN_ERR "Niccy: no PCI bus present\n");
return(0);
}
cs->subtyp = 0;
for (; pci_index < 0xff; pci_index++) {
if (pcibios_find_device(PCI_VENDOR_DR_NEUHAUS,
PCI_NICCY_ID, pci_index, &pci_bus, &pci_device_fn)
== PCIBIOS_SUCCESSFUL)
cs->subtyp = NICCY_PCI;
else
break;
if ((niccy_dev = pci_find_device(PCI_VENDOR_DR_NEUHAUS,
PCI_NICCY_ID, niccy_dev))) {
/* get IRQ */
pcibios_read_config_byte(pci_bus, pci_device_fn,
PCI_INTERRUPT_LINE, &pci_irq);
/* get IO address */
/* if it won't work try the other PCI addresses
* PCI_BASE_ADDRESS_0 ... PCI_BASE_ADDRESS_5
*/
pcibios_read_config_dword(pci_bus, pci_device_fn,
PCI_BASE_ADDRESS_2, &pci_ioaddr);
if (cs->subtyp)
break;
}
if (!cs->subtyp) {
printk(KERN_WARNING "Niccy: No PCI card found\n");
if (!niccy_dev->irq) {
printk(KERN_WARNING "Niccy: No IRQ for PCI card found\n");
return(0);
}
if (!pci_irq) {
printk(KERN_WARNING "Niccy: No IRQ for PCI card found\n");
cs->irq = niccy_dev->irq;
if (!niccy_dev->base_address[0]) {
printk(KERN_WARNING "Niccy: No IO-Adr for PCI cfg found\n");
return(0);
}
if (!pci_ioaddr) {
cs->hw.niccy.cfg_reg = niccy_dev->base_address[0] & PCI_BASE_ADDRESS_IO_MASK;
if (!niccy_dev->base_address[1]) {
printk(KERN_WARNING "Niccy: No IO-Adr for PCI card found\n");
return(0);
}
pci_ioaddr &= ~3; /* remove io/mem flag */
pci_ioaddr = niccy_dev->base_address[1] & PCI_BASE_ADDRESS_IO_MASK;
cs->hw.niccy.isac = pci_ioaddr + ISAC_PCI_DATA;
cs->hw.niccy.isac_ale = pci_ioaddr + ISAC_PCI_ADDR;
cs->hw.niccy.hscx = pci_ioaddr + HSCX_PCI_DATA;
cs->hw.niccy.hscx_ale = pci_ioaddr + HSCX_PCI_ADDR;
cs->irq = pci_irq;
cs->subtyp = NICCY_PCI;
} else {
printk(KERN_WARNING "Niccy: No PCI card found\n");
return(0);
}
if (check_region((cs->hw.niccy.isac), 4)) {
printk(KERN_WARNING
"HiSax: %s data port %x-%x already in use\n",
@ -321,6 +340,17 @@ setup_niccy(struct IsdnCard *card))
return (0);
} else
request_region(cs->hw.niccy.isac, 4, "niccy");
if (check_region(cs->hw.niccy.cfg_reg, 0x80)) {
printk(KERN_WARNING
"HiSax: %s pci port %x-%x already in use\n",
CardType[card->typ],
cs->hw.niccy.cfg_reg,
cs->hw.niccy.cfg_reg + 0x80);
release_region(cs->hw.niccy.isac, 4);
return (0);
} else {
request_region(cs->hw.niccy.cfg_reg, 0x80, "niccy pci");
}
#else
printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
@ -331,7 +361,6 @@ setup_niccy(struct IsdnCard *card))
"HiSax: %s %s config irq:%d data:0x%X ale:0x%X\n",
CardType[cs->typ], (cs->subtyp==1) ? "PnP":"PCI",
cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
niccy_reset(cs);
cs->readisac = &ReadISAC;
cs->writeisac = &WriteISAC;
cs->readisacfifo = &ReadISACfifo;

View File

@ -14,6 +14,9 @@
* Edgar Toernig
*
* $Log$
* Revision 1.6 1998/02/09 18:46:06 keil
* Support for Sedlbauer PCMCIA (Marcus Niemann)
*
* Revision 1.5 1998/02/02 13:29:45 keil
* fast io
*
@ -263,10 +266,7 @@ Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(request_irq(cs->irq, &sedlbauer_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 3);
return(0);
case CARD_TEST:
return(0);

View File

@ -7,6 +7,9 @@
* Thanks to Christian "naddy" Weisgerber (3Com, US Robotics) for documentation
*
* $Log$
* Revision 1.5 1998/02/02 13:29:46 keil
* fast io
*
* Revision 1.4 1997/11/08 21:35:52 keil
* new l1 init
*
@ -186,12 +189,10 @@ Sportster_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(request_irq(cs->irq, &sportster_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 1);
cs->hw.spt.res_irq |= SPORTSTER_INTE; /* IRQ On */
byteout(cs->hw.spt.cfg_reg + SPORTSTER_RES_IRQ, cs->hw.spt.res_irq);
inithscxisac(cs, 2);
return(0);
case CARD_TEST:
return(0);

View File

@ -6,6 +6,9 @@
*
*
* $Log$
* Revision 1.5 1998/02/02 13:40:47 keil
* fast io
*
* Revision 1.4 1997/11/08 21:35:53 keil
* new l1 init
*
@ -270,6 +273,9 @@ TeleInt_card_msg(struct IsdnCardState *cs, int mt, void *arg)
inithfc(cs);
clear_pending_isac_ints(cs);
initisac(cs);
/* Reenable all IRQ */
cs->writeisac(cs, ISAC_MASK, 0);
cs->writeisac(cs, ISAC_CMDR, 0x41);
cs->hw.hfc.timer.expires = jiffies + 1;
add_timer(&cs->hw.hfc.timer);
return(0);

View File

@ -10,6 +10,9 @@
* Beat Doebeli
*
* $Log$
* Revision 2.7 1998/03/07 22:57:08 tsbogend
* made HiSax working on Linux/Alpha
*
* Revision 2.6 1998/02/03 23:27:47 keil
* IRQ 9
*
@ -288,10 +291,7 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(request_irq(cs->irq, &teles0_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 3);
return(0);
case CARD_TEST:
return(0);

View File

@ -11,6 +11,9 @@
* Beat Doebeli
*
* $Log$
* Revision 2.7 1998/02/02 13:29:48 keil
* fast io
*
* Revision 2.6 1997/11/13 16:22:44 keil
* COMPAQ_ISA reset
*
@ -301,10 +304,7 @@ Teles_card_msg(struct IsdnCardState *cs, int mt, void *arg)
return(request_irq(cs->irq, &teles3_interrupt,
I4L_IRQ_FLAG, "HiSax", cs));
case CARD_INIT:
clear_pending_isac_ints(cs);
clear_pending_hscx_ints(cs);
initisac(cs);
inithscx(cs);
inithscxisac(cs, 3);
return(0);
case CARD_TEST:
return(0);