2005-04-17 06:20:36 +08:00
|
|
|
/* $Id: niccy.c,v 1.21.2.4 2004/01/13 23:48:39 keil Exp $
|
|
|
|
*
|
|
|
|
* low level stuff for Dr. Neuhaus NICCY PnP and NICCY PCI and
|
|
|
|
* compatible (SAGEM cybermodem)
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Thanks to Dr. Neuhaus and SAGEM for information
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include "hisax.h"
|
|
|
|
#include "isac.h"
|
|
|
|
#include "hscx.h"
|
|
|
|
#include "isdnl1.h"
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/isapnp.h>
|
|
|
|
|
2005-06-26 05:59:18 +08:00
|
|
|
static const char *niccy_revision = "$Revision: 1.21.2.4 $";
|
2005-04-17 06:20:36 +08:00
|
|
|
|
|
|
|
#define byteout(addr,val) outb(val,addr)
|
|
|
|
#define bytein(addr) inb(addr)
|
|
|
|
|
|
|
|
#define ISAC_PCI_DATA 0
|
|
|
|
#define HSCX_PCI_DATA 1
|
|
|
|
#define ISAC_PCI_ADDR 2
|
|
|
|
#define HSCX_PCI_ADDR 3
|
|
|
|
#define ISAC_PNP 0
|
|
|
|
#define HSCX_PNP 1
|
|
|
|
|
|
|
|
/* SUB Types */
|
|
|
|
#define NICCY_PNP 1
|
|
|
|
#define NICCY_PCI 2
|
|
|
|
|
|
|
|
/* PCI stuff */
|
|
|
|
#define PCI_IRQ_CTRL_REG 0x38
|
|
|
|
#define PCI_IRQ_ENABLE 0x1f00
|
|
|
|
#define PCI_IRQ_DISABLE 0xff0000
|
|
|
|
#define PCI_IRQ_ASSERT 0x800000
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static inline u_char readreg(unsigned int ale, unsigned int adr, u_char off)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
register u_char ret;
|
|
|
|
|
|
|
|
byteout(ale, off);
|
|
|
|
ret = bytein(adr);
|
2006-10-04 17:15:42 +08:00
|
|
|
return ret;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static inline void readfifo(unsigned int ale, unsigned int adr, u_char off,
|
|
|
|
u_char *data, int size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
byteout(ale, off);
|
|
|
|
insb(adr, data, size);
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static inline void writereg(unsigned int ale, unsigned int adr, u_char off,
|
|
|
|
u_char data)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
byteout(ale, off);
|
|
|
|
byteout(adr, data);
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static inline void writefifo(unsigned int ale, unsigned int adr, u_char off,
|
|
|
|
u_char *data, int size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
byteout(ale, off);
|
|
|
|
outsb(adr, data, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Interface functions */
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static u_char ReadISAC(struct IsdnCardState *cs, u_char offset)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-10-04 17:15:42 +08:00
|
|
|
return readreg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, offset);
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static void WriteISAC(struct IsdnCardState *cs, u_char offset, u_char value)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
writereg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, offset, value);
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static void ReadISACfifo(struct IsdnCardState *cs, u_char * data, int size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
readfifo(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, 0, data, size);
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static void WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
writefifo(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, 0, data, size);
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static u_char ReadHSCX(struct IsdnCardState *cs, int hscx, u_char offset)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
2006-10-04 17:15:42 +08:00
|
|
|
return readreg(cs->hw.niccy.hscx_ale,
|
|
|
|
cs->hw.niccy.hscx, offset + (hscx ? 0x40 : 0));
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static void WriteHSCX(struct IsdnCardState *cs, int hscx, u_char offset,
|
|
|
|
u_char value)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
writereg(cs->hw.niccy.hscx_ale,
|
|
|
|
cs->hw.niccy.hscx, offset + (hscx ? 0x40 : 0), value);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define READHSCX(cs, nr, reg) readreg(cs->hw.niccy.hscx_ale, \
|
|
|
|
cs->hw.niccy.hscx, reg + (nr ? 0x40 : 0))
|
|
|
|
#define WRITEHSCX(cs, nr, reg, data) writereg(cs->hw.niccy.hscx_ale, \
|
|
|
|
cs->hw.niccy.hscx, reg + (nr ? 0x40 : 0), data)
|
|
|
|
|
|
|
|
#define READHSCXFIFO(cs, nr, ptr, cnt) readfifo(cs->hw.niccy.hscx_ale, \
|
|
|
|
cs->hw.niccy.hscx, (nr ? 0x40 : 0), ptr, cnt)
|
|
|
|
|
|
|
|
#define WRITEHSCXFIFO(cs, nr, ptr, cnt) writefifo(cs->hw.niccy.hscx_ale, \
|
|
|
|
cs->hw.niccy.hscx, (nr ? 0x40 : 0), ptr, cnt)
|
|
|
|
|
|
|
|
#include "hscx_irq.c"
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 21:55:46 +08:00
|
|
|
static irqreturn_t niccy_interrupt(int intno, void *dev_id)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct IsdnCardState *cs = dev_id;
|
|
|
|
u_char val;
|
|
|
|
u_long flags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&cs->lock, flags);
|
|
|
|
if (cs->subtyp == NICCY_PCI) {
|
|
|
|
int ival;
|
|
|
|
ival = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
|
2006-10-04 17:15:42 +08:00
|
|
|
if (!(ival & PCI_IRQ_ASSERT)) { /* IRQ not for us (shared) */
|
2005-04-17 06:20:36 +08:00
|
|
|
spin_unlock_irqrestore(&cs->lock, flags);
|
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
outl(ival, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
|
|
|
|
}
|
2006-10-04 17:15:42 +08:00
|
|
|
val = readreg(cs->hw.niccy.hscx_ale, cs->hw.niccy.hscx,
|
|
|
|
HSCX_ISTA + 0x40);
|
|
|
|
Start_HSCX:
|
2005-04-17 06:20:36 +08:00
|
|
|
if (val)
|
|
|
|
hscx_int_main(cs, val);
|
|
|
|
val = readreg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, ISAC_ISTA);
|
2006-10-04 17:15:42 +08:00
|
|
|
Start_ISAC:
|
2005-04-17 06:20:36 +08:00
|
|
|
if (val)
|
|
|
|
isac_interrupt(cs, val);
|
2006-10-04 17:15:42 +08:00
|
|
|
val = readreg(cs->hw.niccy.hscx_ale, cs->hw.niccy.hscx,
|
|
|
|
HSCX_ISTA + 0x40);
|
2005-04-17 06:20:36 +08:00
|
|
|
if (val) {
|
|
|
|
if (cs->debug & L1_DEB_HSCX)
|
|
|
|
debugl1(cs, "HSCX IntStat after IntRoutine");
|
|
|
|
goto Start_HSCX;
|
|
|
|
}
|
|
|
|
val = readreg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, ISAC_ISTA);
|
|
|
|
if (val) {
|
|
|
|
if (cs->debug & L1_DEB_ISAC)
|
|
|
|
debugl1(cs, "ISAC IntStat after IntRoutine");
|
|
|
|
goto Start_ISAC;
|
|
|
|
}
|
|
|
|
writereg(cs->hw.niccy.hscx_ale, cs->hw.niccy.hscx, HSCX_MASK, 0xFF);
|
2006-10-04 17:15:42 +08:00
|
|
|
writereg(cs->hw.niccy.hscx_ale, cs->hw.niccy.hscx, HSCX_MASK + 0x40,
|
|
|
|
0xFF);
|
2005-04-17 06:20:36 +08:00
|
|
|
writereg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, ISAC_MASK, 0xFF);
|
|
|
|
writereg(cs->hw.niccy.isac_ale, cs->hw.niccy.isac, ISAC_MASK, 0);
|
|
|
|
writereg(cs->hw.niccy.hscx_ale, cs->hw.niccy.hscx, HSCX_MASK, 0);
|
2006-10-04 17:15:42 +08:00
|
|
|
writereg(cs->hw.niccy.hscx_ale, cs->hw.niccy.hscx, HSCX_MASK + 0x40,0);
|
2005-04-17 06:20:36 +08:00
|
|
|
spin_unlock_irqrestore(&cs->lock, flags);
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static void release_io_niccy(struct IsdnCardState *cs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
if (cs->subtyp == NICCY_PCI) {
|
|
|
|
int val;
|
2006-10-04 17:15:42 +08:00
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
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, 0x40);
|
|
|
|
release_region(cs->hw.niccy.isac, 4);
|
|
|
|
} else {
|
|
|
|
release_region(cs->hw.niccy.isac, 2);
|
|
|
|
release_region(cs->hw.niccy.isac_ale, 2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static void niccy_reset(struct IsdnCardState *cs)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
if (cs->subtyp == NICCY_PCI) {
|
|
|
|
int val;
|
|
|
|
|
|
|
|
val = inl(cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
|
|
|
|
val |= PCI_IRQ_ENABLE;
|
|
|
|
outl(val, cs->hw.niccy.cfg_reg + PCI_IRQ_CTRL_REG);
|
|
|
|
}
|
|
|
|
inithscxisac(cs, 3);
|
|
|
|
}
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
static int niccy_card_msg(struct IsdnCardState *cs, int mt, void *arg)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
u_long flags;
|
|
|
|
|
|
|
|
switch (mt) {
|
2006-10-04 17:15:42 +08:00
|
|
|
case CARD_RESET:
|
|
|
|
spin_lock_irqsave(&cs->lock, flags);
|
|
|
|
niccy_reset(cs);
|
|
|
|
spin_unlock_irqrestore(&cs->lock, flags);
|
|
|
|
return 0;
|
|
|
|
case CARD_RELEASE:
|
|
|
|
release_io_niccy(cs);
|
|
|
|
return 0;
|
|
|
|
case CARD_INIT:
|
|
|
|
spin_lock_irqsave(&cs->lock, flags);
|
|
|
|
niccy_reset(cs);
|
|
|
|
spin_unlock_irqrestore(&cs->lock, flags);
|
|
|
|
return 0;
|
|
|
|
case CARD_TEST:
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __ISAPNP__
|
|
|
|
static struct pnp_card *pnp_c __devinitdata = NULL;
|
|
|
|
#endif
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
int __devinit setup_niccy(struct IsdnCard *card)
|
2005-04-17 06:20:36 +08:00
|
|
|
{
|
|
|
|
struct IsdnCardState *cs = card->cs;
|
|
|
|
char tmp[64];
|
|
|
|
|
|
|
|
strcpy(tmp, niccy_revision);
|
|
|
|
printk(KERN_INFO "HiSax: Niccy driver Rev. %s\n", HiSax_getrev(tmp));
|
|
|
|
if (cs->typ != ISDN_CTYPE_NICCY)
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
#ifdef __ISAPNP__
|
|
|
|
if (!card->para[1] && isapnp_present()) {
|
|
|
|
struct pnp_dev *pnp_d = NULL;
|
|
|
|
int err;
|
|
|
|
|
2006-10-04 17:15:42 +08:00
|
|
|
pnp_c = pnp_find_card(ISAPNP_VENDOR('S', 'D', 'A'),
|
|
|
|
ISAPNP_FUNCTION(0x0150), pnp_c);
|
|
|
|
if (pnp_c) {
|
|
|
|
pnp_d = pnp_find_dev(pnp_c,
|
|
|
|
ISAPNP_VENDOR('S', 'D', 'A'),
|
|
|
|
ISAPNP_FUNCTION(0x0150), pnp_d);
|
|
|
|
if (!pnp_d) {
|
|
|
|
printk(KERN_ERR "NiccyPnP: PnP error card "
|
|
|
|
"found, no device\n");
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
pnp_disable_dev(pnp_d);
|
|
|
|
err = pnp_activate_dev(pnp_d);
|
2006-10-04 17:15:42 +08:00
|
|
|
if (err < 0) {
|
|
|
|
printk(KERN_WARNING "%s: pnp_activate_dev "
|
2008-04-28 17:14:40 +08:00
|
|
|
"ret(%d)\n", __func__, err);
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
card->para[1] = pnp_port_start(pnp_d, 0);
|
|
|
|
card->para[2] = pnp_port_start(pnp_d, 1);
|
|
|
|
card->para[0] = pnp_irq(pnp_d, 0);
|
2006-10-04 17:15:42 +08:00
|
|
|
if (!card->para[0] || !card->para[1] ||
|
|
|
|
!card->para[2]) {
|
|
|
|
printk(KERN_ERR "NiccyPnP:some resources are "
|
|
|
|
"missing %ld/%lx/%lx\n",
|
|
|
|
card->para[0], card->para[1],
|
|
|
|
card->para[2]);
|
2005-04-17 06:20:36 +08:00
|
|
|
pnp_disable_dev(pnp_d);
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-10-04 17:15:42 +08:00
|
|
|
} else
|
2005-04-17 06:20:36 +08:00
|
|
|
printk(KERN_INFO "NiccyPnP: no ISAPnP card found\n");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (card->para[1]) {
|
|
|
|
cs->hw.niccy.isac = card->para[1] + ISAC_PNP;
|
|
|
|
cs->hw.niccy.hscx = card->para[1] + HSCX_PNP;
|
|
|
|
cs->hw.niccy.isac_ale = card->para[2] + ISAC_PNP;
|
|
|
|
cs->hw.niccy.hscx_ale = card->para[2] + HSCX_PNP;
|
|
|
|
cs->hw.niccy.cfg_reg = 0;
|
|
|
|
cs->subtyp = NICCY_PNP;
|
|
|
|
cs->irq = card->para[0];
|
|
|
|
if (!request_region(cs->hw.niccy.isac, 2, "niccy data")) {
|
2007-10-31 15:42:07 +08:00
|
|
|
printk(KERN_WARNING "HiSax: NICCY data port %x-%x "
|
|
|
|
"already in use\n",
|
2006-10-04 17:15:42 +08:00
|
|
|
cs->hw.niccy.isac, cs->hw.niccy.isac + 1);
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
if (!request_region(cs->hw.niccy.isac_ale, 2, "niccy addr")) {
|
2007-10-31 15:42:07 +08:00
|
|
|
printk(KERN_WARNING "HiSax: NICCY address port %x-%x "
|
|
|
|
"already in use\n",
|
2005-04-17 06:20:36 +08:00
|
|
|
cs->hw.niccy.isac_ale,
|
|
|
|
cs->hw.niccy.isac_ale + 1);
|
|
|
|
release_region(cs->hw.niccy.isac, 2);
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
} else {
|
2010-01-19 00:24:10 +08:00
|
|
|
#ifdef CONFIG_PCI
|
2007-10-29 21:48:09 +08:00
|
|
|
static struct pci_dev *niccy_dev __devinitdata;
|
|
|
|
|
2005-04-17 06:20:36 +08:00
|
|
|
u_int pci_ioaddr;
|
|
|
|
cs->subtyp = 0;
|
2010-01-19 00:24:10 +08:00
|
|
|
if ((niccy_dev = hisax_find_pci_device(PCI_VENDOR_ID_SATSAGEM,
|
2006-10-04 17:15:42 +08:00
|
|
|
PCI_DEVICE_ID_SATSAGEM_NICCY,
|
|
|
|
niccy_dev))) {
|
2005-04-17 06:20:36 +08:00
|
|
|
if (pci_enable_device(niccy_dev))
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
/* get IRQ */
|
|
|
|
if (!niccy_dev->irq) {
|
2006-10-04 17:15:42 +08:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"Niccy: No IRQ for PCI card found\n");
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
cs->irq = niccy_dev->irq;
|
|
|
|
cs->hw.niccy.cfg_reg = pci_resource_start(niccy_dev, 0);
|
|
|
|
if (!cs->hw.niccy.cfg_reg) {
|
2006-10-04 17:15:42 +08:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"Niccy: No IO-Adr for PCI cfg found\n");
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
pci_ioaddr = pci_resource_start(niccy_dev, 1);
|
|
|
|
if (!pci_ioaddr) {
|
2006-10-04 17:15:42 +08:00
|
|
|
printk(KERN_WARNING
|
|
|
|
"Niccy: No IO-Adr for PCI card found\n");
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
cs->subtyp = NICCY_PCI;
|
|
|
|
} else {
|
|
|
|
printk(KERN_WARNING "Niccy: No PCI card found\n");
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-07-02 10:29:36 +08:00
|
|
|
cs->irq_flags |= IRQF_SHARED;
|
2005-04-17 06:20:36 +08:00
|
|
|
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;
|
|
|
|
if (!request_region(cs->hw.niccy.isac, 4, "niccy")) {
|
|
|
|
printk(KERN_WARNING
|
2007-10-31 15:42:07 +08:00
|
|
|
"HiSax: NICCY data port %x-%x already in use\n",
|
2006-10-04 17:15:42 +08:00
|
|
|
cs->hw.niccy.isac, cs->hw.niccy.isac + 4);
|
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
if (!request_region(cs->hw.niccy.cfg_reg, 0x40, "niccy pci")) {
|
|
|
|
printk(KERN_WARNING
|
2007-10-31 15:42:07 +08:00
|
|
|
"HiSax: NICCY pci port %x-%x already in use\n",
|
2006-10-04 17:15:42 +08:00
|
|
|
cs->hw.niccy.cfg_reg,
|
|
|
|
cs->hw.niccy.cfg_reg + 0x40);
|
2005-04-17 06:20:36 +08:00
|
|
|
release_region(cs->hw.niccy.isac, 4);
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
printk(KERN_WARNING "Niccy: io0 0 and NO_PCI_BIOS\n");
|
|
|
|
printk(KERN_WARNING "Niccy: unable to config NICCY PCI\n");
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2010-01-19 00:24:10 +08:00
|
|
|
#endif /* CONFIG_PCI */
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2007-10-31 15:42:07 +08:00
|
|
|
printk(KERN_INFO "HiSax: NICCY %s config irq:%d data:0x%X ale:0x%X\n",
|
|
|
|
(cs->subtyp == 1) ? "PnP" : "PCI",
|
2005-04-17 06:20:36 +08:00
|
|
|
cs->irq, cs->hw.niccy.isac, cs->hw.niccy.isac_ale);
|
|
|
|
setup_isac(cs);
|
|
|
|
cs->readisac = &ReadISAC;
|
|
|
|
cs->writeisac = &WriteISAC;
|
|
|
|
cs->readisacfifo = &ReadISACfifo;
|
|
|
|
cs->writeisacfifo = &WriteISACfifo;
|
|
|
|
cs->BC_Read_Reg = &ReadHSCX;
|
|
|
|
cs->BC_Write_Reg = &WriteHSCX;
|
|
|
|
cs->BC_Send_Data = &hscx_fill_fifo;
|
|
|
|
cs->cardmsg = &niccy_card_msg;
|
|
|
|
cs->irq_func = &niccy_interrupt;
|
|
|
|
ISACVersion(cs, "Niccy:");
|
|
|
|
if (HscxVersion(cs, "Niccy:")) {
|
2006-10-04 17:15:42 +08:00
|
|
|
printk(KERN_WARNING "Niccy: wrong HSCX versions check IO "
|
|
|
|
"address\n");
|
2005-04-17 06:20:36 +08:00
|
|
|
release_io_niccy(cs);
|
2006-10-04 17:15:42 +08:00
|
|
|
return 0;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|
2006-10-04 17:15:42 +08:00
|
|
|
return 1;
|
2005-04-17 06:20:36 +08:00
|
|
|
}
|