1997-09-11 17:32:33 +00:00
|
|
|
/* $Id$
|
|
|
|
|
|
|
|
* sedlbauer.c low level stuff for Sedlbauer cards
|
1998-11-15 23:55:28 +00:00
|
|
|
* includes support for the Sedlbauer speed star (speed star II),
|
|
|
|
* support for the Sedlbauer speed fax+,
|
|
|
|
* support for the Sedlbauer ISDN-Controller PC/104 and
|
|
|
|
* support for the Sedlbauer speed pci
|
|
|
|
* derived from the original file asuscom.c from Karsten Keil
|
1997-09-11 17:32:33 +00:00
|
|
|
*
|
1998-02-09 18:46:21 +00:00
|
|
|
* Copyright (C) 1997,1998 Marcus Niemann (for the modifications to
|
1998-11-15 23:55:28 +00:00
|
|
|
* the original file asuscom.c)
|
1997-09-11 17:32:33 +00:00
|
|
|
*
|
1998-02-09 18:46:21 +00:00
|
|
|
* Author Marcus Niemann (niemann@www-bib.fh-bielefeld.de)
|
1997-09-11 17:32:33 +00:00
|
|
|
*
|
|
|
|
* Thanks to Karsten Keil
|
|
|
|
* Sedlbauer AG for informations
|
|
|
|
* Edgar Toernig
|
|
|
|
*
|
|
|
|
* $Log$
|
1999-11-13 21:25:03 +00:00
|
|
|
* Revision 1.17 1999/09/04 06:20:06 keil
|
|
|
|
* Changes from kernel set_current_state()
|
|
|
|
*
|
1999-09-04 06:20:07 +00:00
|
|
|
* Revision 1.16 1999/08/29 18:23:01 niemann
|
|
|
|
* Fixed typo in errormsg
|
|
|
|
*
|
1999-08-29 18:23:01 +00:00
|
|
|
* Revision 1.15 1999/08/25 17:00:00 keil
|
|
|
|
* Make ISAR V32bis modem running
|
|
|
|
* Make LL->HL interface open for additional commands
|
|
|
|
*
|
1999-08-25 17:00:09 +00:00
|
|
|
* Revision 1.14 1999/08/11 20:59:22 keil
|
|
|
|
* new PCI codefix
|
|
|
|
* fix IRQ problem while unload
|
|
|
|
*
|
1999-08-11 20:59:22 +00:00
|
|
|
* Revision 1.13 1999/08/10 16:02:08 calle
|
|
|
|
* struct pci_dev changed in 2.3.13. Made the necessary changes.
|
|
|
|
*
|
1999-08-10 16:02:27 +00:00
|
|
|
* Revision 1.12 1999/08/05 20:43:22 keil
|
|
|
|
* ISAR analog modem support
|
|
|
|
*
|
1999-08-05 20:43:22 +00:00
|
|
|
* Revision 1.11 1999/07/12 21:05:27 keil
|
|
|
|
* fix race in IRQ handling
|
|
|
|
* added watchdog for lost IRQs
|
|
|
|
*
|
1999-07-12 21:05:34 +00:00
|
|
|
* Revision 1.10 1999/07/01 08:12:09 keil
|
|
|
|
* Common HiSax version for 2.0, 2.1, 2.2 and 2.3 kernel
|
|
|
|
*
|
1999-07-01 08:12:15 +00:00
|
|
|
* Revision 1.9 1998/11/15 23:55:20 keil
|
|
|
|
* changes from 2.0
|
|
|
|
*
|
1998-11-15 23:55:28 +00:00
|
|
|
* Revision 1.8 1998/08/13 23:34:51 keil
|
|
|
|
* starting speedfax+ (ISAR) support
|
|
|
|
*
|
1998-08-13 23:34:51 +00:00
|
|
|
* Revision 1.7 1998/04/15 16:44:33 keil
|
|
|
|
* new init code
|
|
|
|
*
|
1998-04-15 16:46:53 +00:00
|
|
|
* Revision 1.6 1998/02/09 18:46:06 keil
|
|
|
|
* Support for Sedlbauer PCMCIA (Marcus Niemann)
|
|
|
|
*
|
1998-02-09 18:46:21 +00:00
|
|
|
* Revision 1.5 1998/02/02 13:29:45 keil
|
|
|
|
* fast io
|
|
|
|
*
|
1998-02-02 13:29:48 +00:00
|
|
|
* Revision 1.4 1997/11/08 21:35:52 keil
|
|
|
|
* new l1 init
|
|
|
|
*
|
1997-11-08 21:35:56 +00:00
|
|
|
* Revision 1.3 1997/11/06 17:09:28 keil
|
|
|
|
* New 2.1 init code
|
|
|
|
*
|
1997-11-06 17:13:35 +00:00
|
|
|
* Revision 1.2 1997/10/29 18:55:52 keil
|
|
|
|
* changes for 2.1.60 (irq2dev_map)
|
|
|
|
*
|
1997-10-29 18:55:59 +00:00
|
|
|
* Revision 1.1 1997/09/11 17:32:04 keil
|
|
|
|
* new
|
|
|
|
*
|
1997-09-11 17:32:33 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
/* Supported cards:
|
|
|
|
* Card: Chip: Configuration: Comment:
|
|
|
|
* ---------------------------------------------------------------------
|
|
|
|
* Speed Card ISAC_HSCX DIP-SWITCH
|
|
|
|
* Speed Win ISAC_HSCX ISAPNP
|
1999-11-13 21:25:03 +00:00
|
|
|
* Speed Fax+ ISAC_ISAR ISAPNP Full analog support
|
1998-11-15 23:55:28 +00:00
|
|
|
* Speed Star ISAC_HSCX CARDMGR
|
|
|
|
* Speed Win2 IPAC ISAPNP
|
|
|
|
* ISDN PC/104 IPAC DIP-SWITCH
|
|
|
|
* Speed Star2 IPAC CARDMGR
|
1999-11-13 21:25:03 +00:00
|
|
|
* Speed PCI IPAC PCI PNP
|
|
|
|
* Speed Fax+ ISAC_ISAR PCI PNP Full analog support
|
1998-11-15 23:55:28 +00:00
|
|
|
*
|
|
|
|
* Important:
|
|
|
|
* For the sedlbauer speed fax+ to work properly you have to download
|
|
|
|
* the firmware onto the card.
|
|
|
|
* For example: hisaxctrl <DriverID> 9 ISAR.BIN
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define SEDLBAUER_PCI 1
|
|
|
|
|
1997-09-11 17:32:33 +00:00
|
|
|
#define __NO_VERSION__
|
1998-11-15 23:55:28 +00:00
|
|
|
#include <linux/config.h>
|
1997-09-11 17:32:33 +00:00
|
|
|
#include "hisax.h"
|
|
|
|
#include "isac.h"
|
1998-11-15 23:55:28 +00:00
|
|
|
#include "ipac.h"
|
1997-09-11 17:32:33 +00:00
|
|
|
#include "hscx.h"
|
1998-08-13 23:34:51 +00:00
|
|
|
#include "isar.h"
|
1997-09-11 17:32:33 +00:00
|
|
|
#include "isdnl1.h"
|
1998-11-15 23:55:28 +00:00
|
|
|
#include <linux/pci.h>
|
1999-07-01 08:12:15 +00:00
|
|
|
#ifndef COMPAT_HAS_NEW_PCI
|
|
|
|
#include <linux/bios32.h>
|
1999-11-13 21:25:03 +00:00
|
|
|
/* in old PCI here is an error in defining SUB SYSTEM/VENDOR Ids */
|
|
|
|
#undef PCI_SUBSYSTEM_VENDOR_ID
|
|
|
|
#define PCI_SUBSYSTEM_VENDOR_ID 0x2c
|
|
|
|
#undef PCI_SUBSYSTEM_ID
|
|
|
|
#define PCI_SUBSYSTEM_ID 0x2e
|
1999-07-01 08:12:15 +00:00
|
|
|
#endif
|
1997-09-11 17:32:33 +00:00
|
|
|
|
|
|
|
extern const char *CardType[];
|
|
|
|
|
|
|
|
const char *Sedlbauer_revision = "$Revision$";
|
|
|
|
|
1998-02-09 18:46:21 +00:00
|
|
|
const char *Sedlbauer_Types[] =
|
1998-11-15 23:55:28 +00:00
|
|
|
{"None", "speed card/win", "speed star", "speed fax+",
|
1999-11-13 21:25:03 +00:00
|
|
|
"speed win II / ISDN PC/104", "speed star II", "speed pci",
|
|
|
|
"speed fax+ pci"};
|
1998-11-15 23:55:28 +00:00
|
|
|
|
|
|
|
#ifdef SEDLBAUER_PCI
|
|
|
|
#define PCI_VENDOR_SEDLBAUER 0xe159
|
1999-11-13 21:25:03 +00:00
|
|
|
#define PCI_SPEEDPCI_ID 0x02
|
|
|
|
#define PCI_SUBVENDOR_SEDLBAUER 0x51
|
|
|
|
#define PCI_SUB_ID_SPEEDFAXP 0x01
|
1998-11-15 23:55:28 +00:00
|
|
|
#endif
|
1998-02-09 18:46:21 +00:00
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
#define SEDL_SPEED_CARD_WIN 1
|
|
|
|
#define SEDL_SPEED_STAR 2
|
|
|
|
#define SEDL_SPEED_FAX 3
|
|
|
|
#define SEDL_SPEED_WIN2_PC104 4
|
|
|
|
#define SEDL_SPEED_STAR2 5
|
|
|
|
#define SEDL_SPEED_PCI 6
|
1999-11-13 21:25:03 +00:00
|
|
|
#define SEDL_SPEEDFAX_PCI 7
|
1998-11-15 23:55:28 +00:00
|
|
|
|
|
|
|
#define SEDL_CHIP_TEST 0
|
|
|
|
#define SEDL_CHIP_ISAC_HSCX 1
|
|
|
|
#define SEDL_CHIP_ISAC_ISAR 2
|
|
|
|
#define SEDL_CHIP_IPAC 3
|
|
|
|
|
|
|
|
#define SEDL_BUS_ISA 1
|
|
|
|
#define SEDL_BUS_PCI 2
|
|
|
|
#define SEDL_BUS_PCMCIA 3
|
1998-02-09 18:46:21 +00:00
|
|
|
|
1998-02-02 13:29:48 +00:00
|
|
|
#define byteout(addr,val) outb(val,addr)
|
|
|
|
#define bytein(addr) inb(addr)
|
1997-09-11 17:32:33 +00:00
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
#define SEDL_HSCX_ISA_RESET_ON 0
|
|
|
|
#define SEDL_HSCX_ISA_RESET_OFF 1
|
|
|
|
#define SEDL_HSCX_ISA_ISAC 2
|
|
|
|
#define SEDL_HSCX_ISA_HSCX 3
|
|
|
|
#define SEDL_HSCX_ISA_ADR 4
|
1997-11-08 21:35:56 +00:00
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
#define SEDL_HSCX_PCMCIA_RESET 0
|
|
|
|
#define SEDL_HSCX_PCMCIA_ISAC 1
|
|
|
|
#define SEDL_HSCX_PCMCIA_HSCX 2
|
|
|
|
#define SEDL_HSCX_PCMCIA_ADR 4
|
1998-02-09 18:46:21 +00:00
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
#define SEDL_ISAR_ISA_ISAC 4
|
|
|
|
#define SEDL_ISAR_ISA_ISAR 6
|
|
|
|
#define SEDL_ISAR_ISA_ADR 8
|
|
|
|
#define SEDL_ISAR_ISA_ISAR_RESET_ON 10
|
|
|
|
#define SEDL_ISAR_ISA_ISAR_RESET_OFF 12
|
|
|
|
|
1999-11-13 21:25:03 +00:00
|
|
|
#define SEDL_IPAC_ANY_ADR 0
|
|
|
|
#define SEDL_IPAC_ANY_IPAC 2
|
1998-11-15 23:55:28 +00:00
|
|
|
|
1999-11-13 21:25:03 +00:00
|
|
|
#define SEDL_IPAC_PCI_BASE 0
|
|
|
|
#define SEDL_IPAC_PCI_ADR 0xc0
|
|
|
|
#define SEDL_IPAC_PCI_IPAC 0xc8
|
|
|
|
#define SEDL_ISAR_PCI_ADR 0xc8
|
|
|
|
#define SEDL_ISAR_PCI_ISAC 0xd0
|
|
|
|
#define SEDL_ISAR_PCI_ISAR 0xe0
|
|
|
|
#define SEDL_ISAR_PCI_ISAR_RESET_ON 0x01
|
|
|
|
#define SEDL_ISAR_PCI_ISAR_RESET_OFF 0x18
|
|
|
|
#define SEDL_ISAR_PCI_LED1 0x08
|
|
|
|
#define SEDL_ISAR_PCI_LED2 0x10
|
1998-08-13 23:34:51 +00:00
|
|
|
|
1997-11-08 21:35:56 +00:00
|
|
|
#define SEDL_RESET 0x3 /* same as DOS driver */
|
|
|
|
|
1997-09-11 17:32:33 +00:00
|
|
|
static inline u_char
|
|
|
|
readreg(unsigned int ale, unsigned int adr, u_char off)
|
|
|
|
{
|
|
|
|
register u_char ret;
|
|
|
|
long flags;
|
|
|
|
|
|
|
|
save_flags(flags);
|
|
|
|
cli();
|
|
|
|
byteout(ale, off);
|
|
|
|
ret = bytein(adr);
|
|
|
|
restore_flags(flags);
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
readfifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size)
|
|
|
|
{
|
|
|
|
/* fifo read without cli because it's allready done */
|
|
|
|
|
|
|
|
byteout(ale, off);
|
|
|
|
insb(adr, data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
writereg(unsigned int ale, unsigned int adr, u_char off, u_char data)
|
|
|
|
{
|
|
|
|
long flags;
|
|
|
|
|
|
|
|
save_flags(flags);
|
|
|
|
cli();
|
|
|
|
byteout(ale, off);
|
|
|
|
byteout(adr, data);
|
|
|
|
restore_flags(flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
writefifo(unsigned int ale, unsigned int adr, u_char off, u_char * data, int size)
|
|
|
|
{
|
|
|
|
/* fifo write without cli because it's allready done */
|
|
|
|
byteout(ale, off);
|
|
|
|
outsb(adr, data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface functions */
|
|
|
|
|
|
|
|
static u_char
|
|
|
|
ReadISAC(struct IsdnCardState *cs, u_char offset)
|
|
|
|
{
|
|
|
|
return (readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
|
|
|
|
{
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset, value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ReadISACfifo(struct IsdnCardState *cs, u_char * data, int size)
|
|
|
|
{
|
|
|
|
readfifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0, data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
|
|
|
|
{
|
|
|
|
writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0, data, size);
|
|
|
|
}
|
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
static u_char
|
|
|
|
ReadISAC_IPAC(struct IsdnCardState *cs, u_char offset)
|
|
|
|
{
|
1999-11-13 21:25:03 +00:00
|
|
|
return (readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset|0x80));
|
|
|
|
}
|
1998-11-15 23:55:28 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
WriteISAC_IPAC(struct IsdnCardState *cs, u_char offset, u_char value)
|
|
|
|
{
|
1999-11-13 21:25:03 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, offset|0x80, value);
|
1998-11-15 23:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
ReadISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
|
|
|
|
{
|
1999-11-13 21:25:03 +00:00
|
|
|
readfifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size);
|
1998-11-15 23:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char * data, int size)
|
|
|
|
{
|
1999-11-13 21:25:03 +00:00
|
|
|
writefifo(cs->hw.sedl.adr, cs->hw.sedl.isac, 0x80, data, size);
|
1998-11-15 23:55:28 +00:00
|
|
|
}
|
|
|
|
|
1997-09-11 17:32:33 +00:00
|
|
|
static u_char
|
|
|
|
ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
|
|
|
|
{
|
|
|
|
return (readreg(cs->hw.sedl.adr,
|
|
|
|
cs->hw.sedl.hscx, offset + (hscx ? 0x40 : 0)));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset, u_char value)
|
|
|
|
{
|
|
|
|
writereg(cs->hw.sedl.adr,
|
|
|
|
cs->hw.sedl.hscx, offset + (hscx ? 0x40 : 0), value);
|
|
|
|
}
|
|
|
|
|
1998-08-13 23:34:51 +00:00
|
|
|
/* ISAR access routines
|
|
|
|
* mode = 0 access with IRQ on
|
|
|
|
* mode = 1 access with IRQ off
|
|
|
|
* mode = 2 access with IRQ off and using last offset
|
|
|
|
*/
|
|
|
|
|
|
|
|
static u_char
|
|
|
|
ReadISAR(struct IsdnCardState *cs, int mode, u_char offset)
|
|
|
|
{
|
|
|
|
if (mode == 0)
|
1998-11-15 23:55:28 +00:00
|
|
|
return (readreg(cs->hw.sedl.adr, cs->hw.sedl.hscx, offset));
|
1998-08-13 23:34:51 +00:00
|
|
|
else if (mode == 1)
|
|
|
|
byteout(cs->hw.sedl.adr, offset);
|
1998-11-15 23:55:28 +00:00
|
|
|
return(bytein(cs->hw.sedl.hscx));
|
1998-08-13 23:34:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
WriteISAR(struct IsdnCardState *cs, int mode, u_char offset, u_char value)
|
|
|
|
{
|
|
|
|
if (mode == 0)
|
1998-11-15 23:55:28 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx, offset, value);
|
1998-08-13 23:34:51 +00:00
|
|
|
else {
|
|
|
|
if (mode == 1)
|
|
|
|
byteout(cs->hw.sedl.adr, offset);
|
1998-11-15 23:55:28 +00:00
|
|
|
byteout(cs->hw.sedl.hscx, value);
|
1998-08-13 23:34:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-09-11 17:32:33 +00:00
|
|
|
/*
|
|
|
|
* fast interrupt HSCX stuff goes here
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define READHSCX(cs, nr, reg) readreg(cs->hw.sedl.adr, \
|
|
|
|
cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0))
|
|
|
|
#define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.sedl.adr, \
|
|
|
|
cs->hw.sedl.hscx, reg + (nr ? 0x40 : 0), data)
|
|
|
|
|
|
|
|
#define READHSCXFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.sedl.adr, \
|
|
|
|
cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
|
|
|
|
|
|
|
|
#define WRITEHSCXFIFO(cs, nr, ptr, cnt) writefifo(cs->hw.sedl.adr, \
|
|
|
|
cs->hw.sedl.hscx, (nr ? 0x40 : 0), ptr, cnt)
|
|
|
|
|
|
|
|
#include "hscx_irq.c"
|
|
|
|
|
|
|
|
static void
|
1997-11-06 17:13:35 +00:00
|
|
|
sedlbauer_interrupt(int intno, void *dev_id, struct pt_regs *regs)
|
1997-09-11 17:32:33 +00:00
|
|
|
{
|
1997-11-06 17:13:35 +00:00
|
|
|
struct IsdnCardState *cs = dev_id;
|
1999-07-12 21:05:34 +00:00
|
|
|
u_char val;
|
1997-09-11 17:32:33 +00:00
|
|
|
|
|
|
|
if (!cs) {
|
|
|
|
printk(KERN_WARNING "Sedlbauer: Spurious interrupt!\n");
|
|
|
|
return;
|
|
|
|
}
|
1998-02-09 18:46:21 +00:00
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
if ((cs->hw.sedl.bus == SEDL_BUS_PCMCIA) && (*cs->busy_flag == 1)) {
|
1998-02-09 18:46:21 +00:00
|
|
|
/* The card tends to generate interrupts while being removed
|
|
|
|
causing us to just crash the kernel. bad. */
|
|
|
|
printk(KERN_WARNING "Sedlbauer: card not available!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1997-09-11 17:32:33 +00:00
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.hscx, HSCX_ISTA + 0x40);
|
|
|
|
Start_HSCX:
|
1999-07-12 21:05:34 +00:00
|
|
|
if (val)
|
1997-09-11 17:32:33 +00:00
|
|
|
hscx_int_main(cs, val);
|
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_ISTA);
|
|
|
|
Start_ISAC:
|
1999-07-12 21:05:34 +00:00
|
|
|
if (val)
|
1997-09-11 17:32:33 +00:00
|
|
|
isac_interrupt(cs, val);
|
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.hscx, HSCX_ISTA + 0x40);
|
|
|
|
if (val) {
|
|
|
|
if (cs->debug & L1_DEB_HSCX)
|
|
|
|
debugl1(cs, "HSCX IntStat after IntRoutine");
|
|
|
|
goto Start_HSCX;
|
|
|
|
}
|
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_ISTA);
|
|
|
|
if (val) {
|
|
|
|
if (cs->debug & L1_DEB_ISAC)
|
|
|
|
debugl1(cs, "ISAC IntStat after IntRoutine");
|
|
|
|
goto Start_ISAC;
|
|
|
|
}
|
1999-07-12 21:05:34 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx, HSCX_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx, HSCX_MASK + 0x40, 0xFF);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_MASK, 0x0);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx, HSCX_MASK, 0x0);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx, HSCX_MASK + 0x40, 0x0);
|
1997-09-11 17:32:33 +00:00
|
|
|
}
|
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
static void
|
|
|
|
sedlbauer_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
struct IsdnCardState *cs = dev_id;
|
1999-07-12 21:05:34 +00:00
|
|
|
u_char ista, val, icnt = 5;
|
1998-11-15 23:55:28 +00:00
|
|
|
|
|
|
|
if (!cs) {
|
|
|
|
printk(KERN_WARNING "Sedlbauer: Spurious interrupt!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ista = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ISTA);
|
|
|
|
Start_IPAC:
|
|
|
|
if (cs->debug & L1_DEB_IPAC)
|
|
|
|
debugl1(cs, "IPAC ISTA %02X", ista);
|
|
|
|
if (ista & 0x0f) {
|
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.hscx, HSCX_ISTA + 0x40);
|
|
|
|
if (ista & 0x01)
|
|
|
|
val |= 0x01;
|
|
|
|
if (ista & 0x04)
|
|
|
|
val |= 0x02;
|
|
|
|
if (ista & 0x08)
|
|
|
|
val |= 0x04;
|
|
|
|
if (val)
|
|
|
|
hscx_int_main(cs, val);
|
|
|
|
}
|
|
|
|
if (ista & 0x20) {
|
|
|
|
val = 0xfe & readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_ISTA | 0x80);
|
|
|
|
if (val) {
|
|
|
|
isac_interrupt(cs, val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ista & 0x10) {
|
|
|
|
val = 0x01;
|
|
|
|
isac_interrupt(cs, val);
|
|
|
|
}
|
|
|
|
ista = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ISTA);
|
|
|
|
if ((ista & 0x3f) && icnt) {
|
|
|
|
icnt--;
|
|
|
|
goto Start_IPAC;
|
|
|
|
}
|
|
|
|
if (!icnt)
|
|
|
|
printk(KERN_WARNING "Sedlbauer IRQ LOOP\n");
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_MASK, 0xC0);
|
|
|
|
}
|
|
|
|
|
1998-08-13 23:34:51 +00:00
|
|
|
static void
|
|
|
|
sedlbauer_interrupt_isar(int intno, void *dev_id, struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
struct IsdnCardState *cs = dev_id;
|
|
|
|
u_char val;
|
1999-07-12 21:05:34 +00:00
|
|
|
int cnt = 5;
|
1998-08-13 23:34:51 +00:00
|
|
|
|
|
|
|
if (!cs) {
|
|
|
|
printk(KERN_WARNING "Sedlbauer: Spurious interrupt!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.hscx, ISAR_IRQBIT);
|
1998-08-13 23:34:51 +00:00
|
|
|
Start_ISAR:
|
|
|
|
if (val & ISAR_IRQSTA)
|
|
|
|
isar_int_main(cs);
|
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_ISTA);
|
|
|
|
Start_ISAC:
|
|
|
|
if (val)
|
|
|
|
isac_interrupt(cs, val);
|
1998-11-15 23:55:28 +00:00
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.hscx, ISAR_IRQBIT);
|
1998-08-13 23:34:51 +00:00
|
|
|
if ((val & ISAR_IRQSTA) && --cnt) {
|
|
|
|
if (cs->debug & L1_DEB_HSCX)
|
|
|
|
debugl1(cs, "ISAR IntStat after IntRoutine");
|
|
|
|
goto Start_ISAR;
|
|
|
|
}
|
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_ISTA);
|
|
|
|
if (val && --cnt) {
|
|
|
|
if (cs->debug & L1_DEB_ISAC)
|
|
|
|
debugl1(cs, "ISAC IntStat after IntRoutine");
|
|
|
|
goto Start_ISAC;
|
|
|
|
}
|
|
|
|
if (!cnt)
|
|
|
|
printk(KERN_WARNING "Sedlbauer IRQ LOOP\n");
|
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx, ISAR_IRQBIT, 0);
|
1998-08-13 23:34:51 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, ISAC_MASK, 0x0);
|
1998-11-15 23:55:28 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx, ISAR_IRQBIT, ISAR_IRQMSK);
|
1998-08-13 23:34:51 +00:00
|
|
|
}
|
|
|
|
|
1997-09-11 17:32:33 +00:00
|
|
|
void
|
1997-11-08 21:35:56 +00:00
|
|
|
release_io_sedlbauer(struct IsdnCardState *cs)
|
1997-09-11 17:32:33 +00:00
|
|
|
{
|
1999-08-05 20:43:22 +00:00
|
|
|
int bytecnt = 8;
|
1997-09-11 17:32:33 +00:00
|
|
|
|
1999-08-05 20:43:22 +00:00
|
|
|
if (cs->subtyp == SEDL_SPEED_FAX) {
|
|
|
|
bytecnt = 16;
|
|
|
|
} else if (cs->hw.sedl.bus == SEDL_BUS_PCI) {
|
1998-11-15 23:55:28 +00:00
|
|
|
bytecnt = 256;
|
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
if (cs->hw.sedl.cfg_reg)
|
|
|
|
release_region(cs->hw.sedl.cfg_reg, bytecnt);
|
1997-09-11 17:32:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
reset_sedlbauer(struct IsdnCardState *cs)
|
|
|
|
{
|
|
|
|
long flags;
|
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
printk(KERN_INFO "Sedlbauer: resetting card\n");
|
|
|
|
|
|
|
|
if (!((cs->hw.sedl.bus == SEDL_BUS_PCMCIA) &&
|
|
|
|
(cs->hw.sedl.chip == SEDL_CHIP_ISAC_HSCX))) {
|
|
|
|
if (cs->hw.sedl.chip == SEDL_CHIP_IPAC) {
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_POTA2, 0x20);
|
|
|
|
save_flags(flags);
|
|
|
|
sti();
|
1999-09-04 06:20:07 +00:00
|
|
|
set_current_state(TASK_INTERRUPTIBLE);
|
1999-07-01 08:12:15 +00:00
|
|
|
schedule_timeout((10*HZ)/1000);
|
1998-11-15 23:55:28 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_POTA2, 0x0);
|
1999-09-04 06:20:07 +00:00
|
|
|
set_current_state(TASK_INTERRUPTIBLE);
|
1999-07-01 08:12:15 +00:00
|
|
|
schedule_timeout((10*HZ)/1000);
|
1998-11-15 23:55:28 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_CONF, 0x0);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ACFG, 0xff);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_AOE, 0x0);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_MASK, 0xc0);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_PCFG, 0x12);
|
|
|
|
restore_flags(flags);
|
1999-11-13 21:25:03 +00:00
|
|
|
} else if ((cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) &&
|
|
|
|
(cs->hw.sedl.bus == SEDL_BUS_PCI)) {
|
|
|
|
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
|
|
|
|
save_flags(flags);
|
|
|
|
sti();
|
|
|
|
current->state = TASK_INTERRUPTIBLE;
|
|
|
|
schedule_timeout((20*HZ)/1000);
|
|
|
|
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
|
|
|
|
current->state = TASK_INTERRUPTIBLE;
|
|
|
|
schedule_timeout((20*HZ)/1000);
|
|
|
|
restore_flags(flags);
|
1998-11-15 23:55:28 +00:00
|
|
|
} else {
|
|
|
|
byteout(cs->hw.sedl.reset_on, SEDL_RESET); /* Reset On */
|
|
|
|
save_flags(flags);
|
|
|
|
sti();
|
1999-09-04 06:20:07 +00:00
|
|
|
set_current_state(TASK_INTERRUPTIBLE);
|
1999-07-01 08:12:15 +00:00
|
|
|
schedule_timeout((10*HZ)/1000);
|
1998-11-15 23:55:28 +00:00
|
|
|
byteout(cs->hw.sedl.reset_off, 0); /* Reset Off */
|
1999-09-04 06:20:07 +00:00
|
|
|
set_current_state(TASK_INTERRUPTIBLE);
|
1999-07-01 08:12:15 +00:00
|
|
|
schedule_timeout((10*HZ)/1000);
|
1998-11-15 23:55:28 +00:00
|
|
|
restore_flags(flags);
|
|
|
|
}
|
1998-02-09 18:46:21 +00:00
|
|
|
}
|
1997-09-11 17:32:33 +00:00
|
|
|
}
|
|
|
|
|
1997-11-08 21:35:56 +00:00
|
|
|
static int
|
1997-09-11 17:32:33 +00:00
|
|
|
Sedl_card_msg(struct IsdnCardState *cs, int mt, void *arg)
|
|
|
|
{
|
1997-11-08 21:35:56 +00:00
|
|
|
switch (mt) {
|
|
|
|
case CARD_RESET:
|
|
|
|
reset_sedlbauer(cs);
|
|
|
|
return(0);
|
|
|
|
case CARD_RELEASE:
|
1999-08-05 20:43:22 +00:00
|
|
|
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
|
1999-08-11 20:59:22 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
|
|
|
|
ISAR_IRQBIT, 0);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac,
|
|
|
|
ISAC_MASK, 0xFF);
|
1999-08-05 20:43:22 +00:00
|
|
|
reset_sedlbauer(cs);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
|
|
|
|
ISAR_IRQBIT, 0);
|
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.isac,
|
|
|
|
ISAC_MASK, 0xFF);
|
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
release_io_sedlbauer(cs);
|
|
|
|
return(0);
|
|
|
|
case CARD_INIT:
|
1998-11-15 23:55:28 +00:00
|
|
|
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
|
1998-08-13 23:34:51 +00:00
|
|
|
clear_pending_isac_ints(cs);
|
1998-11-15 23:55:28 +00:00
|
|
|
writereg(cs->hw.sedl.adr, cs->hw.sedl.hscx,
|
1998-08-13 23:34:51 +00:00
|
|
|
ISAR_IRQBIT, 0);
|
|
|
|
initisac(cs);
|
1998-11-15 23:55:28 +00:00
|
|
|
initisar(cs);
|
1998-08-13 23:34:51 +00:00
|
|
|
/* Reenable all IRQ */
|
|
|
|
cs->writeisac(cs, ISAC_MASK, 0);
|
|
|
|
/* RESET Receiver and Transmitter */
|
|
|
|
cs->writeisac(cs, ISAC_CMDR, 0x41);
|
|
|
|
} else {
|
|
|
|
inithscxisac(cs, 3);
|
|
|
|
}
|
1997-11-08 21:35:56 +00:00
|
|
|
return(0);
|
|
|
|
case CARD_TEST:
|
|
|
|
return(0);
|
1999-11-13 21:25:03 +00:00
|
|
|
case MDL_INFO_CONN:
|
|
|
|
if (cs->subtyp != SEDL_SPEEDFAX_PCI)
|
|
|
|
return(0);
|
|
|
|
if ((long) arg)
|
|
|
|
cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED2;
|
|
|
|
else
|
|
|
|
cs->hw.sedl.reset_off &= ~SEDL_ISAR_PCI_LED1;
|
|
|
|
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
|
|
|
|
break;
|
|
|
|
case MDL_INFO_REL:
|
|
|
|
if (cs->subtyp != SEDL_SPEEDFAX_PCI)
|
|
|
|
return(0);
|
|
|
|
if ((long) arg)
|
|
|
|
cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED2;
|
|
|
|
else
|
|
|
|
cs->hw.sedl.reset_off |= SEDL_ISAR_PCI_LED1;
|
|
|
|
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
|
|
|
|
break;
|
1997-11-08 21:35:56 +00:00
|
|
|
}
|
|
|
|
return(0);
|
1997-09-11 17:32:33 +00:00
|
|
|
}
|
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
#ifdef SEDLBAUER_PCI
|
1999-07-01 08:12:15 +00:00
|
|
|
#ifdef COMPAT_HAS_NEW_PCI
|
|
|
|
static struct pci_dev *dev_sedl __initdata = NULL;
|
|
|
|
#else
|
1998-11-15 23:55:28 +00:00
|
|
|
static int pci_index __initdata = 0;
|
|
|
|
#endif
|
1999-07-01 08:12:15 +00:00
|
|
|
#endif
|
1998-11-15 23:55:28 +00:00
|
|
|
|
1997-11-06 17:13:35 +00:00
|
|
|
__initfunc(int
|
|
|
|
setup_sedlbauer(struct IsdnCard *card))
|
1997-09-11 17:32:33 +00:00
|
|
|
{
|
1998-11-15 23:55:28 +00:00
|
|
|
int bytecnt, ver, val;
|
1997-09-11 17:32:33 +00:00
|
|
|
struct IsdnCardState *cs = card->cs;
|
|
|
|
char tmp[64];
|
1999-11-13 21:25:03 +00:00
|
|
|
u16 sub_vendor_id, sub_id;
|
|
|
|
long flags;
|
1997-09-11 17:32:33 +00:00
|
|
|
|
|
|
|
strcpy(tmp, Sedlbauer_revision);
|
1997-11-06 17:13:35 +00:00
|
|
|
printk(KERN_INFO "HiSax: Sedlbauer driver Rev. %s\n", HiSax_getrev(tmp));
|
1998-11-15 23:55:28 +00:00
|
|
|
|
1998-02-09 18:46:21 +00:00
|
|
|
if (cs->typ == ISDN_CTYPE_SEDLBAUER) {
|
1998-11-15 23:55:28 +00:00
|
|
|
cs->subtyp = SEDL_SPEED_CARD_WIN;
|
|
|
|
cs->hw.sedl.bus = SEDL_BUS_ISA;
|
|
|
|
cs->hw.sedl.chip = SEDL_CHIP_TEST;
|
1998-02-09 18:46:21 +00:00
|
|
|
} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_PCMCIA) {
|
|
|
|
cs->subtyp = SEDL_SPEED_STAR;
|
1998-11-15 23:55:28 +00:00
|
|
|
cs->hw.sedl.bus = SEDL_BUS_PCMCIA;
|
|
|
|
cs->hw.sedl.chip = SEDL_CHIP_TEST;
|
1998-08-13 23:34:51 +00:00
|
|
|
} else if (cs->typ == ISDN_CTYPE_SEDLBAUER_FAX) {
|
|
|
|
cs->subtyp = SEDL_SPEED_FAX;
|
1998-11-15 23:55:28 +00:00
|
|
|
cs->hw.sedl.bus = SEDL_BUS_ISA;
|
|
|
|
cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
|
1998-02-09 18:46:21 +00:00
|
|
|
} else
|
1997-09-11 17:32:33 +00:00
|
|
|
return (0);
|
|
|
|
|
|
|
|
bytecnt = 8;
|
1998-11-15 23:55:28 +00:00
|
|
|
if (card->para[1]) {
|
|
|
|
cs->hw.sedl.cfg_reg = card->para[1];
|
|
|
|
cs->irq = card->para[0];
|
|
|
|
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
|
|
|
|
bytecnt = 16;
|
|
|
|
}
|
1998-02-09 18:46:21 +00:00
|
|
|
} else {
|
1998-11-15 23:55:28 +00:00
|
|
|
/* Probe for Sedlbauer speed pci */
|
|
|
|
#if SEDLBAUER_PCI
|
|
|
|
#if CONFIG_PCI
|
1999-07-01 08:12:15 +00:00
|
|
|
#ifdef COMPAT_HAS_NEW_PCI
|
|
|
|
if (!pci_present()) {
|
1999-08-29 18:23:01 +00:00
|
|
|
printk(KERN_ERR "Sedlbauer: no PCI bus present\n");
|
1999-07-01 08:12:15 +00:00
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
if ((dev_sedl = pci_find_device(PCI_VENDOR_SEDLBAUER,
|
|
|
|
PCI_SPEEDPCI_ID, dev_sedl))) {
|
|
|
|
cs->irq = dev_sedl->irq;
|
|
|
|
if (!cs->irq) {
|
|
|
|
printk(KERN_WARNING "Sedlbauer: No IRQ for PCI card found\n");
|
|
|
|
return(0);
|
|
|
|
}
|
1999-08-11 20:59:22 +00:00
|
|
|
cs->hw.sedl.cfg_reg = get_pcibase(dev_sedl, 0) &
|
1999-07-01 08:12:15 +00:00
|
|
|
PCI_BASE_ADDRESS_IO_MASK;
|
|
|
|
} else {
|
|
|
|
printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
#else
|
1998-11-15 23:55:28 +00:00
|
|
|
for (; pci_index < 255; pci_index++) {
|
|
|
|
unsigned char pci_bus, pci_device_fn;
|
|
|
|
unsigned int ioaddr;
|
|
|
|
unsigned char irq;
|
|
|
|
|
|
|
|
if (pcibios_find_device (PCI_VENDOR_SEDLBAUER,
|
|
|
|
PCI_SPEEDPCI_ID, pci_index,
|
|
|
|
&pci_bus, &pci_device_fn) != 0) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
pcibios_read_config_byte(pci_bus, pci_device_fn,
|
|
|
|
PCI_INTERRUPT_LINE, &irq);
|
|
|
|
pcibios_read_config_dword(pci_bus, pci_device_fn,
|
|
|
|
PCI_BASE_ADDRESS_0, &ioaddr);
|
|
|
|
cs->irq = irq;
|
|
|
|
cs->hw.sedl.cfg_reg = ioaddr & PCI_BASE_ADDRESS_IO_MASK;
|
|
|
|
if (!cs->hw.sedl.cfg_reg) {
|
|
|
|
printk(KERN_WARNING "Sedlbauer: No IO-Adr for PCI card found\n");
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (pci_index == 255) {
|
|
|
|
printk(KERN_WARNING "Sedlbauer: No PCI card found\n");
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
pci_index++;
|
1999-07-01 08:12:15 +00:00
|
|
|
#endif /* COMPAT_HAS_NEW_PCI */
|
1999-11-13 21:25:03 +00:00
|
|
|
cs->irq_flags |= SA_SHIRQ;
|
1999-07-01 08:12:15 +00:00
|
|
|
cs->hw.sedl.bus = SEDL_BUS_PCI;
|
1999-11-13 21:25:03 +00:00
|
|
|
pci_read_config_word(dev_sedl, PCI_SUBSYSTEM_VENDOR_ID,
|
|
|
|
&sub_vendor_id);
|
|
|
|
pci_read_config_word(dev_sedl, PCI_SUBSYSTEM_ID,
|
|
|
|
&sub_id);
|
|
|
|
printk(KERN_INFO "Sedlbauer: PCI subvendor:%x subid %x\n",
|
|
|
|
sub_vendor_id, sub_id);
|
|
|
|
printk(KERN_INFO "Sedlbauer: PCI base adr %#x\n",
|
|
|
|
cs->hw.sedl.cfg_reg);
|
|
|
|
if ((sub_vendor_id == PCI_SUBVENDOR_SEDLBAUER) &&
|
|
|
|
(sub_id == PCI_SUB_ID_SPEEDFAXP)) {
|
|
|
|
cs->hw.sedl.chip = SEDL_CHIP_ISAC_ISAR;
|
|
|
|
cs->subtyp = SEDL_SPEEDFAX_PCI;
|
|
|
|
cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_PCI_ISAR_RESET_ON;
|
|
|
|
cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_PCI_ISAR_RESET_OFF;
|
|
|
|
} else {
|
|
|
|
cs->hw.sedl.chip = SEDL_CHIP_IPAC;
|
|
|
|
cs->subtyp = SEDL_SPEED_PCI;
|
|
|
|
}
|
1999-07-01 08:12:15 +00:00
|
|
|
bytecnt = 256;
|
|
|
|
byteout(cs->hw.sedl.cfg_reg, 0xff);
|
|
|
|
byteout(cs->hw.sedl.cfg_reg, 0x00);
|
|
|
|
byteout(cs->hw.sedl.cfg_reg+ 2, 0xdd);
|
|
|
|
byteout(cs->hw.sedl.cfg_reg+ 5, 0x02);
|
1999-11-13 21:25:03 +00:00
|
|
|
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_on);
|
|
|
|
save_flags(flags);
|
|
|
|
sti();
|
|
|
|
current->state = TASK_INTERRUPTIBLE;
|
|
|
|
schedule_timeout((10*HZ)/1000);
|
|
|
|
byteout(cs->hw.sedl.cfg_reg +3, cs->hw.sedl.reset_off);
|
|
|
|
restore_flags(flags);
|
1998-11-15 23:55:28 +00:00
|
|
|
#else
|
|
|
|
printk(KERN_WARNING "Sedlbauer: NO_PCI_BIOS\n");
|
|
|
|
return (0);
|
|
|
|
#endif /* CONFIG_PCI */
|
|
|
|
#endif /* SEDLBAUER_PCI */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* In case of the sedlbauer pcmcia card, this region is in use,
|
1998-02-09 18:46:21 +00:00
|
|
|
reserved for us by the card manager. So we do not check it
|
|
|
|
here, it would fail. */
|
1998-11-15 23:55:28 +00:00
|
|
|
if (cs->hw.sedl.bus != SEDL_BUS_PCMCIA &&
|
|
|
|
check_region((cs->hw.sedl.cfg_reg), bytecnt)) {
|
1997-09-11 17:32:33 +00:00
|
|
|
printk(KERN_WARNING
|
1998-11-15 23:55:28 +00:00
|
|
|
"HiSax: %s config port %x-%x already in use\n",
|
|
|
|
CardType[card->typ],
|
|
|
|
cs->hw.sedl.cfg_reg,
|
|
|
|
cs->hw.sedl.cfg_reg + bytecnt);
|
|
|
|
return (0);
|
1997-09-11 17:32:33 +00:00
|
|
|
} else {
|
|
|
|
request_region(cs->hw.sedl.cfg_reg, bytecnt, "sedlbauer isdn");
|
|
|
|
}
|
|
|
|
|
|
|
|
printk(KERN_INFO
|
1998-11-15 23:55:28 +00:00
|
|
|
"Sedlbauer: defined at 0x%x-0x%x IRQ %d\n",
|
1997-09-11 17:32:33 +00:00
|
|
|
cs->hw.sedl.cfg_reg,
|
1998-11-15 23:55:28 +00:00
|
|
|
cs->hw.sedl.cfg_reg + bytecnt,
|
1997-09-11 17:32:33 +00:00
|
|
|
cs->irq);
|
1998-02-09 18:46:21 +00:00
|
|
|
|
1998-11-15 23:55:28 +00:00
|
|
|
cs->BC_Read_Reg = &ReadHSCX;
|
|
|
|
cs->BC_Write_Reg = &WriteHSCX;
|
|
|
|
cs->BC_Send_Data = &hscx_fill_fifo;
|
1997-09-11 17:32:33 +00:00
|
|
|
cs->cardmsg = &Sedl_card_msg;
|
1998-11-15 23:55:28 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* testing ISA and PCMCIA Cards for IPAC, default is ISAC
|
|
|
|
* do not test for PCI card, because ports are different
|
|
|
|
* and PCI card uses only IPAC (for the moment)
|
|
|
|
*/
|
|
|
|
if (cs->hw.sedl.bus != SEDL_BUS_PCI) {
|
|
|
|
val = readreg(cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_ADR,
|
|
|
|
cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC, IPAC_ID);
|
|
|
|
if (val == 1) {
|
|
|
|
/* IPAC */
|
|
|
|
cs->subtyp = SEDL_SPEED_WIN2_PC104;
|
|
|
|
if (cs->hw.sedl.bus == SEDL_BUS_PCMCIA) {
|
|
|
|
cs->subtyp = SEDL_SPEED_STAR2;
|
|
|
|
}
|
|
|
|
cs->hw.sedl.chip = SEDL_CHIP_IPAC;
|
|
|
|
} else {
|
|
|
|
/* ISAC_HSCX oder ISAC_ISAR */
|
|
|
|
if (cs->hw.sedl.chip == SEDL_CHIP_TEST) {
|
|
|
|
cs->hw.sedl.chip = SEDL_CHIP_ISAC_HSCX;
|
|
|
|
}
|
1998-08-13 23:34:51 +00:00
|
|
|
}
|
1998-11-15 23:55:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* hw.sedl.chip is now properly set
|
|
|
|
*/
|
|
|
|
printk(KERN_INFO "Sedlbauer: %s detected\n",
|
|
|
|
Sedlbauer_Types[cs->subtyp]);
|
|
|
|
|
|
|
|
|
|
|
|
if (cs->hw.sedl.chip == SEDL_CHIP_IPAC) {
|
|
|
|
/* IPAC */
|
|
|
|
if (cs->hw.sedl.bus == SEDL_BUS_PCI) {
|
|
|
|
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_IPAC_PCI_ADR;
|
|
|
|
cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_IPAC_PCI_IPAC;
|
|
|
|
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_IPAC_PCI_IPAC;
|
|
|
|
} else {
|
|
|
|
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_ADR;
|
|
|
|
cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC;
|
|
|
|
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_IPAC_ANY_IPAC;
|
|
|
|
}
|
|
|
|
test_and_set_bit(HW_IPAC, &cs->HW_Flags);
|
|
|
|
cs->readisac = &ReadISAC_IPAC;
|
|
|
|
cs->writeisac = &WriteISAC_IPAC;
|
|
|
|
cs->readisacfifo = &ReadISACfifo_IPAC;
|
|
|
|
cs->writeisacfifo = &WriteISACfifo_IPAC;
|
1999-07-12 21:05:34 +00:00
|
|
|
cs->irq_func = &sedlbauer_interrupt_ipac;
|
1998-11-15 23:55:28 +00:00
|
|
|
|
1999-11-13 21:25:03 +00:00
|
|
|
val = readreg(cs->hw.sedl.adr, cs->hw.sedl.isac, IPAC_ID);
|
1998-11-15 23:55:28 +00:00
|
|
|
printk(KERN_INFO "Sedlbauer: IPAC version %x\n", val);
|
|
|
|
reset_sedlbauer(cs);
|
1998-08-13 23:34:51 +00:00
|
|
|
} else {
|
1998-11-15 23:55:28 +00:00
|
|
|
/* ISAC_HSCX oder ISAC_ISAR */
|
|
|
|
cs->readisac = &ReadISAC;
|
|
|
|
cs->writeisac = &WriteISAC;
|
|
|
|
cs->readisacfifo = &ReadISACfifo;
|
|
|
|
cs->writeisacfifo = &WriteISACfifo;
|
|
|
|
if (cs->hw.sedl.chip == SEDL_CHIP_ISAC_ISAR) {
|
1999-11-13 21:25:03 +00:00
|
|
|
if (cs->hw.sedl.bus == SEDL_BUS_PCI) {
|
|
|
|
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_PCI_ADR;
|
|
|
|
cs->hw.sedl.isac = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_PCI_ISAC;
|
|
|
|
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_PCI_ISAR;
|
|
|
|
} else {
|
|
|
|
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_ISA_ADR;
|
|
|
|
cs->hw.sedl.isac = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_ISA_ISAC;
|
|
|
|
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_ISA_ISAR;
|
|
|
|
cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_ISA_ISAR_RESET_ON;
|
|
|
|
cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg +
|
|
|
|
SEDL_ISAR_ISA_ISAR_RESET_OFF;
|
|
|
|
}
|
1998-11-15 23:55:28 +00:00
|
|
|
cs->bcs[0].hw.isar.reg = &cs->hw.sedl.isar;
|
|
|
|
cs->bcs[1].hw.isar.reg = &cs->hw.sedl.isar;
|
|
|
|
test_and_set_bit(HW_ISAR, &cs->HW_Flags);
|
1999-07-12 21:05:34 +00:00
|
|
|
cs->irq_func = &sedlbauer_interrupt_isar;
|
1999-08-25 17:00:09 +00:00
|
|
|
cs->auxcmd = &isar_auxcmd;
|
1998-11-15 23:55:28 +00:00
|
|
|
ISACVersion(cs, "Sedlbauer:");
|
|
|
|
cs->BC_Read_Reg = &ReadISAR;
|
|
|
|
cs->BC_Write_Reg = &WriteISAR;
|
|
|
|
cs->BC_Send_Data = &isar_fill_fifo;
|
|
|
|
ver = ISARVersion(cs, "Sedlbauer:");
|
|
|
|
if (ver < 0) {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"Sedlbauer: wrong ISAR version (ret = %d)\n", ver);
|
|
|
|
release_io_sedlbauer(cs);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (cs->hw.sedl.bus == SEDL_BUS_PCMCIA) {
|
|
|
|
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_ADR;
|
|
|
|
cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_ISAC;
|
|
|
|
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_HSCX;
|
|
|
|
cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET;
|
|
|
|
cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_PCMCIA_RESET;
|
|
|
|
} else {
|
|
|
|
cs->hw.sedl.adr = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ADR;
|
|
|
|
cs->hw.sedl.isac = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_ISAC;
|
|
|
|
cs->hw.sedl.hscx = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_HSCX;
|
|
|
|
cs->hw.sedl.reset_on = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_RESET_ON;
|
|
|
|
cs->hw.sedl.reset_off = cs->hw.sedl.cfg_reg + SEDL_HSCX_ISA_RESET_OFF;
|
|
|
|
}
|
1999-07-12 21:05:34 +00:00
|
|
|
cs->irq_func = &sedlbauer_interrupt;
|
1998-11-15 23:55:28 +00:00
|
|
|
ISACVersion(cs, "Sedlbauer:");
|
|
|
|
|
|
|
|
if (HscxVersion(cs, "Sedlbauer:")) {
|
|
|
|
printk(KERN_WARNING
|
|
|
|
"Sedlbauer: wrong HSCX versions check IO address\n");
|
|
|
|
release_io_sedlbauer(cs);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
reset_sedlbauer(cs);
|
1998-08-13 23:34:51 +00:00
|
|
|
}
|
1997-09-11 17:32:33 +00:00
|
|
|
}
|
|
|
|
return (1);
|
|
|
|
}
|