Commit 32610705 authored by Kai Germaschewski's avatar Kai Germaschewski

ISDN/HiSax: Renaming ReadISAC -> isac_read etc.

Basically only a cosmetic patch, with much renaming and a little
rearranging of code.
parent 9ca46b71
......@@ -17,6 +17,19 @@
#define ARCOFI_TIMER_VALUE 20
static inline u8
isac_read(struct IsdnCardState *cs, u8 addr)
{
return cs->dc_hw_ops->read_reg(cs, addr);
}
static inline void
isac_write(struct IsdnCardState *cs, u8 addr, u8 val)
{
cs->dc_hw_ops->write_reg(cs, addr, val);
}
static void
add_arcofi_timer(struct IsdnCardState *cs) {
if (test_and_set_bit(FLG_ARCOFI_TIMER, &cs->HW_Flags)) {
......@@ -43,11 +56,11 @@ send_arcofi(struct IsdnCardState *cs) {
}
cs->dc.isac.mocr &= 0x0f;
cs->dc.isac.mocr |= 0xa0;
isac_write_reg(cs, ISAC_MOCR, cs->dc.isac.mocr);
val = isac_read_reg(cs, ISAC_MOSR);
isac_write_reg(cs, ISAC_MOX1, cs->dc.isac.mon_tx[cs->dc.isac.mon_txp++]);
isac_write(cs, ISAC_MOCR, cs->dc.isac.mocr);
val = isac_read(cs, ISAC_MOSR);
isac_write(cs, ISAC_MOX1, cs->dc.isac.mon_tx[cs->dc.isac.mon_txp++]);
cs->dc.isac.mocr |= 0x10;
isac_write_reg(cs, ISAC_MOCR, cs->dc.isac.mocr);
isac_write(cs, ISAC_MOCR, cs->dc.isac.mocr);
}
int
......
......@@ -90,68 +90,66 @@ writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int siz
spin_unlock_irqrestore(&asuscom_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.asus.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.asus.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, cs->hw.asus.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, cs->hw.asus.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
ReadISAC_IPAC(struct IsdnCardState *cs, u8 offset)
ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.asus.isac, offset|0x80);
}
static void
WriteISAC_IPAC(struct IsdnCardState *cs, u8 offset, u8 value)
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.asus.isac, offset|0x80, value);
}
static void
ReadISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, cs->hw.asus.isac, 0x80, data, size);
}
static void
WriteISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, cs->hw.asus.isac, 0x80, data, size);
}
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
.read_reg = ipac_dc_read,
.write_reg = ipac_dc_write,
.read_fifo = ipac_dc_read_fifo,
.write_fifo = ipac_dc_write_fifo,
};
static u8
......
......@@ -106,35 +106,35 @@ writefifo(struct IsdnCardState *cs, int offset, u8 *data, int size)
spin_unlock_irqrestore(&avm_a1p_lock, flags);
}
static inline u8
ReadISAC(struct IsdnCardState *cs, u8 adr)
static u8
isac_read(struct IsdnCardState *cs, u8 adr)
{
return readreg(cs, ISAC_REG_OFFSET, adr);
}
static inline void
WriteISAC(struct IsdnCardState *cs, u8 adr, u8 value)
static void
isac_write(struct IsdnCardState *cs, u8 adr, u8 value)
{
writereg(cs, ISAC_REG_OFFSET, adr, value);
}
static inline void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
static void
isac_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
readfifo(cs, ISAC_FIFO_OFFSET, data, size);
}
static inline void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
static void
isac_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
writefifo(cs, ISAC_FIFO_OFFSET, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static inline u8
......@@ -193,15 +193,15 @@ avm_a1p_interrupt(int intno, void *dev_id, struct pt_regs *regs)
hscx_int_main(cs, val);
}
if (sval & ASL0_R_ISAC) {
val = ReadISAC(cs, ISAC_ISTA);
val = isac_read(cs, ISAC_ISTA);
if (val)
isac_interrupt(cs, val);
}
}
WriteHSCX(cs, 0, HSCX_MASK, 0xff);
WriteHSCX(cs, 1, HSCX_MASK, 0xff);
WriteISAC(cs, ISAC_MASK, 0xff);
WriteISAC(cs, ISAC_MASK, 0x00);
isac_write(cs, ISAC_MASK, 0xff);
isac_write(cs, ISAC_MASK, 0x00);
WriteHSCX(cs, 0, HSCX_MASK, 0x00);
WriteHSCX(cs, 1, HSCX_MASK, 0x00);
spin_unlock(&cs->lock);
......
......@@ -90,37 +90,35 @@ writefifo(struct IsdnCardState *cs, u8 off, u8 *data, int size)
spin_unlock_irqrestore(&bkm_a8_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, offset | 0x80);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, offset | 0x80, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, 0x80, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, 0x80, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ipac_dc_read,
.write_reg = ipac_dc_write,
.read_fifo = ipac_dc_read_fifo,
.write_fifo = ipac_dc_write_fifo,
};
static u8
......@@ -437,7 +435,7 @@ setup_sct_quadro(struct IsdnCard *card)
test_and_set_bit(HW_IPAC, &cs->HW_Flags);
cs->dc_hw_ops = &isac_ops;
cs->dc_hw_ops = &ipac_dc_ops;
cs->bc_hw_ops = &hscx_ops;
cs->BC_Send_Data = &hscx_fill_fifo;
cs->cardmsg = &BKM_card_msg;
......
......@@ -85,23 +85,25 @@ static spinlock_t diva_lock = SPIN_LOCK_UNLOCKED;
static inline u8
readreg(unsigned int ale, unsigned int adr, u8 off)
{
register u8 ret;
u8 ret;
unsigned long flags;
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
ret = bytein(adr);
spin_unlock_irqrestore(&diva_lock, flags);
return (ret);
return ret;
}
static inline void
readfifo(unsigned int ale, unsigned int adr, u8 off, u8 * data, int size)
{
/* fifo read without cli because it's allready done */
unsigned long flags;
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
insb(adr, data, size);
spin_unlock_irqrestore(&diva_lock, flags);
}
......@@ -119,89 +121,86 @@ writereg(unsigned int ale, unsigned int adr, u8 off, u8 data)
static inline void
writefifo(unsigned int ale, unsigned int adr, u8 off, u8 *data, int size)
{
/* fifo write without cli because it's allready done */
unsigned long flags;
spin_lock_irqsave(&diva_lock, flags);
byteout(ale, off);
outsb(adr, data, size);
spin_unlock_irqrestore(&diva_lock, flags);
}
static inline u8
memreadreg(unsigned long adr, u8 off)
{
return(*((unsigned char *)
(((unsigned int *)adr) + off)));
return readb(((unsigned int *)adr) + off);
}
static inline void
memwritereg(unsigned long adr, u8 off, u8 data)
{
register u8 *p;
p = (unsigned char *)(((unsigned int *)adr) + off);
*p = data;
writeb(data, ((unsigned int *)adr) + off);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return(readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset));
return readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 *data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
readfifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 *data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
ReadISAC_IPAC(struct IsdnCardState *cs, u8 offset)
ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{
return (readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset+0x80));
return readreg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset+0x80);
}
static void
WriteISAC_IPAC(struct IsdnCardState *cs, u8 offset, u8 value)
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs->hw.diva.isac_adr, cs->hw.diva.isac, offset|0x80, value);
}
static void
ReadISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
readfifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0x80, data, size);
}
static void
WriteISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0x80, data, size);
}
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
.read_reg = ipac_dc_read,
.write_reg = ipac_dc_write,
.read_fifo = ipac_dc_read_fifo,
.write_fifo = ipac_dc_write_fifo,
};
static u8
......@@ -224,36 +223,36 @@ static struct bc_hw_ops hscx_ops = {
};
static u8
MemReadISAC_IPAC(struct IsdnCardState *cs, u8 offset)
mem_ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{
return (memreadreg(cs->hw.diva.cfg_reg, offset+0x80));
return memreadreg(cs->hw.diva.cfg_reg, offset+0x80);
}
static void
MemWriteISAC_IPAC(struct IsdnCardState *cs, u8 offset, u8 value)
mem_ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
memwritereg(cs->hw.diva.cfg_reg, offset|0x80, value);
}
static void
MemReadISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
mem_ipac_dc_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
while(size--)
*data++ = memreadreg(cs->hw.diva.cfg_reg, 0x80);
}
static void
MemWriteISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
mem_ipac_dc_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
while(size--)
memwritereg(cs->hw.diva.cfg_reg, 0x80, *data++);
}
static struct dc_hw_ops mem_ipac_dc_ops = {
.read_reg = MemReadISAC_IPAC,
.write_reg = MemWriteISAC_IPAC,
.read_fifo = MemReadISACfifo_IPAC,
.write_fifo = MemWriteISACfifo_IPAC,
.read_reg = mem_ipac_dc_read,
.write_reg = mem_ipac_dc_write,
.read_fifo = mem_ipac_dc_read_fifo,
.write_fifo = mem_ipac_dc_write_fifo,
};
static u8
......@@ -275,36 +274,36 @@ static struct bc_hw_ops mem_hscx_ops = {
/* IO-Functions for IPACX type cards */
static u8
MemReadISAC_IPACX(struct IsdnCardState *cs, u8 offset)
ipacx_dc_read(struct IsdnCardState *cs, u8 offset)
{
return (memreadreg(cs->hw.diva.cfg_reg, offset));
return memreadreg(cs->hw.diva.cfg_reg, offset);
}
static void
MemWriteISAC_IPACX(struct IsdnCardState *cs, u8 offset, u8 value)
ipacx_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
memwritereg(cs->hw.diva.cfg_reg, offset, value);
}
static void
MemReadISACfifo_IPACX(struct IsdnCardState *cs, u8 * data, int size)
ipacx_dc_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
while(size--)
*data++ = memreadreg(cs->hw.diva.cfg_reg, 0);
}
static void
MemWriteISACfifo_IPACX(struct IsdnCardState *cs, u8 * data, int size)
ipacx_dc_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
while(size--)
memwritereg(cs->hw.diva.cfg_reg, 0, *data++);
}
static struct dc_hw_ops mem_ipacx_dc_ops = {
.read_reg = MemReadISAC_IPACX,
.write_reg = MemWriteISAC_IPACX,
.read_fifo = MemReadISACfifo_IPACX,
.write_fifo = MemWriteISACfifo_IPACX,
static struct dc_hw_ops ipacx_dc_ops = {
.read_reg = ipacx_dc_read,
.write_reg = ipacx_dc_write,
.read_fifo = ipacx_dc_read_fifo,
.write_fifo = ipacx_dc_write_fifo,
};
static u8
......@@ -750,7 +749,7 @@ reset_diva(struct IsdnCardState *cs)
*ireg = PITA_PARA_MPX_MODE | PITA_SER_SOFTRESET;
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000);
MemWriteISAC_IPACX(cs, IPACX_MASK, 0xff); // Interrupts off
ipacx_dc_write(cs, IPACX_MASK, 0xff); // Interrupts off
} else { /* DIVA 2.0 */
cs->hw.diva.ctrl_reg = 0; /* Reset On */
byteout(cs->hw.diva.ctrl, cs->hw.diva.ctrl_reg);
......@@ -1123,12 +1122,12 @@ setup_diva(struct IsdnCard *card)
val = memreadreg(cs->hw.diva.cfg_reg, IPAC_ID);
printk(KERN_INFO "Diva: IPAC version %x\n", val);
} else if (cs->subtyp == DIVA_IPACX_PCI) {
cs->dc_hw_ops = &mem_ipacx_dc_ops;
cs->dc_hw_ops = &ipacx_dc_ops;
cs->bc_hw_ops = &mem_ipacx_bc_ops;
cs->BC_Send_Data = &ipacx_fill_fifo;
cs->irq_func = &diva_irq_ipacx_pci;
printk(KERN_INFO "Diva: IPACX Design Id: %x\n",
MemReadISAC_IPACX(cs, IPACX_ID) &0x3F);
ipacx_dc_read(cs, IPACX_ID) &0x3F);
} else { /* DIVA 2.0 */
cs->hw.diva.tl.function = (void *) diva_led_handler;
cs->hw.diva.tl.data = (long) cs;
......
......@@ -188,68 +188,66 @@ writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int siz
spin_unlock_irqrestore(&elsa_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.elsa.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.elsa.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
readfifo(cs, cs->hw.elsa.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
writefifo(cs, cs->hw.elsa.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
ReadISAC_IPAC(struct IsdnCardState *cs, u8 offset)
ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.elsa.isac, offset+0x80);
}
static void
WriteISAC_IPAC(struct IsdnCardState *cs, u8 offset, u8 value)
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.elsa.isac, offset|0x80, value);
}
static void
ReadISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
readfifo(cs, cs->hw.elsa.isac, 0x80, data, size);
}
static void
WriteISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
writefifo(cs, cs->hw.elsa.isac, 0x80, data, size);
}
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
.read_reg = ipac_dc_read,
.write_reg = ipac_dc_write,
.read_fifo = ipac_dc_read_fifo,
.write_fifo = ipac_dc_write_fifo,
};
static u8
......
......@@ -70,48 +70,46 @@ write_fifo(unsigned int adr, u8 * data, int size)
}
static inline u8
readreg_ipac(unsigned int adr, u_short off)
readreg_ipac(struct IsdnCardState *cs, u_short off)
{
register u8 ret;
unsigned long flags;
spin_lock_irqsave(&gazel_lock, flags);
byteout(adr, off);
ret = bytein(adr + 4);
byteout(cs->hw.gazel.ipac, off);
ret = bytein(cs->hw.gazel.ipac + 4);
spin_unlock_irqrestore(&gazel_lock, flags);
return ret;
}
static inline void
writereg_ipac(unsigned int adr, u_short off, u8 data)
writereg_ipac(struct IsdnCardState *cs, u_short off, u8 data)
{
unsigned long flags;
spin_lock_irqsave(&gazel_lock, flags);
byteout(adr, off);
byteout(adr + 4, data);
byteout(cs->hw.gazel.ipac, off);
byteout(cs->hw.gazel.ipac + 4, data);
spin_unlock_irqrestore(&gazel_lock, flags);
}
static inline void
read_fifo_ipac(unsigned int adr, u_short off, u8 * data, int size)
read_fifo_ipac(struct IsdnCardState *cs, u_short off, u8 * data, int size)
{
byteout(adr, off);
insb(adr + 4, data, size);
byteout(cs->hw.gazel.ipac, off);
insb(cs->hw.gazel.ipac + 4, data, size);
}
static void
write_fifo_ipac(unsigned int adr, u_short off, u8 * data, int size)
write_fifo_ipac(struct IsdnCardState *cs, u_short off, u8 * data, int size)
{
byteout(adr, off);
outsb(adr + 4, data, size);
byteout(cs->hw.gazel.ipac, off);
outsb(cs->hw.gazel.ipac + 4, data, size);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
u_short off2 = offset;
......@@ -122,13 +120,13 @@ ReadISAC(struct IsdnCardState *cs, u8 offset)
return (readreg(cs->hw.gazel.isac, off2));
case R753:
case R742:
return (readreg_ipac(cs->hw.gazel.ipac, 0x80 + off2));
return (readreg_ipac(cs, 0x80 + off2));
}
return 0;
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
u_short off2 = offset;
......@@ -140,13 +138,13 @@ WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
break;
case R753:
case R742:
writereg_ipac(cs->hw.gazel.ipac, 0x80 + off2, value);
writereg_ipac(cs, 0x80 + off2, value);
break;
}
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
switch (cs->subtyp) {
case R647:
......@@ -155,13 +153,13 @@ ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
break;
case R753:
case R742:
read_fifo_ipac(cs->hw.gazel.ipac, 0x80, data, size);
read_fifo_ipac(cs, 0x80, data, size);
break;
}
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
switch (cs->subtyp) {
case R647:
......@@ -170,16 +168,16 @@ WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
break;
case R753:
case R742:
write_fifo_ipac(cs->hw.gazel.ipac, 0x80, data, size);
write_fifo_ipac(cs, 0x80, data, size);
break;
}
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static void
......@@ -192,7 +190,7 @@ ReadHSCXfifo(struct IsdnCardState *cs, int hscx, u8 * data, int size)
break;
case R753:
case R742:
read_fifo_ipac(cs->hw.gazel.ipac, hscx * 0x40, data, size);
read_fifo_ipac(cs, hscx * 0x40, data, size);
break;
}
}
......@@ -207,7 +205,7 @@ WriteHSCXfifo(struct IsdnCardState *cs, int hscx, u8 * data, int size)
break;
case R753:
case R742:
write_fifo_ipac(cs->hw.gazel.ipac, hscx * 0x40, data, size);
write_fifo_ipac(cs, hscx * 0x40, data, size);
break;
}
}
......@@ -221,10 +219,10 @@ ReadHSCX(struct IsdnCardState *cs, int hscx, u8 offset)
case R647:
off2 = ((off2 << 8 & 0xf000) | (off2 & 0xf));
case R685:
return (readreg(cs->hw.gazel.hscx[hscx], off2));
return readreg(cs->hw.gazel.hscx[hscx], off2);
case R753:
case R742:
return (readreg_ipac(cs->hw.gazel.ipac, hscx * 0x40 + off2));
return readreg_ipac(cs, hscx * 0x40 + off2);
}
return 0;
}
......@@ -242,7 +240,7 @@ WriteHSCX(struct IsdnCardState *cs, int hscx, u8 offset, u8 value)
break;
case R753:
case R742:
writereg_ipac(cs->hw.gazel.ipac, hscx * 0x40 + off2, value);
writereg_ipac(cs, hscx * 0x40 + off2, value);
break;
}
}
......@@ -276,7 +274,7 @@ gazel_interrupt(int intno, void *dev_id, struct pt_regs *regs)
valhscx = ReadHSCX(cs, 1, HSCX_ISTA);
if (valhscx)
hscx_int_main(cs, valhscx);
valisac = ReadISAC(cs, ISAC_ISTA);
valisac = isac_read(cs, ISAC_ISTA);
if (valisac)
isac_interrupt(cs, valisac);
count++;
......@@ -284,8 +282,8 @@ gazel_interrupt(int intno, void *dev_id, struct pt_regs *regs)
WriteHSCX(cs, 0, HSCX_MASK, 0xFF);
WriteHSCX(cs, 1, HSCX_MASK, 0xFF);
WriteISAC(cs, ISAC_MASK, 0xFF);
WriteISAC(cs, ISAC_MASK, 0x0);
isac_write(cs, ISAC_MASK, 0xFF);
isac_write(cs, ISAC_MASK, 0x0);
WriteHSCX(cs, 0, HSCX_MASK, 0x0);
WriteHSCX(cs, 1, HSCX_MASK, 0x0);
spin_unlock(&cs->lock);
......@@ -303,7 +301,7 @@ gazel_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
printk(KERN_WARNING "Gazel: Spurious interrupt!\n");
return;
}
ista = ReadISAC(cs, IPAC_ISTA - 0x80);
ista = readreg_ipac(cs, IPAC_ISTA);
do {
if (ista & 0x0f) {
val = ReadHSCX(cs, 1, HSCX_ISTA);
......@@ -318,7 +316,7 @@ gazel_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
}
}
if (ista & 0x20) {
val = 0xfe & ReadISAC(cs, ISAC_ISTA);
val = 0xfe & isac_read(cs, ISAC_ISTA);
if (val) {
isac_interrupt(cs, val);
}
......@@ -327,13 +325,13 @@ gazel_interrupt_ipac(int intno, void *dev_id, struct pt_regs *regs)
val = 0x01;
isac_interrupt(cs, val);
}
ista = ReadISAC(cs, IPAC_ISTA - 0x80);
ista = readreg_ipac(cs, IPAC_ISTA);
count++;
}
while ((ista & 0x3f) && (count < MAXCOUNT));
WriteISAC(cs, IPAC_MASK - 0x80, 0xFF);
WriteISAC(cs, IPAC_MASK - 0x80, 0xC0);
writereg_ipac(cs, IPAC_MASK, 0xFF);
writereg_ipac(cs, IPAC_MASK, 0xC0);
}
void
release_io_gazel(struct IsdnCardState *cs)
......@@ -393,28 +391,28 @@ reset_gazel(struct IsdnCardState *cs)
plxcntrl = inl(addr + PLX_CNTRL);
plxcntrl |= (RESET_9050 + RESET_GAZEL);
outl(plxcntrl, addr + PLX_CNTRL);
WriteISAC(cs, IPAC_POTA2 - 0x80, 0x20);
writereg_ipac(cs, IPAC_POTA2, 0x20);
HZDELAY(4);
plxcntrl &= ~(RESET_9050 + RESET_GAZEL);
outl(plxcntrl, addr + PLX_CNTRL);
HZDELAY(10);
WriteISAC(cs, IPAC_POTA2 - 0x80, 0x00);
WriteISAC(cs, IPAC_ACFG - 0x80, 0xff);
WriteISAC(cs, IPAC_AOE - 0x80, 0x0);
WriteISAC(cs, IPAC_MASK - 0x80, 0xff);
WriteISAC(cs, IPAC_CONF - 0x80, 0x1);
writereg_ipac(cs, IPAC_POTA2, 0x00);
writereg_ipac(cs, IPAC_ACFG, 0xff);
writereg_ipac(cs, IPAC_AOE, 0x0);
writereg_ipac(cs, IPAC_MASK, 0xff);
writereg_ipac(cs, IPAC_CONF, 0x1);
outb(INT_IPAC_EN + INT_PCI_EN, addr + PLX_INCSR);
WriteISAC(cs, IPAC_MASK - 0x80, 0xc0);
writereg_ipac(cs, IPAC_MASK, 0xc0);
break;
case R742:
WriteISAC(cs, IPAC_POTA2 - 0x80, 0x20);
writereg_ipac(cs, IPAC_POTA2, 0x20);
HZDELAY(4);
WriteISAC(cs, IPAC_POTA2 - 0x80, 0x00);
WriteISAC(cs, IPAC_ACFG - 0x80, 0xff);
WriteISAC(cs, IPAC_AOE - 0x80, 0x0);
WriteISAC(cs, IPAC_MASK - 0x80, 0xff);
WriteISAC(cs, IPAC_CONF - 0x80, 0x1);
WriteISAC(cs, IPAC_MASK - 0x80, 0xc0);
writereg_ipac(cs, IPAC_POTA2, 0x00);
writereg_ipac(cs, IPAC_ACFG, 0xff);
writereg_ipac(cs, IPAC_AOE, 0x0);
writereg_ipac(cs, IPAC_MASK, 0xff);
writereg_ipac(cs, IPAC_CONF, 0x1);
writereg_ipac(cs, IPAC_MASK, 0xc0);
break;
}
return (0);
......@@ -513,13 +511,13 @@ setup_gazelisa(struct IsdnCard *card, struct IsdnCardState *cs)
// R742 decodes address even in not started...
// R647 returns FF if not present or not started
// eventually needs improvment
if (readreg_ipac(card->para[1], IPAC_ID) == 1)
cs->hw.gazel.ipac = card->para[1];
if (readreg_ipac(cs, IPAC_ID) == 1)
cs->subtyp = R742;
else
cs->subtyp = R647;
cs->hw.gazel.cfg_reg = card->para[1] + 0xC000;
cs->hw.gazel.ipac = card->para[1];
cs->hw.gazel.isac = card->para[1] + 0x8000;
cs->hw.gazel.hscx[0] = card->para[1];
cs->hw.gazel.hscx[1] = card->para[1] + 0x4000;
......@@ -708,7 +706,7 @@ setup_gazel(struct IsdnCard *card)
case R742:
case R753:
cs->irq_func = &gazel_interrupt_ipac;
val = ReadISAC(cs, IPAC_ID - 0x80);
val = readreg_ipac(cs, IPAC_ID);
printk(KERN_INFO "Gazel: IPAC version %x\n", val);
break;
}
......
This diff is collapsed.
......@@ -66,27 +66,3 @@
extern void ISACVersion(struct IsdnCardState *cs, char *s);
extern void initisac(struct IsdnCardState *cs);
extern void isac_interrupt(struct IsdnCardState *cs, u8 val);
static inline u8
isac_read_reg(struct IsdnCardState *cs, u8 addr)
{
return cs->dc_hw_ops->read_reg(cs, addr);
}
static inline void
isac_write_reg(struct IsdnCardState *cs, u8 addr, u8 val)
{
cs->dc_hw_ops->write_reg(cs, addr, val);
}
static inline void
isac_read_fifo(struct IsdnCardState *cs, u8 *p, int len)
{
return cs->dc_hw_ops->read_fifo(cs, p, len);
}
static inline void
isac_write_fifo(struct IsdnCardState *cs, u8 *p, int len)
{
return cs->dc_hw_ops->write_fifo(cs, p, len);
}
......@@ -87,37 +87,35 @@ writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int siz
spin_unlock_irqrestore(&ix1_micro_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.ix1.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.ix1.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, cs->hw.ix1.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, cs->hw.ix1.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
......
......@@ -78,37 +78,35 @@ writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int siz
spin_unlock_irqrestore(&mic_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.mic.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.mic.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, cs->hw.mic.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, cs->hw.mic.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
......
......@@ -93,37 +93,35 @@ writefifo(unsigned int ale, unsigned int adr, u8 off, u8 * data, int size)
spin_unlock_irqrestore(&niccy_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return (readreg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, offset));
return readreg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
readfifo(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
writefifo(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
......
......@@ -104,37 +104,35 @@ write_fifo(struct IsdnCardState *cs, signed int adr, u8 * data, int size)
outb_p(0x1c,padr+2);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.teles3.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.teles3.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
read_fifo(cs, cs->hw.teles3.isacfifo, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
write_fifo(cs, cs->hw.teles3.isacfifo, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
......
......@@ -78,37 +78,35 @@ writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 *data, int size
spin_unlock_irqrestore(&saphir_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.saphir.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.saphir.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, cs->hw.saphir.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, cs->hw.saphir.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
......@@ -186,7 +184,7 @@ static void
SaphirWatchDog(struct IsdnCardState *cs)
{
/* 5 sec WatchDog, so read at least every 4 sec */
ReadISAC(cs, ISAC_RBCH);
isac_read(cs, ISAC_RBCH);
mod_timer(&cs->hw.saphir.timer, jiffies+1*HZ);
}
......
......@@ -165,68 +165,66 @@ writefifo(struct IsdnCardState *cs, unsigned int adr, u8 off, u8 * data, int siz
spin_unlock_irqrestore(&sedlbauer_lock, flags);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.sedl.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.sedl.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, cs->hw.sedl.isac, 0, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, cs->hw.sedl.isac, 0, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
ReadISAC_IPAC(struct IsdnCardState *cs, u8 offset)
ipac_dc_read(struct IsdnCardState *cs, u8 offset)
{
return readreg(cs, cs->hw.sedl.isac, offset|0x80);
}
static void
WriteISAC_IPAC(struct IsdnCardState *cs, u8 offset, u8 value)
ipac_dc_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs, cs->hw.sedl.isac, offset|0x80, value);
}
static void
ReadISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
readfifo(cs, cs->hw.sedl.isac, 0x80, data, size);
}
static void
WriteISACfifo_IPAC(struct IsdnCardState *cs, u8 * data, int size)
ipac_dc_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
writefifo(cs, cs->hw.sedl.isac, 0x80, data, size);
}
static struct dc_hw_ops ipac_dc_ops = {
.read_reg = ReadISAC_IPAC,
.write_reg = WriteISAC_IPAC,
.read_fifo = ReadISACfifo_IPAC,
.write_fifo = WriteISACfifo_IPAC,
.read_reg = ipac_dc_read,
.write_reg = ipac_dc_write,
.read_fifo = ipac_dc_read_fifo,
.write_fifo = ipac_dc_write_fifo,
};
static u8
......
......@@ -49,37 +49,35 @@ write_fifo(unsigned int adr, u8 * data, int size)
outsb(adr, data, size);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return (bytein(calc_off(cs->hw.spt.isac, offset)));
return bytein(calc_off(cs->hw.spt.isac, offset));
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
byteout(calc_off(cs->hw.spt.isac, offset), value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
read_fifo(cs->hw.spt.isac, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
write_fifo(cs->hw.spt.isac, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
......@@ -121,7 +119,7 @@ sportster_interrupt(int intno, void *dev_id, struct pt_regs *regs)
Start_HSCX:
if (val)
hscx_int_main(cs, val);
val = ReadISAC(cs, ISAC_ISTA);
val = isac_read(cs, ISAC_ISTA);
Start_ISAC:
if (val)
isac_interrupt(cs, val);
......@@ -131,7 +129,7 @@ sportster_interrupt(int intno, void *dev_id, struct pt_regs *regs)
debugl1(cs, "HSCX IntStat after IntRoutine");
goto Start_HSCX;
}
val = ReadISAC(cs, ISAC_ISTA);
val = isac_read(cs, ISAC_ISTA);
if (val) {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "ISAC IntStat after IntRoutine");
......
......@@ -29,19 +29,47 @@ const char *teles0_revision = "$Revision: 2.13.6.2 $";
#define byteout(addr,val) outb(val,addr)
#define bytein(addr) inb(addr)
static inline u8
readisac(unsigned long adr, u8 off)
static u8
isac_read(struct IsdnCardState *cs, u8 off)
{
return readb(adr + ((off & 1) ? 0x2ff : 0x100) + off);
return readb(cs->hw.teles0.membase +
((off & 1) ? 0x2ff : 0x100) + off);
}
static inline void
writeisac(unsigned long adr, u8 off, u8 data)
static void
isac_write(struct IsdnCardState *cs, u8 off, u8 data)
{
writeb(data, adr + ((off & 1) ? 0x2ff : 0x100) + off); mb();
writeb(data, cs->hw.teles0.membase +
((off & 1) ? 0x2ff : 0x100) + off); mb();
}
static void
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
int i;
unsigned long ad = cs->hw.teles0.membase + 0x100;
for (i = 0; i < size; i++)
data[i] = readb(ad);
}
static void
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
int i;
unsigned long ad = cs->hw.teles0.membase + 0x100;
for (i = 0; i < size; i++) {
writeb(data[i], ad); mb();
}
}
static struct dc_hw_ops isac_ops = {
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static inline u8
readhscx(unsigned long adr, int hscx, u8 off)
{
......@@ -56,25 +84,6 @@ writehscx(unsigned long adr, int hscx, u8 off, u8 data)
((off & 1) ? 0x1ff : 0) + off); mb();
}
static inline void
read_fifo_isac(unsigned long adr, u8 * data, int size)
{
register int i;
register u8 *ad = (u8 *)adr + 0x100;
for (i = 0; i < size; i++)
data[i] = readb(ad);
}
static inline void
write_fifo_isac(unsigned long adr, u8 * data, int size)
{
register int i;
register u8 *ad = (u8 *)adr + 0x100;
for (i = 0; i < size; i++) {
writeb(data[i], ad); mb();
}
}
static inline void
read_fifo_hscx(unsigned long adr, int hscx, u8 * data, int size)
{
......@@ -94,39 +103,6 @@ write_fifo_hscx(unsigned long adr, int hscx, u8 * data, int size)
}
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
{
return (readisac(cs->hw.teles0.membase, offset));
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
{
writeisac(cs->hw.teles0.membase, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
{
read_fifo_isac(cs->hw.teles0.membase, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
{
write_fifo_isac(cs->hw.teles0.membase, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u8
ReadHSCX(struct IsdnCardState *cs, int hscx, u8 offset)
{
......@@ -167,7 +143,7 @@ teles0_interrupt(int intno, void *dev_id, struct pt_regs *regs)
Start_HSCX:
if (val)
hscx_int_main(cs, val);
val = readisac(cs->hw.teles0.membase, ISAC_ISTA);
val = isac_read(cs, ISAC_ISTA);
Start_ISAC:
if (val)
isac_interrupt(cs, val);
......@@ -178,7 +154,7 @@ teles0_interrupt(int intno, void *dev_id, struct pt_regs *regs)
debugl1(cs, "HSCX IntStat after IntRoutine");
goto Start_HSCX;
}
val = readisac(cs->hw.teles0.membase, ISAC_ISTA);
val = isac_read(cs, ISAC_ISTA);
if (val && count < 5) {
if (cs->debug & L1_DEB_ISAC)
debugl1(cs, "ISAC IntStat after IntRoutine");
......@@ -186,8 +162,8 @@ teles0_interrupt(int intno, void *dev_id, struct pt_regs *regs)
}
writehscx(cs->hw.teles0.membase, 0, HSCX_MASK, 0xFF);
writehscx(cs->hw.teles0.membase, 1, HSCX_MASK, 0xFF);
writeisac(cs->hw.teles0.membase, ISAC_MASK, 0xFF);
writeisac(cs->hw.teles0.membase, ISAC_MASK, 0x0);
isac_write(cs, ISAC_MASK, 0xFF);
isac_write(cs, ISAC_MASK, 0x0);
writehscx(cs->hw.teles0.membase, 0, HSCX_MASK, 0x0);
writehscx(cs->hw.teles0.membase, 1, HSCX_MASK, 0x0);
spin_unlock(&cs->lock);
......
......@@ -51,37 +51,35 @@ write_fifo(unsigned int adr, u8 * data, int size)
outsb(adr, data, size);
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
isac_read(struct IsdnCardState *cs, u8 offset)
{
return (readreg(cs->hw.teles3.isac, offset));
return readreg(cs->hw.teles3.isac, offset);
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
isac_write(struct IsdnCardState *cs, u8 offset, u8 value)
{
writereg(cs->hw.teles3.isac, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_read_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
read_fifo(cs->hw.teles3.isacfifo, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
write_fifo(cs->hw.teles3.isacfifo, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static u8
......
......@@ -42,10 +42,11 @@ const char *telespci_revision = "$Revision: 2.16.6.5 $";
portdata = readl(adr + 0x200); \
} while (portdata & ZORAN_PO_RQ_PEN)
static inline u8
readisac(unsigned long adr, u8 off)
static u8
isac_read(struct IsdnCardState *cs, u8 off)
{
register unsigned int portdata;
unsigned long adr = cs->hw.teles0.membase;
unsigned int portdata;
ZORAN_WAIT_NOBUSY;
......@@ -59,10 +60,11 @@ readisac(unsigned long adr, u8 off)
return((u8)(portdata & ZORAN_PO_DMASK));
}
static inline void
writeisac(unsigned long adr, u8 off, u8 data)
static void
isac_write(struct IsdnCardState *cs, u8 off, u8 data)
{
register unsigned int portdata;
unsigned long adr = cs->hw.teles0.membase;
unsigned int portdata;
ZORAN_WAIT_NOBUSY;
......@@ -75,6 +77,50 @@ writeisac(unsigned long adr, u8 off, u8 data)
ZORAN_WAIT_NOBUSY;
}
static void
isac_read_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
unsigned long adr = cs->hw.teles0.membase;
unsigned int portdata;
int i;
ZORAN_WAIT_NOBUSY;
/* read data from ISAC */
for (i = 0; i < size; i++) {
/* set address for ISAC fifo */
writel(WRITE_ADDR_ISAC | 0x1E, adr);
ZORAN_WAIT_NOBUSY;
writel(READ_DATA_ISAC, adr + 0x200);
ZORAN_WAIT_NOBUSY;
data[i] = (u8)(portdata & ZORAN_PO_DMASK);
}
}
static void
isac_write_fifo(struct IsdnCardState *cs, u8 *data, int size)
{
unsigned long adr = cs->hw.teles0.membase;
unsigned int portdata;
int i;
ZORAN_WAIT_NOBUSY;
/* write data to ISAC */
for (i = 0; i < size; i++) {
/* set address for ISAC fifo */
writel(WRITE_ADDR_ISAC | 0x1E, adr);
ZORAN_WAIT_NOBUSY;
writel(WRITE_DATA_ISAC | data[i], adr + 0x200);
ZORAN_WAIT_NOBUSY;
}
}
static struct dc_hw_ops isac_ops = {
.read_reg = isac_read,
.write_reg = isac_write,
.read_fifo = isac_read_fifo,
.write_fifo = isac_write_fifo,
};
static inline u8
readhscx(unsigned long adr, int hscx, u8 off)
{
......@@ -106,41 +152,6 @@ writehscx(unsigned long adr, int hscx, u8 off, u8 data)
ZORAN_WAIT_NOBUSY;
}
static inline void
read_fifo_isac(unsigned long adr, u8 * data, int size)
{
register unsigned int portdata;
register int i;
ZORAN_WAIT_NOBUSY;
/* read data from ISAC */
for (i = 0; i < size; i++) {
/* set address for ISAC fifo */
writel(WRITE_ADDR_ISAC | 0x1E, adr + 0x200);
ZORAN_WAIT_NOBUSY;
writel(READ_DATA_ISAC, adr + 0x200);
ZORAN_WAIT_NOBUSY;
data[i] = (u8)(portdata & ZORAN_PO_DMASK);
}
}
static void
write_fifo_isac(unsigned long adr, u8 * data, int size)
{
register unsigned int portdata;
register int i;
ZORAN_WAIT_NOBUSY;
/* write data to ISAC */
for (i = 0; i < size; i++) {
/* set address for ISAC fifo */
writel(WRITE_ADDR_ISAC | 0x1E, adr + 0x200);
ZORAN_WAIT_NOBUSY;
writel(WRITE_DATA_ISAC | data[i], adr + 0x200);
ZORAN_WAIT_NOBUSY;
}
}
static inline void
read_fifo_hscx(unsigned long adr, int hscx, u8 * data, int size)
{
......@@ -177,39 +188,6 @@ write_fifo_hscx(unsigned long adr, int hscx, u8 * data, int size)
}
}
/* Interface functions */
static u8
ReadISAC(struct IsdnCardState *cs, u8 offset)
{
return (readisac(cs->hw.teles0.membase, offset));
}
static void
WriteISAC(struct IsdnCardState *cs, u8 offset, u8 value)
{
writeisac(cs->hw.teles0.membase, offset, value);
}
static void
ReadISACfifo(struct IsdnCardState *cs, u8 * data, int size)
{
read_fifo_isac(cs->hw.teles0.membase, data, size);
}
static void
WriteISACfifo(struct IsdnCardState *cs, u8 * data, int size)
{
write_fifo_isac(cs->hw.teles0.membase, data, size);
}
static struct dc_hw_ops isac_ops = {
.read_reg = ReadISAC,
.write_reg = WriteISAC,
.read_fifo = ReadISACfifo,
.write_fifo = WriteISACfifo,
};
static u8
ReadHSCX(struct IsdnCardState *cs, int hscx, u8 offset)
{
......@@ -249,7 +227,7 @@ telespci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
val = readhscx(cs->hw.teles0.membase, 1, HSCX_ISTA);
if (val)
hscx_int_main(cs, val);
val = readisac(cs->hw.teles0.membase, ISAC_ISTA);
val = isac_read(cs, ISAC_ISTA);
if (val)
isac_interrupt(cs, val);
/* Clear interrupt register for Zoran PCI controller */
......@@ -257,8 +235,8 @@ telespci_interrupt(int intno, void *dev_id, struct pt_regs *regs)
writehscx(cs->hw.teles0.membase, 0, HSCX_MASK, 0xFF);
writehscx(cs->hw.teles0.membase, 1, HSCX_MASK, 0xFF);
writeisac(cs->hw.teles0.membase, ISAC_MASK, 0xFF);
writeisac(cs->hw.teles0.membase, ISAC_MASK, 0x0);
isac_write(cs, ISAC_MASK, 0xFF);
isac_write(cs, ISAC_MASK, 0x0);
writehscx(cs->hw.teles0.membase, 0, HSCX_MASK, 0x0);
writehscx(cs->hw.teles0.membase, 1, HSCX_MASK, 0x0);
spin_unlock(&cs->lock);
......
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