[ltp] nsc-ircc patch
Thomas Hood
linux-thinkpad@www.bm-soft.com
Mon, 26 Feb 2001 20:19:27 -0500
This is a multi-part message in MIME format.
--------------8AD69CC82DD417E645ECD4CD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Okay, I attach the patch (against kernel 2.4.2) to fix the nsc-ircc
driver. (I'm also sending it to the maintainer.)
I recompiled my kernel with modular serial driver . When I remove
serial.o I can now modprobe the fixed nsc-ircc.o and I get this
message in /var/log/syslog:
> Feb 26 20:01:35 thanatos kernel: nsc-ircc, Found chip at io base 0x02e
> Feb 26 20:01:35 thanatos kernel: nsc-ircc, Driver loaded (Dag Brattli)
> Feb 26 20:01:35 thanatos kernel: IrDA: Registered device irda0
> Feb 26 20:01:35 thanatos kernel: nsc-ircc, Using dongle: IBM31T1100 or Temic TFDS6000/TFDS6500
I am still unable to test the module since I don't have
another computer with an infrared interface.
In case you need them, the modules:
/lib/modules/2.4.2/kernel/net/irda/irda.o
/lib/modules/2.4.2/kernel/drivers/net/irda/nsc-ircc.o
are available on my website:
http://panopticon.csustan.edu/thood/tp600lnx.htm
Thomas
--------------8AD69CC82DD417E645ECD4CD
Content-Type: text/plain; charset=us-ascii;
name="irda.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="irda.patch"
--- drivers/net/irda/nsc-ircc.c_2.4.2 Tue Feb 13 16:15:05 2001
+++ drivers/net/irda/nsc-ircc.c Mon Feb 26 19:35:53 2001
@@ -90,7 +90,7 @@
static nsc_chip_t chips[] = {
{ "PC87108", { 0x150, 0x398, 0xea }, 0x05, 0x10, 0xf0,
nsc_ircc_probe_108, nsc_ircc_init_108 },
- { "PC87338", { 0x398, 0x15c, 0x2e }, 0x08, 0xb0, 0xf0,
+ { "PC87338", { 0x398, 0x15c, 0x2e }, 0x08, 0xb0, 0xf8,
nsc_ircc_probe_338, nsc_ircc_init_338 },
{ NULL }
};
@@ -160,7 +160,7 @@
int i = 0;
/* Probe for all the NSC chipsets we know about */
- for (chip=chips; chip->name ; chip++,i++) {
+ for (chip=chips; chip->name ; chip++) {
IRDA_DEBUG(2, __FUNCTION__"(), Probing for %s ...\n",
chip->name);
@@ -180,7 +180,7 @@
reg = inb(cfg_base);
if (reg == 0xff) {
IRDA_DEBUG(2, __FUNCTION__
- "() no chip at 0x%03x\n", cfg_base);
+ "(), No chip seen at io address 0x%03x\n", cfg_base);
continue;
}
@@ -189,14 +189,14 @@
id = inb(cfg_base+1);
if ((id & chip->cid_mask) == chip->cid_value) {
IRDA_DEBUG(2, __FUNCTION__
- "() Found %s chip, revision=%d\n",
+ "(), Found %s chip, revision=%d\n",
chip->name, id & ~chip->cid_mask);
/*
* If the user supplies the base address, then
* we init the chip, if not we probe the values
* set by the BIOS
*/
- if (io[i] < 2000) {
+ if (io[i] < 0x2000) {
chip->init(chip, &info);
} else
chip->probe(chip, &info);
@@ -257,7 +257,7 @@
/* Allocate new instance of the driver */
self = kmalloc(sizeof(struct nsc_ircc_cb), GFP_KERNEL);
if (self == NULL) {
- ERROR(__FUNCTION__ "(), can't allocate memory for "
+ ERROR(__FUNCTION__ "(), Can't allocate memory for "
"control block!\n");
return -ENOMEM;
}
@@ -277,15 +277,14 @@
self->io.fifo_size = 32;
/* Reserve the ioports that we need */
- ret = check_region(self->io.fir_base, self->io.fir_ext);
- if (ret < 0) {
- WARNING(__FUNCTION__ "(), can't get iobase of 0x%03x\n",
+ ret = request_region(self->io.fir_base, self->io.fir_ext, driver_name);
+ if (ret == NULL) {
+ WARNING(__FUNCTION__ "(), Request for io region at 0x%03x was refused\n",
self->io.fir_base);
dev_self[i] = NULL;
kfree(self);
- return -ENODEV;
+ return -EBUSY;
}
- request_region(self->io.fir_base, self->io.fir_ext, driver_name);
/* Initialize QoS for this device */
irda_init_max_qos_capabilies(&self->qos);
@@ -401,7 +400,7 @@
}
/* Release the PORT that this driver is using */
- IRDA_DEBUG(4, __FUNCTION__ "(), Releasing Region %03x\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), Releasing io region at %03x\n",
self->io.fir_base);
release_region(self->io.fir_base, self->io.fir_ext);
@@ -439,7 +438,7 @@
case 0x2e8: outb(0x15, cfg_base+1); break;
case 0x3f8: outb(0x16, cfg_base+1); break;
case 0x2f8: outb(0x17, cfg_base+1); break;
- default: ERROR(__FUNCTION__ "(), invalid base_address");
+ default: ERROR(__FUNCTION__ "(), Invalid base_address");
}
/* Control Signal Routing Register (CSRT) */
@@ -451,7 +450,7 @@
case 9: temp = 0x05; break;
case 11: temp = 0x06; break;
case 15: temp = 0x07; break;
- default: ERROR(__FUNCTION__ "(), invalid irq");
+ default: ERROR(__FUNCTION__ "(), Invalid irq");
}
outb(1, cfg_base);
@@ -459,7 +458,7 @@
case 0: outb(0x08+temp, cfg_base+1); break;
case 1: outb(0x10+temp, cfg_base+1); break;
case 3: outb(0x18+temp, cfg_base+1); break;
- default: ERROR(__FUNCTION__ "(), invalid dma");
+ default: ERROR(__FUNCTION__ "(), Invalid dma");
}
outb(2, cfg_base); /* Mode Control Register (MCTL) */
@@ -498,7 +497,7 @@
break;
}
info->sir_base = info->fir_base;
- IRDA_DEBUG(2, __FUNCTION__ "(), probing fir_base=0x%03x\n",
+ IRDA_DEBUG(2, __FUNCTION__ "(), Probing fir_base 0x%03x\n",
info->fir_base);
/* Read control signals routing register (CSRT) */
@@ -531,7 +530,7 @@
info->irq = 15;
break;
}
- IRDA_DEBUG(2, __FUNCTION__ "(), probing irq=%d\n", info->irq);
+ IRDA_DEBUG(2, __FUNCTION__ "(), Probing irq %d\n", info->irq);
/* Currently we only read Rx DMA but it will also be used for Tx */
switch ((reg >> 3) & 0x03) {
@@ -548,7 +547,7 @@
info->dma = 3;
break;
}
- IRDA_DEBUG(2, __FUNCTION__ "(), probing dma=%d\n", info->dma);
+ IRDA_DEBUG(2, __FUNCTION__ "(), Probing dma %d\n", info->dma);
/* Read mode control register (MCTL) */
outb(CFG_MCTL, cfg_base);
@@ -597,7 +596,7 @@
outb(CFG_PNP0, cfg_base);
reg = inb(cfg_base+1);
- pnp = (reg >> 4) & 0x01;
+ pnp = (reg >> 3) & 0x01;
if (pnp) {
IRDA_DEBUG(2, "(), Chip is in PnP mode\n");
outb(0x46, cfg_base);
@@ -696,10 +695,10 @@
/* Should be 0x2? */
if (0x20 != (version & 0xf0)) {
- ERROR("%s, Wrong chip version %02x\n", driver_name, version);
+ ERROR("%s, Incorrect module version=%02x\n", driver_name, version);
return -1;
}
- MESSAGE("%s, Found chip at base=0x%03x\n", driver_name,
+ MESSAGE("%s, Found chip at io base 0x%03x\n", driver_name,
info->cfg_base);
/* Switch to advanced mode */
@@ -729,7 +728,7 @@
outb(0x0d, iobase+2); /* Set SIR pulse width to 1.6us */
outb(0x2a, iobase+4); /* Set beginning frag, and preamble length */
- MESSAGE("%s, driver loaded (Dag Brattli)\n", driver_name);
+ MESSAGE("%s, Driver loaded (Dag Brattli)\n", driver_name);
/* Enable receive interrupts */
switch_bank(iobase, BANK0);
@@ -851,7 +850,7 @@
outb(0x62, iobase+MCR);
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "(), invalid dongle_id %#x",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Invalid dongle_id=%#x",
dongle_id);
}
@@ -943,7 +942,7 @@
outb(0x62, iobase+MCR);
break;
default:
- IRDA_DEBUG(0, __FUNCTION__ "(), invalid data_rate\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Invalid data_rate\n");
}
/* Restore bank register */
outb(bank, iobase+BSR);
@@ -995,19 +994,19 @@
outb(inb(iobase+4) | 0x04, iobase+4);
mcr = MCR_MIR;
- IRDA_DEBUG(0, __FUNCTION__ "(), handling baud of 576000\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Handling 576000 baud\n");
break;
case 1152000:
mcr = MCR_MIR;
- IRDA_DEBUG(0, __FUNCTION__ "(), handling baud of 1152000\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Handling 1152000 baud\n");
break;
case 4000000:
mcr = MCR_FIR;
- IRDA_DEBUG(0, __FUNCTION__ "(), handling baud of 4000000\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Handling 4000000 baud\n");
break;
default:
mcr = MCR_FIR;
- IRDA_DEBUG(0, __FUNCTION__ "(), unknown baud rate of %d\n",
+ IRDA_DEBUG(0, __FUNCTION__ "(), Unknown baud rate=%d\n",
speed);
break;
}
@@ -1279,7 +1278,7 @@
switch_bank(iobase, BANK0);
if (!(inb_p(iobase+LSR) & LSR_TXEMP)) {
IRDA_DEBUG(4, __FUNCTION__
- "(), warning, FIFO not empty yet!\n");
+ "(), Warning: FIFO not empty yet!\n");
/* FIFO may still be filled to the Tx interrupt threshold */
fifo_size -= 17;
@@ -1291,7 +1290,7 @@
outb(buf[actual++], iobase+TXD);
}
- IRDA_DEBUG(4, __FUNCTION__ "(), fifo_size %d ; %d sent of %d\n",
+ IRDA_DEBUG(4, __FUNCTION__ "(), Fifo_size=%d ; %d of %d sent\n",
fifo_size, actual, len);
/* Restore bank */
@@ -1449,7 +1448,7 @@
len = inb(iobase+RFLFL) | ((inb(iobase+RFLFH) & 0x1f) << 8);
if (st_fifo->tail >= MAX_RX_WINDOW) {
- IRDA_DEBUG(0, __FUNCTION__ "(), window is full!\n");
+ IRDA_DEBUG(0, __FUNCTION__ "(), Window is full!\n");
continue;
}
@@ -1539,7 +1538,7 @@
skb = dev_alloc_skb(len+1);
if (skb == NULL) {
- WARNING(__FUNCTION__ "(), memory squeeze, "
+ WARNING(__FUNCTION__ "(), Memory squeeze, "
"dropping frame.\n");
self->stats.rx_dropped++;
@@ -1847,7 +1846,7 @@
iobase = self->io.fir_base;
if (request_irq(self->io.irq, nsc_ircc_interrupt, 0, dev->name, dev)) {
- WARNING("%s, unable to allocate irq=%d\n", driver_name,
+ WARNING("%s, Request for irq %d was refused\n", driver_name,
self->io.irq);
return -EAGAIN;
}
@@ -1856,7 +1855,7 @@
* failure.
*/
if (request_dma(self->io.dma, dev->name)) {
- WARNING("%s, unable to allocate dma=%d\n", driver_name,
+ WARNING("%s, Request for dma %d was refused\n", driver_name,
self->io.dma);
free_irq(self->io.irq, self);
return -EAGAIN;
--- net/irda/af_irda.c_2.4.2 Mon Jan 29 01:59:34 2001
+++ net/irda/af_irda.c Mon Feb 26 19:12:12 2001
@@ -2434,5 +2434,7 @@
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
MODULE_DESCRIPTION("The Linux IrDA Protocol Subsystem");
+#ifdef CONFIG_IRDA_DEBUG
MODULE_PARM(irda_debug, "1l");
+#endif
#endif /* MODULE */
--------------8AD69CC82DD417E645ECD4CD--
----- The Linux ThinkPad mailing list -----
The linux-thinkpad mailing list home page is at:
http://www.bm-soft.com/~bm/tp_mailing.html