/* $Id: elsa.c,v 2.32.2.4 2004/01/24 20:47:21 keil Exp $
*
* low level stuff for Elsa isdn cards
*
* Author Karsten Keil
* Copyright by Karsten Keil <keil@isdn4linux.de>
*
* This software may be used and distributed according to the terms
* of the GNU General Public License, incorporated herein by reference.
*
* For changes and modifications please read
* Documentation/isdn/HiSax.cert
*
* Thanks to Elsa GmbH for documents and information
*
* Klaus Lichtenwalder (Klaus.Lichtenwalder@WebForum.DE)
* for ELSA PCMCIA support
*
*/
#include <linux/init.h>
#include <linux/slab.h>
#include "hisax.h"
#include "arcofi.h"
#include "isac.h"
#include "ipac.h"
#include "hscx.h"
#include "isdnl1.h"
#include <linux/pci.h>
#include <linux/isapnp.h>
#include <linux/serial.h>
#include <linux/serial_reg.h>
static const char *Elsa_revision = "$Revision: 2.32.2.4 $";
static const char *Elsa_Types[] =
{"None", "PC", "PCC-8", "PCC-16", "PCF", "PCF-Pro",
"PCMCIA", "QS 1000", "QS 3000", "Microlink PCI", "QS 3000 PCI",
"PCMCIA-IPAC" };
static const char *ITACVer[] =
{"?0?", "?1?", "?2?", "?3?", "?4?", "V2.2",
"B1", "A1"};
#define byteout(addr, val) outb(val, addr)
#define bytein(addr) inb(addr)
#define ELSA_ISAC 0
#define ELSA_ISAC_PCM 1
#define ELSA_ITAC 1
#define ELSA_HSCX 2
#define ELSA_ALE 3
#define ELSA_ALE_PCM 4
#define ELSA_CONTROL 4
#define ELSA_CONFIG 5
#define ELSA_START_TIMER 6
#define ELSA_TRIG_IRQ 7
#define ELSA_PC 1
#define ELSA_PCC8 2
#define ELSA_PCC16 3
#define ELSA_PCF 4
#define ELSA_PCFPRO 5
#define ELSA_PCMCIA 6
#define ELSA_QS1000 7
#define ELSA_QS3000 8
#define ELSA_QS1000PCI 9
#define ELSA_QS3000PCI 10
#define ELSA_PCMCIA_IPAC 11
/* PCI stuff */
#define ELSA_PCI_IRQ_MASK 0x04
/* ITAC Registeradressen (only Microlink PC) */
#define ITAC_SYS 0x34
#define ITAC_ISEN 0x48
#define ITAC_RFIE 0x4A
#define ITAC_XFIE 0x4C
#define ITAC_SCIE 0x4E
#define ITAC_STIE 0x46
/*** ***
*** Makros als Befehle fuer die Kartenregister ***
*** (mehrere Befehle werden durch Bit-Oderung kombiniert) ***
*** ***/
/* Config-Register (Read) */
#define ELIRQF_TIMER_RUN 0x02 /* Bit 1 des Config-Reg */
#define ELIRQF_TIMER_RUN_PCC8 0x01 /* Bit 0 des Config-Reg bei PCC */
#define ELSA_IRQ_IDX 0x38 /* Bit 3,4,5 des Config-Reg */
#define ELSA_IRQ_IDX_PCC8 0x30 /* Bit 4,5 des Config-Reg */
#define ELSA_IRQ_IDX_PC 0x0c /* Bit 2,3 des Config-Reg */
/* Control-Register (Write) */
#define ELSA_LINE_LED 0x02 /* Bit 1 Gelbe LED */
#define ELSA_STAT_LED 0x08 /* Bit 3 Gruene LED */
#define ELSA_ISDN_RESET 0x20 /* Bit 5 Reset-Leitung */
#define ELSA_ENA_TIMER_INT 0x80 /* Bit 7 Freigabe Timer Interrupt */
/* ALE-Register (Read) */
#define ELSA_HW_RELEASE 0x07 /* Bit 0-2 Hardwarerkennung */
#define ELSA_S0_POWER_BAD 0x08 /* Bit 3 S0-Bus Spannung fehlt */
/* Status Flags */
#define ELIRQF_TIMER_AKTIV 1
#define ELSA_BAD_PWR 2
#define ELSA_ASSIGN 4
#define RS_ISR_PASS_LIMIT 256
#define FLG_MODEM_ACTIVE 1
/* IPAC AUX */
#define ELSA_IPAC_LINE_LED 0x40 /* Bit 6 Gelbe LED */
#define ELSA_IPAC_STAT_LED 0x80 /* Bit 7 Gruene LED */
#if ARCOFI_USE
static struct arcofi_msg ARCOFI_XOP_F =
{NULL,0,2,{0xa1,0x3f,0,0,0,0,0,0,0,0}}; /* Normal OP */
static struct arcofi_msg ARCOFI_XOP_1 =
{&ARCOFI_XOP_F,0,2,{0xa1,0x31,0,0,0,0,0,0,0,0}}; /* PWR UP */
static struct arcofi_msg ARCOFI_SOP_F =
{&ARCOFI_XOP_1,0,10,{0xa1,0x1f,0x00,0x50,0x10,0x00,0x00,0x80,0x02,0x12}};
static struct arcofi_msg ARCOFI_COP_9 =
{&ARCOFI_SOP_F,0,10,{0xa1,0x29,0x80,0xcb,0xe9,0x88,0x00,0xc8,0xd8,0x80}}; /* RX */
static struct arcofi_msg ARCOFI_COP_8 =
{&ARCOFI_COP_9,0,10,{0xa1,0x28,0x49,0x31,0x8,0x13,0x6e,0x88<